Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Custom controller dies when launched in global launch file

I have a custom robot consisting of different nodelets and controllers which are organized in sub-packages:

.
├── project
│   ├── launch
├── project_description
│   └── urdf
├── project_hardware
│   ├── config
│   ├── launch
├── project_logic
│   ├── launch
├── project_networking
└── project_vision

I implemented a custom LedController to control some Leds on my hardware following the usual ROS approach (i.e. custom interface, handle, controller, message).

The controller works fine (i.e. setting the Leds to given values via the corresponding topic), when I am launching my hardware.launch which is located in project_hardware:

<launch>
  <arg name="nodelet_manager" default="nodelet_manager" />
  <node name="$(arg nodelet_manager)" pkg="nodelet" type="nodelet" args="manager" />

  <param name="robot_description" command="$(find xacro)/xacro.py '$(find project_description)/urdf/ccs_robot.xacro'" />

  <include file="$(find project_hardware)/launch/hardware.xml">
    <arg name="nodelet_manager" value="$(arg nodelet_manager)" />
  </include>
</launch>

My hardware.xml with the LedController:

<launch>
  <arg name="nodelet_manager" />
  <rosparam file="$(find project_hardware)/config/drive_controller.yaml" />
  <node name="drive_controller_spawner" pkg="controller_manager" type="spawner" args="drive_controller --shutdown-timeout 2" />
  <node name="driver" pkg="nodelet" type="nodelet" args="load project/RobotNodelet $(arg nodelet_manager)" >
    <param name="rate" value="100" />
    <param name="ros_hw_velocity_conversion_factor" value="5.615" />
    <param name="ros_hw_led_max_value" value="64" />
  </node>

  <rosparam file="$(find project_hardware)/config/distance_sensor_controller.yaml" />
  <node name="distance_sensor_controller_spawner" pkg="controller_manager" type="spawner" args="distance_sensor_controller --shutdown-timeout 2" />
  <rosparam file="$(find project_hardware)/config/led_controller.yaml" />
  <node name="led_controller_spawner" pkg="controller_manager" type="spawner" args="led_controller --shutdown-timeout 2" />
</launch>

However, the LedController dies (and also kills the controller_manager which in turn kills all my other controllers), when I am launching everything with my global launch file robot.launch which is located in a different sub-package called project only:

<launch>
  <arg name="nodelet_manager" default="nodelet_manager" />
  <node name="$(arg nodelet_manager)" pkg="nodelet" type="nodelet" args="manager" />

  <param name="robot_description" command="$(find xacro)/xacro.py '$(find project_description)/urdf/ccs_robot.xacro'" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>

  <include file="$(find project_vision)/launch/feature_extraction.xml">
    <arg name="nodelet_manager" value="$(arg nodelet_manager)" />
  </include>
  <include file="$(find project_logic)/launch/demo_app.xml" />
  <include file="$(find project_logic)/launch/logic.xml">
    <arg name="nodelet_manager" value="$(arg nodelet_manager)" />
  </include>
  <include file="$(find project_hardware)/launch/hardware.xml">
    <arg name="nodelet_manager" value="$(arg nodelet_manager)" />
  </include>
  <!--<include file="$(find project_hardware)/launch/led.launch" />-->
  <include file="$(find project_networking)/launch/monitoring.launch" />
</launch>

When I move the Led part from the hardware.xml to a seperate file (led.launch) and launch robot.launch first and then led.launch everything works. When I am including led.launch in robot.launch (see above), it does not work.

My hardware.xml without the LedController:

<launch>
  <arg name="nodelet_manager" />
  <rosparam file="$(find project_hardware)/config/drive_controller.yaml" />
  <node name="drive_controller_spawner" pkg="controller_manager" type="spawner" args="drive_controller --shutdown-timeout 2" />
  <node name="driver" pkg="nodelet" type="nodelet" args="load project/RobotNodelet $(arg nodelet_manager)" >
    <param name="rate" value="100" />
    <param name="ros_hw_led_max_value" value="64" />
  </node>

  <rosparam file="$(find project_hardware)/config/distance_sensor_controller.yaml" />
  <node name="distance_sensor_controller_spawner" pkg="controller_manager" type="spawner" args="distance_sensor_controller --shutdown-timeout 2" />
</launch>

My led.launch containing the Led part moved from the hardware.xml:

<launch>
  <rosparam file="$(find project_hardware)/config/led_controller.yaml" />
  <node name="led_controller_spawner" pkg="controller_manager" type="spawner" args="led_controller --shutdown-timeout 2" />
</launch>

Since the difference between working and not working is only a matter of including led.launch or starting it by hand via roslaunch, I am out of debugging ideas. I would appreciate any little hint pointing me to further debugging and eventually to the solution of my problem. Please let me know, if you need any further information.