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

Rosserial Arduino control by keyboard

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

YingHua gravatar image

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

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
0

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

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 Serial.read().

edit flag offensive delete link more

Comments

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 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 1,601 times

Last updated: Jan 24 '16