soccer_pycontrol.path_robot.PathRobot
- class soccer_pycontrol.path_robot.PathRobot(start_transform, end_transform, foot_center_to_floor)[source]
Bases:
PathTorso
Subclass for the robot’s path, contains functions to draw the path of the robot
- __init__(start_transform, end_transform, foot_center_to_floor)[source]
Initialization function for Path, creates a single path section, other path sections are only added when the route needs to change
- Parameters:
start_transform – Starting Robot Position
end_transform – Ending Robot Position
Methods
__init__
(start_transform, end_transform, ...)Initialization function for Path, creates a single path section, other path sections are only added when the route needs to change
How many footsteps used for turning the robot takes to run this path
createPathSection
(start_transform, end_transform)Create a path section between the two transforms
duration
()Get the duration in seconds for a given path
dynamicallyUpdateGoalPosition
(t, end_transform)Updates the goal position dynamically (not working)
Get an estimated position of the robot given a certain time.
footPosition
(t)Returns the positions of both feet given a certain time :param t: Relative time of the entire robot path :return: [Transformation of right foot, Transformation of left foot]
The time it takes for the robot to take a full step :return: Time in seconds
Returns the PathSection and ratio of the pathsection given a ratio of the entire Path
Get a series of information about the path at a certain time
getTorsoStepPose
(step_num)Get the torso position given a certain torso step
The time it takes for the robot to take a half step :return: Time in seconds
isFinished
(t)Whether the path is complete
isShortPath
(start_transform, end_transform)Determine whether the movement can be done with a short path of another type of path (bezier).
Position of the left foot on the ground at a certain foot step
leftRightFootStepRatio
(t[, post_pre_settings])Gets the ratio of the step of the foot given the time of the path :param t: The time of the path :param post_pre_settings: Which setting to use, whether post and pre steps are taken account for :return: (Step Number, Right foot's step ratio, Left foots step ratio)
How many footsteps used for moving forward and backwards the robot takes to run this path
Total number of steps in a path
parabolicPath
(startTransform, endTransform, ...)Calculates the position of a certain ratio on the parabolic path between two transforms http://mathworld.wolfram.com/ParabolicSegment.html
poseAtRatio
(r)Get the position given the ratio of the entire path
Position of the right foot on the ground at a certain foot step
show
()Draws the torso position
Displays a set of timing diagrams showing the foot step and ratios along the robot path
show_tf
([fig, tf_array, length])Helper function to draw the H-transforms equivalent to plotTransforms function in Matlab
Get estimated path ratio from the current time plus one more step, and then find the distance of that ratio and set the distance.
torsoPosition
(t[, invert_calibration])Retrieves the torso position at a given time of the path
Number of torso steps, a torso step is the amount of steps the body moves (similar to foot steps, but doesn't include turning in place.
The average time it takes for the robot's torso to make a single step
whatIsTheFootDoing
(step_num)What is the foot doing, returns right and left foot actions, if the number is 0, then it is waiting at torsoStep 0, if the number is 1, then it is waiting at torso step 1.
Attributes
start_transformed_inv
How much the torso bounces up and down while following the torso trajectory (m)
How much the torso sways left and right while following the torso trajectory (m)
How much the torso rotates while following the torso trajectory (yaw, pitch, roll)
The seperation of the feet while walking
The height of the step from the ground
The distance to the outwards direction when the robot takes a step, positive means away from the Path
The amount of rotation of the footstep, positive means the feet turns outwards to the side
Whether the first step is the left foot
How precise the curves are calculated.
A list of Path Sections used to define the path
- angularStepCount()
How many footsteps used for turning the robot takes to run this path
- Returns:
The number of steps
- createPathSection(start_transform: Transformation, end_transform: Transformation) PathSection
Create a path section between the two transforms
- Parameters:
start_transform – Starting robot position
end_transform – Ending robot position
- Returns:
Depending on whether its a short path, a bezier path or a short path
- duration() float
Get the duration in seconds for a given path
- Returns:
Duration of the paths in seconds
- dynamicallyUpdateGoalPosition(t, end_transform)
Updates the goal position dynamically (not working)
- Parameters:
t – Current time
end_transform – New goal position
- estimatedPositionAtTime(t) Transformation
Get an estimated position of the robot given a certain time. Used by strategy simulation. Do not use in the walking engine
- Parameters:
t – The relative time of the path
- Returns:
Position of the torso at the given time
- first_step_left
Whether the first step is the left foot
- footPosition(t: float) [<class 'soccer_common.transformation.Transformation'>, <class 'soccer_common.transformation.Transformation'>]
Returns the positions of both feet given a certain time :param t: Relative time of the entire robot path :return: [Transformation of right foot, Transformation of left foot]
- foot_separation
The seperation of the feet while walking
- full_step_time()
The time it takes for the robot to take a full step :return: Time in seconds
- getSubPathSectionAndRatio(r: float) -> (<class 'soccer_pycontrol.path_section.PathSection'>, <class 'float'>)
Returns the PathSection and ratio of the pathsection given a ratio of the entire Path
- Parameters:
r – ratio of the entire Path
- Returns:
Path section and the ratio of the Path Section
- getTimePathOfNextStep(t) -> (<class 'float'>, <class 'float'>, <class 'float'>, <class 'soccer_pycontrol.path_section.PathSection'>, <class 'float'>)
Get a series of information about the path at a certain time
- Parameters:
t – The time relative to the entire path’s time
- Returns:
a list of relavant information
- getTorsoStepPose(step_num) Transformation
Get the torso position given a certain torso step
- Parameters:
step_num – The body step of the path
- Returns:
A position of the robot’s torso at the spot
- half_step_time()
The time it takes for the robot to take a half step :return: Time in seconds
- isFinished(t)
Whether the path is complete
:param t The relative time of the path :return: True if the path has been completed walking
- isShortPath(start_transform: Transformation, end_transform: Transformation)
Determine whether the movement can be done with a short path of another type of path (bezier). Bezier is used only on simple forward paths, the rest use ShortPath
- Parameters:
start_transform – The start transform
end_transform – The end transform
- Returns:
- leftFootGroundPositionAtTorsoStep(n: int) Transformation
Position of the left foot on the ground at a certain foot step
- Parameters:
n – Body Step
- Returns:
Position given as a transformation
- leftRightFootStepRatio(t: float, post_pre_settings: ~soccer_pycontrol.path_foot.PostPreSetting = PostPreSetting.POST_AND_PRE) -> (<class 'int'>, <class 'float'>, <class 'float'>)
Gets the ratio of the step of the foot given the time of the path :param t: The time of the path :param post_pre_settings: Which setting to use, whether post and pre steps are taken account for :return: (Step Number, Right foot’s step ratio, Left foots step ratio)
- linearStepCount() float
How many footsteps used for moving forward and backwards the robot takes to run this path
- Returns:
The number of steps
- num_steps()
Total number of steps in a path
- parabolicPath(startTransform: Transformation, endTransform: Transformation, zdiff: float, sidediff: float, rotdiff: float, ratio: float) Transformation
Calculates the position of a certain ratio on the parabolic path between two transforms http://mathworld.wolfram.com/ParabolicSegment.html
- Parameters:
startTransform – Starting Transform of the Parabolic path
endTransform – End Transform of the Parabolic path
zdiff – The height of the parabola
sidediff – The left right of the parabola
rotdiff – The amount the transformation rotates on its own axis (roll angle)
ratio – The ratio between the two transforms
- Returns:
The transform between the two points on the parabolic path
- path_sections
A list of Path Sections used to define the path
- poseAtRatio(r: float) Transformation
Get the position given the ratio of the entire path
- Parameters:
r – ratio of the entire Path
- Returns:
Position of the torso at that time
- rightFootGroundPositionAtTorsoStep(n: int) Transformation
Position of the right foot on the ground at a certain foot step
- Parameters:
n – Body Step
- Returns:
Position given as a transformation
- showTimingDiagram()[source]
Displays a set of timing diagrams showing the foot step and ratios along the robot path
- static show_tf(fig=None, tf_array=None, length=0)
Helper function to draw the H-transforms equivalent to plotTransforms function in Matlab
- Parameters:
fig – Shared figure object
tf_array – Array of transforms of size (4,4,n)
length – The 3rd dimension of the array, n
- Returns:
None
- step_height
The height of the step from the ground
- step_outwardness
The distance to the outwards direction when the robot takes a step, positive means away from the Path
- step_precision
How precise the curves are calculated. The amount of movement per given step_precision is calculated (s)
- step_rotation
The amount of rotation of the footstep, positive means the feet turns outwards to the side
- terminateWalk(t)
Get estimated path ratio from the current time plus one more step, and then find the distance of that ratio and set the distance. Stops the walking at a given time, ends the current PathSection’s trajectory
- Parameters:
t – Time relative to the Path
- torsoPosition(t: float, invert_calibration=False) Transformation
Retrieves the torso position at a given time of the path
- Parameters:
t – Time since the beginning of the robot path
- Returns:
The transformation of the torso position on the path
- torsoStepCount() int
Number of torso steps, a torso step is the amount of steps the body moves (similar to foot steps, but doesn’t include turning in place.
- Returns:
- torsoStepTime()
The average time it takes for the robot’s torso to make a single step
- Returns:
time in seconds
- torso_sidediff_sway
How much the torso sways left and right while following the torso trajectory (m)
- torso_thetadiff_sway
How much the torso rotates while following the torso trajectory (yaw, pitch, roll)
- torso_zdiff_sway
How much the torso bounces up and down while following the torso trajectory (m)
- whatIsTheFootDoing(step_num: int) [<class 'int'>, <class 'int'>]
What is the foot doing, returns right and left foot actions, if the number is 0, then it is waiting at torsoStep 0, if the number is 1, then it is waiting at torso step 1. If it is an array like [1, 3], it indicates that it is in the middle of the parabolic trajectory from torsoPose 1 to torsePose 3
- Parameters:
step_num – Step Pose
- Returns:
[right foot action, left foot action]