Robotics StackExchange | Archived questions

How to create a ros launch file for arduino node?

Hey I wanted to open up the arduino node by using the ros launch file is there is any way to do that??

Asked by shashikg on 2017-01-22 00:57:06 UTC

Comments

What package are you using to talk to the Arduino? Both rosserial and ros_arduino_bridge are appropriate choices. You'll start nodes in those packages. Those nodes will open up the communication channel to the Arduino sketch.

Asked by Mark Rose on 2017-01-25 14:50:28 UTC

Answers

First you could try with a simple command line and make sure everything works:

$ rosrun rosserial_python serial_node.py _baud:=57600 _port:=/dev/ttyACM0

Then you make a catkin package in your catkin workspace, add a folder with a name launch in your package.

Inside your launch folder, your launch file run_arduino.launch should be created (right click -> new document -> empty document)

Here's the corresponding launch file:

<launch>
    <node name="serial_node"        pkg="rosserial_python"      type="serial_node.py">
    <param name="port"              type="string"               value="/dev/ttyACM0"/>
    <param name="baud"              type="int"                  value="57600"/>
    </node>
</launch>

After creating a launch file, what you simply do is going to your package directory, where you have you launch file and use the following command to start the arduino node:

$ roslaunch /your_catkinpackage/launchFolder/run_arduino.launch

Asked by Farid on 2018-06-28 02:07:21 UTC

Comments

Is there a way to upload code to the Arduino using a .launch file, in addition to forwarding serial data from Arduino to roscore using serial_node?

Asked by Void on 2019-01-01 19:10:06 UTC

Can you tell how to specify the tcp port number in a launch file?

Asked by Saums on 2019-08-08 15:57:09 UTC