robotdjman / MuSHR-ROS-Docker

VSCode Dev Container and Dockerfile for MuSHR Ros Noetic development. Preinstalled with many tools including catkin, python3, conda/mamba, and more.
0 stars 0 forks source link

Command failed #1

Open HoAdrian opened 1 year ago

HoAdrian commented 1 year ago

I am having this error when VsCode is opening the course folder in a dev container: 9.0/dist/spec-node/devContainersSpecCLI.js:611:12240) [1178624 ms] at async WeA (/Users/adrianho/.vscode/extensions/ms-vscode-remote.remote-containers-0.309.0/dist/spec-node/devContainersSpecCLI.js:611:11981) [1178633 ms] Exit code 1 [1178656 ms] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Users/adrianho/.vscode/extensions/ms-vscode-remote.remote-containers-0.309.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/adrianho/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-0fba3443-44f0-4199-a15e-ddb29a972ccc1694205768254 --workspace-folder /Users/adrianho/Downloads/CS4963_foundations_robotics --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/adrianho/Downloads/CS4963_foundations_robotics --id-label devcontainer.config_file=/Users/adrianho/Downloads/CS4963_foundations_robotics/.devcontainer/devcontainer.json --log-level debug --log-format json --config /Users/adrianho/Downloads/CS4963_foundations_robotics/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true [1178656 ms] Exit code 1

This is my file structure:

Screen Shot 2023-09-08 at 3 37 28 PM

and this is my Docker file: FROM osrf/ros:noetic-desktop-full

Add vscode user with same UID and GID as your host system

(copied from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user)

ARG USERNAME=vscode ARG USER_UID=1000 ARG USER_GID=$USER_UID ARG DEBIAN_FRONTEND=noninteractive RUN groupadd --gid $USER_GID $USERNAME \ && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ && apt-get update \ && apt-get install -y sudo \ && echo $USERNAME ALL=(root) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME

Switch from root to user

USER $USERNAME

Add user to video group to allow access to webcam

RUN sudo usermod --append --groups video $USERNAME

Update all packages

RUN sudo apt update && sudo apt upgrade -y

Create setup folder

RUN sudo mkdir /setup

Install Deps and Python 3.11

RUN sudo apt-get install software-properties-common -y RUN sudo apt install wget build-essential libncursesw5-dev libssl-dev \ libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev -y RUN sudo add-apt-repository ppa:deadsnakes/ppa RUN sudo apt install python3.11 -y RUN sudo apt-get -y install python3-pip

Install Conda

RUN sudo apt-get install wget RUN sudo wget https://repo.anaconda.com/archive/Anaconda3-2023.07-2-Linux-x86_64.sh -O /setup/anaconda.sh RUN sudo bash /setup/anaconda.sh -b -p /home/vscode/anaconda3 RUN sudo rm /setup/anaconda.sh RUN sudo chown -R vscode /home/vscode/anaconda3

ENV PATH /home/vscode/anaconda3/bin:$PATH RUN conda update conda -y

RUN conda update anaconda -y

Set Solver to libmamba

RUN conda update --all -y RUN conda install -n base conda-libmamba-solver RUN conda config --set solver libmamba RUN conda init

Setup Conda environment

COPY foundations.yaml /home/vscode/foundations.yaml RUN conda env create -f /home/vscode/foundations.yaml

Install catkin

RUN pip3 install -U catkin_tools

Install Git

RUN sudo apt install -y git

Rosdep update

RUN rosdep update

RUN mkdir /home/vscode/setup

--------------------------- MuSHR Deps ---------------------------

Install git, tkinter, wget, g++, vim, tmux, networking stuff, apt-add-repository

RUN sudo apt-get install -y git-all python3-tk wget g++ vim tmux net-tools iputils-ping software-properties-common RUN sudo apt-get update RUN sudo apt-get install -y python3-vcstool python3-pip

Install extra ROS packages

RUN sudo apt-get install -y ros-noetic-ackermann-msgs ros-noetic-map-server ros-noetic-urg-node ros-noetic-robot-state-publisher ros-noetic-xacro ros-noetic-joy ros-noetic-ddynamic-reconfigure ros-noetic-fake-localization ros-noetic-gmapping ros-noetic-rosbridge-suite ros-noetic-sbpl

Install Cython, PyTorch 1.10 at least!

RUN sudo pip3 install Cython torch torchvision torchaudio numpy scipy networkx progress --upgrade

Create OpenCV symbolic link

RUN sudo ln -s /usr/include/opencv4 /usr/include/opencv

Auto source this workspace on terminal startup

RUN echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc

Install rangelibc

RUN python3 /range_libc/pywrapper/setup.py install

Create default RVIZ setup

RUN mkdir ~/.rviz RUN cp /dependencies_ws/src/cse478_dependencies/mushr/mushr_utils/rviz/default.rviz ~/.rviz/

MuSHR Hardware drivers

Hardware drivers (Only needed on physical robot)

COPY mushr_install_hw_drivers.bash /home/vscode/setup/mushr_install_hw_drivers.bash

RUN if [ "$REAL" = 1 ] ; then chmod +x /home/vscode/setup/mushr_install_hw_drivers.bash && /home/vscode/setup/mushr_install_hw_drivers.bash ; fi

Source the ROS setup file

RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc

robotdjman commented 1 year ago

This might be a permission issue. Are you using Orbstack or Docker Desktop?

HoAdrian commented 1 year ago

I was using Docker when I had this error. Now I have installed both Docker and Orbstack

robotdjman commented 1 year ago

Ok, make sure docker is closed (click the little whale in mac top bar, then click "Quit") and make sure orbstack is the only one open. You may need to restart visual studio in order for it to use Orbstack.

HoAdrian commented 1 year ago

I want to make sure: Do we need to have dependencies_ws, mushr_ws and range_libc all in the course folder before using the container?

Also this is my file structure (more specific): CS4963_foundations_robots: ---> .devcontainer foundations.yaml --- >dependencies_ws ---> src ---> cse_478_dependencies --- >mushr_ws ---> src ---> mushr478 ---->range_libc

robotdjman commented 1 year ago

Yes, and inside the Dockerfile (located inside the .devcontainer folder) replace every occurrence of "CS4963-Robots" with your workspace "CS4963_foundations_robots". So far you should only need to change one line.

HoAdrian commented 1 year ago

Should I also

  1. replace the catkin_ws with dependencies_ws
  2. modify the path that involves going into src of mushr_ws and dependences_ws because I have the GitHub repo inside my src folder
robotdjman commented 1 year ago

catkin_ws is actually me following this guide here to get the simulator GUI working. The dockerfile inside of .devcontainer does not rely on that so you should need it. All that matters is that .devcontainer is in the root (folder dedicated for this class) and everything else is at the same level. Like this (note I have some extra folders/items that you do not need, and imagine "catkin_ws" in this screen shot is actually the "dependencies_ws" but the name doesn't matter):

CleanShot 2023-09-08 at 18 25 19@2x
robotdjman commented 1 year ago

Also I updated the devcontainer.json file just now that fixes some issues with GUI applications, they should work better now.