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

Is there a way to publish keyboard events (using key_teleop for example) to a serial port?

asked 2018-03-13 20:33:57 -0600

trixr4kdz gravatar image

updated 2018-03-13 20:37:15 -0600

Hi,

I've been looking at ways to publish keyboard commands to a UART serial port and the top result keeps pointing me to rosserial, but I'm not entirely sure this exactly fits my needs. Ideally, I want to be able to send keyboard events to my flight controller through PPM signals because I already have the hardware that would send signals from a serial port to my flight controller. This is how I envision it would go from all the materials I have:

KEYPRESS (Twist message) ==> UART SERIAL PORT (probably ttyS1) ==> PPM ENCODER (not an Arduino) ==> FLIGHT CONTROLLER

I found that I can publish Twist messages using either the key_teleop module or teleop_twist_keyboard, but I'm stuck as to how to send this to a serial port (i.e. ttyS1). Would I simply need to write my own ROS node and use pyserial (since I would be writing in python) to open the port and pass the message in? Or can I use rosserial somehow to pass in Twist messages?

Thank you in advance and please excuse me for asking a noob question.

Trixie

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-14 03:20:56 -0600

gvdhoorn gravatar image

rosserial will assume control over your serial port, so if that port is being used by something else -- and that 'something' is not a rosserial client -- that is probably not what you want.

Would I simply need to write my own ROS node and use pyserial (since I would be writing in python) to open the port and pass the message in?

If you're basically trying to convert ROS geometry_msgs/Twist msgs into something your remote system can use, then yes, you'll probably have to write a node that does this for you.

Please take the time to first search for an existing solution / implementation though, as it's likely someone (or multiple someones) has (have) already done this.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2018-03-13 20:33:57 -0600

Seen: 415 times

Last updated: Mar 14 '18