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

How to change the serial port in rosserial for the arduino to publish to

asked 2020-12-31 08:37:22 -0500

nbaddorf gravatar image

I am trying to change the serial port that my teensy Arduino publishes rosserial on. I already know how to change what serial port that, in this case, my raspberry pi reads rosserial from, but instead of the teensy publishing the data over USB, I would like the data to be published over Serial2. I have tried to follow the tutorial given by rosserial on changing the port, but when I try to upload the sketch to the teensy, it errors. Here is the link to the tutorial: http://wiki.ros.org/rosserial_arduino...

In case this helps, I am running Ubuntu 18.04 on my master computer, and Ubuntu-mate 18.04 on a raspberry pi for the slave computer. I have a Teensy 4.1 microcontroller that talks to the raspberry pi with rosserial. Rosserial currently works fine over USB, but I cant get rosserial to use a different serial port.

edit retag flag offensive close merge delete

Comments

I don't know the solution, but I'm pretty sure "it errors" won't be sufficient description for anyone else to help you.

gvdhoorn gravatar image gvdhoorn  ( 2021-01-01 03:25:13 -0500 )edit

Sorry about not including the error. When I follow the tutorial exactly, by adding ros.h and the arduinohardware file, I get the error:

In file included from    /Users/nbaddorf/Documents/Arduino/TempForumChaingeRosserialPort/TempForumChaingeRosserialPort.ino:6:0:    /var/folders/2t/1ymz5b_d0x59sqrw7rfsvnkh0000gn/T/arduino_build_44793/sketch/ros.h:4:29:    fatal error: ros/node_handle.h: No    such file or directory compilation    terminated. Error compiling for board    Teensy 4.1.

When I saw this error, I tried copying over all the files in the rosserial library into my current sketch folder. When I try running that, I get this error:

Oops, the forum won't let me post it, due to its length.

nbaddorf gravatar image nbaddorf  ( 2021-01-01 08:53:08 -0500 )edit

Ok, so the error I get from the running the sketch with the ros library inside is:

In file included from /var/folders/2t/1ymz5b_d0x59sqrw7rfsvnkh0000gn/T/arduino_build_44793/sketch/ros.h:38:0,
                 from /Users/nbaddorf/Documents/Arduino/TempForumChaingeRosserialPort/TempForumChaingeRosserialPort.ino:6:
/var/folders/2t/1ymz5b_d0x59sqrw7rfsvnkh0000gn/T/arduino_build_44793/sketch/ros/node_handle.h:40:27: fatal error: std_msgs/Time.h: No such file or directory
 #include "std_msgs/Time.h"
                           ^
compilation terminated.
Error compiling for board Teensy 4.1.

It seems that the tutorial for changing the rosserial serial port no longer works. I am using a slightly modified version of the library by James Bruton, to make it compatible with the teensy 4.1, but he showed me the files that he changed, which were small changes like increasing the buffer for sending messages. Thanks for your help!

nbaddorf gravatar image nbaddorf  ( 2021-01-01 08:55:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-01-01 09:43:44 -0500

duck-development gravatar image

you may use the solution in this question

https://answers.ros.org/question/198247/how-to-change-the-serial-port-in-the-rosserial-lib-for-the-arduino-side/
edit flag offensive delete link more

Comments

I did look at the question, and I wasn't sure about implementing the answer. I do not want to change the serial port for all sketches, only one, so that leads me to the answer to that question, but I was not sure how to implement that.

nbaddorf gravatar image nbaddorf  ( 2021-01-01 14:32:24 -0500 )edit

Question Tools

Stats

Asked: 2020-12-31 08:37:22 -0500

Seen: 523 times

Last updated: Jan 01 '21