Motion Framework¶
The motion framework uses the so called MotionPhase, which implements a few functions and are used in a control cycle of the module MotionEngine. Different modules implement different versions of the MotionPhase, which can be created by the so called MotionGenerators. The overview is seen below.
The MotionEngine takes the representation MotionRequest from the behavior and acts accordingly.
For it the MotionEngine will always first update the currently active MotionPhase, to let it know a motion frame passed.
Afterwards the isDone-function is used to determine, if the active MotionPhase can be stopped and a new one can begin.
If so the MotionGenerators are used with the MotionRequest to create a new MotionPhase.
Additionally the until now active MotionPhase can also create a new one, which then overwrites the one from the MotionGenerators.
Afterwards the head and arm joints are determined and last but not least the active MotionPhase is used to determine the rest of the joints.
This motion cycle is illustrated below.
Adding New Motions¶
The B-Human system supports different motion types like walking, kicking or getting up. One may add more motions, which shall be executable from the behavior. To achieve this the new motion must be added to the following files:
Src/Representations/MotionControl/MotionRequest.h: add your motion to the enumMotionand other new parameters to theMotionRequestSrc/Representations/MotionControl/: add a representation which inherits fromTools/Motion/MotionGenerator.hSrc/Modules/MotionControl/: add a module, which will provide the added representationSrc/Modules/MotionControl/MotionEngine/MotionEngine: add the representation asREQUIRESand add it to thegeneratorslistSrc/Representations/BehaviorControl/SkillInterfaces.h: add a skill that sets theMotionRequestmotion and the other new parametersSrc/Modules/BehaviorControl/SkillBehaviorControl/Skills/Output/MotionRequest/: add the implementation of your skillConfig/Scenarios/*/threads.cfg: add the provider for the new representation
Motion Coordinate System¶
All necessary information for Motion comes from the representation MotionRequest.
It is generated by Cognition and is relative to the TorsoMatrix of the robot at the time the MotionRequest was last updated.
Therefore the robot can be in different configurations.
To accurately determine the ball position relative to the robot which is compatible to how the WalkingEngine functions, a transformation is needed to convert the robot relative coordinates (from the MotionRequest) into the newest one from motion.
This transformation mostly just adds the missing odometry data that accumulated between the time the camera image was recorded and motion now executes the latest request.