Hello community, I’m trying to fly the drone by using only optical flow with ROS 2, UXRCE DDS architecture, and uORB Topics. I’m following the instructions provided in the PX4 documentation:
*UXRCE DDS architecture:
https://docs.px4.io/main/en/middleware/uxrce_dds.html
*uORB topics:
https://github.com/PX4/PX4-Autopilot/blob/710286da722beae72a488af52b6c1e603f68eea7/src/modules/uxrce_dds_client/dds_topics.yaml
I’m using the VL53L1X rangefinder to measure the distance from the drone to the ground, along with a Raspberry Pi camera. Both are connected to the Jetson Orin.
My node receives data from the VL53L1X rangefinder and images from the camera. With this information, the node calculates the optical flow quality, flow_x, and flow_y in radians.
After calculating the flow, I publish the data using the SensorOpticalFlow
message type (UORB message)
(SensorOpticalFlow (UORB message) | PX4 Guide (main)).
I publish the message on this topic:
- topic: /fmu/in/sensor_optical_flow
type: px4_msgs::msg::SensorOpticalFlow
This message type requires the distance from the rangefinder (local_distance).
Then I set the parameters in the pixhawk by ground control:
After that:
-
I successfully run the UXRCE DDS agent on the onboard computer.
-
I successfully start the UXRCE DDS client on the Pixhawk.
-
I execute my node, and then in the Mavlink Inspector, I can see the optical flow data (although I’m not sure why I cannot see the
sensor_id
andtime_delta_distance_us
).
The distance changes correctly in OPTICAL_FLOW_RAD
when I move the drone in the z-axis. However, when I check the ODOMETRY & LOCAL_POSITION_NED, the value in the z-axis is different.
My question :
- How should I set up the Pixhawk to fly using optical flow?
- Do I need to publish only the value of the rangefinder to another node?
- What is the purpose of publishing the distance into the topic
/fmu/in/sensor_optical_flow
with this structure type:px4_msgs::msg::SensorOpticalFlow
?
Thank you in advance.