Tekkotsu XWalk Introduction
What is XWalk
XWalk is a motion trajectory generator in Tekkotsu. Once the configuration of a robot is set in the .kin file, XWalk will enable the robot to walk over a certain displacement at a certain speed.
How to run XWalk
1)Running XWalk with a Robot simulation
- A. Create a robot simulation and put related files into appropriate directories(More details: http://www.tekkotsu.org/mirage.html)
cd Tekkotsu/tools/mirage ./mirage
Afterward, a window should appear, displaying the Mirage 3D environment.
- C. connecting Tekkotsu
cd Tekkotsu/project ./tekkotsu-TARGET –c mirage.plist (for example, if we use the simulation of Gort, we type : ./tekkotsu-GORT –c mirage.plist)
- D.turning on ControllerGUI
cd Tekkotsu/tools/bin ./ControllerGUI localhost
- E.Root Control -> TekkotsuMon -> Walk Controller
- Actually, not only the Walk Controller will call XWalk, many other motions in the list, including Chase Ball call XWalk, too.
2)Running XWalk with a real Robot
- A. Open a terminal windown
- B.cd /usr/local/Tekkotsu/tools/mon
- C. enter ./ControllerGUI ip-address
(Usually we need to run ControllerGUI whenenver we want to use XWalk, with ControllerGUI, we will be able to control the robot easily.)
Looking Into The Code
- 1)Where is the core code of XWalk?
under this directory, there are two files: XWalkMC.cc and XWalkMC.h
- 2) Important Parameters and functions and how to use them
- A. offsetX(0): Bias the position of the body relative to the ground (in millimeters), so increasing this parameter moves the robot forward, parallel to the ground.
- B. offsetY(0): Bias the position of the body relative to the ground (in millimeters), so increasing this parameter moves the robot left, parallel to the ground.
- C. offsetA(0):Bias the orientation of the body relative to the ground (in radians), so increasing this parameter turns the robot counter-clockwise.
- D. resetOnStop(true): Causes the feet to redistribute to their central positions when motion stops.
- E. frictionCoef(0): Coefficient of friction with the ground (aka µ), limits the amount of non-normal force which can be applied.(Not finished. Cannot be used yet)
- F. strideLenX(100): The size of forward (x-axis) step (mm) to take with each leg (all legs have the same period and travel same speed, so must have the same length of stride).
- G. strideLenY(60): The size of sideways (y-axis) step (mm) to take with each leg (all legs have the same period and travel same speed, so must have the same length of stride)
- H. adaptiveLegOrder(true): If true, re-orders the leg flights based on direction of motion
- I. rotateBodyMotion(true): If true, rotate the sway and surge motions to match direction of motion
- J. transitionDuration(1500): How much time to use getting into initial position, or when parameters change (milliseconds)
- K. bounce():Movement up and down while walking
- L. sway():Movement left and right while walking, balancing the center of mass
- M. surge():Movement forward and backward while walking
- N. legParams(NumLegs,false): an array of parameters that control the leg motion
- O. nonLegJoints(): By default, there is not entry for the nonLegjoints. However, if there are some other nonlegjoints, like arms, we should add an array of parameters that control the non-leg joint motions.
- P. Two copies of XWalk parameters: XWalkMC has two copies of each parameter. The reason for this is in XWalk editor in the ControllerGUI or anything else that modifies XWalk settings, they will modify the inherited copies. When a setting is modified, it starts a transition, and gradually updates the copy in ‘p’. This allows the robot to transition from one posture to another smoothly. If you were directly editing a single parameter, it would immediately ‘snap’ to the updated position instead of transitioning smoothly over time. The two copies are just to separate the ‘current’ value in ‘p’from the ‘target’ value from the inherited class.
- Q. About the ‘updateOutputs’: Actual code can be found in the XWalkMC.cc file. This function is common to all motion commands in Tekkotsu. The motionManager will call this function at high frequency each motion command is supposed to then figure out where it wants to put the joints. And then it calls motion manager’s setOutput functions to assign these values. So, in this way it controls the parameters.
- R. Initial Position: If your robot uses Dynamixel , generally you won’t have such problems in recognizing the initial position of the servos.
- S. updateOutputInitial: if xwalk is not already standing, it will move the feet up above the belly, then over their ‘neutral’ position, and then lower to standing height. Needed to be changed because humanoid robots have different kind of initial position. (If you want to make the humanoid robot stand by itself, it will have to call another function to figure out which side the humanoid robot is sitting or lying on. If you can suspend the robot until it is initialized and put the robot manually on the floor, you can remove the call to updateOutputsInitial and only use updateOutputsWalking, or you can override the initialPlacement flag ‘false’ to skip this.)
- T. setTargetDisplacement(float xdisp, float ydisp, float adisp, float time):
This function needs the displacement in the x, y, direction and also an angular discplacement. The robot will cover the discplacement in the given time
- U. setTargetVelocity(xdisp/maxTime, ydisp/maxTime, adisp/maxTime, maxTime):
This function directly calculate the target velocity