public interface Chassis
How to use a Chassis object
The primary goal of the chassis is to make a robot move.
This can be done in two different ways.
One way is by specifying the speed at which a chassis should move, this is called velocity mode.
The primary methods for this mode are setVelocity
and stop
.
The second way is by specifying the kind of move the chassis should make, this is called move mode.
The primary methods for this mode are arc
, rotate
and travel
.
The move mode methods use speed and acceleration parameters that have to be specified beforehand using setSpeed
and setAcceleration
.
Depending on the application one of these modes will suit better, but the modes can be used together.
Understanding linear and angular velocity and acceleration
Within the context of the chassis speed and acceleration have both a linear and an angular component.
The linear component describes the forward speed (or acceleration) of the robot.
It specifies the speed of the robot traveling a straight line using the same unit as was used to specify the wheels of the chassis.
The linear speed is always the speed of the center of the robot, when driving an arc the forward speed of the outer wheel exceeds the speed of the center of the chassis.
The angular component of speed (or acceleration) describes how fast the robot is turning around its center. This is always expressed in degrees/second.
When using velocity based methods the chassis combines both speed elements to calculate the speed of each of the wheels.
This results in a movement of the robot that can be anything from a rotation around its center (when the linear speed component is zero)
to a curve (when both components are not zero) to a straight line (when the angular component is zero).
When using move based methods the speed settings are used to calculate the speed at which a move can be made.
If, for example, a very low angular speed has been set then this influences the speed at which an arc will be driven.
The chassis makes sure the forward speed will be such that the angular speed will not exceed the specified setting.
Speed transitions
To prevent jerky movements of the robot the velocity based methods setVelocity
and stop
ensure smooth speed transitions using the acceleration settings that are specified using the
setAcceleration
method.
This means that each of the wheels of the chassis takes exactly the same time to reach final speed,
no matter what the speed of the wheels was at the moment the travel method was issued.
The move based methods do not know these smooth transitions.
These methods assume that the robot is at stand still when the method is issued and that the robot is at stand still again when the move ends.
(Without this assumption it cannot be guaranteed that the trajectory of the robot has indeed the same shape as the method name implies.)
Odometry
The chassis can provide a PoseProvider
that keeps track of the robots pose using the encoders of the wheels.
The object is provided by the getPoseProvider
method.
Modifier and Type | Method and Description |
---|---|
void |
arc(double radius,
double angle)
Moves the chassis in an arc
|
double |
getAngularAcceleration()
Gets the setting for angular acceleration as is used in travel, arc, rotate and setvelocity methods
|
double |
getAngularSpeed()
Gets the setting for angular speed as is used in travel, arc, and rotate methods
|
double |
getAngularVelocity()
Returns the angular component of the current speed of the robot
|
Matrix |
getCurrentSpeed()
Returns a matrix containing the current speed of the robot.
|
Move |
getDisplacement(Move move)
Method used by the MovePilot to update a move object that describes the move executed since the last call to startMove.
|
double |
getLinearAcceleration()
Gets the setting for linear acceleration as is used in travel, arc, rotate and setvelocity methods
|
double |
getLinearDirection()
Returns the current direction of the linear speed component of the robot
|
double |
getLinearSpeed()
Gets the setting for linear speed as is used in moveTo, Arc, and Rotate methods
|
double |
getLinearVelocity()
Returns the linear component of the current speed of the robot
|
double |
getMaxAngularSpeed()
Returns how fast the robot can rotate.
|
double |
getMaxLinearSpeed()
Returns the maximum speed of the robot.
|
double |
getMinRadius()
Returns the smallest possible radius this chassis is able turn
|
PoseProvider |
getPoseProvider()
Returns an Pose provider that uses odometry to keep track of the pose of the chassis
|
boolean |
isMoving()
Returns true if the robot is moving.
|
boolean |
isStalled()
Returns true if at least one of the wheels is stalled
|
void |
moveStart()
Method used by the MovePilot to tell the chassis that a new move has started.
|
void |
rotate(double angular)
Rotates the chassis for the specified number of degrees
|
void |
setAcceleration(double forwardAcceleration,
double angularAcceleration)
Sets the acceleration of the chassis for the moveTo and travel methods
|
void |
setAngularAcceleration(double angularAcceleration)
Sets the angular acceleration as is used in travel, arc, rotate and setvelocity methods
|
void |
setAngularSpeed(double angularSpeed)
Sets the angular speed as is used in travel, arc, and rotate methods
|
void |
setLinearAcceleration(double linearAcceleration)
Sets the linear acceleration as is used in travel, arc, rotate and setvelocity methods
|
void |
setLinearSpeed(double linearSpeed)
Sets the linear speed as is used in travel, arc, and rotate methods
|
void |
setSpeed(double linearSpeed,
double angularSpeed)
Sets the speed of the chassis for the moveTo method
|
void |
setVelocity(double linearSpeed,
double angularSpeed)
Moves the chassis with specified speed
|
void |
setVelocity(double linearSpeed,
double direction,
double angularSpeed)
Moves a holonomic chassis with specified speed
|
void |
stop()
Makes the robot stop and returns immediately.
|
void |
travel(double linear)
Moves the chassis the specified distance
|
void |
travelCartesian(double xSpeed,
double ySpeed,
double angularSpeed)
Moves a holonomic robot with the specified speed.
|
void |
waitComplete()
Blocks while the chassis is moving, returns when all wheels have stopped
(including stops caused by stalls)
|
double getLinearSpeed()
void setLinearSpeed(double linearSpeed)
linearSpeed
- Linear speed in robot units/seconddouble getAngularSpeed()
void setAngularSpeed(double angularSpeed)
angularSpeed
- Angular speed in degrees/second.double getLinearAcceleration()
void setLinearAcceleration(double linearAcceleration)
linearAcceleration
- Linear acceleration in robot units/second^2double getAngularAcceleration()
void setAngularAcceleration(double angularAcceleration)
angularAcceleration
- Angular Acceleration in degrees/second^2.Matrix getCurrentSpeed()
boolean isMoving()
void stop()
void setVelocity(double linearSpeed, double angularSpeed)
linearSpeed
- linear component of the robot speed, expressed in the same unit as the wheel diameter.angularSpeed
- angular component of the robot speed expressed in degrees/second.void setVelocity(double linearSpeed, double direction, double angularSpeed)
linearSpeed
- linear component of the robot speed, expressed in the same unit as the wheel diameter.direction
- The direction of the linear speedangularSpeed
- angular component of the robot speed expressed in degrees/second.void travelCartesian(double xSpeed, double ySpeed, double angularSpeed)
xSpeed
- speed along the robots x-axisySpeed
- speed along the robots y-axisangularSpeed
- angular component of the robot speed expressed in degrees/second.void travel(double linear)
linear
- linear component of the robot speed, expressed in the same unit as the wheel diameter.void arc(double radius, double angle)
radius
- the radius of the arc.
A positive radius means the center of the arc is on the left side of the robot,
the center of a negative arc is on the right side of the robot. Infinite radius is not allowed.
A radius of 0 makes the robot spin in place.angle
- The number of degrees of the arc. A positive number of degrees makes the robot go forward,
a negative number makes it go backward.double getMaxLinearSpeed()
double getMaxAngularSpeed()
void waitComplete()
boolean isStalled()
double getMinRadius()
void setSpeed(double linearSpeed, double angularSpeed)
linearSpeed
- linear component of the robot speed, expressed in the same unit as the wheel diameter.angularSpeed
- angular component of the robot speed expressed in degrees/second.void setAcceleration(double forwardAcceleration, double angularAcceleration)
forwardAcceleration
- linear component of the robot acceleration, expressed in robot units/second^2.angularAcceleration
- angular component of the robot speed expressed acceleration, expressed in degrees/second^2.PoseProvider getPoseProvider()
void moveStart()
Move getDisplacement(Move move)
This method is only to be used by applications that apply just moves that meet the following conditions:
move
- The move object to updatevoid rotate(double angular)
angular
- double getLinearVelocity()
double getLinearDirection()
double getAngularVelocity()