Skip to content

DaischSensor/im1r_ros1_driver

Repository files navigation

DAISCH Banner

IM1R_ROS_Driver

GitHub issues GitHub pr GitHub GitHub release (with filter) GitHub Repo stars

English · 简体中文 · Global Official Site · 中文官网


Table of Contents

Project Description

The project aims to develop and maintain ROS drivers suitable for IM1R-FB-U, a compact 6-axis inertial measurement module designed by DAISCH.

Getting Started

System Requirements

  • Ubuntu 18.04 / ROS Melodic
  • Ubuntu 20.04 / ROS Noetic

Installation Setups

  1. Install ROS: Please refer to the ROS installation guide for detailed instructions.

  2. Install Dependencies:

    Run the following commands to install dependencies based on your system's Python version:

    • For Ubuntu 18.04 / Python 2:

      sudo apt update
      sudo apt install python-pip
      pip install pyserial
    • For Ubuntu 20.04 / Python 3:

      sudo apt update
      sudo apt install python3-pip
      pip3 install pyserial
  3. Create catkin workspace:

    mkdir -p ~/catkin_ws/src
  4. Clone the project repository to the src directory of your catkin workspace:

    cd ~/catkin_ws/src
    git clone https://github.com/DAISCHSensor/IM1R_ROS_Driver.git
    • For Ubuntu 20.04 / Python 3, switch to the appropriate branch:
      cd IM1R_ROS_Driver
      git checkout ubuntu20.04-support
  5. Build the driver:

    cd ~/catkin_ws/
    catkin_make
  6. Update the .bashrc file:

    echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
    source ~/.bashrc

Usage Instructions

  1. Connect IM1R via UART1 data cable.

  2. Start the ROS master:

    roscore
  3. Identify the serial port for the IM1R device:

    dmesg | grep tty
  4. Set the serial port permissions: Assuming the IM1R device is connected to /dev/ttyUSB0:

    sudo chmod 666 /dev/ttyUSB0
  5. Launch the driver node:

    rosrun im1r_ros_driver daisch_im1r_node.py /dev/ttyUSB0 115200
    • /dev/ttyUSB0 is the serial port.
    • 115200 is the baud rate used by IM1R, adjust it as needed.
  6. List all the topic:

    rostopic list
  7. echo the specific topic:

    rostopic echo imu/data
  8. (Example Program) Subscribe to a topic:

    rosrun im1r_ros_driver subscriber_example.py

Published Topics

Parameters Introductions

Standard Topic

imu/data

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

temperature

Variable Supported
time header.stamp ✔️
string header.frame_id ✔️
float64 temperature ✔️
float64 variance

Custom Topic

im1r/extra

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)

IM1R Configuration Tool

Starting the Tool

  1. Connect IM1R via UART2 debug cable.

  2. Start the ROS core service:

    roscore
  3. Identify the serial port of the IM1R device:

    dmesg | grep tty
  4. Set serial port permissions: Assuming the IM1R device is connected to /dev/ttyUSB0:

    sudo chmod 666 /dev/ttyUSB0
  5. Start the configuration tool:

    rosrun im1r_ros_driver daisch_im1r_config.py /dev/ttyUSB0
    • Ensure the serial port connected to IM1R is set to port 2, with a fixed baud rate of 115200.
  6. After a successful start, the main interface will display the following content:

    DAISCH_IM1R_Config_MainWindow

  7. If the serial port connection fails, you will see the information in the image below. Please check if the device is correctly connected and reconfigure the serial port permissions.

    DAISCH_IM1R_Config_ConnectFail

Changing Configuration Items

Here are the steps to change the output frequency as an example:

  1. Enter 2 in the main interface and press Enter to enter the submenu:

    DAISCH_IM1R_Config_Frequency

  2. Select the desired output frequency from the submenu. After the configuration is successful, the tool will automatically return to the main menu. For example, after setting the output frequency to 50Hz, you can see the setting has been successfully changed in the main menu:

    DAISCH_IM1R_Config_Result

Notes

  • The output frequency should match the baud rate. Mismatched baud rates and output frequencies can result in erroneous messages being received.

    Baud Rate Maximum Output Frequency
    115200 100Hz
    230400 250Hz
    460800 500Hz
    921600 1000Hz

FAQ

Issue 1: Script Not Found

Symptom: Running rosrun im1r_ros_driver subscriber_example.py results in the following error:

[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

Solution: Grant executable permissions to the script:

chmod +x /home/daisch/catkin_ws/src/im1r_ros_driver/scripts/subscriber_example.py

If you have any other questions or need further assistance, feel free to ask.

Contributing

License

BSD-3-Clause