Module: robotics.motion
functionality for motion including generation of trajectories with acceleration profiles, path planning and motion
Author: Johannes Gerstmayr
Date: 2022-02-16
CLASS ProfileConstantAcceleration (in module robotics.motion)
class description: class to create a constant acceleration (optimal) PTP trajectory; trajectory ignores global max. velocities and accelerations
input:
finalCoordinates: list or numpy array with final coordinates for profileduration: duration (time) for profile
output: returns profile object, which is then used to compute interpolated trajectory
Class function: init
__init__(self, finalCoordinates, duration)
class function description: initialize ProfileConstantAcceleration with vector of final coordinates and duration (time span)
Class function: GetBasicProfile
GetBasicProfile(self, initialTime, initialCoordinates, globalMaxVelocities, globalMaxAccelerations)
class function description: return a class representing profile which is used in Trajectory
Relevant Examples (Ex) and TestModels (TM) with weblink to github: humanRobotInteraction.py (Ex), mobileMecanumWheelRobotWithLidar.py (Ex), ROSMobileManipulator.py (Ex), serialRobotFlexible.py (Ex), serialRobotInteractiveLimits.py (Ex), movingGroundRobotTest.py (TM), serialRobotTest.py (TM), …
CLASS ProfileLinearAccelerationsList (in module robotics.motion)
class description: class to create a linear acceleration PTP profile, using a list of accelerations to define the profile; the (joint) coordinates and velocities are computed relative to values of previous profiles; ignores global max. accelerations and velocities of Trajectory
input:
accelerationList: list of tuples (relativeTime, accelerationVector) in which relativeTime is the time relative to the start of the profile (first time must be zero!) and accelerationVector is the list of accelerations of this time point, which is then linearly interpolated
output: returns profile object, which is then used to compute interpolated trajectory in class Trajectory
example:
profile = ProfileLinearAccelerationsList([(0,[0.,1.,2]), (0,[1.,1.,-2])])
Class function: init
__init__(self, accelerationList)
class function description: initialize ProfileLinearAccelerationsList with a list of tuples containing time and acceleration vector
Class function: GetBasicProfile
GetBasicProfile(self, initialTime, initialCoordinates, globalMaxVelocities, globalMaxAccelerations)
class function description: return a class representing profile which is used in Trajectory
CLASS ProfilePTP (in module robotics.motion)
class description: class to create a synchronous motion PTP trajectory, using max. accelerations and max velocities; duration automatically computed
input:
finalCoordinates: list or numpy array with final coordinates for profilemaxVelocities: list or numpy array with maximum velocities; may be empty list []; used if smaller than globalMaxVelocitiesmaxAccelerations: list or numpy array with maximum accelerations; may be empty list []; used if smaller than globalMaxAccelerations
output: returns profile object, which is then used to compute interpolated trajectory
Class function: init
__init__(self, finalCoordinates, syncAccTimes = True, maxVelocities = [], maxAccelerations = [])
class function description: initialize ProfilePTP with final coordinates of motion, optionally max. velocities and accelerations just for this profile (overrides global settings)
Class function: GetBasicProfile
GetBasicProfile(self, initialTime, initialCoordinates, globalMaxVelocities, globalMaxAccelerations)
class function description: return a class representing profile which is used in Trajectory
Relevant Examples (Ex) and TestModels (TM) with weblink to github: serialRobotFlexible.py (Ex), serialRobotInteractiveLimits.py (Ex), serialRobotInverseKinematics.py (Ex), serialRobotKinematicTree.py (Ex), serialRobotTSD.py (Ex)
CLASS Trajectory (in module robotics.motion)
class description: class to define (PTP) trajectories for robots and multibody systems; trajectories are defined for a set of coordinates (e.g. joint angles or other coordinates which need to be interpolated over time)
example:
#create simple trajectory for two joint coordinates:
traj = Trajectory(initialCoordinates=[1,1], initialTime=1)
#add optimal trajectory with max. accelerations:
traj.Add(ProfileConstantAcceleration([2.,3.],2.))
traj.Add(ProfileConstantAcceleration([3.,-1.],2.))
#add profile with limited velocities and accelerations:
traj.Add(ProfilePTP([1,1],syncAccTimes=False, maxVelocities=[1,1], maxAccelerations=[5,5]))
#now evaluate trajectory at certain time point (this could be now applied in a user function)
[s,v,a] = traj.Evaluate(t=0.5)
Class function: init
__init__(self, initialCoordinates, initialTime = 0, maxVelocities = [], maxAccelerations = [])
class function description: initialize robot link with parameters, being self-explaining
input:
initialTime: initial time for initial coordinatesinitialCoordinates: initial coordinates for profilemaxVelocities: list or numpy array to describe global maximum velocities per coordinatemaxAccelerations: list or numpy array to describe global maximum accelerations per coordinate
Class function: GetFinalCoordinates
class function description: returns the coordinates at the end of the (currently) Final profile
Class function: Add
class function description: add successively profiles, using MotionProfile class
Class function: GetTimes
class function description: return vector of times of start/end of profiles
Class function: Initialize
class function description: initialize some parameters for faster evaluation
Class function: Evaluate
class function description: return interpolation of trajectory for coordinates, velocities and accelerations at given time
output: [s, v, a] as numpy arrays representing coordinates, velocities and accelerations
Class function: EvaluateCoordinate
EvaluateCoordinate(self, t, coordinate)
class function description: return interpolation of trajectory for coordinate, including velocity and acceleration coordinate at given time
output: [s, v, a] being scalar position, velocity and acceleration
notes: faster for single coordinate than Evaluate(…)
Class function: iter
class function description: iterator allows to use for x in trajectory: … constructs
Class function: getitem
class function description: access to profiles via operator [], allowing trajectory[0], etc.
Class function: len
class function description: allow using len(trajectory)
Class function: repr
class function description: representation of Trajectory is given a list of profiles, allowing easy inspection of data
Relevant Examples (Ex) and TestModels (TM) with weblink to github: humanRobotInteraction.py (Ex), mobileMecanumWheelRobotWithLidar.py (Ex), ROSMobileManipulator.py (Ex), serialRobotFlexible.py (Ex), serialRobotInteractiveLimits.py (Ex), movingGroundRobotTest.py (TM), serialRobotTest.py (TM), …