The hardware used to accomplish the requirements of this project was the Unitree A1 Robot. The reasons behind the choice of hardware can be found in the Design section of the report.
Below are diagrams that illustrate the hardware equipment, electrical design, and user interface options of the Unitree A1 Robot.
Source: Unitree A1 User Manual
We have two sub-objectives:
Keep the robot stable (centered CoM).
Keep the robot stationary (joint angles stay near initial pose).
Solution: We allocate a PID controller to each of these two tasks.
(discretized PID controller)
First we need to find the current center of mass (CoM) and desired CoM (centroid of grounded legs). We can approximate the CoM by treating the feet like point masses, and we can find the centroid of our grounded legs by taking an average of all foot positions.
With this information we can construct an error vector, a total amount of displacement by which each of our grounded legs must 'move' in order for the CoM to shift to the desired position. This 'movement' is really handled in-place, since the feet are making contact with the ground and undergo static friction. From each foot's coordinate frame, the robot body (CoM) is moving towards the desired CoM position. This creates the effect of shifting the robot body back onto the desired CoM.
In the XY plane, every grounded leg actuates along the vector between the desired and actual CoM.
A leg-specific Z component is added to each leg's error vector. This uses the cross product of each leg's foot position with the CoM offset. In practice, this causes legs that are near the actual CoM to favor higher Z positions (taller) and legs that are far from the CoM to favor lower Z positions (shorter), allowing the robot to more effectively lean backwards onto its hind legs during a stability test.
We then apply PID control to our system using inverse kinematics (IK). The construction of our desired pose is fairly straightforward, using standard discrete PID control methodology.
Implementation Details Can Be Explored Further on Github:
The implementation of the stability query was broken down into two parts: force test actuation and classification from sensor data
Force Test Actuation
The robot's actual actuation to perform the force test is done in three steps. The first step is to raise the leg performing the stability query off the ground, then it will extend in front of the robot, then it will lower onto the terrain. During the third and final step, the robot will begin sensor data collection to classify the terrain.
To actuate the robot, the implementation makes use of the joint sensors on the robot. This gives feedback on the robot's joint coordinates in the robot's base frame. This allows us to perform the same trajectory repeatedly to test terrain.
Classification from Sensor Data
During the third motion of the force test actuation, the robot beings its stability query and data collection process. A high-level description of this process is as follows:
Begin lowering leg from elevated position to ground-level height
While lowering
Once foot makes contact with some surface, begin data collection
Collect foot force sensor data
Collect joint sensor data ((x, y, z) coordinate of foot in robot's base frame)
Check for exit conditions
If force exceeds certain threshold, terrain can be deemed stable. Test concludes
If robot detects loss of contact with surface, terrain can be deemed unstable. Test concludes
If robot completes actuation, complete data collection. Terrain stability will be calculated from data collection. Test concludes
If foot never makes contact with some surface, terrain can be deemed unstable. Test concludes
Of the exit conditions listed above, only one requires post-processing the data collected during the force test. In the event that the max force threshold is not met, and that the robot does not lose contact with the terrain being test, the robot needs to use the base coordinate positional data and foot force data to classify stability. For classification, three linear regression models are computed. Each model correlates the X, Y, and Z coordinate, respectively, with the magnitude of contact force the robot senses (example plots are shown to the right). The slope of the graphs allows us to classify stability:
If the X and Y coordinates are relatively constant while contact force increased, we know there is a low chance that slippage occurred.
If the Z coordinate is relatively constant while contact force increased, we know that there is a high probability that the terrain maintained rigidity and support while applying force.
The above two considerations are an example of what is considered when performing the stability classification. Once terrain is classified, the robot will traverse over the terrain if stable or maneuver around it if unstable.
We used the motion imitation library by Google Research to walk the quadruped after evaluating terrain stability.
On a high level, the library works by:
Gathering video data from an animal walking
Transferring the video into simulation
Retargeting the motion of the simulated animal so that the motion can be accomplished using the quadruped robot's joints in simulation. (This motion becomes the reference motion)
Learning a policy that allows the quadruped's gait to resemble the reference motion
The library provides an interface to use the pre-trained gait controllers, which we used for walking the quadruped after it evaluates the stability of terrain.
The three main components that make up our system, as described in the sections above, are as follows: Balance PID Controller, Force & Stability Classification, and Gait/Motion implementation.
The robot operates with multiple controllers. The first controller activates the Balance PID Controller on the three legs not performing the force test and enables us to control the 4th leg by setting joint angles through inverse kinematics. This controller is active during force and stabilization testing. The second controller enables legged locomotion. This controller is activated when the robot has concluded its force test and is actively navigating on or around the identified terrain. This process can be summarized by the following steps:
Enter mode to perform force and stability check. This activates the Balance PID Controller and enables control of the 4th leg to perform the force and stability test
Perform stability test and return classification
Switch controllers to use legged locomotion to navigate over terrain or around terrain, depending on results from stability query
Switch back to original controller (step 1) once another force test needs to be performed.