# Issue with ROS2 set-up, Deserialization of UORB Topics

Source: https://forum.modalai.com/topic/3561/issue-with-ros2-set-up-deserialization-of-uorb-topics
Category: VOXL SDK and Software (https://forum.modalai.com/category/47/voxl-sdk-and-software)
Tags: ros
Posted: 2024-06-18 15:19:27 UTC by jmltt
Replies: 16 · Views: 4302

## jmltt · 2024-06-18 15:19:27 UTC

I have a Sentinel running VOXL SDK v1.1.2.  I installed ros2 foxy a while ago when the documentation linked to a bash script here to install it

https://github.com/jetsonhacks/installROS2

I'm running the mircodds agent and trying to listen to one of the PX4 topics (specifically vehicle_local_position) but I'm getting the same deserialization issue that was brought up here

https://forum.modalai.com/topic/3453/unable-to-subscribe-to-vehicle_command_position-topic?_=1718720783022

I thought I must have pulled the px4_msg repo from the main branch instead of the release/1.14 branch as mentioned in that thread, but I've deleted and reinstalled everything according to the documentation and still can't get it to work.  I purged and reinstalled voxl-microdds and voxl-ros2-foxy from the offline suite. I even built voxl-mpa-to-ros2 from source and explicitly pulled the correct branches.  Is this a known issue or am I doing something wrong?

## Reply by jmltt · 2024-06-18 16:00:03 UTC

I think I found the issue but not sure how to solve it.

Every branch of voxl-mpa-to-ros2 that I've seen in the voxlSDK gitlab repo is pulling from the branch of px4_msgs @ a692ca42

(see here: https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-to-ros2/-/tree/sdk-1.1.0/colcon_ws/src?ref_type=tags)

which has one more variable in the message definition of VehicleLocalPosition.msg at line 42 than the message definitions included in all recent branches of the px4-firmware:

float32 unaided_heading                 # Same as heading but generated by integrating corrected gyro data only

Here's the message definition for the master branch of voxl-px4: https://github.com/modalai/px4-firmware/blob/b5c45bb232afc6a936b8349f4fa0be1efeb17707/msg/VehicleLocalPosition.msg
Here's the message definition every branch of voxl-mpa-to-ros2 is linking to: https://github.com/PX4/px4_msgs/blob/a692ca426e35d8f5085979febc9065fe60907cb7/msg/VehicleLocalPosition.msg

Not sure how many other messages this affects.  Is this an easy fix on the dev side?

## Reply by Zachary Lowell 0 · 2024-06-18 17:01:54 UTC

Hi @jmltt - will try and recreate the same issue you are seeing and the solution you proposed as a fix!

If this is the case I will merge in a PR and it will be on the most recent dev branch for voxl-mpa-to-ros, anyways - will test out the solution soon.

Zach

## Reply by jmltt · 2024-06-18 17:04:15 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 Sounds good, thank you!

## Reply by Zachary Lowell 0 · 2024-06-20 19:51:27 UTC

@jmltt said in [Issue with ROS2 set\-up, Deserialization of UORB Topics](/post/17743):
> Not sure how many other messages this affects. Is this an easy fix on the dev side?
> 
> Reply

So @jmltt it looks like this isnt necessarily an issue with the branch itself as mainline px4_msgs also has the unaided_heading in part of the VehicleLocalPosition: 
https://github.com/PX4/px4_msgs/blob/f90685f29174d4debfe31e22b4cf1412c3c16448/msg/VehicleLocalPosition.msg#L42C9-L42C24

Trying to figure out a way to remove it without recreating a new submodule - will hopefully have a fix soon.

Zach

## Reply by Zachary Lowell 0 · 2024-06-20 20:49:39 UTC

Ok @jmltt I fixed it - there was a giant conflict with versioning on px4_msgs and px4_ros_coms which was fun to deal with :) - anyways I have a branch waiting for approval to be merged into the most recent nightly and you can then pull the dev from the apt repository when it gets merged in - until then feel free to rebuild voxl-mpa-to-ros2 deb and install on your voxl2 from the branch zach/submodule update: https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-to-ros2/-/tree/zach/submodule_update

