Interface Chassis
-
- All Known Implementing Classes:
WheeledChassis
public interface ChassisRepresents the chassis of a robot. The Chassis provides a control system for driving a mobile robot.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 aresetVelocityandstop.
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 arearc,rotateandtravel. The move mode methods use speed and acceleration parameters that have to be specified beforehand usingsetSpeedandsetAcceleration.
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 methodssetVelocityandstopensure smooth speed transitions using the acceleration settings that are specified using thesetAccelerationmethod. 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 aPoseProviderthat keeps track of the robots pose using the encoders of the wheels. The object is provided by thegetPoseProvidermethod.- Author:
- Aswin Bouwmeester
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidarc(double radius, double angle)Moves the chassis in an arcdoublegetAngularAcceleration()Gets the setting for angular acceleration as is used in travel, arc, rotate and setvelocity methodsdoublegetAngularSpeed()Gets the setting for angular speed as is used in travel, arc, and rotate methodsdoublegetAngularVelocity()Returns the angular component of the current speed of the robotMatrixgetCurrentSpeed()Returns a matrix containing the current speed of the robot.MovegetDisplacement(Move move)Method used by the MovePilot to update a move object that describes the move executed since the last call to startMove.doublegetLinearAcceleration()Gets the setting for linear acceleration as is used in travel, arc, rotate and setvelocity methodsdoublegetLinearDirection()Returns the current direction of the linear speed component of the robotdoublegetLinearSpeed()Gets the setting for linear speed as is used in moveTo, Arc, and Rotate methodsdoublegetLinearVelocity()Returns the linear component of the current speed of the robotdoublegetMaxAngularSpeed()Returns how fast the robot can rotate.doublegetMaxLinearSpeed()Returns the maximum speed of the robot.doublegetMinRadius()Returns the smallest possible radius this chassis is able turnPoseProvidergetPoseProvider()Returns an Pose provider that uses odometry to keep track of the pose of the chassisbooleanisMoving()Returns true if the robot is moving.booleanisStalled()Returns true if at least one of the wheels is stalledvoidmoveStart()Method used by the MovePilot to tell the chassis that a new move has started.voidrotate(double angular)Rotates the chassis for the specified number of degreesvoidsetAcceleration(double forwardAcceleration, double angularAcceleration)Sets the acceleration of the chassis for the moveTo and travel methodsvoidsetAngularAcceleration(double angularAcceleration)Sets the angular acceleration as is used in travel, arc, rotate and setvelocity methodsvoidsetAngularSpeed(double angularSpeed)Sets the angular speed as is used in travel, arc, and rotate methodsvoidsetLinearAcceleration(double linearAcceleration)Sets the linear acceleration as is used in travel, arc, rotate and setvelocity methodsvoidsetLinearSpeed(double linearSpeed)Sets the linear speed as is used in travel, arc, and rotate methodsvoidsetSpeed(double linearSpeed, double angularSpeed)Sets the speed of the chassis for the moveTo methodvoidsetVelocity(double linearSpeed, double angularSpeed)Moves the chassis with specified speedvoidsetVelocity(double linearSpeed, double direction, double angularSpeed)Moves a holonomic chassis with specified speedvoidstop()Makes the robot stop and returns immediately.voidtravel(double linear)Moves the chassis the specified distancevoidtravelCartesian(double xSpeed, double ySpeed, double angularSpeed)Moves a holonomic robot with the specified speed.voidwaitComplete()Blocks while the chassis is moving, returns when all wheels have stopped (including stops caused by stalls)
-
-
-
Method Detail
-
getLinearSpeed
double getLinearSpeed()
Gets the setting for linear speed as is used in moveTo, Arc, and Rotate methods- Returns:
- Linear speed in robot units/second
-
setLinearSpeed
void setLinearSpeed(double linearSpeed)
Sets the linear speed as is used in travel, arc, and rotate methods- Parameters:
linearSpeed- Linear speed in robot units/second
-
getAngularSpeed
double getAngularSpeed()
Gets the setting for angular speed as is used in travel, arc, and rotate methods- Returns:
- Angular speed in degrees/second.
-
setAngularSpeed
void setAngularSpeed(double angularSpeed)
Sets the angular speed as is used in travel, arc, and rotate methods- Parameters:
angularSpeed- Angular speed in degrees/second.
-
getLinearAcceleration
double getLinearAcceleration()
Gets the setting for linear acceleration as is used in travel, arc, rotate and setvelocity methods- Returns:
- Linear acceleration in robot units/second^2
-
setLinearAcceleration
void setLinearAcceleration(double linearAcceleration)
Sets the linear acceleration as is used in travel, arc, rotate and setvelocity methods- Parameters:
linearAcceleration- Linear acceleration in robot units/second^2
-
getAngularAcceleration
double getAngularAcceleration()
Gets the setting for angular acceleration as is used in travel, arc, rotate and setvelocity methods- Returns:
- Angular acceleration in degrees/second^2.
-
setAngularAcceleration
void setAngularAcceleration(double angularAcceleration)
Sets the angular acceleration as is used in travel, arc, rotate and setvelocity methods- Parameters:
angularAcceleration- Angular Acceleration in degrees/second^2.
-
getCurrentSpeed
Matrix getCurrentSpeed()
Returns a matrix containing the current speed of the robot.- Returns:
- A matrix (3x1) containing the current speed of the robot. First row contains linear speed, second row contains direction of linear speed, third row contains angular speed.
-
isMoving
boolean isMoving()
Returns true if the robot is moving.- Returns:
- true if the robot is moving
-
stop
void stop()
Makes the robot stop and returns immediately.
-
setVelocity
void setVelocity(double linearSpeed, double angularSpeed)Moves the chassis with specified speed- Parameters:
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.
-
setVelocity
void setVelocity(double linearSpeed, double direction, double angularSpeed)Moves a holonomic chassis with specified speed- Parameters:
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.
-
travelCartesian
void travelCartesian(double xSpeed, double ySpeed, double angularSpeed)Moves a holonomic robot with the specified speed.
The method will throw an exception when issued on a differential chassis.- Parameters:
xSpeed- speed along the robots x-axisySpeed- speed along the robots y-axisangularSpeed- angular component of the robot speed expressed in degrees/second.
-
travel
void travel(double linear)
Moves the chassis the specified distance- Parameters:
linear- linear component of the robot speed, expressed in the same unit as the wheel diameter.
-
arc
void arc(double radius, double angle)Moves the chassis in an arc- Parameters:
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.
-
getMaxLinearSpeed
double getMaxLinearSpeed()
Returns the maximum speed of the robot.- Returns:
- Speed in robot units
-
getMaxAngularSpeed
double getMaxAngularSpeed()
Returns how fast the robot can rotate.- Returns:
- Speed in degrees / second
-
waitComplete
void waitComplete()
Blocks while the chassis is moving, returns when all wheels have stopped (including stops caused by stalls)
-
isStalled
boolean isStalled()
Returns true if at least one of the wheels is stalled- Returns:
- true if at least one of the wheels is stalled
-
getMinRadius
double getMinRadius()
Returns the smallest possible radius this chassis is able turn- Returns:
- radius in robot units
-
setSpeed
void setSpeed(double linearSpeed, double angularSpeed)Sets the speed of the chassis for the moveTo method- Parameters:
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.
-
setAcceleration
void setAcceleration(double forwardAcceleration, double angularAcceleration)Sets the acceleration of the chassis for the moveTo and travel methods- Parameters:
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.
-
getPoseProvider
PoseProvider getPoseProvider()
Returns an Pose provider that uses odometry to keep track of the pose of the chassis- Returns:
- an Pose provider that uses odometry to keep track of the pose of the chassis
-
moveStart
void moveStart()
Method used by the MovePilot to tell the chassis that a new move has started. This method is used in conjuction with the getDisplacement method.
-
getDisplacement
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.This method is only to be used by applications that apply just moves that meet the following conditions:
- The move must start and end with the robot being motionless
- The speed ratio between the wheels must be constant during the move
- Parameters:
move- The move object to update
-
rotate
void rotate(double angular)
Rotates the chassis for the specified number of degrees- Parameters:
angular-
-
getLinearVelocity
double getLinearVelocity()
Returns the linear component of the current speed of the robot- Returns:
- linear speed in robot units/second
-
getLinearDirection
double getLinearDirection()
Returns the current direction of the linear speed component of the robot- Returns:
- direction in degrees
-
getAngularVelocity
double getAngularVelocity()
Returns the angular component of the current speed of the robot- Returns:
- Angular speed in degrees/second
-
-