The pose class allows for a posing of objects in 2D space. The pose uses a right-hand coordinate system with counter-clockwise measurement of theta from the x-axis
There are several ways to create a pose:
Pose(x,y,theta) | A pose at x,y and orientation theta |
Pose(x,y) | Same as Pose(x,y,0) |
Pose() | Same as Pose(0,0,0) |
Pose([x,y,theta]) | Same as Pose(x,y,theta) |
There are several ways to access pose parameters:
x, y, theta = pose
x, y, theta = pose.get_list()
x = pose.x; y = pose.y; theta = pose.theta
Compare this pose to other. Returns True if the relative distance in x, y and theta is smaller than epsilon
Set all or some pose parameters.
Possible arguments are:
set_pose(x, y, theta) | Set all of x, y and theta |
set_pose(another_pose) | Use x, y and theta from another pose |
set_pose(x = 3.0) | Only change the x position |
set_pose(theta = pi, y = 3.0) | Only change the y position and orientation |
set_pose(another_pose, y = 1) | Use x and theta from another pose, use y=1 |
The base class for all objects that can be drawn in the simulator. Every SimObject has a pose, an envelope and a color.
Parameters: |
|
---|
Draws the object using renderer (see Renderer).
The object doesn’t have to use only one color. It doesn’t even have to use its internal color while drawing.
Get the envelope of the object in object’s local coordinates.
The envelope is a list of xy pairs, describing the shape of the bounding polygon.
Get the envelope of the object in world coordinates. Used for checking collision.
The envelope is cached, and will be recalculated if recalculate is True.
Get the smallest rectangle that contains the object as a tuple (x, y, width, height).
The polygon is a simobject that gets the envelope supplied at construction. It draws itself as a filled polygon.
Parameters: |
|
---|
The cloud is a collection of points.
Append a point at pose to the collection. The orientation of the pose is ignored
Draw a polyline with modes at all added points, using the internal color
The path is a simobject that draws itself as a polyline. The line starts at start, and can be continued by adding points using add_point().
Parameters: |
|
---|
The path is used by the simulator to track the history of robot motion