dusty-nv / jetbot_ros

ROS nodes and Gazebo model for NVIDIA JetBot with Jetson Nano
MIT License
383 stars 180 forks source link

running jetbot_ros in Jupyterlab #46

Open smalloytn opened 3 years ago

smalloytn commented 3 years ago

Following: jetbot_ros

ROS2 nodes and Gazebo model for NVIDIA JetBot with Jetson Nano

note: if you want to use ROS Melodic, see the melodic branch

Start the JetBot ROS2 Foxy container

git clone https://github.com/dusty-nv/jetbot_ros cd jetbot_ros docker/run.sh

I installed jetbot_ros and testing while attached to hdmi monitor everything worked, now using battery pack and accessing jetbot remotely through Jupyterlab. I ran in Jupyter lab terminal: cd jetbot_ros docker/run.sh

get this error: root@nano-4gb-jp45:/workspace/jetbot_ros# docker/run.sh head: cannot open '/etc/nv_tegra_release' for reading: No such file or directory reading L4T version from "dpkg-query --show nvidia-l4t-core" dpkg-query: no packages found matching nvidia-l4t-core L4T BSP Version: L4T R. CONTAINER: dustynv/jetbot_ros:foxy-r. DEV_VOLUME:
DATA_VOLUME: --volume /workspace/jetbot_ros/data:/workspace/src/jetbot_ros/data USER_VOLUME:
USER_COMMAND:
V4L2_DEVICES: --device /dev/video0 docker/run.sh: line 182: sudo: command not found docker/run.sh: line 186: sudo: command not found xauth: file /root/.Xauthority does not exist xauth: file /tmp/.docker.xauth does not exist xauth: (argv):1: unable to read any entries from file "(stdin)" chmod: cannot access '/tmp/.docker.xauth': No such file or directory docker/run.sh: line 191: sudo: command not found root@nano-4gb-jp45:/workspace/jetbot_ros#

sudo command not found

run.sh lines 181-199

give docker root user X11 permissions

sudo xhost +si:localuser:root

enable SSH X11 forwarding inside container (https://stackoverflow.com/q/48235040)

XAUTH=/tmp/.docker.xauth sudo rm -rf $XAUTH xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - chmod 777 $XAUTH

run the container

sudo docker run --runtime nvidia -it --rm --name jetbot_ros \ --network host \ --privileged \ -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix/:/tmp/.X11-unix \ -v $XAUTH:$XAUTH -e XAUTHORITY=$XAUTH \ -v /tmp/argus_socket:/tmp/argus_socket \ -v /etc/enctune.conf:/etc/enctune.conf \ $MOUNTS $CONTAINER_IMAGE $USER_COMMAND

dusty-nv commented 2 years ago

Unlike the original jetbot repo which uses IPython notebooks, jetbot_ros isn't really designed/intended to be run from JupyterLab. Does it work fine over SSH?