Handling topic names for secondary IMU and IMU Filter

Hello everyone, I’m relatively new when it comes to ROS, so bare with me here if this is a pretty basic question.

To summarize my setup, I’m working with a Clearpath Jackal robot that runs ROS Indigo on Ubuntu 14.05 LTS. On board, the robot has a GPS and IMU unit, and starts up its own ROS components for these sensors as well as a controller node for a bluetooth PS3 controller.

The above works great, but the hurdle I’m running into is when I try to integrate our own IMU unit into the mix, which is a PhidgetSpatial Precision 3/3/3, I believe.

I have a launch file for our IMU that runs a few nodes, and is pretty much the same as this example here: phidgets_drivers/phidgets_imu/launch/imu.launch at kinetic · ros-drivers/phidgets_drivers · GitHub

The problem I’m running into is getting the IMU filter to subscribe to the Phidget IMU topics. The IMU filter is looking for /imu/data_raw and /imu/mag topics to subscribe to, which are published by the IMU itself. For my case, these two topics are already being published by the default IMU on the Jackal. I’d like to be able to run our Phidget IMU launch file alongside the Jackal’s nodes and topics.

I’ve tried giving the nodes in the Phidget IMU launch file their own namespace, but the IMU filter node never subscribes to the Phidget IMU node’s topics.


Here is some additional info to make this a little easier to see what’s going on:


The Jackal’s topics at startup:

/bluetooth_teleop/joy
/cmd_drive
/cmd_vel
/diagnostics
/diagnostics_agg
/diagnostics_toplevel_state
/feedback
/imu/data
/imu/data_raw
/imu/mag
/imu/magnetic_field
/imu_filter/parameter_descriptions
/imu_filter/parameter_updates
/jackal_velocity_controller/cmd_vel
/jackal_velocity_controller/odom
/joint_states
/navsat/fix
/navsat/nmea_sentence
/navsat/time_reference
/navsat/vel
/odometry/filtered
/rosout
/rosout_agg
/set_pose
/status
/tf
/tf_static
/twist_marker_server/feedback
/twist_marker_server/update
/twist_marker_server/update_full
/wifi_connected


Goal:
Have Phidget IMU node publish /phidget/imu/data_raw and /phidget/imu/mag, which the IMU filter subscribes to instead of /imu/data_raw and /imu/mag.


Any help would be greatly appreciated, and I can provide any additional details if needed. It’s probably something pretty simple to someone more versed in ROS. I’ve tried using ‘ns’ for handling the IMU nodes with a different namespace, and messed around some with ‘remap’, but haven’t had any luck.


thanks!



Nick

Hi, @popenc, welcome to ROS! :smile:

Maintainer of phidgets_drivers here. There are many ways of doing this. From the command line:

ROS_NAMESPACE=phidget roslaunch phidgets_imu imu_single_nodes.launch

Inside another launch file:

    <include file="$(find phidgets_imu)/launch/imu.launch" ns="phidget" />

… or by copying and then editing the launch file directly, and adding remappings to the nodes/nodelets, like this:

  <node pkg="nodelet" type="nodelet" name="PhidgetsImuNodelet" 
    args="load phidgets_imu/PhidgetsImuNodelet imu_manager" 
    output="screen">

    <remap from="imu/data_raw" to="phidget/imu/data_raw" />
    ... and so on ...
  </node>


  <node pkg="nodelet" type="nodelet" name="ImuFilterNodelet" 
    args="load imu_filter_madgwick/ImuFilterNodelet imu_manager" 
    output="screen">

    <remap from="imu/data_raw" to="phidget/imu/data_raw" />
    ... and so on ...
  </node>

When using remappings, remember that you have to remap both the publisher and subscriber, and that “from” and “to” don’t mean the direction of the data flow, but “from” the old name “to” the new name.

Also, I’d recommend using imu_single_nodes.launch from the same directory. With nodelets, it can be harder to see what’s going on using tools like rostopic, rosnode or rqt_graph.

P.S.: It’s preferred to ask questions like these (i.e., which have a clear “right” answer) on http://answers.ros.org/ and keep discourse.ros.org for other kinds of discussions (open-ended discussions, project announcements and so on).

1 Like

Thanks for all the info, @Martin_Guenther!

I see what you’re saying about posting location. I’ll make sure to post something like this over at answers next time. I’ll try what you mentioned here and provide the outcome.

thanks again!

Nick

The 2nd suggestion @Martin_Guenther provided, which included the IMU launch file with a namespace worked for me! Thanks a lot for the help, and next time I’ll make sure to post something like this over at answers.ros.org.

:+1::+1: