rostopic pub: "required argument is not a float" while sending Float32MultiArray.
Hello,
I would like to run one of my robot's wheel with a ros command in a terminal.
The function I use need two parameters so I wanted to use Float32MultiArray.
My arduino code ressembles to the following one:
float x,y;
----------
/*callback*/
void cmd(const std_msgs::Float32MultiArray& array){
x = a.data[0];
y = a.data[1];
motor1.run(x,y); }
----------
/*suscriber*/
ros::Subscriber<std_msgs::float32multiarray> sub("cmd", &cmd);
In a terminal, I type the following command:
rostopic pub /cmd std_msgs/Float32MultiArray "layout:
dim:
- label: "run"
size: 2
stride: 1
data_offset:0
data:[100 100]" --once
However, I have the following error:
[WARN] [..]: Inbound TCP/IP connection failed: <class 'struct.error'="">: 'required argument is not a float' when writing 'label: run size: 2
Thank you in advance for your help.
Kindest regards,
Could you precise what does your
(x, y)
variables stand for? If they are velocities, we could come up with a more natural/coherent way to publish them.In fact, (x,y) variables stands for the position (degrees) the robot has to reach and its speed (rpm)