Cheers!
Zach

## Reply by Eric Katzfey (ModalAI staff) · 2024-06-25 15:40:21 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 The updated Debian package can be found here: http://voxl-packages.modalai.com/dists/qrb5165/dev/binary-arm64/voxl-mpa-to-ros2_0.0.3-202406240850_arm64.deb

## Reply by jmltt · 2024-06-25 21:17:31 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 Awesome, thanks for fixing this I really appreciate it!

## Reply by tahawaru · 2024-07-24 16:11:13 UTC (in reply to jmltt)

@Zachary-Lowell-0 

I'm following the tutorial at https://docs.modalai.com/building-ros2-nodes/
I dont get the 's' for 'px4_ros_coms'.
Instead, I have 'px4_ros_com' which doesn't have an executable. So I get:

rb5:~/colcon_ws$ ros2 run px4_ros_com px4_ros_com
No executable found

Any help on this is welcome.

## Reply by Zachary Lowell 0 · 2024-08-02 16:11:50 UTC

Hi @tahawaru looks like its just a type on the documentation I will update it:

Please just try running `ros2 run px4_ros_com px4_ros_com` - no s anywhere in site. Note this package is fully managed by PX4 - not modalAI and can be followed here: https://github.com/PX4/px4_ros_com

LMK if this helps,
Zach

## Reply by tahawaru · 2024-08-06 16:22:25 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 

Still getting the same issue

rb5:~/colcon_ws$ ros2 run px4_ros_com px4_ros_com 
No executable found

## Reply by Zachary Lowell 0 · 2024-08-06 16:49:11 UTC

@tahawaru said in [Issue with ROS2 set\-up, Deserialization of UORB Topics](/post/18527):
> No executable found
> 
> Reply

@tahawaru why are you trying to run px4_ros_com's package in general? The package pertinent to voxl-mpa-to-ros2 is voxl_mpa_to_ros2 - what is it exactly you are trying to do?

## Reply by tahawaru · 2024-08-07 11:07:53 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 

I'm following this content https://docs.modalai.com/building-ros2-nodes/

After sourcing, and getting the "no executables found" error, I tried
rb5:~/colcon_ws$ ros2 pkg executables px4_ros_com 
px4_ros_com debug_vect_advertiser
px4_ros_com offboard_control
px4_ros_com sensor_combined_listener
px4_ros_com vehicle_gps_position_listener

## Reply by tahawaru · 2024-08-08 16:33:30 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 

I'm having a similar error from running a ros2 command

rb5:~/colcon_ws$ ros2 run voxl_offboard_figure8 voxl_offboard_figure8 
[INFO] [1723134293.283379373] [offboard_figure8_node]: Offboard Figure 8 Node Alive!
2024-08-08 16:24:53.442 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:53.950 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
[INFO] [1723134294.428290964] [offboard_figure8_node]: Switching to offboard mode
[INFO] [1723134294.428816835] [offboard_figure8_node]: Arm command sent
2024-08-08 16:24:54.452 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:54.951 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:55.452 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:55.961 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:56.461 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:56.971 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:57.482 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:57.988 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:58.488 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:58.998 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:24:59.507 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:25:00.016 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
2024-08-08 16:25:00.528 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change

