How to control turtlesim by a publisher data sent by arduino rosserial
I'm noob in ROS, and i used this aduino code to send Float64 data to ros
#include <std_msgs/Float64.h>
ros::NodeHandle nh;
std_msgs::Float64 float_msg;
ros::Publisher chatter("chatter", &float_msg);
float x = 5;
void setup()
{
nh.initNode();
nh.advertise(chatter);
}
void loop()
{
float_msg.data = x;
chatter.publish( &float_msg );
nh.spinOnce();
delay(1000);
}
then i used the following command to control turtle sent publisher data
rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[chatter, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
but it doesn't read chatter as Float64 data so it doesn't work , even i checked rostopic info chatter
and it had float64 data type
Thanks in advance