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

Geometry_Driver Class Reference

[Ref. JAUS component ID 44] A class which allows navigation along a path described by a primitive geometrical shape. Currently supported shapes include line (vector) and circle. More...

#include <local_vector_driver.h>

Inheritance diagram for Geometry_Driver:

Primitive_Driver Motion_Driver Local_Waypoint_Driver

Public Member Functions

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

void travel (MOTION idir, ENCODER_TYPE s, ENCODER_TYPE radius, FIXED_RADIAN idirection, FIXED_RADIAN c)
 Method to travel a fraction of a circular arc, c (radians) with given circle radius.

void travel (MOTION idir, ENCODER_TYPE EU_s, const point &P2, FIXED_RADIAN Fidirection)
 travel Forward Only form #1 (point)

void travel (MOTION idir, ENCODER_TYPE EU_s, MILLIMETER idistance)
 travel Forward form #2 (millimeter--Quick move short cut)

void travel (MOTION idir)
 STOP Only form of travel.

void travel (MOTION idir, SPEED speed, const point &P1, const point &P2, int weight)
 Segment Driver form Method to travel based upon 2 points and a third control point with weighting (segment driver).

void heading (ENCODER_TYPE s, FIXED_RADIAN destination)
 Given desired orientation and speed, automatically turn to proper orientation at that speed. Method automatically calculates whether it should turn left or right based upon current orientation and new orientation.

void keep_straight (void)
 function to maintain position on course between inital and final positions given its present location.

int offset (void)
 How much we deviate from where we should be.

DEGREE face (void)
 Return current facing (degrees).

void linear_path (int &, int &, oPID &, bool &, bool &)
 control function to maintain a straight line.

bool complete ()
 Returns true if path is complete.

void control_points (const point &p1, const point &p2)
 Currently, p1 is current location and p2 is destination (used in PID).

void WSwrite (void)
 Geometry_Driver (IOLINE Pencoder, IOLINE Sencoder, IOLINE f, PORT fp, IOLINE tpu, IOLINE Pencoder, IOLINE Sencoder, IOLINE rf, PORT rfp, IOLINE rtpu, uint8 subclass=0)
 Quadrature encoding, sign magnitude (A/B toggling).

void travel (MOTION idir, SPEED s, MILLIMETER radius, DEGREE idirection, RADIAN c=1.570796)
 Method to travel a fraction of a circular arc, c (radians) with given circle radius.

void travel (MOTION idir, SPEED speed, const point &P1, const point &P2, int weight)
 Method to travel based upon 2 points and a third control point with weighting (segment driver).

void initial_heading (POSITION, POSITION, DEGREE)
 Sets the initial orientation of the robot (should be done before anything).

void heading (SPEED s, DEGREE destination)
 Given desired orientation and speed, automatically turn to proper orientation at that speed. Method automatically calculates whether it should turn left or right based upon current orientation and new orientation.

void keep_straight (void)
 function to maintain position on course between inital and final positions given its present location.

int offset (void)
 How much we deviate from where we should be.

DEGREE face (void)
 Return current facing (degrees).

void segment_path (int &dx, int &dy, oPID &pid, bool &lpower, bool &rpower)
void circular_path (int &, int &, oPID &, bool &, bool &)
 Control function to maintain a circular path.

void linear_path (int &, int &, oPID &, bool &, bool &)
 control function to maintain a straight line.

bool complete ()
 Returns true if path is complete.

POSITION x0 ()
POSITION y0 ()
POSITION centerx ()
POSITION centery ()
POSITION distance (void)
POSITION current_distance ()
RADIAN get_stop (void)
SPEED get_global_speed (void)
SPEED get_actual_speed (void)
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

MILLIMETER distance (void)
 If oSchedule period has changed, then be sure to call this: Geometry_Driver::syncronize();.

