publish array velocities in a topic?
Hi Ros users! I have just done a .cpp wich publish velocities in a opic (p3dx/cmd_vel) Here it is:
int main(int argc, char **argv)
{
ros::init(argc, argv, "lanzando_vel");
ros::NodeHandle n;
ros::Publisher vel_pub_ = n.advertise<geometry_msgs::Twist>("p3dx/cmd_vel", 1);
while (ros::ok())
{
geometry_msgs::Twist cmd;
cmd.linear.x = 0;
cmd.linear.y = 0;
cmd.linear.z = 0;
cmd.angular.x = 0;
cmd.angular.y = 0;
cmd.angular.z = 0;
vel_pub_.publish(cmd);
}
return 0;
}
I would like to publish an array velocities, for example:
at 1seg ==> cmd.linear.x=1 at 3 seg==> cmd.linear.x=4 . . .
how can I do that?
Thank you so much!