-
Notifications
You must be signed in to change notification settings - Fork 77
Run instructions
The following command will launch the driver. Keep in mind each instance needs to be run in a separate terminal.
ros2 launch microstrain_inertial_driver microstrain_launch.py
The node has some optional launch parameters that can be specified from the command line in the format param:=value
-
namespace
: namespace that the driver will run in. All services and publishers will be prepended with this, default:/
-
node_name
: name of the driver, default:microstrain_inertial_driver
-
debug
: output debug logs, default:false
-
params_file
: path to a parameter file to override the default parameters stored inparams.yml
, default:empty.yml
Note
The example params.yml
file is formatted to work with ROS and will not work if specified as the params_file argument in ROS2.
If you want to override parameters for ROS2, start with empty.yml
.
- Create the following files somewhere on your system (we will assume they are stored in your home (
~
) directory):-
~/sensor_a_params.yml
with the contents:microstrain_inertial_driver: ros__parameters: port: /dev/ttyACM0
-
~/sensor_b_params.yml
with the contents:microstrain_inertial_driver: ros__parameters: port: /dev/ttyACM1
-
- In two different terminals:
ros2 launch microstrain_inertial_driver microstrain_launch.py node_name:=sensor_a_node namespace:=sensor_a params_file:="$HOME/sensor_a_params.yml"
ros2 launch microstrain_inertial_driver microstrain_launch.py node_name:=sensor_b_node namespace:=sensor_b params_file:="$HOME/sensor_b_params.yml"
This will launch two nodes that publish data to different namespaces:
-
/sensor_a
, connected over port:/dev/ttyACM0
-
/sensor_b
, connected over port:/dev/ttyACM1
This package also provides a lifecycle node implementation. This version of the driver can be launched by running:
ros2 launch microstrain_inertial_driver microstrain_lifecycle_launch.py
This launch file accepts all of the same arguments as the above node as well as:
-
configure
: If set to the exact stringtrue
the driver will automatically transition into the configure state. -
activate
: If set to the exact stringtrue
the driver will automatically transition into the activate state.
Additionally, the node may be transitioned anytime after startup using the following commands (note that the namespace
and name
parameters will affect the node name in the following commands):
-
Transition to configure state:
ros2 lifecycle set /microstrain_inertial_driver_node configure
-
Transition to active state:
ros2 lifecycle set /microstrain_inertial_driver_node activate
You can stop data from streaming by putting the device into the "deactivate" state. Both the "cleanup" and "shutdown" states will disconnect from the device and close the raw data log file (if enabled.)