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

ROS program controlling arduino via serial communication

asked 2015-08-11 06:57:05 -0500

oneevening gravatar image

updated 2015-08-11 08:40:36 -0500

I have been working on arduino and ros communication for few days and now I have an arduino code which have two subscribers as;

ros::Subscriber<std_msgs::uint16> sub("red", redLED); ros::Subscriber<std_msgs::uint16> sub2("yellow", yellowLED);

So, when I input "rostopic pub red -r 1 std_msgs/UInt16 1000" it lights up the LED then waits 1 second and turns it off and does that at 1 Hz.

What I want to do is writing a ros code so that when I press up key on keyboard, this rostopic I mentioned above will be sent or the subscriber will be called, however it works.

How can I do that, which topics do I have to look at? Keep in mind that I have no experience with ROS

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-11 07:14:19 -0500

Akif gravatar image

You may look at key_teleop which is used to publish velocity commands using keyboard.

You should write a publisher, and using key bindings, you should publish messages.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-08-11 06:57:05 -0500

Seen: 178 times

Last updated: Aug 11 '15