XUAN bicycle,Unfortunately, Mr. Zhihui only opened up the mechanical structure and did not open up his own control program implementation, there are certain differences in the specific technical solutions. The mechanical structure has made small improvements to the support mechanism of the momentum wheel, and the original movable structure has been removed. For motor control, odrive is used. The entire control program is based on the ROS communication middleware, combined with the CAN bus for direct data interaction with the NUC, without using a separate microcontroller to drive the motor. The control algorithm uses the classic three-loop PID control. It also has a simple obstacle avoidance system based on vision, and the final overall operating effect is as follows.
![]() |
![]() |
| go straight | avoid obstacle |
AI processing module uses the same Huawei Ascend Atlas 200 DK processing chip as Zhi Huijun. Sponsored by the CASC.
| Sensor | Type |
|---|---|
| battery | DJI Roomaster 6S battery |
| processor unit | Intel NUC OR Huawei Ascend |
| Momentum and rearwheel motor | X8018 motor |
IMU |
IMU-CH100 |
| Brushless motor drive | odrive |
| servo | 60KG Serial servo |
| Camera | Astra S |
| Some mechanical structural parts | Resin printing or metal processing |
| bike | fixed gear |
| remote control | DJI Robomaster remote control |
-
can_send_receive_nodeThis node is mainly responsible for regularly sending
CANcommands toOdriveso thatOdrivecan return the click speed and position information toNUC. Then the received data is parsed and published toROS. -
parser_remote_dataThis node is responsible for receiving
DJIremote control serial port data, parsing and publishing it toROS. -
bike_xuan_control_nodeThis node is the core node of the entire system, runs the overall control algorithm, and sends control information to
Odrivethrough theCANbus to achieve balance.
- Launch
IMU
roslaunch imu_launch imu_msg.launch- Start the remote control parsing node
rosrun bike_core parser_remote_data_node- Start the
CANmessage sending node
rosrun bike_core can_send_receive_node- Start the core control node
rosrun bike_core bike_xuan_core_control_nodePID control algorithm. From outside to inside, there are speed loop, angle loop and angular velocity loop. The debugging sequence is based on the inside-out principle. Other important system parameters for the initial balancing in the project are as follows. By writing them in the YAML file, you can easily change the parameters. And other pid param, you can also config them by the yaml file.
%YAML:1.0
---
IMU.Machine.Middle.Angle: 2.89
Middle.Angle.Tolerance.Change.ABSValue: 1.0
Output.Middle.Angle: 1
Servo.PWM.Middle.Value: 1700
Bike.Turn.Scale: 0.005
Bike.Middle.Angle.Rectify.Scale: 0.0001
Middle.Angle.Rectify.Calculate.Time: 100
Bike.Middle.Angle.Rectify.Limit.Abs.Angle: 1.5
Axis0.Can.ID: 0x010
Axis1.Can.ID: 0x020
Debug.Faucte.Dir: 1
Debug.Momentum.Wheel: 1
Debug.Back.Drive.Wheel: 1
Servo.Port.Name: "/dev/dbus_serial"
Servo.ID: 0
Dbus.Serial.Port.Name: "/dev/sbus_serial"
Imu.Serial.Port.Name: "/dev/imu_serial" # nousing
# avoid obstacle config params
Tolerance.Nearest.Obstacle.Dis: 1.7
Avoid.Obstacle.Drive.Speed: 2.4
Faucet.Dir.Control.Rate: 20
Faucet.Dir.Error.P: 1.0
Faucet.Dir.Output.ABS.Limit: 3If you have any technical questions, please contact me in time.
- Email: weihaoysgs@gmail.com
- Blog: www.weihaoysgs.com



