yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
ROS Robot Expansion Board📖
1.Expansion board STM32 driver
  • 0. Precautions
  • 1.1Expansion Board Introduction_V4.0
  • 1.1 Expansion Board Introduction_V3.0
  • 1.1 Expansion Board Introduction_V1.0
  • 1.2 STM32 Development environment
  • 1.3 Button to control the buzzer to whistle
  • 1.4 FreeRTOS application
  • 1.5 Serial communication
  • 1.6 SBUS model aircraft remote control
  • 1.7 CAN bus communication
  • 1.8 RGB colorful light bar
  • 1.9 Timer interrupt to control PWM servo
  • 1.10 Control serial port servos
  • 1.11 Nine-axis attitude sensor to obtain data
  • 1.12 Control the forward and reverse rotation of the motor
  • 1.13 The timer captures the encoder data
  • 1.14.1 Robot kinematics analysis theory
  • 1.14.2 Mecanum wheel kinematics analysis
  • 1.15 PID control robot movement
  • 1.16 OLED character display
  • 1.17Host computer use
2.Python basic control
  • 2.0 Bind PCB port devices
  • 2.1 Update the firmware of the expansion board
  • 2.2 Turn off the self-starting large program at startup
  • 2.3 Install the Rosmaster driver library
  • 2.4 Buzzer whistle
  • 2.5 Control PWM servo
  • 2.6 RGB colorful light bar special effects display
  • 2.7 Control the forward and reverse rotation of the motor
  • 2.8 Control the movement of the robot
  • 2.9 Control Serial Servo
3.ROS1 Basic Course
  • 1.ROS introduction
  • 2.ROS installation
  • 3.ROS common command tools
  • 4.ROS workspace
  • 5.ROS function package
  • 6.ROS node
  • 7.ROS topic publisher
  • 8.ROS topic subscribers
  • 9.ROS service client
  • 10.ROS service server
  • 11.ROS action client
  • 12.ROS action server
  • 13.ROS custom message reception
  • 14.ROS-launch file
  • 15.ROS-TF transformation
  • 16.ROS parameter service
  • 17.ROS-rviz use
  • 18.ROS-rqt tool usage
  • 19.Topic message recording and playback
  • 20.urdf model introduction
  • 21.gazebo introduction
  • 22.ROS distributed communication
4.ROS1 robot control
  • 0. Bind PCB port devices
  • 1. Package Use the tutorial
  • 2. Package Description
  • 3. Robot keyboard control
  • 4. Robot state estimation
  • 5. Robot imu calibration
  • 6. Robot URDF Model
5.ROS2 Basic Course
  • 1.Introduction to ROS2
  • 2.ROS2 install Humble
  • 3.ROS2 development environment
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
6.ROS2 robot control
  • 0. Bind PCB port devices
  • 1. Package Use the tutorial
  • 2. Robot information release
  • 3. Robot keyboard control
  • 4. Robot state estimation
  • 5. Robot calibration
  • 6. URDF model
7.RDK X3 course
  • 1. Update the firmware of the expansion board
  • 2. Turn off the self-starting large program at startup
  • 3. Install the Rosmaster driver library
  • 4. Buzzer whistle
  • 5. Control PWM servo
  • 6. RGB colorful light bar special effects
  • 7. Control motor forward reverse
  • 8. Control robot movement
  • 9. Control Serial Servo
Download
  • Rules_File
  • Hardware Info
  • Code
  • 3D Model File
  • RDK Code
  • ROS2_Basic_VM
  • PC_Software
Download ZIP

Welcome to ROS Robot Expansion Board repository

4. Robot state estimation

4、Robot state estimation

4.1、run

4.1.1、code reference path

~/driver_ws/src/yahboomcar_bringup/launch/bringup.launch

4.1.1、start

xxxxxxxxxx
cd ~/driver_ws/src/yahboom_bringup/launch
roslaunch bringup.launch

image-20220302195347075

4.1.1、View tf tree and node graph

1)、View TF tree

xxxxxxxxxx
rosrun rqt_tf_tree rqt_tf_tree

image-20220302195541781

2)、View Node Graph

xxxxxxxxxx
rosrun rqt_graph rqt_graph

