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

djiglesias's profile - activity

2021-03-23 11:30:06 -0500 received badge  Good Question (source)
2019-05-30 09:01:56 -0500 received badge  Nice Question (source)
2019-05-16 01:27:35 -0500 received badge  Student (source)
2019-04-24 05:14:54 -0500 received badge  Famous Question (source)
2018-11-21 21:54:17 -0500 received badge  Notable Question (source)
2018-11-21 21:54:17 -0500 received badge  Popular Question (source)
2018-07-19 13:26:34 -0500 asked a question Recording tf_static from rosbag api.

Recording tf_static from rosbag api. I am recording data about my robot's motion and trying to play it back offline. Whe

2018-04-17 20:12:49 -0500 marked best answer Set build order in catkin: generate custom messages before generating ros_lib

Quesiton: When using catkin to build a project, how do you set one package to finish compiling before another executes?


Background: I am making a robot with custom messages/services on an Arduino using catkin. The project layout is rather similar to the Clearpath Robotics Husky where the project is separated into packages: msgs, hardware, description, ... etc. Everything works and the Arduino even compiles and uploads though catkin_make commands as outlined by this rosserial_arduino tutorial. The current project layout is as follows:

  • catkin_ws/
    • src/
      • robot_msgs: description of custom ros messages/services (Status.msg & Command.srv)
      • robot_hardware: source code for Arduino (runs rosserial_client & rosserial_arduino)
      • robot_description: robot description files (urdf/xacro)
      • robot_viz: opens RVIZ with robot model

Problem: When building from a fresh install (no build/devel folders in the main catkin workspace), the issue arises when executing catkin_make for the first time. It seems that the robot_hardware package builds and compiles a new ros_lib before robot_msgs can add Status.msg or Command.srv to the project directory (robot_msgs folder is absent in the final ros_lib folder). However, if robot_hardware is temporarily removed while catkin_make is run, then afterwards replaced and catkin_make is run again, everything compiles and robot_msgs now exists in ros_lib. Is there anyway to add a dependency to the CMakeLists.txt file in robot_hardware to force it to go last so that the project compiles using catkin_make without tinkering with the project folders in a such a way?


Supplementary:

robot_hardware/CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(robot_hardware)

find_package(catkin REQUIRED COMPONENTS
  rosserial_arduino
  rosserial_client
  robot_msgs
)

catkin_package()

rosserial_generate_ros_lib(
  PACKAGE rosserial_arduino
  SCRIPT make_libraries.py
)

# Added as a suggestion from @jayess (Sept 15 '17)
add_dependencies(robot_hardware_ros_lib 
    robot_msgs_generate_messages
    robot_msgs_generate_messages_cpp
    robot_msgs_generate_messages_eus
    robot_msgs_generate_messages_lisp
    robot_msgs_generate_messages_nodejs
    robot_msgs_generate_messages_py
)

rosserial_configure_client(
  DIRECTORY firmware
  TOOLCHAIN_FILE ${ROSSERIAL_ARDUINO_TOOLCHAIN}
)

rosserial_add_client_target(firmware robot_base ALL)
rosserial_add_client_target(firmware robot_base-upload)

robot_msgs/CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(robot_msgs)

find_package(catkin REQUIRED COMPONENTS
  message_generation
  std_msgs
)

add_message_files(FILES
  Status.msg
)

add_service_files(FILES
  Command.srv
)

generate_messages(DEPENDENCIES
  std_msgs
)

catkin_package(CATKIN_DEPENDS std_msgs message_runtime)

runtime error on fresh build

...
[86%] Building CXX object CMakeFiles/robot_base.dir/robot_hardware.cpp.obj
/home/user/catkin_ws/src/robot_hardware/firmware/robot_hardware.cpp:52:34: fatal error: robot_msgs/Command.h: No such file or directory
#include <robot_msgs/Command.h>
                               ^
compilation terminated.
...
2018-02-05 06:16:39 -0500 received badge  Famous Question (source)
2017-09-18 12:57:26 -0500 commented answer Set build order in catkin: generate custom messages before generating ros_lib

@kmhallen catkin_make_isolated compiles fine with the robot_msgs building to ros_lib as desired, but removes the abilit

2017-09-17 23:01:09 -0500 received badge  Notable Question (source)
2017-09-15 15:29:33 -0500 received badge  Popular Question (source)
2017-09-15 13:59:57 -0500 received badge  Autobiographer
2017-09-15 13:54:47 -0500 edited question Set build order in catkin: generate custom messages before generating ros_lib

Set build order in catkin: generate custom messages before generating ros_lib Quesiton: When using catkin to build a pro

2017-09-15 13:51:17 -0500 commented answer Set build order in catkin: generate custom messages before generating ros_lib

Great find, slightly embarrassed that I didn't find that sooner. Unfortunately, the solution did not work. I found the t

2017-09-15 12:23:32 -0500 asked a question Set build order in catkin: generate custom messages before generating ros_lib

Set build order in catkin: generate custom messages before generating ros_lib Quesiton: When using catkin to build a pro

2017-09-13 11:30:40 -0500 commented answer Parse error when using a xacro property loaded through a yaml file.

Awesome! Thanks so much. This simplifies the code drastically being able to load in YAML files.

2017-03-01 09:53:22 -0500 received badge  Enthusiast
2017-02-17 10:14:07 -0500 received badge  Supporter (source)