1. Introduction
This is the most important class. It is used to communicate with the robot by sending commands andretrieving data (including wheel odometry, digital and analog inputs,sonar data, and more).It is also used to provide
access to objects for controlling attached accessories,ArRangeDevice objects, ArAction objects,and others. For details on usage, and how the task cycle and obotstate synchronization works.
2. Member functions
///Starts the instance to do processing in this thread
void run(bool stopRunIfNotConnected,bool runNonThreaded =false);
/// Starts the instance to do processing in its own newthread
void runAsync(bool stopRunIfNotConnected,bool runNonThreadedPacketReader =false);
/// Returns whether the robot is currently running or not
bool isRunning(void)const;
/// Stops the robot from doing any more processing
void stopRunning(bool doDisconnect=true);
/// Sets the connection this instance uses
void setDeviceConnection(ArDeviceConnection *connection);
/// Gets the connection this instance uses
ArDeviceConnection*getDeviceConnection(void)const;
/// Questions whether the robot is connected or not
//return true if connected to a robot,false if not
bool isConnected(void)const { return myIsConnected; }
/// Connects to a robot, not returning until connectionmade or failed
bool blockingConnect(void);
/// Connects to a robot, from the robots own thread
bool asyncConnect(void);
/// Disconnects from a robot
bool disconnect(void);
/// Clears what direct motion commands have been given,so actions work
void clearDirectMotion(void);
/// Returns true if direct motion commands are blockingactions
bool isDirectMotion(void)const;
/// Sets the state reflection to be inactive (until motion or clearDirectMotion)
/// @see clearDirectMotion
void stopStateReflection(void);
/// Enables the motors on the robot
void enableMotors();
/// Disables the motors on the robot
void disableMotors();
/// Enables the sonar on the robot
void enableSonar();
/// Enables some of the sonar on the robot (the ones for autonomous driving)
void enableAutonomousDrivingSonar();
/// Disables the sonar on the robot
void disableSonar();
/// Stops the robot
/// @see clearDirectMotion
void stop(void);
/// Sets the velocity
/// @see clearDirectMotion
void setVel(double velocity);
/// Sets the velocity of the wheels independently
void setVel2(double leftVelocity,double rightVelocity);
/// Move the given distance forward/backwards
void move(double distance);
/// Sees if the robot is done moving the previously given move
bool isMoveDone(double delta = 0.0);
/// Sets the difference required for being done with a move
setMoveDoneDist(doubledist) { myMoveDoneDist =dist; }
/// Gets the difference required for being done with a move
getMoveDoneDist(void) {return myMoveDoneDist; }
/// Sets the heading
void setHeading(double heading);
/// Sets the rotational velocity
void setRotVel(double velocity);
/// Sets the delta heading
void setDeltaHeading(double deltaHeading);
/// Sees if the robot is done changing to the previously given set Heading
bool isHeadingDone(double delta = 0.0)const;
/// sets the difference required for being done with a heading change (e.g. used in isHeadingDone())
void setHeadingDoneDiff(doubledegrees)
{ myHeadingDoneDiff = degrees; }
/// Gets the difference required for being done with aheading change (e.g. used in isHeadingDone())
double getHeadingDoneDiff(void)const { return myHeadingDoneDiff;}
/// Sets the lateral velocity
/// @see clearDirectMotion
void setLatVel(double latVelocity);
/// sees if we're stopped
bool isStopped(double stoppedVel = 0.0,double stoppedRotVel =0.0, double stoppedLatVel =0.0);
/// Sets the vels required to be stopped
void setStoppedVels(double stoppedVel,double stoppedRotVel, double stoppedLatVel);
/// Sets the length of time a direct motion command will take precedence
/// over actions, in milliseconds
void setDirectMotionPrecedenceTime(int mSec);
/// Gets the length of time a direct motion command willtake precedence
/// over actions, in milliseconds
unsignedint getDirectMotionPrecedenceTime(void)const;
/// Sends a command to the robot with no arguments
bool com(unsignedchar command);
/// Sends a command to the robot with an int for argument
bool comInt(unsignedchar command, shortint argument);
/// Sends a command to the robot with two bytes for argument
bool com2Bytes(unsignedchar command, char high,char low);
/// Sends a command to the robot with a length-prefixedstring for argument
bool comStr(unsignedchar command, constchar *argument);
/// Sends a command to the robot with a length-prefixedstring for argument
bool comStrN(unsignedchar command, constchar *str, int size);
/// Sends a command containing exactly the data in the given buffer as argument
bool comDataN(unsignedchar command, constchar *data, int size);
/// Returns the robot's name that is set in its onboard firmware configuration
constchar * getRobotName(void)const { return myRobotName.c_str();}
/// Returns the type of the robot we are currently connected to
constchar * getRobotType(void)const { return myRobotType.c_str();}
/// Returns the subtype of the robot we are currently connected to
constchar * getRobotSubType(void)const
{ return myRobotSubType.c_str(); }
/// Gets the robot's absolute maximum translational velocity
double getAbsoluteMaxTransVel(void)const
{ return myAbsoluteMaxTransVel; }
/// Sets the robot's absolute maximum translational velocity
bool setAbsoluteMaxTransVel(double maxVel);
/// Gets the robot's absolute maximum translational velocity
double getAbsoluteMaxTransNegVel(void)const
{ return myAbsoluteMaxTransNegVel; }
/// Sets the robot's absolute maximum translational velocity
bool setAbsoluteMaxTransNegVel(double maxVel);
/// Gets the robot's absolute maximum translational acceleration
double getAbsoluteMaxTransAccel(void)const
{ return myAbsoluteMaxTransAccel; }
/// Sets the robot's absolute maximum translational acceleration
bool setAbsoluteMaxTransAccel(double maxAccel);
/// Gets the robot's absolute maximum translational deceleration
double getAbsoluteMaxTransDecel(void)const
{ return myAbsoluteMaxTransDecel; }
/// Sets the robot's absolute maximum translational deceleration
bool setAbsoluteMaxTransDecel(double maxDecel);
/// Gets the robot's absolute maximum rotational velocity
getAbsoluteMaxRotVel(void)const
{ return myAbsoluteMaxRotVel; }
/// Sets the robot's absolute maximum rotational velocity
bool setAbsoluteMaxRotVel(double maxVel);
/// Gets the robot's absolute maximum rotationalacceleration
double getAbsoluteMaxRotAccel(void)const
{ return myAbsoluteMaxRotAccel; }
/// Sets the robot's absolute maximum rotationalacceleration
bool setAbsoluteMaxRotAccel(double maxAccel);
/// Gets the robot's absolute maximum rotationaldeceleration
double getAbsoluteMaxRotDecel(void)const
{ return myAbsoluteMaxRotDecel; }
/// Sets the robot's absolute maximum rotationaldeceleration
bool setAbsoluteMaxRotDecel(double maxDecel);
/// Gets the robot's absolute maximum lateral velocity
double getAbsoluteMaxLatVel(void)const
{ return myAbsoluteMaxLatVel; }
/// Sets the robot's absolute maximum lateral velocity
bool setAbsoluteMaxLatVel(double maxVel);
/// Gets the robot's absolute maximum lateralacceleration
double getAbsoluteMaxLatAccel(void)const
{ return myAbsoluteMaxLatAccel; }
/// Sets the robot's absolute maximum lateralacceleration
bool setAbsoluteMaxLatAccel(double maxAccel);
/// Gets the robot's absolute maximum lateraldeceleration
double getAbsoluteMaxLatDecel(void)const
{ returnmyAbsoluteMaxLatDecel; }
/// Sets the robot'sabsolute maximum lateral deceleration
boolsetAbsoluteMaxLatDecel(double maxDecel);