This code was based on the official Xsens 2023 Open source Xsens Device API tested on MTi-680G/MTi-8 with ROS2 Humble at Ubuntu 22.04.3 LTS .
Note that this branch contains the ROS2
implementation that is compatible for Humble
and Jazzy
.
If you are looking for the ROS1
version, you should go to the main
branch.
And if you are looking for the ROS2 Foxy
version, you should go to the ros2-foxy
branch.
git clone --recursive --branch ros2 https://github.com/xsenssupport/Xsens_MTi_ROS_Driver_and_Ntrip_Client.git
Note: the UTC Time, SampleTimeFine, Status Word, Latitude and Longitude needs to be enabled, in order to get GPGGA data for topic /nmea
: MT Manager - Device Settings - Output Configuration , select "UTC Time, Sample TimeFine, Status Word, Latitude and Longitude" and other required data, click "Apply"
Here are the recommended Output Configurations and Device Settings:
-
Fix the fix_type of the
/nmea
GPGGA topic to align with NMEA standards. -
Add:
- +Sensor ouput configurations;
- +Sensor Filter Settings;
- +Setting baudrate;
- +Setting GNSS Lever Arm for MTi-8/MTi-680(G)
- +Setting u-Blox GNSS Platform
- +Option Flags Settings(AHS,In-Run Compass, Beidou, OrientationSmoother, PositionVelocitySmoother, ContinousZRU);
- +Manual Gyro Bias Estimation Periodically
- +Add
filter/euler
and high rate topics forimu/acceleration_hr
,imu/angular_velocity_hr
- +Add error messages.
-
change:
lib/xspublic/xscontroller/iointerface.h
, line 138, change toPO_OneStopBIt
for PO_XsensDefaults.lib/xspublic/xscommon/threading.cpp
, updated to work with glibc 2.35.
The Ntrip_client subscribes to the /nmea
rostopic from xsens_mti_ros2_driver
, and wait until it gets data for maximum 300 sec, it will send GPGGA to the Ntrip Caster(Server) every 1 second.
User needs to change the ntrip_launch.py
for their own credentials/servers/mountpoint.
install dependency:
sudo apt install ros-[ROSDISTRIBUTION]-nmea-msgs
sudo apt install ros-[ROSDISTRIBUTION]-mavros-msgs
for example for ROS2 Humble:
sudo apt install ros-humble-nmea-msgs
sudo apt install ros-humble-mavros-msgs
change the NTRIP credentials/servers/mountpoint in src/ntrip/launch/ntrip_launch.py
to your own one.
copy the src
folder to your ros2_ws
folder, and run the code below:
cd ~/ros2_ws
colcon build
Source the install/setup.bash
file inside your ROS2 workspace
source install/setup.bash
or
add it into rules:
sudo nano ~/.bashrc
At the end of the file, add the following line:
source /home/[USER_NAME]/ros2_ws/install/setup.bash
save the file, exit.
Note: If you don't add this source line to your ~/.bashrc
, then every time you open a new terminal, you will have to firstly do source install/setup.bash
, otherwise you couldn't read the /status
topic data.
open first terminal:
ros2 launch xsens_mti_ros2_driver xsens_mti_node.launch.py
or with the 3D display rviz:
ros2 launch xsens_mti_ros2_driver display.launch.py
and then open another terminal
ros2 launch ntrip ntrip_launch.py
you could check ros2 topic echo /rtcm
, there should be HEX RTCM data coming,
or ros2 topic echo /status
to check the RTK Fix type, it should be 1(RTK Floating) or 2(RTK Fix).
topic | Message Type | Message Contents | Data Output Rate (Depending on Model and OutputConfigurations at MT Manager) |
---|---|---|---|
filter/free_acceleration | geometry_msgs/Vector3Stamped | free acceleration from filter, which is the acceleration in the local earth coordinate system (L) from which the local gravity is deducted |
1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
filter/positionlla | geometry_msgs/Vector3Stamped | filtered position output in latitude (x), longitude (y) and altitude (z) as Vector3, in WGS84 datum | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
filter/quaternion | geometry_msgs/QuaternionStamped | quaternion from filter | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
filter/euler | geometry_msgs/Vector3Stamped | euler(roll,pitch,yaw) from filter | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
filter/twist | geometry_msgs/TwistStamped | filtered velocity and calibrated angular velocity | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
filter/velocity | geometry_msgs/Vector3Stamped | filtered velocity output as Vector3 | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
gnss | sensor_msgs/NavSatFix | raw 4 Hz latitude, longitude, altitude and status data from GNSS receiver | 4Hz |
gnss_pose | geometry_msgs/PoseStamped | filtered position output in latitude (x), longitude (y) and altitude (z) as Vector3 in WGS84 datum, and quaternion from filter | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
imu/acceleration | geometry_msgs/Vector3Stamped | calibrated acceleration | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
imu/angular_velocity | geometry_msgs/Vector3Stamped | calibrated angular velocity | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
imu/data | sensor_msgs/Imu | quaternion, calibrated angular velocity and acceleration | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
imu/dq | geometry_msgs/QuaternionStamped | integrated angular velocity from sensor (in quaternion representation) | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
imu/dv | geometry_msgs/Vector3Stamped | integrated acceleration from sensor | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
imu/mag | sensor_msgs/MagneticField | calibrated magnetic field | 1-100Hz |
imu/time_ref | sensor_msgs/TimeReference | SampleTimeFine timestamp from device | depending on packet |
imu/utctime | sensor_msgs/TimeReference | UTC Time from the device | depending on packet |
nmea | nmea_msgs/Sentence | 4Hz GPGGA data from GNSS receiver PVTData(if available) and StatusWord | 4Hz |
pressure | sensor_msgs/FluidPressure | barometric pressure from device | 1-100Hz |
status | xsens_mti_driver/XsStatusWord | statusWord, 32bit | depending on packet |
temperature | sensor_msgs/Temperature | temperature from device | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
tf | geometry_msgs/TransformStamped | transformed orientation | 1-400Hz(MTi-600 and MTi-100 series), 1-100Hz(MTi-1 series) |
imu/acceleration_hr | geometry_msgs/Vector3Stamped | high rate acceleration | see xsens_mti_node.yaml |
imu/angular_velocity_hr | geometry_msgs/Vector3Stamped | high rate angular velocity | see xsens_mti_node.yaml |
Please refer to MTi Family Reference Manual for detailed definition of data.
- Refer to the README.txt
- nVidia Jetson devices, ref to Interfacing MTi devices with the NVIDIA Jetson
- Docs, ref code: All MTi Related Documentation Links
- Regarding Parameters: If you have previously run
colcon build
and then changed the credentials in ntrip or YAML parameters, you will need to runcolcon build
again after making those changes. Otherwise, it won't work for ROS 2. - For technical support, and if it is no relevant to the code here, please send your questions to [email protected]