MILLIMETER get_actual_speed (void)
MILLIMETER x0 ()
MILLIMETER y0 ()
MILLIMETER current_distance ()
RADIAN get_stop (void)
MILLIMETER get_global_speed (void)
void syncronize (void)
 If oSchedule period has changed, then be sure to call this: Geometry_Driver::syncronize();.

void teleoperate (bool b)
bool teleoperate (void)

Data Fields

int Label
Fl_Value_Output * Distance
Fl_Value_Output * Current_Distance
Fl_Value_Output * Speed
Fl_Value_Output * EM2_Speed
Fl_Value_Output * X
Fl_Value_Output * Y
Fl_Value_Output * Angle
Fl_Value_Output * X0
Fl_Value_Output * Y0
Fl_Light_Button * Operate
Fl_Value_Output * Stop
Fl_Output * Motion
Fl_Choice * FL_unit
Fl_Value_Input * FL_mapunit
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

 Geometry_Driver (void)
 Geometry_Driver (void)

Static Protected Member Functions

foo2 callback (void)

Protected Attributes

ENCODER_TYPE EU_distance
FIXED_RADIAN F_STOP
bool _complete
ENCODER_TYPE EU_global_speed
MILLIMETER MM_current_distance
point _p1
point _p2
float _weight
FIXED_METER FM_offset
ENCODER_TYPE EU_centerx
ENCODER_TYPE EU_centery
ENCODER_TYPE EU_distance2go
FIXED_RADIAN F_Tradian
ENCODER_TYPE EU_x0
ENCODER_TYPE EU_y0
MILLIMETER _distance2go
int _distance
DEGREE _Tdegree
POSITION _x0
POSITION _y0
POWER _wrench_effort
uint8 _status
jaus_message PD_msg

Static Protected Attributes

bool _teleoperate

Private Member Functions

void prestuff (ENCODER_TYPE EU_S)
void poststuff (MOTION idir, ENCODER_TYPE EU_left, ENCODER_TYPE EU_right)

Private Attributes

RADIAN _STOP
int _offset
POSITION _centerx
POSITION _centery
FIXED_POSITION _current_distance

Friends

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

Detailed Description

[Ref. JAUS component ID 44] A class which allows navigation along a path described by a primitive geometrical shape. Currently supported shapes include line (vector) and circle.

A class which allows navigation along a path described by a primitive geometrical shape. Currently supported shapes include line (vector) and circle. In JAUS terminology this would be the vector driver; this deviates from JAUS in that JAUS defines a vector driver and a segment path driver seperately, this methodology rather simply defines a driver for which basic gemetric primitives form the basis--a vector simply being one of these primitve shapes supported.

Operation
Each primitive operation should have at least two basic properties:
Subclassing Primitive Driver?
I just remembered why I did not subclass Prmitive_Driver (PD), but passed as a pointer before. If you subclass, then you need to have a constructor for each type of motor arrangement possible, also waypoint driver would need this, as would command_driver...so it gets a lot of unnecessary constructors when I don't care how you internally connect the motors, it still works the same at the higher level! Same problem if you contain a PD rathe than subclass. Only the A/B toggling Quadrature constructor is currently defined.
Notes
The distance from the current position to the starting position (_x0,_y0) is calculated; An ideal position along the geometric figure is calculated given distance and initial coordatinate. A control factor is used to adjust motors depending upon ideal position and current position.
Warning
The distance variables cannot use fixed point as distance traveled can be over 32768 millimeters.


Constructor & Destructor Documentation

Geometry_Driver IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  f,
PORT  ,
IOLINE  tpu,
IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  rf,
PORT  rfp,
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.

Geometry_Driver void   )  [protected]
 

Geometry_Driver IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  f,
PORT  fp,
IOLINE  tpu,
IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  rf,
PORT  rfp,
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.

Geometry_Driver void   )  [protected]
 


Member Function Documentation

foo2 callback void   )  [static, protected]
 

Reimplemented from Primitive_Driver.

Reimplemented in Local_Waypoint_Driver, and Motion_Driver.

POSITION centerx  ) 
 

POSITION centery  ) 
 

