LPMS-CU2 是一种小型惯性测量单元(IMU)/姿态航向参考系统(AHRS)。在ROS中使用此款IMU时,需要进行相关的安装和配置, 具体可以参考https://bitbucket.org/lpresearch/openzenros/src/master/。
catkin_make -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
2)使用USB接口时,需要用户有访问/dev/ttyUSB 设备的权限,把用户加到dialout组就可以:
sudo adduser
mkdir -p catskin_ws/src
cd catskin_ws/src
git clone --recurse-submodules https://bitbucket.org/lpresearch/openzenros.git
# get your ROS environment going
source /opt/ros/melodic/setup.bash
cd ..
catkin_make
source ./devel/setup.bash
参见https://lpresearch.bitbucket.io/openzen/latest/ros.html#ros-api
简单的,可以使用如下命令启动:
rosrun openzen_sensor openzen_sensor_node _sensor_name:="LPMSCU2000573"
如何确定_sensor_name呢?
在电脑上插入IMU的USB口后,运行命令dmesg,可以看到如下输出:
[ 1994.060806] usb 1-2.3: new full-speed USB device number 7 using tegra-xusb
[ 1994.112317] usb 1-2.3: New USB device found, idVendor=10c4, idProduct=ea61
[ 1994.112330] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1994.112337] usb 1-2.3: Product: CP2102 USB to UART Bridge Controller
[ 1994.112343] usb 1-2.3: Manufacturer: Silicon Labs
[ 1994.112348] usb 1-2.3: SerialNumber: LPMSCU2001018
[ 1994.121625] cp210x 1-2.3:1.0: cp210x converter detected
[ 1994.123370] usb 1-2.3: cp210x converter now attached to ttyUSB2
其中的SerialNumber: LPMSCU2001018就是sensor name。
~sensor_name (string, default: null)
By default, the library will connect to the first available sensor. If you want to connect to a specific sensor, you can use the serial name of the sensor as sensor_name parameter as follow:
$ rosrun openzen_sensor openzen_sensor_node _sensor_name:=”LPMSCU2000573”
~sensor_interface (string, default: LinuxDevice)
Name of IO system for initiating sensor connection. Use “LinuxDevice” for usb connection in Linux. For more details, please check the documentation in the section IO Systems.
~baudrate (integer, default: 0)
Baudrate in bits per seconds used to connect to the sensor. If the baudrate is left at 0, OpenZen will automatically pick the default baudrate for the respective sensor model.
~frame_id (string, default: imu)
The frame in which imu readings will be returned
/imu/data (sensor_msgs/Imu)
Inertial data from the IMU. Includes calibrated acceleration, calibrated angular rates and orientation. The orientation is always unit quaternion.
/imu/mag (sensor_msgs/MagneticField)
Magnetometer reading from the sensor.
/imu/is_autocalibration_active (std_msgs/Bool)
Latched topic indicating if the gyro autocalibration feature is active
创建文件:openzen_cu2.launch
因为openzen默认发布的topic为/imu/data, 我们需要的是/imu, 所以这里使用remap将topic的名字做一个映射。
Linux下,"sensor_interface"的值为"LinuxDevice"