ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
508 stars 527 forks source link

Custom messages require catkin build to be run twice - ros_lib does not exist. #601

Open arpaterson opened 1 year ago

arpaterson commented 1 year ago

I am using rosserial, and rosserial_arduino with custom messages.

Within the ros project I only use rosserial_arduino to build a helloworld arduino sketch (the chatter example), and include custom message types. I then grab ros_lib and take it over to a platformio project, because the arduino ide installed by apt is very old (~1.0), and I need to use a more powerful board than an AVR anyway. Currently I am using a ATSAMD51 Feather M4 Express board, and have successfully connected it to rosserial and published/subscribed to topics.

Anyway, that works - I can even upload the example to an arduino micro, all within the ros project. This is quite neat, one command to build the ros workspace including the arduino sketch, one further command to upload, but the 32u4 just ran out of memory (I think I can strip some unused stuff from ros_lib?).

The issue is that the first build always fails with the following error ros_lib does not exist, and then the second build succeeds. I am using catkin build.

Finished  <<< vehicle_msgs                    [ 0.6 seconds ]                                                                                                                                                              
Starting  >>> arduino_examples                                                                                                                                                                                             
___________________________________________________________________________________________________________________________________________________________________________________________________________________________
Errors     << arduino_examples:check /home/sacvp-user/git/scaled-acv/sacvp/on-the-device/ros/logs/arduino_examples/build.check.014.log                                                                                     
CMake Error at /home/sacvp-user/git/scaled-acv/sacvp/on-the-device/ros/src/vehicle_base/arduino_examples/CMakeLists.txt:35 (add_dependencies):
  The dependency target "vehicle_msgs_generate_messages" of target
  "arduino_examples_ros_lib" does not exist.

CMake Generate step failed.  Build files cannot be regenerated correctly.
make: *** [Makefile:908: cmake_check_build_system] Error 1
cd /home/sacvp-user/git/scaled-acv/sacvp/on-the-device/ros/build/arduino_examples; catkin build --get-env arduino_examples | catkin env -si  /usr/bin/make cmake_check_build_system; cd -

...........................................................................................................................................................................................................................
Failed     << arduino_examples:check          [ Exited with code 2 ]                                                                                                                                                       
Failed    <<< arduino_examples                [ 1.3 seconds ]                                                                                                                                                              
[build] Summary: 1 of 2 packages succeeded.                                                                                                                                                                                
[build]   Ignored:   19 packages were skipped or are skiplisted.                                                                                                                                                           
[build]   Warnings:  None.                                                                                                                                                                                                 
[build]   Abandoned: None.                                                                                                                                                                                                 
[build]   Failed:    1 packages failed.                                                                                                                                                                                    
[build] Runtime: 2.0 seconds total.   

Then immediately afterwards, the second build succeeds.

[build] Found 21 packages in 0.0 seconds.                                                                                                                                                                                  
[build] Package table is up to date.                                                                                                                                                                                       
Starting  >>> vehicle_msgs                                                                                                                                                                                                 
Finished  <<< vehicle_msgs                    [ 0.5 seconds ]                                                                                                                                                              
Starting  >>> arduino_examples                                                                                                                                                                                             
___________________________________________________________________________________________________________________________________________________________________________________________________________________________
Warnings   << arduino_examples:make /home/sacvp-user/git/scaled-acv/sacvp/on-the-device/ros/logs/arduino_examples/build.make.009.log                                                                                       
make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
cd /home/sacvp-user/git/scaled-acv/sacvp/on-the-device/ros/build/arduino_examples; catkin build --get-env arduino_examples | catkin env -si  /usr/bin/make --jobserver-auth=3,4; cd -

...........................................................................................................................................................................................................................
Finished  <<< arduino_examples                [ 0.6 seconds ]                                                                                                                                                              
[build] Summary: All 2 packages succeeded!                                                                                                                                                                                 
[build]   Ignored:   19 packages were skipped or are skiplisted.                                                                                                                                                           
[build]   Warnings:  1 packages succeeded with warnings.                                                                                                                                                                   
[build]   Abandoned: None.                                                                                                                                                                                                 
[build]   Failed:    None.                                                                                                                                                                                                 
[build] Runtime: 1.2 seconds total.  

Any help appreciated. The tutorials I found seem to be light and out of date and I am no CMake expert.