void circular_path int &  ,
int &  ,
oPID ,
bool &  ,
bool & 
 

Control function to maintain a circular path.

bool complete  ) 
 

Returns true if path is complete.

bool complete  ) 
 

Returns true if path is complete.

void control_points const point p1,
const point p2
 

Currently, p1 is current location and p2 is destination (used in PID).

POSITION current_distance  ) 
 

MILLIMETER current_distance  )  [static]
 

POSITION distance void   ) 
 

MILLIMETER distance void   )  [static]
 

If oSchedule period has changed, then be sure to call this: Geometry_Driver::syncronize();.

DEGREE face void   ) 
 

Return current facing (degrees).

DEGREE face void   ) 
 

Return current facing (degrees).

SPEED get_actual_speed void   ) 
 

MILLIMETER get_actual_speed void   )  [static]
 

SPEED get_global_speed void   ) 
 

MILLIMETER get_global_speed void   )  [static]
 

RADIAN get_stop void   ) 
 

RADIAN get_stop void   )  [static]
 

void heading SPEED  s,
DEGREE  destination
 

Given desired orientation and speed, automatically turn to proper orientation at that speed. Method automatically calculates whether it should turn left or right based upon current orientation and new orientation.

void heading ENCODER_TYPE  s,
FIXED_RADIAN  destination
 

Given desired orientation and speed, automatically turn to proper orientation at that speed. Method automatically calculates whether it should turn left or right based upon current orientation and new orientation.

CAUTION: this function is not desgined to turn x radians; i.e., rotate 3*PI. it is strictly designed for rotating to a heading (0..2*PI)

void initial_heading POSITION  ,
POSITION  ,
DEGREE 
 

Sets the initial orientation of the robot (should be done before anything).

void keep_straight void   ) 
 

function to maintain position on course between inital and final positions given its present location.

:

void keep_straight void   ) 
 

function to maintain position on course between inital and final positions given its present location.

:

void linear_path int &  ,
int &  ,
oPID ,
bool &  ,
bool & 
 

control function to maintain a straight line.

void linear_path int &  ,
int &  ,
oPID ,
bool &  ,
bool & 
 

control function to maintain a straight line.

void Lpower int  p  )  [inherited]
 

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

int offset void   ) 
 

How much we deviate from where we should be.

int offset void   ) 
 

How much we deviate from where we should be.

void poststuff MOTION  idir,
ENCODER_TYPE  EU_left,
ENCODER_TYPE  EU_right
[private]
 

void prestuff ENCODER_TYPE  EU_S  )  [private]
 

void primitive_motion MOTION  m,
MILLIMETER  s,
bool  ramp
[inherited]
 

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

void Rpower int  p  )  [inherited]
 

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

void segment_path int &  dx,
int &  dy,
oPID pid,
bool &  lpower,
bool &  rpower
 

void status uint8  s  )  [inherited]
 

Set the status of the component.

uint8 status void   )  [inherited]
 

Returns the current state of the top level component.

void stop int  s = 0  )  [inherited]
 

Stops both motors.

void syncronize void   )  [static]
 

If oSchedule period has changed, then be sure to call this: Geometry_Driver::syncronize();.

bool teleoperate void   )  [static, inherited]
 

void teleoperate bool  b  )  [static, inherited]
 

void travel MOTION  idir,
SPEED  speed,
const point P1,
const point P2,
int  weight
 

Method to travel based upon 2 points and a third control point with weighting (segment driver).

void travel MOTION  idir,
SPEED  s,
MILLIMETER  radius,
DEGREE  idirection,
RADIAN  c = 1.570796
 

Method to travel a fraction of a circular arc, c (radians) with given circle radius.