image-20220328152523358

4.1.2、launch file analysis

In the bringup.launch file, there are several important nodes

1)、/drive_node

This node mainly publishes /imu/imu_raw and /vel_raw data, terminal input

xxxxxxxxxx
rosnode info /driver_node 

image-20220302200405156

As can be seen,

  • The /driver_node node publishes the /imu/imu_raw topic data to the /imu_filter_madgwick node, which filters and fuses the imu data;
  • The /driver_node node publishes the /vel_raw topic data to the /odometry_publisher node. After the latter is integrated, the /odom_raw data is published;

2)、/odometry_publisher

This node mainly receives the vel_raw topic data sent by the /driver_node node, publishes the /odom_raw topic data to /ekf_localization, and publishes the /tf topic data to other nodes, terminal input,

xxxxxxxxxx
rosnode info /odometry_publisher

image-20220302201321953

3)、/imu_filter_madgwick

This node mainly filters and fuses imu data, and then publishes the processed /imu/imu_data topic data to the /ekf_localization node to receive and publish /tf data to other nodes, terminal input,

xxxxxxxxxx
rosnode info /imu_filter_madgwick

image-20220302202045302

4)、/ekf_localization

This node mainly integrates imu data and odom data and publishes tf data, terminal input,

xxxxxxxxxx
rosnode info /ekf_localization

image-20220302202824433

Next, we describe these nodes in detail.

4.1.3、imu_filter_madgwick

1)、Introduction

IMU refers to a six-axis sensor that includes a gyroscope and an accelerometer. MARG refers to a nine-axis sensor that adds a magnetometer to the IMU.

xxxxxxxxxx
IMU = gyroscope + accelerometer
MARG(Magnetic, Angular Rate, and Gravity) = gyroscope + accelerometer + magnetometer

Madgwick is an Orientation Filter that filters and fuses raw data from IMU devices. It fuses angular velocity, acceleration, and (optionally) magnetometer readings from generic IMU devices into orientation quaternions, and publishes the fused data on the IMU topic without considering the entire IMU integration process.

2)、Topic

/Topic NameTypeAttributes
Subscribed/imu/data_rawsensor_msgs/Imu校准后的IMU数据的消息,包括角速度和线加速度
Subscribed/imu/magsensor_msgs/MagneticField[可选]磁力计,会受磁场影响
Published/imu/datasensor_msgs/Imu融合的Imu信息。

3)、parameter

Topic NameTypeDefaultsAttributes
~gaindouble0.1filter gain
Higher values result in faster convergence but more noise.。
The lower the value, the slower the convergence, but the smoother the signal. Range: 0.0 to 1.0
~zetadouble0.0Gyro drift gain (about rad/s). Range: -1.0 to 1.0
~mag_bias_xdouble0.0Magnetometer bias (hard iron corrected), x-component. Range: -10.0 to 10.0
~mag_bias_ydouble0.0Magnetometer bias (hard iron correction), y component. Range: -10.0 to 10.0
~mag_bias_zdouble0.0Magnetometer bias (hard iron correction), z component. Range: -10.0 to 10.0
~orientation_stddevdouble0.0The standard deviation of the orientation estimate. Range: 0.0 to 1.0
~world_framestring"nwu"World frame indicating direction (see REP-145). The old default was "nwu" (northwest up). New deployments should use "enu". Valid values: "nwu", "enu", "ned".
~use_magbooltrueWhether to use magnetic field data in data fusion.
~use_magnetic_field_msgboolfalseIf set to true, subscribe /imu, /mag topics as sensor_msgs/MagneticField; if set to false (deprecated), use geometry_msgs/Vector3Stamped
~fixed_framestringodomParent coordinate system to use in publishing
~publish_tfboolfalseWhether to publish the TF transformation representing the direction of the IMU as the pose of the IMU; use the fixed coordinate system as the parent coordinate system, and the input imu information as the child coordinate system
~reverse_tfboolfalseIf set to true, the transformation from the imu coordinate system to the fixed coordinate system is published, not the other way around.
~constant_dtdouble0.0The dt to use; if 0.0 (default), the dt dynamic value is calculated from the message start position.
~publish_debug_topicsboolfalseIf set to true, two debug topics are published.
~statelessboolfalseIf set to true, the filtered orientation is not published. Instead, a stateless estimate of orientation is published based only on the latest accelerometer (and optional magnetometer) readings. for debugging.
~remove_gravity_vectorboolfalseIf set to true, the gravity vector is subtracted from the acceleration field in the published IMU message.

