Motion Kicks - northern-bites/nbites GitHub Wiki

Creating a motion kick for the bhuman walk engine:

Config File

nbites/src/man/motion/bhwalk/Config/Kicks

Each motion kick has its own file and is structured as shown below. This is an example of a front kick. The first block of code is not very well understood yet. According to bhuman documentation, preStepSize and StepSize are related to the speed and size of the steps before and during the kicks. Proceed is thought to be related to timing but, it is unclear. The second block of code is where the kick is really designed. Each setLeg corresponds to a leg position and they are all strung together to make a motion kick. setLeg has 6 parameters. The first three are the x, y, and z, translations. The last three are rotational (which have not yet been used). Although kicks can be made completely from scratch, it is easiest completely copy another kick file and only change the set legs. The setLeg after proceed 1 is the big kick motion that will make contact the ball.

setType walking

setPreStepSize 30 -20 0 0 0 0

setStepSize 30 0 0 0 0 0

setRefX 4

setDuration 800

/

proceed 800

setLeg -10 0 5 0 0 0

proceed 100

setLeg -15 0 10 0 0 0

proceed 1

setLeg 100 0 15 0 0 0

proceed 200

setLeg 40 0 15 0 0 0

proceed 800

WalkRequest.h

.../bhwalk/Representations/MotionControl/WalkRequest.h

The second ENUM, starting with KickType contains all of the kicks. Add the name of your kick file, without .cfg, to this as well as a mirrored version (i.e. if your kick is sideLeft.cfg, add sideLeft and sideRight to ENUM) because a mirrored version of your kick will be automatically generated. The code will not run unless both are included because the ENUM will not be the right size.

BHWalkProvider.cpp

.../bhwalk/BHWalkProvider.cpp

There is a series of if statements starting on line 229 starting with: if (command->motionKick && !justMotionKicked) {. Following the format of the others, add your kicks to this. The order in which the kicks are added to this will become important later.

NavHelper.py

This is where the kick is renamed and linked to the kick files in bhwalk. Search for if kick:. It is very important to add you kicks so that they are ordered the same as in WalkRequest.h or else you will be associating kicks with the wrong motions.

kicks.py

All of the motion kicks are grouped together. Like any other kick, name the kick, give it a sweet spot and heading. The kicks also need to be added to the chooseAlignedKickFromKick(player): function. This just decides which foot to kick with once you are close to the ball. If it is a directional kick it should not realign and you can follow what is done for the chip shots and side kicks at the end of this method.

KickDecider.py

Motion kicks are located in two places: motionKicksOnGoal(): and motionKicksAsap():. Append the kicks your want to self.kicks in both.

TrackingConstants

KICK_DICT associates a head move with a kick so if you are kicking left you, look left afterwards. Add your kicks to KICK_DICT and give it a head move that will look towards the direction the ball goes after the kick