本项目旨在开发和维护适用于 IM1R-FB-U 的 ROS 驱动程序。IM1R-FB-U 是一款由 DAISCH 设计的紧凑型 6 轴惯性测量模块。
- Ubuntu 18.04 / ROS Melodic
- Ubuntu 20.04 / ROS Noetic
-
安装 ROS: 请参考 ROS 安装指南 获取详细说明。
-
安装依赖项:
运行以下命令安装依赖项:
- 对于Ubuntu 18.04 / Python 2
sudo apt update sudo apt install python-pip pip install pyserial
- 对于Ubuntu 20.04 / Python 3
sudo apt update sudo apt install python3-pip pip3 install pyserial
-
创建 catkin 工作空间:
mkdir -p ~/catkin_ws/src
-
克隆项目仓库到 src 目录:
cd ~/catkin_ws/src git clone https://github.com/DAISCHSensor/IM1R_ROS_Driver.git
-
对于Ubuntu 20.04 / Python 3, 需要切换到适配的分支
cd IM1R_ROS_Driver git checkout ubuntu20.04-support
-
-
构建工作空间:
cd ~/catkin_ws/ catkin_make
-
添加工作空间的环境变量到
.bashrc
:echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc
-
通过UART1数据线束连接IM1R
-
启动 ROS 核心服务:
roscore
-
识别 IM1R 设备的串口:
dmesg | grep tty
-
设置串口权限: 假设 IM1R 设备连接到 /dev/ttyUSB0:
sudo chmod 666 /dev/ttyUSB0
-
启动驱动节点:
rosrun im1r_ros_driver daisch_im1r_node.py /dev/ttyUSB0 115200
/dev/ttyUSB0
是当前IM1R连接的串口115200
是当前IM1R使用的波特率
-
列出所有话题:
rostopic list
-
输出指定话题的内容:
rostopic echo imu/data
-
(示例程序)订阅话题:
rosrun im1r_ros_driver subscriber_example.py
imu/data
(sensor_msgs/Imu) 四元数、角速度和线性加速度temperature
(sensor_msgs/Temperature) 来自设备的温度im1r/extra
(DAISCH 自定义话题) 来自 IM1R 的额外参数
Variable | Supported |
---|---|
time header.stamp |
✔️ |
string header.frame_id |
✔️ |
float64 orientation.x |
✔️ |
float64 orientation.y |
✔️ |
float64 orientation.z |
✔️ |
float64 orientation.w |
✔️ |
float64[9] orientation_covariance |
✘ |
float64 angular_velocity.x |
✔️ |
float64 angular_velocity.y |
✔️ |
float64 angular_velocity.z |
✔️ |
float64[9] angular_velocity_covariance |
✘ |
float64 linear_acceleration.x |
✔️ |
float64 linear_acceleration.y |
✔️ |
float64 linear_acceleration.z |
✔️ |
float64[9] linear_acceleration_covariance |
✘ |
Variable | Supported |
---|---|
time header.stamp |
✔️ |
string header.frame_id |
✔️ |
float64 temperature |
✔️ |
float64 variance |
✘ |
Variable | Type | Definition | Unit | Remarks |
---|---|---|---|---|
count |
uint8 | Message counter | - | 0~255 cyclic increment |
timestamp |
uint64 | Timestamp of the measurement | microseconds (µs) | UNIX time |
pitch |
float64 | Pitch angle | degrees (°) | |
roll |
float64 | Roll angle | degrees (°) | |
yaw |
float64 | Yaw angle | degrees (°) | |
imu_status |
uint8 | IMU status indicator | - | Bit 0: Acceleration valid (0) / invalid (1) Bit 2: Angular velocity valid (0) / invalid (1) Higher bits are not defined |
gyro_bias_x |
float64 | Gyroscope bias along the X axis | radians/second (rad/s) | |
gyro_bias_y |
float64 | Gyroscope bias along the Y axis | radians/second (rad/s) | |
gyro_bias_z |
float64 | Gyroscope bias along the Z axis | radians/second (rad/s) | |
gyro_static_bias_x |
float64 | Static gyroscope bias along the X axis | radians/second (rad/s) | |
gyro_static_bias_y |
float64 | Static gyroscope bias along the Y axis | radians/second (rad/s) | |
gyro_static_bias_z |
float64 | Static gyroscope bias along the Z axis | radians/second (rad/s) |
-
通过UART2调试线束连接IM1R
-
启动 ROS 核心服务:
roscore
-
识别 IM1R 设备的串口:
dmesg | grep tty
-
设置串口权限: 假设 IM1R 设备连接到 /dev/ttyUSB0:
sudo chmod 666 /dev/ttyUSB0
-
启动配置工具:
rosrun im1r_ros_driver daisch_im1r_config.py /dev/ttyUSB0
/dev/ttyUSB0
是当前IM1R连接的串口
-
启动成功后,主界面会显示以下内容:
-
如果串口连接失败,你会看到下图中的信息,请检查设备是否连接正确,并重新设置串口权限。
以下是以更改输出频率为例的步骤:
-
输出频率应与波特率匹配,设置不匹配的波特率和输出频率会导致接收到错误的报文。
波特率 最大输出频率 115200 100Hz 230400 250Hz 460800 500Hz 921600 1000Hz
症状:运行 rosrun im1r_ros_driver subscriber_example.py
时出现以下错误:
[rosrun] Couldn't find executable named subscriber_example.py below /home/daisch/catkin_ws/src/im1r_ros_driver
[rosrun] Found the following, but they're either not files,
[rosrun] or not executable:
[rosrun] /home/daisch/catkin_ws/src/im1r_ros_driver/scripts/subscriber_example.py
解决方案:授予脚本可执行权限:
chmod +x /home/daisch/catkin_ws/src/im1r_ros_driver/scripts/subscriber_example.py
如果您有任何其他问题或需要进一步的帮助,请随时提出。