I recently working on a localization project which require a customized gazebo vehicle attached with 2 optical flow sensors(no gyro) and 4 lidar sensors. I want to publish the 2 optical flow sensors data to these 2 mavros topics:
Initially, both topics were successfully published and were verified as below picture
However, I realized that the data output for both topics are similar to each other which I do not expect as the gaussian noise is being added into the model when I am editing the sdf file. Hence, I checked my ‘PX4 on SITL’ by typing
listener optical_flowand only 1 instance was being shown. [see below]
This verify my doubt that only 1 optical flow data is being published to the PX4 stack.
I realized that the
int:Simulator::publish_distance_topic function in
simulator_mavlink.cpp used the method as below to publish multiple lidar sensors data to PX4 stack
So, I modified
int:Simulator::publish_flow_topic function the same way to publish multiple optical flow data to PX4 stack.
However, I still couldn’t let both optical flow data being published to PX4 stack. It still gives me 1 instance for optical flow data but it gives me 4 instances for lidar data.
Please let me know if anyone knows how to solve this issue. Also, I want to send 2 optical flow data instances to MAVROS topic eventually. If anyone knows the way to differentiate two instances of optical flow data for both MAVROS topics, please let me know your approach too! Thank you and I do appreciate any help!.