My Rb5 specs:
rb5:~/colcon_ws$ voxl-version 
--------------------------------------------------------------------------------
system-image: 1.7.1-M0052-14.1a-perf-nightly-20231025
kernel:       #1 SMP PREEMPT Thu Oct 26 05:24:02 UTC 2023 4.19.125
--------------------------------------------------------------------------------
hw version:   M0052
--------------------------------------------------------------------------------
voxl-suite:   
--------------------------------------------------------------------------------
Packages:
Repo:  http://voxl-packages.modalai.com/ ./dists/qrb5165/sdk-1.1/binary-arm64/
Last Updated: 2024-07-19 09:01:43
List:
	libmodal-cv                 0.4.0
	libmodal-exposure           0.1.0
	libmodal-journal            0.2.2
	libmodal-json               0.4.3
	libmodal-pipe               2.9.2
	libqrb5165-io               0.4.2
	libvoxl-cci-direct          0.2.1
	libvoxl-cutils              0.1.1
	mv-voxl                     0.1-r0
	qrb5165-bind                0.1-r0
        ...............
        voxl-mavlink                0.1.1
	voxl-mavlink-server         1.3.2
	voxl-microdds-agent         2.4.1-0
	voxl-modem                  1.0.8
	voxl-mongoose               7.7.0-1
	voxl-mpa-to-ros             0.3.7
	voxl-mpa-to-ros2            0.0.4
	voxl-mpa-tools              1.1.3
	voxl-neopixel-manager       0.0.3
	voxl-opencv                 4.5.5-2
	voxl-portal                 0.6.3
	voxl-px4                    1.14.0-2.0.63
	voxl-px4-imu-server         0.1.2
	voxl-px4-params             0.3.3
	voxl-qvio-server            1.0.0
	voxl-remote-id              0.0.9
	voxl-ros2-foxy              0.0.1
	voxl-streamer               0.7.4
	voxl-tag-detector           0.0.4
	voxl-tflite-server          0.3.1
	voxl-utils                  1.3.3
	voxl-uvc-server             0.1.6
	voxl-vision-hub             1.7.3

There is no response from the drone.

## Reply by tahawaru · 2024-09-30 15:33:20 UTC (in reply to tahawaru)

@tom 
Hi Tom,
I have downloaded the src files from https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-to-ros2/-/tree/master/colcon_ws/src?ref_type=heads
Then I build with colcon build
The command "ros2 run voxl_offboard_figure8 voxl_offboard_figure8 " outputs the following while the rb5 is not responding at all
[INFO] [1727710160.087447748] [offboard_figure8_node]: Offboard Figure 8 Node Alive!
[INFO] [1727710161.215068375] [offboard_figure8_node]: Switching to offboard mode
[INFO] [1727710161.225198835] [offboard_figure8_node]: Arm command sent
[INFO] [1727710170.118029165] [offboard_figure8_node]: Doing figure 8 now
[INFO] [1727710183.178457539] [offboard_figure8_node]: Switching to land mode

Can someone update the short introduction to ROS2 usage with the rb5? Please.

