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

Rosserial Arduino control by keyboard

asked 2016-01-24 20:25:03 -0600

YingHua gravatar image

updated 2016-01-24 20:25:50 -0600

I wonder use keyboard to control My arduino for making a little car.

So I use the package "ros-keyboard" and write a node myself(click me to github).

And it seems that two packages' data types are different, even the arduino recive topic message "/keyboard/keydown", there is nothing happen when I push buttom on the keyboard.

Do I miss something ? thanks!! > <

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-24 21:47:12 -0600

ahendrix gravatar image

The publisher is sending messages with the message type keyboard/Key, but your subscriber is subscribing to message with the type std_msgs/Empty. Since these message types don't match, the subscriber will discard any messages it receives.

You're also reading data from the serial line with the Serial class in Arduino, and trying to use rosserial at the same time. Since both are trying to use the serial line, there will be a conflict, and rosserial probably will not work. The keypress data you want should be in the keyboard/Key message, so you don't need to do

edit flag offensive delete link more


Thanks for your response.I am planning to modify arduino code to subscribe to keyboard/Key.

YingHua gravatar image YingHua  ( 2016-01-27 01:08:54 -0600 )edit

Question Tools

1 follower


Asked: 2016-01-24 20:25:03 -0600

Seen: 1,591 times

Last updated: Jan 24 '16