Updated:

This page contains notes from my various tests and experiments. It is a raw record of what I did, without correction for errors, or later update for things that I learn. Use at your own risk.

Jetbot ROS2 #1: camera node

I’m going to restart keeping notes of my work, starting today.

How do I organize repos and workspaces?

My previous plan of organizing bdbd2 is breaking down as I struggle with Docker on Jetbot. With the successful source installation of ROS2, I no longer am forced to use Docker. So I need a plan of how to organize things.

I created a new repo called bdbd2_lib which will contain code that is not part of a colcon build of ROS2 packages. Initially, it contains the dusty-nv repo jetson-inference. The idea is it will contain individual subdirectories (that may be just git submodules) that contain individual software packages to install. Local ROS2 build by source will probably be one of them, so I created a ros2 subdirectory with an install script.

Now I need to separate the Docker from the Local sections of the Jetbot workspace.

I created a local ws with jetbot_ros and ros_deep_learning in it. These built OK. But when I sourced install/setup.bash, then the ros_deep_learning nodes are not found. I could get it working by either only including ros_deep_learning in the ws, or by using colcon build --merge-install

But in any case, I am getting the same errors as I got with Docker:

video_output-2] [gstreamer] gstreamer message async-done ==> pipeline0
[video_output-2] [gstreamer] gstreamer changed state from PAUSED to PLAYING ==> udpsink0
[video_output-2] [gstreamer] gstreamer changed state from PAUSED to PLAYING ==> pipeline0
[video_source-1] nvbuf_utils: dmabuf_fd 1030 mapped entry NOT found
[video_source-1] nvbuf_utils: Can not get HW buffer from FD... Exiting...
[video_source-1] NvBufferGetParams failed for dst_dmabuf_fd
[video_source-1] nvbuffer_transform Failed
[video_source-1] [gstreamer] gstDecoder -- failed to retrieve next image buffer
[video_source-1] [ERROR] [1646431002.353312844] [video_source]: failed to capture next frame
[video_source-1] [gstreamer] gstDecoder -- failed to retrieve next image buffer
[video_source-1] [ERROR] [1646431003.353858666] [video_source]: failed to capture next frame
[video_source-1] [gstreamer] gstDecoder -- failed to retrieve next image buffer

What to do? I need to confirm that the hardware still works, so I need to try with my older bdbd versions of the camera code.

2022-03-07

Installing ros-melodic-desktop on nano, ran into an error with cv. I’ll try to remove the cv that was installed with ros2.

sudo apt-get purge -y '"*opencv*'
sudo rm -rf /usr/share/opencv4
sudo rm -f /usr/bin/opencv*
sudo apt install ros-melodic-desktop

That did not work though. I ended up manually uninstalling a chain of packages with dpkg, that finally got things OK to install ros-melodic-desktop.

I tried building rkent/jetson-inference but got errors.

I checked out in dusty-nv/jetson-inference branch L4T-R32.5.0 It also had errors. Checking through issues, it may be that jetson inference is not compatible with tensorrt 8. To downgrade to tensorrt7, I need to reflash the SD card. Orderered parts to do that.

2022-03-08

I reflashed the SD card. New issue: when I try to upgrade, I get an error trying to configure the nvidia bootloader. A little googling hints that the issue may be that the bootload, which is stored in separate storage, got upgraded when I did the initial install of Jetson L4T 32.6.1 When you try to downgrade, that storage fails. That means I cannot do a sudo apt upgrade accepting all choices.

I did this to try to stop that:

sudo apt-mark hold nvidia-l4t-bootloader

After that the sudo apt-get upgrade worked OK.

Now building ros2 on the new system.

2022-03-09

Built ros2, built jetbot_ros and ros_deep_learning. Tried the camera, it does not work. It works fine if I run detectnet with the nano monitor connected.

After a cold restart, when I run camera.launch.py I get this:

[video_source-1] nvbuf_utils: dmabuf_fd 1030 mapped entry NOT found
[ERROR] [video_source-1]: process has died [pid 8141, exit code -11, cmd '/home/kent/github/rkent/bdbd2_jl_ws/install/lib/ros_deep_learning/video_source --ros-args --params-file /tmp/launch_params_mtmmsn1_ --params-file /tmp/launch_params_nqpp5bl8 --params-file /tmp/launch_params_g93jkvfu --params-file /tmp/launch_params_gyghtlon --params-file /tmp/launch_params_z2_01vc6 -r /video_source/raw:=/jetbot/camera/image_raw'].

Previously I got past that and got some errors about NVMM - could that be because I was running in multi-user mode? Nope. Maybe it was because I ran detectnet first.

Anyway. https://github.com/dusty-nv/jetson-utils/issues/101 suggests building with -DENABLE_NVMM=off. I’ll try that.

OK now it appears to run - but when I try to look at it with rviz2 on uburog I get:

[INFO] [1646846247.831124179] [rviz]: Message Filter dropping message: frame '' at time 1646846247.810 for reason 'the frame id of the message is empty'

If I do ros2 topic echo /jetbot/camera/image_raw I can see valid image data, but yes frame_id is blank. That should be easily fixable.

I updated rkent/ros_deep_learning with current dusty-nv master into by branch bdbd2, then added a frame_id. Now rviz2 gets slightly further but still no work:

[INFO] [1646848671.540045216] [rviz]: Message Filter dropping message: frame 'jetbot_camera' at time 1646848670.732 for reason 'discarding message because the queue is full'

I can fix this by setting the global frame to jetbot_camera.

I fixed it up and landed it in rkent/ros_deep_learning.