0
$\begingroup$

Rosanswers logo

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


Originally posted by oneevening on ROS Answers with karma: 1 on 2015-08-11

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Akif with karma: 3561 on 2015-08-11

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.