Package Summary
ROS package for Epson IMU based on C++ wrapper of Linux C driver
- Maintainer status: maintained
- Maintainer: Raymond Chow <raymond.chow AT ea.epson DOT com>
- Author:
- License: BSD-3, Public Domain
- Source: git https://github.com/cubicleguy/ess_imu_driver.git (branch: noetic)
Epson IMU ROS1 Driver Node
Contents
Overview
The Epson IMU ROS software is ROS C++ wrapper of a Linux C driver for communicating on a ROS system
- The original Linux C driver can be found below:
- This version of the driver software supports either UART or SPI interface connection to the Epson device
This code assumes that the user is familiar with building ROS packages using the catkin_make process
This is NOT detailed step by step instructions describing how to build and install this ROS2 driver
Refer to the README.md inside the ROS package for more detailed up-to-date info on usage or Github repository
Interface Connections
UART Connection & Configuration
- Direct connection to UART port must be compatible with CMOS 3.3V I/O
Connection is also possible through a USB-UART 3.3V converter IC such as on the M-G32EV041 evaluation board
- GPIO output for asserting RESET# pin on the IMU is optional, but recommended where possible (i.e. embedded platforms)
- Below is an example IMU UART connection when using a Raspberry Pi based system:
Epson IMU
Raspberry Pi
EPSON_SIN Input
RPI_GPIO_P1_8 (GPIO14/UART_TXD) Output
EPSON_SOUT Output
RPI_GPIO_P1_10 (GPIO15/UART_RXD) Input
EPSON_RESET Input
RPI_GPIO_P1_15 (GPIO22) Output *Optional, but recommended*
- When connecting the Epson G552PRx to a ROS2 system using a RS422 UART interface, direct connection to RS422 UART port must be compatible with RS422 I/O signal levels
- Below is an example IMU RS422 connection to a RS422 Host:
Epson IMU
RS422 Host
EPSON_TD+ Output
HOST_RD+ Input
EPSON_TD- Output
HOST_RD- Input
EPSON_RD+ Input
HOST_TD+ Output
EPSON_RD- Input
HOST_TD- Output
SPI Connection & Configuration
- Since SPI interfaces are not standard on PCs, interfacing using SPI to ROS2 is typically applicable only to embedded Linux platforms
- Direct connection to SPI port must be compatible with CMOS 3.3V I/O
Connection between the host & Epson device is possible using the M-G32EV031 evaluation breakout board
This ROS2 driver uses the external library Unofficial wiringPi library to generate low level SPI communication & accurate time delays
- Other libraries can be used to generate timer delays and SPI messages but requires minor changes to redirect the low-level function calls (i.e. similar to bcm2835 C library, etc)
Accurate timing delays are necessary to optimize throughput for high dout_rate when using the SPI interface (refer to IMU datasheets for timing specifications)
- Below is an example IMU SPI connection when using a Raspberry Pi:
Epson IMU
Raspberry Pi
EPSON_RESET Input
RPI_GPIO_P1_15 (GPIO22) Output
EPSON_DRDY Output
RPI_GPIO_P1_18 (GPIO24) Input
EPSON_CS Input
RPI_GPIO_P1_16 (GPIO23) Output
EPSON_SCLK Input
RPI_GPIO_P1_23 (GPIO11) Output
EPSON_DOUT Output
RPI_GPIO_P1_19 (GPIO10) Input
EPSON_DIN Input
RPI_GPIO_P1_21 (GPIO9) Output
SPI Configuration for Timer Delays
- This software contains wrapper functions for time delays in millisecond and microseconds using seDelayMS() and seDelayMicroSecs(), respectively.
On embedded Linux platforms, these function calls may need to be redirected to platform-specific HW delay routines if not using a RaspberryPi
For example on RaspberryPi, the time delay functions for millisecond and microseconds is redirected to WiringPi library delay() and delayMicroseconds() function calls, respectively.
- If a hardware delay is not available from a library, then a custom written software delay loop is possible, but not preferred
SPI Configuration for GPIO Control
- This software uses the following 3 GPIO pins designated on the host for connection to the Epson device
GPIO output for asserting CS# on the Epson device (NOTE: Alternatively, pin SPI0_CE0 on the RaspberryPi can be used)
- GPIO input for reading the logic status on the Epson device DRDY (GPIO1) pin
- GPIO output for asserting RESET# on the Epson device
- Connecting CS# and DRDY to the Epson device is mandatory
- RESET# is recommended to force Hardware Reset during every IMU initialization for better robustness
ROS1 Node
This ROS1 driver publishes IMU messages as per REP 145 Conventions for IMU Sensor Drivers
Imu Message - contains header, orientation, angular velocity and linear acceleration
Temperature Message - contains header, temperature in Degrees Celsius
Orientation Data
For IMU models that support quaternion output function the orientation field in Imu Message can update with valid data and publish on imu/data
For IMU models that do not support quaternion output function the orientation field will not update with valid data and publish on imu/data_raw
Launch File
The roslaunch/XML in the launch folder of this package is used to pass the init parameters to configure the Epson device at runtime using roslaunch
Changes to init parameters by editing the launch file does not require rebuilding with catkin_make
Typically, the user only needs to modify imu_dout_rate & imu_filter_sel as needed based on system requirements
NOTE: Only use the specific IMU model launch file which matches the IMU model that the driver was built for by catkin_make process
Timestamping With EXT Signal (Time Correction)
- The Epson G3xx series IMU has a 3.3V I/O EXT (GPIO2) pin which can be connected to a cyclic external sync signal such as a GNSS 1PPS signal
When time_correction is enabled (set to 1), the driver attempts to correct the time stamp field in Imu Message using the devices internal reset counter value (measured delay since latest GNSS 1PPS)
To enable the time_correction feature, do the following:
- Connect a function 1PPS signl to the EXT/GPIO2 pin of the Epson device
Edit the appropriate IMU model roslaunch/XML in launch/ to set ext_sel to External Counter Reset, set <param name="ext_sel" type="int" value="1" />
In the same launch file, enable the time_correction, set <param name="time_correction" type="int" value="1" />
The use of time_correction feature is expected to give a more accurate timestamp of the inertial data by minimizing the effects of link delays and host processing delays
Building & Installing ROS1 Node
Place this package (including folders) into a new folder within your catkin workspace src/ folder.
Modify the CMakeLists.txt to select the desired Epson IMU model that is being used in the ROS system.
NOTE: You *MUST* re-build using catkin_make when changing IMU models or making any changes in the CMakeLists.txt
From the catkin workspace folder run catkin_make to build all changed ROS1 packages located in the <catkin_workspace>/src/ folder
- Reload the current ROS1 environment variables that may have changed after the catkin build process
<catkin_workspace>/source devel/setup.bash
Modify the appropriate roslaunch/XML int he launch folder to set your desired IMU init parameters for the specific IMU model that you built using catkin_make
Typically, only the dout_rate & filter_sel needs to be edited
Running the ROS1 Node
To start the Epson IMU ROS1 driver use the appropriate roslaunch/XML located in launch/ with roslaunch
- For example:
<catkin_workspace>/roslaunch ess_imu_driver g370.launch
USB-UART Latency
When using USB-UART bridge ICs to connect between the Linux host & Epson device, it is possible to experience higher than expected latencies or slower than expected IMU data rates
If your connection between the Epson IMU UART and the Linux host is by FTDI, the latency_timer setting in the FTDI driver may be large i.e. typically 16 (msec)
For example, the M-G32EV041 evaluation board uses an FTDI IC and driver
There are 3 methods listed below to reduce the impact of this latency by setting the latency_timer to 1msec
Modifying *latency_timer* by *udev* mechanism
udev is a device manager for Linux that can dynamically create and remove devices in *userspace* and run commands when new devices appear or for other device events
Create a udev rule to automatically set the latency_timer to 1 when an FTDI USB-UART device is plugged in
- For example, below is a text file named *99-ftdi_sio.rules* that can be put in the */etc/udev/rules.d* directory
SUBSYSTEM=="usb-serial", DRIVER=="ftdi_sio", ATTR{latency_timer}="1"
NOTE: Requires root (sudo) access to create or copy file in */etc/udev/rules.d* NOTE: This is a more robust method because it automatically sets when device is plugged in, but affects ALL FTDI USB-UART devices on the system
Modifying *latency_timer* by *sysfs* mechanism
- The example below reads the *latency_timer* setting for */dev/ttyUSB0* which returns 16msec.
- Then, it sets the *latency_timer* to 1msec, and confirms it by readback.
NOTE: May require root (sudo su) access on your system to modify
cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer 16 echo 1 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer 1
Modifying *low_latency* flag using *setserial* utility
The example below sets the low_latency flag for /dev/ttyUSB0
This will have the same effect as setting the latency_timer to 1msec.
This can be confirmed by running the setserial command again.
NOTE: You may need to install setserial with sudo apt install setserial
user@user:~$ setserial /dev/ttyUSB0 /dev/ttyUSB0, UART: unknown, Port: 0x0000, IRQ: 0 user@user:~$ setserial /dev/ttyUSB0 low_latency user@user:~$ setserial /dev/ttyUSB0 /dev/ttyUSB0, UART: unknown, Port: 0x0000, IRQ: 0, Flags: low_latency
Technical Support
For technical support or related issues using this ROS software, please email sensingsystem_support@ea.epson.com