MavROS topic distance_sensor not published

I have gone through the MavROS setup on the Emlid docs and have it working as expected. However, I have a Teraranger One and a PX4Flow sensor attached over I2C that I would like to be able to get the data from, but the distance_sensor and px4flow plugins seem to not work. When I type >rostopic echo /mavros/ and press tab I do not get the distance_sensor or px4flow topics to choose from. I have gone into both the apm and px4 .yaml files and removed the distance_sensor and px4flow from the blacklist.
After I edit the .yaml what do I need to do for the changes to take effect?

Both sensors work properly in Ardupilot and the drone flies great I just need to get the data into my own ROS node.
I am using the latest firmware version available for the Navio2 in Arducopter and I’m using a Pi 4 4gb.
Any help is greatly appreciated.

Hi Brady,

We haven’t tested the ROS workflow with Terranger One or PX4Flow. However, usually, you should stop the launch file (for example, apm.launch), edit the .yaml file, and then relaunch.

Did you check if the changes were applied with the rosparam get command?

Also, did I get correctly that only distance_sensor and px4flow topics aren’t shown in the topics list?

1 Like

Svetlana,

Sorry for the late reply.

You are correct that only the distance_sensor and px4flow topics are not listed is rostopic echo. If I remove other items from the blacklist such as “altitude”, it then shows up in rostopic echo.

I have attempted to change the parameters inside the apm_pluginlists.yaml after stopping the service and then restarting. I have also attempted to restart the Pi itself after changes.

When I do the >rosparam get mavros command the distance_sensor section is as follows:

distance_sensor:
rangefinder_pub:
field_of_view: 0.0
frame_id: lidar
id: 0
send_tf: false
sensor_position: {x: 0.0, y: 0.0, z: -0.1}
rangefinder_sub: {id: 1, orientation: PITCH_270, subscriber: true}

I’m not sure if these are the correct parameters or not. If you have any insight into that I would greatly appreciate it.

Thanks,
Brady

I have also tried it with the following parameters:

distance_sensor:
rangefinder_pub:
field_of_view: 0.2
frame_id: lidar
id: 0
orientation: PITCH_270
send_tf: true
sensor_position: {x: 0.0, y: 0.0, z: -0.1}
rangefinder_sub: {id: 1, orientation: PITCH_270, subscriber: true}

with no success.

The blacklist is as follows in the rosparam get mavros:

plugin_blacklist: [actuator_control, ftp, safety_area, hil, debug_value, image_pub,
vibration, vision_speed_estimate, wheel_odometry]

distance_sensor is not included in the blacklist so my changes are taking effect.

Brady

Now I have tried whitelisting the plugin to see if that worked but no success:

plugin_blacklist: [actuator_control, ftp, safety_area, hil, debug_value, image_pub,
vibration, vision_speed_estimate, wheel_odometry]
plugin_whitelist: [distance_sensor]

Also, here are the parameters for the px4flow:

px4flow: {frame_id: px4flow, ranger_fov: 0.118682, ranger_max_range: 5.0, ranger_min_range: 0.3}

This is a list of all the active channels that rostopic will show:

pi@navio:/opt/ros/kinetic/share/mavros/launch $ rostopic echo /mavros/
/mavros/altitude
/mavros/battery
/mavros/estimator_status
/mavros/extended_state
/mavros/global_position/compass_hdg
/mavros/global_position/global
/mavros/global_position/gp_lp_offset
/mavros/global_position/gp_origin
/mavros/global_position/home
/mavros/global_position/local
/mavros/global_position/raw/fix
/mavros/global_position/raw/gps_vel
/mavros/global_position/raw/satellites
/mavros/global_position/rel_alt
/mavros/global_position/set_gp_origin
/mavros/home_position/home
/mavros/home_position/set
/mavros/imu/data
/mavros/imu/data_raw
/mavros/imu/diff_pressure
/mavros/imu/mag
/mavros/imu/static_pressure
/mavros/imu/temperature_baro
/mavros/imu/temperature_imu
/mavros/local_position/accel
/mavros/local_position/odom
/mavros/local_position/pose
/mavros/local_position/pose_cov
/mavros/local_position/velocity_body
/mavros/local_position/velocity_body_cov
/mavros/local_position/velocity_local
/mavros/manual_control/control
/mavros/manual_control/send
/mavros/mission/reached
/mavros/mission/waypoints
/mavros/param/param_value
/mavros/radio_status
/mavros/rc/in
/mavros/rc/out
/mavros/rc/override
/mavros/setpoint_accel/accel
/mavros/setpoint_attitude/cmd_vel
/mavros/setpoint_attitude/thrust
/mavros/setpoint_position/global
/mavros/setpoint_position/global_to_local
/mavros/setpoint_position/local
/mavros/setpoint_raw/attitude
/mavros/setpoint_raw/global
/mavros/setpoint_raw/local
/mavros/setpoint_raw/target_attitude
/mavros/setpoint_raw/target_global
/mavros/setpoint_raw/target_local
/mavros/setpoint_trajectory/desired
/mavros/setpoint_trajectory/local
/mavros/setpoint_velocity/cmd_vel
/mavros/setpoint_velocity/cmd_vel_unstamped
/mavros/state
/mavros/statustext/recv
/mavros/statustext/send
/mavros/time_reference
/mavros/timesync_status
/mavros/vfr_hud
/mavros/wind_estimation