ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I finally find the right syntax to define a publisher

include "ros.h"

include "geometry_msgs/Twist.h"

float x;

ros::NodeHandle nh;

void velCallback( const geometry_msgs::Twist& vel) { x = vel.linear.x - 1.0; // I CAN USE VEL AS I WANT }

ros::Subscriber<geometry_msgs::twist> sub("cmd_vel" , velCallback);

void setup() { nh.initNode(); nh.subscribe(sub); }

void loop() { nh.spinOnce(); delay(10); }

I finally find the right syntax to define a publisher

include "ros.h"

include "geometry_msgs/Twist.h"

float x;

ros::NodeHandle nh;

void velCallback( const geometry_msgs::Twist& vel) { x = vel.linear.x - 1.0; // I CAN USE VEL AS I WANT }

ros::Subscriber<geometry_msgs::twist> sub("cmd_vel" , velCallback);

void setup() { nh.initNode(); nh.subscribe(sub); }

void loop() { nh.spinOnce(); delay(10); }

I finally find the right syntax to define a publisher

include "ros.h"

include "geometry_msgs/Twist.h"

float x;

ros::NodeHandle nh;

void velCallback( const geometry_msgs::Twist& vel) { x = vel.linear.x - 1.0; // I CAN USE VEL AS I WANT }

ros::Subscriber<geometry_msgs::twist> sub("cmd_vel" , velCallback);

void setup() { nh.initNode(); nh.subscribe(sub); }

void loop() { nh.spinOnce(); delay(10); }

Thanks for support

PS : I am still don't knwo how to properly insert cpp code citation

I finally find the right syntax to define a publisher

#include "ros.h"
  

include "ros.h"

#include "geometry_msgs/Twist.h"

include "geometry_msgs/Twist.h"

float x;

ros::NodeHandle nh;

nh;

void velCallback( const geometry_msgs::Twist& vel) { x = vel.linear.x - 1.0; // I CAN USE VEL AS I WANT }

}

ros::Subscriber<geometry_msgs::twist> ros::Subscriber<geometry_msgs::Twist> sub("cmd_vel" , velCallback);

velCallback);

void setup() { nh.initNode(); nh.subscribe(sub); }

}

void loop() { nh.spinOnce(); delay(10); }

}

Thanks for support

PS : I am still don't knwo how to properly insert cpp code citation