Zed2i ros2 wrapper body_trk service - not able to stop and re start again

Hi,

I have Zed2i + nvidia AGX orin dev kit setup.

Ros2 wrapper works perfectly - ros2 launch zed_wrapper zed2i.launch.py

I have been using the following topics without issues:

  • odom
  • pose
  • obj_det/objects

Today I’m trying to use body_trk/skeletons

I can start and stop the body tracking service successfully on the first run:

ros2 service call /zed2i/zed_node/enable_body_trk std_srvs/srv/SetBool "{data: true}"
ros2 service call /zed2i/zed_node/enable_body_trk std_srvs/srv/SetBool "{data: false}"

However when I’m trying to start the service again, it fails with following error loop:

[zed_wrapper-2] [INFO] [1690806145.542062317] [zed2i.zed_node]: *** Starting Body Tracking ***
[zed_wrapper-2] [ERROR] [1690806145.542302544] [zed2i.zed_node]: Body Tracking error: INVALID FUNCTION CALL
[zed_wrapper-2] [ZED][ERROR] Camera::enableBodyTracking() : instance_module_id '1' is already used, please use a different one
[zed_wrapper-2] [INFO] [1690806145.570391708] [zed2i.zed_node]: *** Starting Body Tracking ***
[zed_wrapper-2] [ERROR] [1690806145.570472061] [zed2i.zed_node]: Body Tracking error: INVALID FUNCTION CALL
[zed_wrapper-2] [ZED][ERROR] Camera::enableBodyTracking() : instance_module_id '1' is already used, please use a different one

Note: this error didn’t happen for object detection service. (I can start and stop object detection many times without issue)


PS, there might be a small typo on this body tracking doc :

by calling the service ~/enable_body_trk with the parameter True.

Hi @Jian
I’m working on a fix for this problem.

The cause of the problem has been detected and fixed.
The fix will be merged into the master branch as soon as CI is completed.

The ZED ROS 2 Wrapper branch is updated with the fix.
@Jian Would you kindly ensure that it performs as expected and validate the outcomes?

hi, thanks for the prompt reply and fix.

I just pulled latest master, and tried colcon rebuild. The issue still exists.

during the build command, there were catkin error:

$ colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc)
[0.734s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
        'camera_info_manager' is in: /home/orin/ros2_ws/install/camera_info_manager, /opt/ros/foxy
        'image_transport' is in: /home/orin/ros2_ws/install/image_transport, /opt/ros/foxy
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

If you understand the risks and want to override a package anyways, add the following to the command line:
        --allow-overriding camera_info_manager image_transport

This may be promoted to an error in a future release of colcon-override-check.
Starting >>> image_transport
Starting >>> zed_interfaces
Starting >>> camera_calibration_parsers
Starting >>> zed_topic_benchmark_interfaces
Starting >>> catkin
Starting >>> zed_tutorial_depth                                                                                            
Starting >>> zed_tutorial_pos_tracking
Starting >>> zed_tutorial_video
Finished <<< zed_tutorial_depth [0.69s]                                                                                          
Finished <<< zed_tutorial_video [0.67s]                                                                   
Finished <<< zed_tutorial_pos_tracking [0.70s]
Finished <<< camera_calibration_parsers [0.89s]                                                           
Starting >>> camera_info_manager
Finished <<< image_transport [1.06s]                                                                      
Finished <<< zed_topic_benchmark_interfaces [1.20s]                                                                      
Starting >>> zed_topic_benchmark_component
Finished <<< camera_info_manager [0.47s]                                                                                              
Starting >>> image_common
[2.279s] WARNING:colcon.colcon_cmake.task.cmake.build:Could not run installation step for package 'zed_topic_benchmark_component' because it has no 'install' target
--- stderr: catkin                                                                                                                         
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --install-layout not recognized
CMake Error at catkin_generated/safe_execute_install.cmake:4 (message):
  
  execute_process(/home/orin/ros2_ws/build/catkin/catkin_generated/python_distutils_install.sh)
  returned error code
Call Stack (most recent call first):
  cmake_install.cmake:49 (include)


---
Failed   <<< catkin [1.49s, exited with code 1]
Aborted  <<< zed_topic_benchmark_component [0.31s]
Aborted  <<< zed_interfaces [1.56s]
Aborted  <<< image_common [0.17s]

Summary: 7 packages finished [1.99s]
  1 package failed: catkin
  3 packages aborted: image_common zed_interfaces zed_topic_benchmark_component
  1 package had stderr output: catkin
  8 packages not processed

Did you clean the workspace before rebuilding it?
rm -rf build log install

hi, sorry my ros2_ws is a bit messy, think I was trying to manually build catkin package to run c++ samples before. After removing the catkin package, the build went through.

I can confirm the body tracking service can restart without issues now.

Thank you very much.

1 Like

Thank you for the feedback and thank you for reporting the issue :slight_smile: