Main Page   Hardware Class Hierarchy   Hardware API     Mapping Class Hierarchy  Mapping API 

Primitive_Driver Class Reference

An object to control a differentially steered mobile platform using 2 encoded DC motors. (Ref. oEncodedMotor). This was tested using Hammamatsu P5587 photoreflectors for encoders using locked antiphase configuration, and a Hewlett Packard Encoder (5VDC input, 512 counts/rev.) using sign magnitude. More...

#include <primitive_driver.h>

Inheritance diagram for Primitive_Driver:

Geometry_Driver Motion_Driver Local_Waypoint_Driver

Public Member Functions

 Primitive_Driver (IOLINE Pencoder, IOLINE Sencoder, IOLINE,PORT,IOLINE,PORT,IOLINE tpu, IOLINE Pencoder, IOLINE Sencoder, IOLINE,PORT,IOLINE,PORT,IOLINE tpu, uint8 subclass=0)
 Quadrature encoding; sign-magnitude (enable toggling).

 Primitive_Driver (IOLINE encoder, IOLINE f, PORT,IOLINE,PORT,IOLINE tpu, IOLINE encoder, IOLINE f, PORT,IOLINE,PORT,IOLINE tpu, uint8 subclass=0)
 Single channel encoder, sign-magnitude (enable toggling).

 Primitive_Driver (IOLINE Pencoder, IOLINE Sencoder, IOLINE,PORT,IOLINE tpu, IOLINE Pencoder, IOLINE Sencoder, IOLINE,PORT, IOLINE rtpu, uint8 subclass=0)
 Quadrature encoding, sign magnitude (A/B toggling).

 Primitive_Driver (IOLINE encoder, IOLINE f, PORT,IOLINE tpu, IOLINE encoder, IOLINE,PORT, IOLINE, uint8 subclass=0)
 Single Channle encoding, sign magnitude (A/B toggling).

 Primitive_Driver (IOLINE Pencoder, IOLINE Sencoder, IOLINE ltpu, IOLINE Pencoder, IOLINE Sencoder, IOLINE rtpu, uint8 subclass=0)
 Quadrature encoding, locked antiphase.

 Primitive_Driver (IOLINE encoder, IOLINE ltpu, IOLINE encoder, IOLINE rtpu, uint8 subclass=0)
 Single Channel encoding, locked antiphase.

void Rpower (int p)
 // Set wrench effort to right motor. Percent to increase/decrease motor's power.
int: +/- percentage increase or decrease in power.


void Lpower (int p)
 Set wrench effort to left motor. Percent to increase/decrease motor's power.
int: +/- percentage increase or decrease in power.


void stop (int s=0)
 Stops both motors.

void primitive_motion (MOTION m, MILLIMETER s, bool ramp)
 Execute basic motions like forward, and rotate left or right.

uint8 status (void)
 Returns the current state of the top level component.

void status (uint8 s)
 Set the status of the component.


Static Public Member Functions

foo2 callback (void)
void teleoperate (bool b)
bool teleoperate (void)

Data Fields

int Label
oEncodedMotor _Lmotor
 Unfortunately, a lot of algorithms need access to changing the speed of the individual motors.

oEncodedMotor _Rmotor

Static Public Attributes

Watchdog watchdog
 Provides primitive mechanism to auto-shutoff primitive driver for safety reasons.


Protected Member Functions

 Primitive_Driver ()

Protected Attributes

uint8 _status
jaus_message PD_msg

Static Protected Attributes

bool _teleoperate

Private Member Functions

void init (uint8 subclass)

Friends

class Motion_Driver
class Geometry_Driver
void task_motion_driver (void)
void task_local_vector_driver (void)

Detailed Description

An object to control a differentially steered mobile platform using 2 encoded DC motors. (Ref. oEncodedMotor). This was tested using Hammamatsu P5587 photoreflectors for encoders using locked antiphase configuration, and a Hewlett Packard Encoder (5VDC input, 512 counts/rev.) using sign magnitude.

Note:
Left and right are as robot faces forward.
Operation
The Primitive_Driver allows basic control of a robot which has differentially steered motors. It uses two oEncodedMotors for motor control. The oSchedule is used to maintain current position, thus the oSchedule period changes both the rate at which the PID is calculated and the rate at which the robot speed is calculated in the motors. If the resolution on the encoder pattern is below 50 or so, the error involved in calculated millimeters/second becomes rather large unless you increase your period, which also of course increases time lag between the actual readings. The motors' speed are automatically adjusted based upon the speed set.
Be sure to disable both, if automatic speed adjustments are not desired.
Warning:
Currently, you can only declare one Primitive_Drivers because of internal limitations
Note:
The encoder's are automatically set to HIGH_PRIORITY through the oEncodedMotor.

Remarks

This object really becomes useful when experimenting whith different encoder patterns or robot bases. Instead of having to refigure all the information for making a turn, it is all done automatically for you. This allowed me to try an "encoder pattern generator" program and increase the number of patterns until the hardware was unable to keep up thus maximizing my rate.
It is difficult to specify speed. It must make some assumption about initial power supply--either being too fast or too slow. Especially burdensome is perhaps way too fast making it crash before it can slow it down. the solution I developed was with the battery method--by specifying the power needed to start moving and the maximum speed of the robot, it can interpolate the needed POWER by assuming a linear graph which is usually close enough.
In general, methods will use degrees (int) for the interface, but internally use radians (float). If this proves unsatisfactory, then I will switch to radians (How many know the exact value for 90 degrees in radians!).


Constructor & Destructor Documentation

Primitive_Driver IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  ,
PORT  ,
IOLINE  ,
PORT  ,
IOLINE  tpu,
IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  ,
PORT  ,
IOLINE  ,
PORT  ,
IOLINE  tpu,
uint8  subclass = 0
 

Quadrature encoding; sign-magnitude (enable toggling).

Parameters:
IOLINE Left motor Primary encoder channel on TPU port.
IOLINE Left motor Secondary encoder channel on TPU port.
IOLINE Left motor "Forward" channel.
PORT Left motor "Forward" port (E/F)
IOLINE Left motor "Reverse" channel.
PORT Left motor "Reverse" port (E/F)
IOLINE Left motor TPU pin used used for enable toggling on motor controller.
IOLINE Right motor Primary encoder channel on TPU port.
IOLINE Right motor Secondary encoder channel on TPU port.
IOLINE f Right motor "Forward" channel.
PORT fp Right motor "Forward" port (E/F)
IOLINE r Right motor "Reverse" channel.
PORT rp Right motor "Reverse" port (E/F)
IOLINE tpu Right motor TPU pin used used for enable toggling on motor controller.

Primitive_Driver IOLINE  encoder,
IOLINE  f,
PORT  ,
IOLINE  ,
PORT  ,
IOLINE  tpu,
IOLINE  encoder,
IOLINE  f,
PORT  ,
IOLINE  ,
PORT  ,
IOLINE  tpu,
uint8  subclass = 0
 

Single channel encoder, sign-magnitude (enable toggling).

Parameters:
IOLINE Left motor encoder channel on TPU port.
IOLINE Left motor "Forward" channel.
PORT Left motor "Forward" port (E/F)
IOLINE Left motor "Reverse" channel.
PORT Left motor "Reverse" port (E/F)
IOLINE Left motor TPU pin used used for enable toggling on motor controller.
IOLINE Right motor encoder channel on TPU port.
IOLINE f Right motor "Forward" channel.
PORT fp Right motor "Forward" port (E/F)
IOLINE r Right motor "Reverse" channel.
PORT rp Right motor "Reverse" port (E/F)
IOLINE tpu Right motor TPU pin used used for enable toggling on motor controller.

Primitive_Driver IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  ,
PORT  ,
IOLINE  tpu,
IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  ,
PORT  ,
IOLINE  rtpu,
uint8  subclass = 0
 

Quadrature encoding, sign magnitude (A/B toggling).

Parameters:
IOLINE Left motor Primary encoder channel on TPU port.
IOLINE Left motor Secondary encoder channel on TPU port.
IOLINE Left motor "Forward" channel.
PORT Left motor "Forward" port (E/F)
IOLINE tpu Left motor TPU channel used used for B ("reverse") channel toggling on motor controller.
IOLINE Right motor Primary encoder channel on TPU port.
IOLINE Right motor Secondary encoder channel on TPU port.
IOLINE f Right motor "Forward" channel.
PORT fp Right motor "Forward" port (E/F)
IOLINE tpu Right motor TPU channel used used for B ("reverse") channel toggling on motor controller.
MILLIMETER d wheel diameter.

