0
$\begingroup$

Rosanswers logo

Hi, i'm actually trying to use my own class method as callback of a topic. I do it like this

First i created a publisher :

    ros::Publisher topicDirection = n.advertise<std_msgs::Float64>("commandeDir", 1);

then i subscribe to this topic (commandeDir) with :

Servo pwmDir();
ros::Subscriber topicDir = n.subscribe("commandeDir", 1, &Servo::commande(const std_msgs::Float64& msg), pwmDir);

and my function looks like this :

void Servo::commande(const std_msgs::Float64& msg)
{
     //.......
}

it throw me this error :

/opt/ros/indigo/include/ros/message_traits.h:138:31: error: ‘__s_getDataType’ is not a member of ‘int’
 return M::__s_getDataType().c_str();

i don't get what i am doing wrong ?


Originally posted by pit on ROS Answers with karma: 1 on 2016-03-04

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

At the very least, you don't include the method signature (just the function identifier) in the 3rd parameter when creating the subscriber (the n.subscribe call).


Originally posted by kramer with karma: 1470 on 2016-03-05

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.