Arduino subscriber node error

asked 2021-07-21 05:48:47 -0600

doldol gravatar image

Using arduino i want to print turtle_teleop_key's geometry_msg/Twist data on arduino serial monitor ​

include <ros.h>

include <geometry_msgs twist.h="">

ros::NodeHandle nh;

void callback(const geometry_msgs::Twist& cmd_vel){

Serial.println(cmd_vel.linear.x);

}

ros::Subscriber<geometry_msgs::twist.h> sub("/turtle1/cmd_vel", callback);

void setup()

{

nh.initNode();

nh.subscribe(sub);

}

void loop()

{

nh.spinOnce();

delay(1);

}

​ At this part

ros::Subscriber<geometry_msgs::twist.h> sub("/turtle1/cmd_vel", callback);

I got an error like this. what should i have to do??

error: no matching function for call to 'ros::NodeHandle_<arduinohardware, 25,="" 25,="" 280,="" 280="">::subscribe(int&)'

edit retag flag offensive close merge delete