Primitive_Driver IOLINE  encoder,
IOLINE  f,
PORT  ,
IOLINE  tpu,
IOLINE  encoder,
IOLINE  ,
PORT  ,
IOLINE  ,
uint8  subclass = 0
 

Single Channle encoding, sign magnitude (A/B toggling).

Parameters:
IOLINE Left motor encoder channel on TPU port.
IOLINE Left motor "Forward" channel.
PORT Left motor "Forward" port (E/F)
IOLINE tpu Left motor TPU channel used used for B ("reverse") channel toggling on motor controller.
IOLINE Right motor encoder channel on TPU port.
IOLINE f Right motor "Forward" channel.
PORT fp Right motor "Forward" port (E/F)
IOLINE tpu Right motor TPU channel used used for B ("reverse") channel toggling on motor controller.
MILLIMETER d wheel diameter.

Primitive_Driver IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  ltpu,
IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  rtpu,
uint8  subclass = 0
 

Quadrature encoding, locked antiphase.

Parameters:
IOLINE Left motor Primary encoder channel on TPU port.
IOLINE Left motor Secondary encoder channel on TPU port.
IOLINE tpu Left motor TPU channel used used for toggling on motor controller.
IOLINE Right motor Primary encoder channel on TPU port.
IOLINE Right motor Secondary encoder channel on TPU port.
IOLINE tpu Right motor TPU channel used used for toggling on motor controller.
MILLIMETER d wheel diameter.

Primitive_Driver IOLINE  encoder,
IOLINE  ltpu,
IOLINE  encoder,
IOLINE  rtpu,
uint8  subclass = 0
 

Single Channel encoding, locked antiphase.

Parameters:
IOLINE Left motor encoder channel on TPU port.
IOLINE tpu Left motor TPU channel used used for toggling on motor controller.
IOLINE Right motor encoder channel on TPU port.
IOLINE tpu Right motor TPU channel used used for toggling on motor controller.
MILLIMETER d wheel diameter.

Primitive_Driver  )  [protected]
 


Member Function Documentation

foo2 callback void   )  [static]
 

Reimplemented in Geometry_Driver, Local_Waypoint_Driver, and Motion_Driver.

void init uint8  subclass  )  [private]
 

void Lpower int  p  ) 
 

Set wrench effort to left motor. Percent to increase/decrease motor's power.
int: +/- percentage increase or decrease in power.

void primitive_motion MOTION  m,
MILLIMETER  s,
bool  ramp
 

Execute basic motions like forward, and rotate left or right.

void Rpower int  p  ) 
 

// Set wrench effort to right motor. Percent to increase/decrease motor's power.
int: +/- percentage increase or decrease in power.

void status uint8  s  ) 
 

Set the status of the component.

uint8 status void   ) 
 

Returns the current state of the top level component.

void stop int  s = 0  ) 
 

Stops both motors.

bool teleoperate void   )  [static]
 

void teleoperate bool  b  )  [static]
 


Friends And Related Function Documentation

friend class Geometry_Driver [friend]
 

friend class Motion_Driver [friend]
 

void task_local_vector_driver void   )  [friend]
 

Reimplemented in Geometry_Driver.

void task_motion_driver void   )  [friend]
 

Reimplemented in Geometry_Driver.


Field Documentation

oEncodedMotor _Lmotor
 

Unfortunately, a lot of algorithms need access to changing the speed of the individual motors.

oEncodedMotor _Rmotor
 

uint8 _status [protected]
 

bool _teleoperate [static, protected]
 

int Label
 

Reimplemented in Geometry_Driver.

jaus_message PD_msg [protected]
 

Watchdog watchdog [static]
 

Provides primitive mechanism to auto-shutoff primitive driver for safety reasons.


Generated on Mon Oct 8 19:32:27 2007 for OOMRM Mapping API by doxygen1.3