This repository contains a framework of developing controllers for BXI robots, including:
- A reinforcement learning based sample controller program;
- A Mujoco simulator based on ROS2;
- The BXI Hardware envrionment based on ROS2
The binary ROS2 packages of ROS2 environment and mujoco can be find here:bxi_ros2_pkg - The binary ROS2 package
bxi_ros2_pkg/directory:
communication:the robot communication package, including custom communication package formats.description: contains the robot description files, including urdf, xml and the meshe files.mujoco: Mujoco simulator based on ROS2. Controller programs a recommened to be verified in Mujoco before deploy to the robot hardware.hardware: The robot hardware package. This node publishes all sensor data of the robot and receives control commands.hardware_arm: The hardware control package for the upper-body-only version of the robot. This node publishes information about the robot's upper-body arms and receives control commands.
The bxi_ros2_pkg is a unified framework for both simulation and hardare:
ROS2 structure simulation: 
ROS2 structure hardware: 
- Control program
src/directory::
src/bix_example: demo of the initialization process and basic message receiving and sending functions.src/bix_example_py: a demo of learming based control policy.src/bix_example_py_elf3: a demo of learming based control policy elf3.remote_controller: reads the Xbox/PS input and publish the commands. Work with both the robot hardware and the simulation environment.src/bix_example_py_arm: a demo of upper body control.
elf2-trunk:Elf2 v1,base linkistrunk(torso),elf2-trunk_dof12: only 12 leg joints are free joints. dof25: all joints are free.elf2-ankle:Elf2 v2: ankles torques are increased50Nm.elf2-foot: Elf2 v3: sole changed: 1 shaping to human foot for wearing shoes. 2 symmetric soles change to asymmetric, like human feet.(deprecated)elf2-footv4: Elf2 v4: sole change : sole shape change back to regular rectangle with oval ends. Asymmetric sole.elf2-arm: arms only.elf3_dof29: Elf3 version with dof29
hwis short forhardware,alllaunchfiles with suffixhware to launch real hardware. Please use them carefully.- The simulation environment and the robot hardware share the same control program. You only need to apply different launch files to switch between simulation and hardware. Topics for simulation code are with the
simulation/prefix, while topics for the hardware are with thehardware/prefix. For details, please refer to the topic parameter settings in src/example. - The robot in the simulation environment is initialized with a virtual suspension. After startup, the suspension needs to be released. While suspension-related signals are ignored when operating on robot hardware).
- There is a global odometer topic
odmin the simulation env, while this topic is not available inhardwareenvironment.
Ubuntu 22.04,with ROS2 versionhumble.mujocorequireslibglfw3-dev.- Copy
./script/bxi-dev.rulesto/etc/udev/rules.d/ - To set up remote controller auto-start, edit
./script/ros_elf_launch.service, copy to/etc/systemd/system/, and used thesystemctltool to enable the auto-start service.
In both simulation and hardware, the motors are in a disabled state when started, and all parameters are uncontrollable. The startup process consists of two steps:
- Enable position control of the motors. The motors can implement position control by setting three parameters:
pos kp kd. As of Elf2 hardware, when received the 1stresetcommand, it's joints rotate to zero position and keep it for 10 seconds. - Enable all control parameters. The motors can be set with
pos vel tor kp kd. As of Elf2 hardware, when received the 2ndresetcommand, it's joints start taking control input.
For startup examples, please refer to src/bxi_example_py.
- Copy the ROS2 binary packages
bxi_ros2_pkgto /opt/bxi/bxi_ros2_pkg , activate it:source /opt/bxi/bxi_ros2_pkg/setup.bash. Run it asrooton robot hardware. - In bxi_rl_controller_ros2_example directory, run
bash build.shto compile all sources in./srcdirector. When compilation is done,runsource ./install/setup.bashto activate the environment of current packages. - Run whole body demos:
ros2 launch bxi_example_py_elf3 example_launch_demo.py: start simulation + controller program(learning based)ros2 launch bxi_example_py_elf3 example_launch_demo_hw.pystart robot hardware + control policy
- The control commands in the topic must be sent in the specified joint order. The order of joints refer to the example
src/bix_example - Both the simulation environment and the hardware robot have an out-of-control protection. The protection is triggered if control commands are lost for more than 100ms. Once triggered, the motors will be disabled, and the system must be reinitialized before it can be used again.
In addition to communication timeout protection, the hardware node also includes torque protection, overspeed protection, and position protection.
- There is an error counter built into the hardware node. When the error count reaches
1000, the motor will exit the enabled state. - The error counter logic: increases the error count by
50if receive a motor speed overrun ; increases the error count by100if receive a torque overrun ; decreases the error count by1if receive normal motor messages, with a minimum value of0. - When the position overrun protection is triggered, the error count is not increased. The overrun direction control will be disabled, the motor can only rotate in the opposite direction.
- Please contact us to get the detailed overrun values. It is not recommended to modify them unless necessary.
Large-sized robots may pose risks. Check instructions carefully before operation!
All control programs must go through simulation before deploying on robot hardwares.
Press the stop button immediately if any abnormality occurs!