@tahawaru said in [Issue with ROS2 set\-up, Deserialization of UORB Topics](/post/18561):
> @Zachary-Lowell-0 
> 
> I'm having a similar error from running a ros2 command
> 
> rb5:~/colcon_ws$ ros2 run voxl_offboard_figure8 voxl_offboard_figure8 
> [INFO] [1723134293.283379373] [offboard_figure8_node]: Offboard Figure 8 Node Alive!
> 2024-08-08 16:24:53.442 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:53.950 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> [INFO] [1723134294.428290964] [offboard_figure8_node]: Switching to offboard mode
> [INFO] [1723134294.428816835] [offboard_figure8_node]: Arm command sent
> 2024-08-08 16:24:54.452 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:54.951 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:55.452 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:55.961 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:56.461 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:56.971 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:57.482 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:57.988 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:58.488 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:58.998 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:24:59.507 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:25:00.016 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 2024-08-08 16:25:00.528 [SUBSCRIBER Error] Deserialization of data failed -> Function deserialize_change
> 
> 
> 
> My Rb5 specs:
> rb5:~/colcon_ws$ voxl-version 
> --------------------------------------------------------------------------------
> system-image: 1.7.1-M0052-14.1a-perf-nightly-20231025
> kernel:       #1 SMP PREEMPT Thu Oct 26 05:24:02 UTC 2023 4.19.125
> --------------------------------------------------------------------------------
> hw version:   M0052
> --------------------------------------------------------------------------------
> voxl-suite:   
> --------------------------------------------------------------------------------
> Packages:
> Repo:  http://voxl-packages.modalai.com/ ./dists/qrb5165/sdk-1.1/binary-arm64/
> Last Updated: 2024-07-19 09:01:43
> List:
> 	libmodal-cv                 0.4.0
> 	libmodal-exposure           0.1.0
> 	libmodal-journal            0.2.2
> 	libmodal-json               0.4.3
> 	libmodal-pipe               2.9.2
> 	libqrb5165-io               0.4.2
> 	libvoxl-cci-direct          0.2.1
> 	libvoxl-cutils              0.1.1
> 	mv-voxl                     0.1-r0
> 	qrb5165-bind                0.1-r0
>         ...............
>         voxl-mavlink                0.1.1
> 	voxl-mavlink-server         1.3.2
> 	voxl-microdds-agent         2.4.1-0
> 	voxl-modem                  1.0.8
> 	voxl-mongoose               7.7.0-1
> 	voxl-mpa-to-ros             0.3.7
> 	voxl-mpa-to-ros2            0.0.4
> 	voxl-mpa-tools              1.1.3
> 	voxl-neopixel-manager       0.0.3
> 	voxl-opencv                 4.5.5-2
> 	voxl-portal                 0.6.3
> 	voxl-px4                    1.14.0-2.0.63
> 	voxl-px4-imu-server         0.1.2
> 	voxl-px4-params             0.3.3
> 	voxl-qvio-server            1.0.0
> 	voxl-remote-id              0.0.9
> 	voxl-ros2-foxy              0.0.1
> 	voxl-streamer               0.7.4
> 	voxl-tag-detector           0.0.4
> 	voxl-tflite-server          0.3.1
> 	voxl-utils                  1.3.3
> 	voxl-uvc-server             0.1.6
> 	voxl-vision-hub             1.7.3
> 
> 
> There is no response from the drone.

## Reply by brahim · 2024-10-01 14:44:44 UTC

@tahawaru there are a few intermediate steps to get ros2 offboard control:

* disable offboard_mode (set to false) in voxl-vision-hub.conf line 237: `"offboard_mode":        "false"`

* Ensure voxl-microdds-agent is running. You can check by running `systemctl status voxl-microdds-agent`

* Once these steps are complete, and you have the ros2 offboard fig 8 running,  you should be able to echo the offboard control mode info either in an adb shell or mavlink console:

In adb you can use the command `px4-listener offboard_control_mode` which should return this
```TOPIC: offboard_control_mode
 offboard_control_mode
    timestamp: 314055050 (0.031338 seconds ago)
    position: True
    velocity: False
    acceleration: False
    attitude: False
    body_rate: False
    actuator: False
```
* A way to verify the figure 8 ros2 node is sending setpoints to px4 is to echo trajectory setpoints: ` ros2 topic echo /fmu/in/trajectory_setpoint`
* When you kill the ros2 offboard node, you can echo that offboard mode status again and the timestamp should go stale and no longer update.

## Reply by tahawaru · 2024-10-22 12:56:15 UTC (in reply to brahim)

@brahim 
@tom 

Hi and sorry for the delayed response.

Main result : no response from the rb5
Comments: the offboard code example in cpp is running in Gazebo but I cannot get the drone to arm via *ROS2 run px4_ros_com offboard_control*.

This is the output from my terminal
~/ros2_ws$ ros2 run px4_ros_com offboard_control
Starting offboard control node...
[INFO] [1729601421.989530505] [offboard_control]: Arm command send

Notes: The offboard setting is "off" not "false" on the voxl-vision-hub.conf.

Do you have a recent tutorial on how to use ROS2 with the rb5?

Best wishes,
