JY901 Module
Introduction to JY901 Module
- The JY901 is an external nine-axis sensor module (comprising a three-axis gyroscope, three-axis accelerometer, and three-axis magnetometer). We connect it to the robot via a USB-to-TTL module to obtain more precise nine-axis IMU data.
Module Installation
Baud Rate Configuration Before connecting a new JY901 module to the robot, ensure that the module's baud rate is configured to 115200 using the accompanying software, and set the feedback frequency to above 200Hz.
Module Installation Position The module typically has coordinate definitions printed on it:
After soldering the JY901 to the USB-to-TTL module, insert it into the USB port on the back of the robot. Note that the module's coordinate system must be aligned with the robot's coordinate system, which is defined as follows:
- Forward is the positive x-axis (+x)
- Left is the positive y-axis (+y)
- Upward is the positive z-axis (+z)
Node Information
Node Name
- /jy901Module_node
- The function of this node is to read data from the JY901 module and then convert it into ROS messages for publication.
Package Path
- ~/robot_ros_application/catkin_ws/src/jy901_module
Message Name
- /jy901Module_node/jy901Data
Message Type
- std_msgs/Float64MultiArray
Message Type Definition
std_msgs/MultiArrayLayout layout
std_msgs/MultiArrayDimension[] dim
string label
uint32 size
uint32 stride
uint32 data_offset
float64[] data
Starting the Node and Acquiring IMU Data
Starting the JY901 Node in the Terminal
source ~/robot_ros_application/catkin_/devel/setup.bash
rosrun jy901_module jy901_module_node- Do not close the terminal after the node is running, as the JY901 data relies on this node for publication.
Acquiring JY901 Data in the Terminal After inserting the JY901 module and starting the JY901 node using the above commands, you can check via the terminal whether the JY901 data is being correctly read.
Open a new terminal and run the following command:rostopic echo /jy901Module_node/jy901Data
The terminal will output the data.
Subscribing to IMU Data - Python Implementation
#!/usr/bin python
# -*- coding: utf-8 -*-
import rospy
from std_msgs.msg import Float64MultiArray
JY901_TOPIC = "/jy901Module_node/jy901Data"
class JY901Data:
def __init__(self):
self.jy901_data = []
rospy.Subscriber(JY901_TOPIC, Float64MultiArray, self.jy901_callback, queue_size=1)
def jy901_callback(self, msg):
self.jy901_data = msg.data
def show_data(self):
while not rospy.core.is_shutdown_requested():
rospy.loginfo(self.jy901_data)
rospy.sleep(0.5) # Print JY901 data every 0.5 seconds
if __name__ == "__main__":
rospy.init_node("get_jy901")
jy901 = JY901Data()
jy901.show_data()
Data Meaning
We can subscribe to the JY901 data using Python code and view the real-time data. Here is an example of a data entry:
(0.0, 0.0, 0.0, -0.9013671875, -0.13037109375, -0.26513671875, -153.863525390625, 71.8505859375, 31.5802001953125)
This data consists of nine values:
The first three values represent the angular velocity around the x, y, and z axes, respectively.
The middle three values represent the acceleration along the x, y, and z axes, respectively.
The last three values represent the Euler angles around the x, y, and z axes, respectively.