swri-robotics / mapviz

Modular ROS visualization tool for 2D data.
BSD 3-Clause "New" or "Revised" License
371 stars 144 forks source link

Navsat - no messages received #730

Closed spam-12345 closed 3 years ago

spam-12345 commented 3 years ago

Hello everyone, i am quiet new to ROS2, but I would like to utilize Mapviz to visualize the movement of my robot.

This is my launch file:

  <launch>
  <!-- Note that the XML-based launch format is only supported in ROS Eloquent and newer. -->

  <node pkg="mapviz" exec="mapviz" name="mapviz" required="true" output="screen" />  <!--  -->

  <node pkg="swri_transform_util" exec="initialize_origin.py" name="initialize_origin" >
    <param name="local_xy_frame" value="map"/>
    <param name="local_xy_origin" value="swri"/>
    <param name="local_xy_origins" value="
      [{ name: swri,
         latitude: 47.8,
         longitude: 10.6,
         altitude: 740.719,
         heading: 0.0},

       { name: back_40,
         latitude: 47.83,
         longitude: 10.641,
         altitude: 740.0,
         heading: 0.0}]"/>

    <remap from="/fix" to="/gps/fix"/>
  </node>

  <node pkg="tf2_ros"
        exec="static_transform_publisher"
        name="swri_transform"
        args="0 0 0 0 0 0 map odom "/>

  <node pkg="tf2_ros"
        exec="static_transform_publisher"
        name="swri_transform"
        args="0 0 0 0 0 0 odom base_footprint"/>  <!--  -->

</launch>

The problem is mapviz does not receive the message from my topic /gps/fix, although the data of the topic is published (see right: ros2 topic echo /gps/fix ). image

If I publish data for example via ros2 topic pub /gps/fix sensor_msgs/msg/NavSatFix "{header:{frame_id: gps_link},status:{status: 0,service: 0}, latitude: 47.8051,longitude: 10.60652, altitude: 740.3, position_covariance_type: 2}" , it will be visualized in mapviz.

My ros2 topic echo /local_xy_origin shows plausible data: unnamed

This is my rqt_graph for the problem topic: image (1)

Can anybody help me? I am using Ubuntu 20.04 with foxy and cloned the mapviz branch dashing-devel.

spam-12345 commented 3 years ago

It is a Quality of Service probleme...

Changed the navsat subscriber in the navsat_plugin.cpp to

navsat_sub_ = node_->create_subscription<sensor_msgs::msg::NavSatFix>(
            topic_,
            rclcpp::SensorDataQoS(), //instead of QoS(1) 
            std::bind(&NavSatPlugin::NavSatFixCallback, this, std::placeholders::_1));