4.1.4、robot_localization

1)、Introduction

robot_localization is a collection of state estimation nodes, each node is an implementation of a nonlinear state estimator for robots moving in 3D space. It includes two state estimation nodes ekf_localization_node and ukf_localization_node. Also, robot_localization provides navsat_transform_node, which helps to integrate GPS data.

ekf_localization_node is an implementation of Extended Kalman Filter. It uses an omnidirectional motion model to predict states in time and uses sensed sensor data to correct the predicted estimates.

ukf_localization_node is an implementation of Unscented Kalman Filter. It uses a carefully chosen set of sigma points to project the state through the same motion model used in the EKF, and then uses these projected sigma points to recover the state estimate and covariance. This eliminates the use of the Jacobian matrix and makes the filter more stable. However, it is also more computationally heavy compared to ekf_localization_node.

2)、Topic

/Topic NameTypeAttributes
Subscribed/imu/datasensor_msgs/ImuFiltered imu information
Subscribed/odom_rawnav_msgs/OdometryOdometer Information
Published/odomnav_msgs/OdometryFusion odometer information
Published/tftf2_msgs/TFMessageCoordinate system information

3)、Parameter

  • frequency: The true frequency (in Hz) at which the filter produces state estimates. Note: The filter will not start computing until at least one message has been received from one of the inputs.

  • [sensor] : For each sensor, the user needs to define this parameter according to the message type. Each parameter name is indexed from 0 (e.g. odom0, odom1, etc.) and must be defined in order (e.g. don't use pose0 and pose2 if pose1 is not already defined). The value of each parameter is the topic name for that sensor.

    xxxxxxxxxx
    odom0: /odom_raw
    imu0: /imu/data
  • [sensor]_differential: For each sensor message defined above that contains pose information, the user can specify whether the pose variables should be integrated differentially. If the given value is set to true, then for the measurement taken at time t from the relevant sensor, we will first subtract the measurement at time t-1 and then convert the resulting value to velocity.。

    xxxxxxxxxx
    ~odomN_differential
    ~imuN_differential
    ~poseN_differential
  • [sensor]_relative: If this parameter is set to true, any measurements from this sensor will be fused relative to the first measurement received from this sensor. This is useful, for example, if you want the state estimate to always start at (0,0,0) and the roll, pitch and yaw angle values to be (0,0,0).

    xxxxxxxxxx
    ~odomN_relative
    ~imuN_relative
    ~poseN_relative
  • two_d_mode: Set this to true if your robot operates in a flat environment and can ignore small changes in the ground (as reported by the IMU). It fuses all 3D variables (Z, roll, pitch and their respective velocity and acceleration) into a value of 0. This ensures that the covariances of these values don't explode, while ensuring that your robot's state estimate remains fixed in the X-Y plane.

  • odom0_config:[ false, false, false, false, false, false, true, true, false, false, false, true, false, false, false ]

    The order of Boolean values is: [[X],[Y],[Z],[roll],[pitch],[yaw],[X ' ],[Y ' ],[Z ' ],[roll '] ,[pitch '],[yaw '],[X ''],[Y ''],[Z '']]. The user must specify which variables of these messages should be fused into the final state estimate.

4)、Published Transform

If the user's world_frame parameter is set to the value of odom_frame, the transformation is posted from the coordinate system given by the odom_frame parameter to the coordinate system given by the base_link_frame parameter. If the user's world_frame parameter is set to the value of map_frame, the transformation is published from the coordinate system given by the map_frame parameter to the coordinate system given by the odom_frame parameter.

For example, we set to publish the transformation from the coordinate system given by the [odom_frame] parameter to the coordinate system given by the [base_link_frame] parameter.

xxxxxxxxxx
odom_frame: odom
base_link_frame: base_footprint
world_frame: odom

image-20220303095917633

 

Robot keyboard control
Robot imu calibration

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文