Mocap - Mavros - PX4, error receiving Mavros topic in px4

I’m trying to setup a px4 within a mocap system. The peculiarities of the system are the following:

  • I have an Auterion system that is composed of a companion computer and a PX4 autopilot.

  • I use a WiFi-router to connect all the systems: The Mocap server (192.168.0.10), a Linux system with GCS and ROS (192.168.0.15) that redirects/remaps the ROS messages and the Auterion (192.168.0.11) that should receive the topics. I have changed the configuration files of the Auterion (with mavlink-router library) in order to send Mavlink to the GCS inside Linux automatically.

I have been following the steps in external_position_estimation
It seems that it works up to Linux sending the Mavros topic from the ROS system, because I can see it with the command rostopic echo /mavros/vision_pose/pose, but PX4 does not seem to receive it.

I’m not sure about the fcu_url and gcs_url and the upd/tcp ports in the launch script of Mavros. The thing I’ve come up to is the following modified ROS launch script (based on px4.launch):


<launch>

<arg name="fcu_url" default="udp://:14553@192.168.0.11:14556" />
<arg name="gcs_url" default="udp://192.168.0.15:14550@192.168.0.15:14560" />
<arg name="tgt_system" default="1" />
<arg name="tgt_component" default="1" />
<arg name="server" default="192.168.0.10"/>
<arg name="log_output" default="screen" />
<arg name="fcu_protocol" default="v2.0" />
<arg name="respawn_mavros" default="false" />

<node pkg="mavros" type="mavros_node" name="mavros" required="$(eval not respawn_mavros)" clear_params="true" output="$(arg log_output)" respawn="$(arg respawn_mavros)">
  <param name="fcu_url" value="$(arg fcu_url)" />
  <param name="gcs_url" value="$(arg gcs_url)" />
  <param name="target_system_id" value="$(arg tgt_system)" />
  <param name="target_component_id" value="$(arg tgt_component)" />
  <param name="fcu_protocol" value="$(arg fcu_protocol)" />
</node>

<node pkg="vrpn_client_ros" type="vrpn_client_node" name="vrpn_client_node" output="screen">
  <remap from="/vrpn_client_node/drone/pose" to="/mavros/vision_pose/pose"/> 
  <rosparam subst_value="true">
    server: $(arg server)
    port: 3883

    update_frequency: 100.0
    frame_id: world

    # Use the VRPN server's time, or the client's ROS time.
    use_server_time: false
    broadcast_tf: true

    # Must either specify refresh frequency > 0.0, or a list of trackers to create
    refresh_tracker_frequency: 1.0
    #trackers:
    #- FirstTracker
    #- SecondTracker
  </rosparam>
</node>

</launch>

Is it correct? At least I don’t receive any errors when executing it.

I used the tip of the previous page and when changing MAV_ODOM_LP parameter to 1, I stop receiving any ODOMETRY message.
Is there other way to debug the communication?

Hi @Cloud , you can check PX4 is receiving the messages: from a MAVLINK Shell use

listener vehicle_vision_odometry

it has to output the odometry message associated to /mavros/vision_pose/pose in the correct frames.

which version of PX4 are you using?

the PX4 version I am using is 1.12.3.
It seems that the listener doesn’t receive any vehicle_vision_odometry. I think that I’m not assigning the correct ports in the script, but I don’t have a lot of knowledge about the tools I can use to detect the correct one and the documentation although clear for basic cases, I can’t seem to fully understand it for my case.

In MAVROS, do you see the odom plugin loaded?

You can also check (Using Vision or Motion Capture Systems for Position Estimation | PX4 User Guide) if the MAVlink message VISION_POSITION_ESTIMATE is being sent

In the end, it was a silly mistake, The main issue was that I had not installed mavros_extras package.

Also, I am not sure why I have to declare fcu_url = 0.0.0.0:1540@127.0.0.1:1557 in px4.launch in order to work. From my understanding, the 0.0.0.0 broadcasts to all network inside a PC, in this case the one who launches Mavros? But could it be improved with a specific address like my IP or something? And I think the localhost IP is due to how the companion is routed with Mavlink (it seems that every Mavlink messages is transmitted to localhost). The ports specified are the ones enabled by me through the companion computer mavlink-router file.

The other required steps are just like the vision configuration section in the px4 documentation/manual

2 Likes