diff --git a/Source Code/pico_ws/.devcontainer/Dockerfile b/Source Code/pico_ws/.devcontainer/Dockerfile index e4acd52..c0da9c8 100644 --- a/Source Code/pico_ws/.devcontainer/Dockerfile +++ b/Source Code/pico_ws/.devcontainer/Dockerfile @@ -30,6 +30,17 @@ RUN apt-get update \ && apt-get install -y python3-pip \ && rm -rf /var/lib/apt/lists/* && apt-get autoremove && apt-get autoclean +# Install OpenSSH Server +#RUN apt-get update \ +# && apt-get install -y python3-pip openssh-server \ +# && rm -rf /var/lib/apt/lists/* && apt-get autoremove && apt-get autoclean + +# Set the SSH server port to 44 +#RUN sed -i "s/#Port 22/Port 44/" /etc/ssh/sshd_config + +# Set a password for the nonroot user +#RUN echo "${USERNAME}:nonroot" | chpasswd + # Pico setup COPY install_pico.sh /pico_setup.sh RUN export NONROOT_USERNAME=${USERNAME} \ diff --git a/Source Code/pico_ws/.devcontainer/devcontainer.json b/Source Code/pico_ws/.devcontainer/devcontainer.json index 076835c..6093b32 100644 --- a/Source Code/pico_ws/.devcontainer/devcontainer.json +++ b/Source Code/pico_ws/.devcontainer/devcontainer.json @@ -22,7 +22,7 @@ { - "name": "MicroROS Workspace", + "name": "MicroROS Workspace (Remote)", "remoteUser": "nonroot", "overrideCommand": true, "postCreateCommand": "/devcon_post_create.sh", diff --git a/Source Code/pico_ws/.devcontainer/install_pico.sh b/Source Code/pico_ws/.devcontainer/install_pico.sh index b0078ac..e31d9d4 100644 --- a/Source Code/pico_ws/.devcontainer/install_pico.sh +++ b/Source Code/pico_ws/.devcontainer/install_pico.sh @@ -29,78 +29,55 @@ cd $OUTDIR GITHUB_PREFIX="https://github.com/raspberrypi/" GITHUB_SUFFIX=".git" SDK_BRANCH="1.5.1" +PICOTOOL_BRANCH="1.1.2" echo "" >> ~/.bashrc echo "" >> /home/$NONROOT_USERNAME/.bashrc -for REPO in sdk examples extras playground -do - DEST="$OUTDIR/pico-$REPO" - - if [ -d $DEST ]; then - echo "$DEST already exists so skipping" - else - REPO_URL="${GITHUB_PREFIX}pico-${REPO}${GITHUB_SUFFIX}" - echo "Cloning $REPO_URL" - git clone -b $SDK_BRANCH $REPO_URL - - # Any submodules - cd $DEST - git submodule update --init - cd $OUTDIR - - # Define PICO_SDK_PATH in .bashrc - VARNAME="PICO_${REPO^^}_PATH" - echo "Adding $VARNAME to .bashrc" - echo "export $VARNAME=$DEST" >> ~/.bashrc - echo "export $VARNAME=$DEST" >> /home/$NONROOT_USERNAME/.bashrc - export ${VARNAME}=$DEST - fi -done +DEST="$OUTDIR/pico-sdk" -cd $OUTDIR +if [ -d $DEST ]; then + echo "$DEST already exists so skipping" +else + REPO_URL="${GITHUB_PREFIX}pico-sdk${GITHUB_SUFFIX}" + echo "Cloning $REPO_URL" + git clone -b $SDK_BRANCH $REPO_URL -# Pick up new variables we just defined -source ~/.bashrc + # Any submodules + cd $DEST + git submodule update --init + cd $OUTDIR -# Build a couple of examples -cd "$OUTDIR/pico-examples" -mkdir build -cd build -cmake ../ -DCMAKE_BUILD_TYPE=Debug + # Define PICO_SDK_PATH in .bashrc + VARNAME="PICO_SDK_PATH" + echo "Adding $VARNAME to .bashrc" + echo "export $VARNAME=$DEST" >> ~/.bashrc + echo "export $VARNAME=$DEST" >> /home/$NONROOT_USERNAME/.bashrc + export ${VARNAME}=$DEST +fi -for e in blink hello_world -do - echo "Building $e" - cd $e - make -j$JNUM - cd .. -done +# Pick up new variables we just defined +source ~/.bashrc cd $OUTDIR -# Picoprobe and picotool -for REPO in picoprobe picotool -do - DEST="$OUTDIR/$REPO" - REPO_URL="${GITHUB_PREFIX}${REPO}${GITHUB_SUFFIX}" - git clone $REPO_URL +# Picotool +DEST="$OUTDIR/picotool" +REPO_URL="${GITHUB_PREFIX}picotool${GITHUB_SUFFIX}" +git clone --branch $PICOTOOL_BRANCH $REPO_URL - # Build both - cd $DEST - git submodule update --init - mkdir build - cd build - cmake ../ - make -j$JNUM +# Build both +cd $DEST +git submodule update --init +mkdir build +cd build +cmake ../ +make -j$JNUM - if [[ "$REPO" == "picotool" ]]; then - echo "Installing picotool to /usr/local/bin/picotool" - cp picotool /usr/local/bin/ - fi +echo "Installing picotool to /usr/local/bin/picotool" +cp picotool /usr/local/bin/ - cd $OUTDIR -done +cd $OUTDIR # Build OpenOCD echo "Building OpenOCD" diff --git a/Source Code/pico_ws/.devcontainer/post_create.sh b/Source Code/pico_ws/.devcontainer/post_create.sh index cf95327..f6efeb3 100644 --- a/Source Code/pico_ws/.devcontainer/post_create.sh +++ b/Source Code/pico_ws/.devcontainer/post_create.sh @@ -14,7 +14,7 @@ echo "-> Installing MicroROS tools..." sudo apt-get update \ && rosdep update \ && cd $HOME/pico_ws/libmicroros \ -&& sudo rosdep install --from-paths src --ignore-src -y \ +&& rosdep install --from-paths src --ignore-src -y \ && sudo apt-get autoremove && sudo apt-get autoclean \ && echo "-> Tools installed!" diff --git a/Source Code/pico_ws/.devcontainer/post_start.sh b/Source Code/pico_ws/.devcontainer/post_start.sh index de9d824..0dd7ee7 100644 --- a/Source Code/pico_ws/.devcontainer/post_start.sh +++ b/Source Code/pico_ws/.devcontainer/post_start.sh @@ -14,4 +14,7 @@ cd $HOME/pico_ws/libmicroros/src && colcon build source $HOME/pico_ws/libmicroros/src/install/local_setup.bash cd $HOME/pico_ws +#echo "-> Start SSH server..." +#sudo service ssh start + echo "--> post_start.sh done!" \ No newline at end of file diff --git a/Source Code/pico_ws/CMakeLists.txt b/Source Code/pico_ws/CMakeLists.txt index 8ffdc23..6418a47 100644 --- a/Source Code/pico_ws/CMakeLists.txt +++ b/Source Code/pico_ws/CMakeLists.txt @@ -19,7 +19,7 @@ # Set minimum required version of CMake cmake_minimum_required(VERSION 3.12) -# Set project name and Pico A/B name suffixes. +# Set project name and Pico name suffixes. set(PROJ_NAME ROS_Remote) set(PICO_NAME ${PROJ_NAME}_Pico) diff --git a/Source Code/pico_ws/src/CMakeLists.txt b/Source Code/pico_ws/src/CMakeLists.txt index cc1844d..f3d051a 100644 --- a/Source Code/pico_ws/src/CMakeLists.txt +++ b/Source Code/pico_ws/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# The ROS remote project - Firmware CMake config +# The ROS remote project - Firmware CMake config # (NOTE: THIS IS NOT THE TOP-LEVEL CMAKE FILE!) # Copyright 2024 Samyar Sadat Akhavi # Written by Samyar Sadat Akhavi, 2024. diff --git a/Source Code/ros_ws_remote/.devcontainer/devcontainer.json b/Source Code/ros_ws_remote/.devcontainer/devcontainer.json index a3d3431..1cac1ab 100644 --- a/Source Code/ros_ws_remote/.devcontainer/devcontainer.json +++ b/Source Code/ros_ws_remote/.devcontainer/devcontainer.json @@ -22,7 +22,7 @@ { - "name": "ROS 2 Workspace", + "name": "ROS 2 Workspace (Remote)", "remoteUser": "nonroot", "overrideCommand": true, "postCreateCommand": "/devcon_post_create.sh", @@ -57,5 +57,6 @@ "--gpus", "all", "-v", "/tmp/.X11-unix:/tmp/.X11-unix:rw", "--env=DISPLAY", - "-v", "/dev:/dev"] + "-v", "/dev:/dev", + "--device-cgroup-rule=c *:* rmw"] } \ No newline at end of file diff --git a/Source Code/ros_ws_remote/.devcontainer/post_create.sh b/Source Code/ros_ws_remote/.devcontainer/post_create.sh index 3707085..db61061 100644 --- a/Source Code/ros_ws_remote/.devcontainer/post_create.sh +++ b/Source Code/ros_ws_remote/.devcontainer/post_create.sh @@ -13,7 +13,7 @@ sudo chown -R nonroot: $HOME/ros_ws/ #sudo apt-get update \ #&& rosdep update \ #&& cd $HOME/pico_ws/libmicroros \ -#&& sudo rosdep install --from-paths src --ignore-src -y \ +#&& rosdep install --from-paths src --ignore-src -y \ #&& sudo apt-get autoremove && sudo apt-get autoclean \ #&& echo "-> Tools installed!"