Two ways of travel:

  • portion of a circular arc: the radius is set to center of circle forming path robot will travel.
  • straight distance: the radius parameter is set to distance to travel. (radians ignored).
    Parameters:
    idir (MOTION) direction of travel
    s (SPEED) speed of travel (mm/sec)
    radius (MILLIMETER) - radius of turn. Only applicable for turn right/left. (turn is made around this point--0 degree is pivot; infinite is straight line).
    idirection (DEGREE) - current direction of travel.
    c RADIAN amount to arc (0=none PI/2= 90 degree 2*PI=full circle etc.)

void travel MOTION  idir,
SPEED  speed,
const point P1,
const point P2,
int  weight
 

Segment Driver form Method to travel based upon 2 points and a third control point with weighting (segment driver).

void travel MOTION  idir  ) 
 

STOP Only form of travel.

void travel MOTION  idir,
ENCODER_TYPE  EU_s,
MILLIMETER  idistance
 

travel Forward form #2 (millimeter--Quick move short cut)

void travel MOTION  idir,
ENCODER_TYPE  EU_s,
const point P2,
FIXED_RADIAN  Fidirection
 

travel Forward Only form #1 (point)

void travel MOTION  idir,
ENCODER_TYPE  s,
ENCODER_TYPE  radius,
FIXED_RADIAN  idirection,
FIXED_RADIAN  c
 

Method to travel a fraction of a circular arc, c (radians) with given circle radius.

void WSwrite void   ) 
 

Reimplemented in Local_Waypoint_Driver.

POSITION x0  ) 
 

MILLIMETER x0  )  [static]
 

POSITION y0  ) 
 

MILLIMETER y0  )  [static]
 


Friends And Related Function Documentation

friend class Geometry_Driver [friend, inherited]
 

friend class Motion_Driver [friend, inherited]
 

void task_keep_straight void   )  [friend]
 

void task_local_vector_driver void   )  [friend]
 

Reimplemented from Primitive_Driver.

void task_local_vector_driver void *   )  [friend]
 

void task_motion_driver void   )  [friend]
 

Reimplemented from Primitive_Driver.


Field Documentation

POSITION _centerx [private]
 

POSITION _centery [private]
 

bool _complete [protected]
 

FIXED_POSITION _current_distance [private]
 

int _distance [protected]
 

MILLIMETER _distance2go [protected]
 

oEncodedMotor _Lmotor [inherited]
 

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

int _offset [private]
 

point _p1 [protected]
 

point _p2 [protected]
 

oEncodedMotor _Rmotor [inherited]
 

uint8 _status [protected, inherited]
 

RADIAN _STOP [private]
 

DEGREE _Tdegree [protected]
 

bool _teleoperate [static, protected, inherited]
 

float _weight [protected]
 

POWER _wrench_effort [protected]
 

POSITION _x0 [protected]
 

POSITION _y0 [protected]
 

Fl_Value_Output* Angle
 

Fl_Value_Output* Current_Distance
 

Fl_Value_Output* Distance
 

Fl_Value_Output* EM2_Speed
 

ENCODER_TYPE EU_centerx [protected]
 

ENCODER_TYPE EU_centery [protected]
 

ENCODER_TYPE EU_distance [protected]
 

ENCODER_TYPE EU_distance2go [protected]
 

ENCODER_TYPE EU_global_speed [protected]
 

ENCODER_TYPE EU_x0 [protected]
 

ENCODER_TYPE EU_y0 [protected]
 

FIXED_RADIAN F_STOP [protected]
 

FIXED_RADIAN F_Tradian [protected]
 

Fl_Value_Input* FL_mapunit
 

Fl_Choice* FL_unit
 

FIXED_METER FM_offset [protected]
 

int Label
 

Reimplemented from Primitive_Driver.

MILLIMETER MM_current_distance [protected]
 

Fl_Output* Motion
 

Fl_Light_Button* Operate
 

jaus_message PD_msg [protected, inherited]
 

Fl_Value_Output* Speed
 

Fl_Value_Output* Stop
 

Watchdog watchdog [static, inherited]
 

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

Fl_Value_Output* X
 

Fl_Value_Output* X0
 

Fl_Value_Output* Y
 

Fl_Value_Output* Y0
 


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