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

Use catkin build/catkin-tools with rosserial arduino sketches

asked 2022-09-03 06:08:08 -0500

arpaterson gravatar image

updated 2022-09-03 06:08:34 -0500

(noetic on ubuntu20.04/Jetpack5.0.2 on a Jetson AGX Orin)

I'm currently using rosserial_arduino and building with catkin_make, with some custom messages. It works (although a little finicky with generating the custom messages, and I'm not exactly sure why). I can compile and upload to a pair of arduino micros using `catkin_make <pkg>_<sketch>_<target>-upload.

The rest of the project should be moving over to use python3-catkin-tools. I have no idea how to use catkin build with rosserial_arduino, and I am a complete newbie when it comes to CMake if thats even the right place to look to make changes.

If anyone knows something about this, please let me know.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-11-09 04:55:01 -0500

Maxim Rovbo gravatar image

You can try generating custom headers for arduino and compiling&uploading the arduino code separately. These packages should probably be installed for that (maybe some are optional):

sudo apt install ros-noetic-rosserial-arduino ros-noetic-rosserial-python ros-noetic-rosserial-client ros-noetic-rosserial

Build the headers for arduino:

# make sure that all messages have been built in the workspace
catkin build
source setup.bash

# cd ~/<sketchbook>/libraries
cd ~/Arduino/libraries

# remove old versions of the compiled headers (including installed from GUI)
# or back them up just in case (but make sure they are not under the ~/<sketchbook>/libraries)
rm -rf ros_lib
rm -rf Rosserial_Arduino_Library

# compile common ros headers
rosrun rosserial_arduino .

# compile custom headers
rosrun rosserial_client make_libraries .

After his you should have a ~/<sketchbook>/libraries/ros_lib directory with ros.h header, some other common headers and directories, as well as directories with your custom message headers.

Compiling and uploading code to the arduino can then be done either via the Arduino IDE or using arduino-cli.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-09-03 06:08:08 -0500

Seen: 242 times

Last updated: Nov 09 '22