参考文献:
https://blog.csdn.net/i_robots/article/details/107193385
https://zhuanlan.zhihu.com/p/385671094
更新时间:2021-11-23
前提:已经安装好ROS Melodic并且下载了MT Software Suite
MT Software Suite下载地址:https://content.xsens.com/mt-software-suite-download
运行:
sudo ./mtsdk_linux-x64_2021.4.sh
结果:
安装sharutils:
运行:
sudo apt-get update -y
sudo apt-get install -y sharutils
重新运行:
sudo ./mtsdk_linux-x64_2021.4.sh
结果:
文件浏览器中可以看到:
安装完成后将xsens_mti_driver文件夹移动到catkinworkspace src文件夹中(这个文件夹看你自己的工作空间定义,我的在~/catkin_ws/src/下)。
运行:
cd /usr/local/xsens
cp -r xsens_ros_mti_driver/~/catkin_ws/src/
需要进行修改文件夹权限,应该也可以不修改,给others用户组添加权限rw
sudo chmod -R o+rwxsens_ros_mti_driver/
确定成功之后可以进行make命令,这里使用了目录栈指令,把目录换成自己的工作空间就可以了,我的是~/catkin_ws/src/xsens_ros_mti_driver/lib/xspublic。
也可以自己手动cd然后make,查看当前目录栈可以使用dirs -v命令。
popd就是目录出栈,pushd就是目录入栈,当前目录==栈顶目录。
————————————————————————————————————————————————
Cd回到根目录,然后cd进入 ~/catkin_ws
运行:
cd ~/catkin_ws
pushdsrc/xsens_ros_mti_driver/lib/xspublic && make && popd
构建驱动包,在自己的ROS工作空间使用命令
catkin_make
然后在新的窗口启动roscore
Roscore
注意进行launch节点时需要在工作空间目录进行source
$ cd ~/catkin_ws/
$ source ./devel/setup.bash
可以运行两个launch文件,一个用于rviz显示,一个用于MTI系列产品发送消息
roslaunch xsens_mti_driverxsens_mti_node.launch
roslaunch xsens_mti_driverdisplay.launch
结果:
根据说明文档,此问题出现的原因可能是用户不在dialout组中,需要添加到组,并且重启设备:
运行:
ls -l /dev/ttyUSB0
groups
sudo usermod -G dialout -a $USER
newgrp dialout
重启虚拟机
重新输入
$ cd ~/catkin_ws/
$ source ./devel/setup.bash
然后:
roslaunch xsens_mti_driverxsens_mti_node.launch
如果没有数据出现,请再次确认你在MTManager的传感器配置中将Orientation栏设为了Quaternion:
设置方法:
在MTManager中:
点击左上角:device settings
然后在outputconfiguration选项卡,Orientation(姿态)选择Quaternion(四元数),点击“Apply"应用,然后关闭MTManager, 重新启动ROS
附件:
以下文件为xsens_ros_mti_driver文件夹下面的 READ.me文件:
=============== [ Xsens MTi driver for ROS]===========================================
文档:
You can find the fulldocumentation in "/doc/xsensdeviceapi/doc/html/index.html"under "ROS MTi driver" section.
您可以在“ROS MTi驱动程序”部分下的“<您的MT SDK目录>/doc/xsensdeviceapi/doc/html/index.html”中找到完整文档。
Prerequisites先决条件::
- ROS Kinetic orMelodic
- C/C++ Compiler:GCC 5.4.0 or MSVC 14.0
- C++11
Building:
- Copy xsens_ros_mti_driverfolder from your MT SDK directory into your catkin workspace 'src' folder.
将xsens_ros_mti_driver文件夹从您的MT SDK目录复制到您的catkin工作区“src”文件夹中。
Make sure thepermissions are set to o+rw on your files and directories.
确保您的文件和目录的权限设置为o+rw。
- Build xspublic from your catkinworkspace:
从您的catkin工作区构建xspublic:
$ pushdsrc/xsens_ros_mti_driver/lib/xspublic && make && popd
- Build Xsens MTi driver package:
构建Xsens MTi驱动程序包:
$ catkin_make
- Source workspace:
源工作区:
$ sourcedevel/setup.bash
Running:
- Configure your MTi device tooutput desired data (e.g. for display example -orientationoutput)
配置您的MTi设备以输出所需的数据(例如,显示示例 –姿态输出)
- Launch the Xsens MTi driverfrom your catkin workspace:
从您的catkin工作区启动Xsens MTi驱动程序:
$roslaunch xsens_mti_driver xsens_mti_node.launch
After thedevice has been detected, you can communicate with it from another process /terminal window.
检测到设备后,您可以从另一个进程/终端窗口与其通信。
For example:
$ rostopicecho /filter/quaternion
This willresult in a continuous stream of data output:
这将产生连续的数据输出流:
---
header:
seq:1386351
stamp:
secs:1545223809
nsecs:197252179
frame_id: "imu_link"
quaternion:
x:0.00276306713931
y:0.00036825647112
z:-0.89693570137
w:-0.442152231932
---
- There is also an example thatshows a 3D visualization of the device (orientation
datashould be enabled in the device):
还有一个示例显示了设备的3D可视化(应在设备中启用姿态数据):
$roslaunch xsens_mti_driver display.launch
Notes:
- ROS timestamps
The data messages from devices are time stamped on arrivalin the ROS driver.
来自设备的数据消息在到达ROS驱动程序时带有时间戳。
When collecting data at higher rates, eg 100 Hz, the timesbetween reads can differ from the configured output rate in the device.
当以更高的速率(例如100 Hz)收集数据时,读取之间的时间可能与设备中配置的输出速率不同。
This is caused by possible buffering in the USB/FTDI driver.
这是由USB/FTDI驱动程序中可能存在的缓冲引起的。
For instance:
10 us, 10 us,10 us, 45 ms, 10 us, 10 us, 10 us, 39 ms, 10 us, etc.
instead of
10 ms, 10 ms,10 ms, 10 ms, 10 ms, 10 ms, 10 ms, 10 ms, 10 ms, etc.
Work-around:for accurate and stable time stamp information, users can make use of thesensor reported time stamp (/imu/time_ref) instead.
解决方法:为了获得准确和稳定的时间戳信息,用户可以改用传感器报告的时间戳(/imu/time_ref)。
---------------------------- [ Troubleshooting常见问题]------------------------------------------------------------
问题1:
-The Mti1 (Motion TrackerDevelopment Board) is not recognized.
无法识别Mti1(惯性传感器开发板)。
Support forthe Development Board is present in recent kernels. (Since June 12, 2015).
If your kerneldoes not support the Board, you can add this manually
最近的内核中提供了对开发板的支持。 (自2015年6月12日起)。
如果你的内核不支持Board,你可以手动添加:
$ sudo/sbin/modprobe ftdi_sio
$ echo 26390300 | sudo tee /sys/bus/usb-serial/drivers/ftdi_sio/new_id
问题2:
- The device is recognized, but Icannot ever access the device –
-该设备已被识别,但我无法访问该设备-
Make sure youare in the correct group (often dialout or uucp) in order to
access thedevice. You can test this with
确保您在正确的组中(通常是dialout或uucp)以便访问设备。 你可以用:
$ ls -l/dev/ttyUSB0
crw-rw----1 root dialout 188, 0 May 6 16:21/dev/ttyUSB0
$ groups
dialoutaudio video usb users plugdev
If you aren'tin the correct group, you can fix this in two ways.
如果您不在正确的组中,可以通过两种方式解决此问题。
1. Addyourself to the correct group将自己添加到正确的组
You canadd yourself to it by using your distributions user management
tool, orcall
您可以使用您的发行版用户管理工具将自己添加到其中,或调用:
$ sudousermod -G dialout -a $USER
Be sure toreplace dialout with the actual group name if it is
different.After adding yourself to the group, either relogin to your
user, orcall
如果实际组名不同,请务必将dialout替换为实际组名。 将自己添加到组后,重新登录到您的用户(或重启设备),或调用:
$newgrp dialout
to add the currentterminal session to the group.
将当前终端会话添加到组中。
2. Use udevrules
使用udev规则
Alternatively, put the following rule into/etc/udev/rules.d/99-custom.rules
或者,将以下规则放入/etc/udev/rules.d/99-custom.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="2639",ACTION=="add", GROUP="$GROUP", MODE="0660"
Change$GROUP into your desired group (e.g. adm, plugdev, or usb).
将$GROUP更改为您想要的组(例如adm、plugdev或usb)。
问题3:
- Thedevice is inaccessible for a while after plugging it in –
插入设备后一段时间无法访问
When having problems with the device being busy the first 20seconds after plugin, purge the modemmanager application.
如果在插入后的前20秒内遇到设备繁忙的问题,请清除modemmanager应用程序。
问题4:
- RViz doesn't show an MTi model.
RViz不显示MTi模型。
It is a knownissue with urdfdom in ROS Melodic. A workaround is to unset/modify theLC_NUMERIC environment variable:
这是ROSMelodic中urdfdom的一个已知问题。 解决方法是取消设置/修改LC_NUMERIC环境变量:
$LC_NUMERIC="en_US.UTF-8"