Ask Your Question

Tried to advertise on topic [/mavros/setpoint_position/global] with md5sum [07...] and datatype [mavros_msgs/GlobalPositionTarget], but the topic is already advertised as md5sum [cc...] and datatype [geographic_msgs/GeoPoseStamped]

asked 2021-08-08 04:37:38 -0600

Rika gravatar image

Hi everyone, I have been trying to set a GPS position by setting mavros/setpoint_position/global, but faced with this error message:

 [ERROR] [1628412556.927932932]: Tried to advertise on topic [/mavros/setpoint_position/global] with md5sum [076ded0190b9e045f9c55264659ef102] and datatype [mavros_msgs/GlobalPositionTarget], but the topic is already advertised as md5sum [cc409c8ed6064d8a846fa207bf3fba6b] and datatype [geographic_msgs/GeoPoseStamped]
[ INFO] [1628412557.179607573]: Connected to PX4!

What is wrong here?
Based on the documentation which seems to be wrong bye the way, I had to use mavros_msgs/GlobalPositionTarget but doing so, results in failure of the application in runtime and instead I'm instructed to use geographic_msgs/GeoPoseStamped instead. now that I use this, when I subscribe to mavros/global_position/global I get the stated error.

in case it matters, this is my node that sets the gps position:

#include <limits>
#include <ros/ros.h>
#include <sensor_msgs/NavSatFix.h>
#include <geographic_msgs/GeoPoseStamped.h>
#include <mavros_msgs/GlobalPositionTarget.h>

int main(int argc, char **argv)
    ros::init(argc, argv, "offb_node22");
    ros::NodeHandle nh;

    //set gps 
    ros::Publisher pub_global_gps = nh.advertise<geographic_msgs::GeoPoseStamped>("mavros/setpoint_position/global", 10);
    geographic_msgs::GeoPoseStamped gps_target;

    //the setpoint publishing rate MUST be faster than 2Hz
    ros::Rate rate(20.0);

    // wait for GPS connection
        gps_target.header.stamp = ros::Time::now();
        gps_target.header.frame_id = "base_link";

        gps_target.pose.position.altitude = 10;
        gps_target.pose.position.latitude = 10;
        gps_target.pose.position.longitude = 10;


    return 0;
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-08-09 03:58:31 -0600

Benjamin-Tan gravatar image

I would do the following checks:

  1. Do not run this publisher node. Simply check the message type by rostopic info mavros/setpoint_position/global
  2. If the message type is correct and matching (e.g. geographic_msgs/GeoPoseStamped), and the similar error message persists, then it could be due to the fact that there are 2 different versions of the message type geographic_msgs/GeoPoseStamped in your computer. Make sure to have the same version of geographic_msgs/GeoPoseStamped to resolve this issue.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-08-08 04:37:38 -0600

Seen: 33 times

Last updated: Aug 08 '21