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

Motion_Driver Class Reference

Defines a basic means of traversing a predefined motion queue. More...

#include <motion_driver.h>

Inheritance diagram for Motion_Driver:

Geometry_Driver Primitive_Driver Local_Waypoint_Driver

Public Member Functions

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

void abort (bool icancel=true)
 Stops robot, and aborts any previously programmed paths if cancel is true (default).

bool target (void)
 Return whether robot position is at the preprogrammed final target.

bool waypoint (void)
 Return whether robot position is at one of the preprogrammed waypoints.

void relaunch (void)
 Continue preprogrammed path.

void launch (motion_chain *const path)
 Begin new preprogrammed course.

void acquire_targets (motion_chain *const _target)
 Set new target location for robot to travel. Does not automatically start; call launch to begin.

LAUNCH get_launch (void)
short destx ()
short desty ()
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 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 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 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.

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.

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

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

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

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.

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 distance (void)
SPEED get_actual_speed (void)
POSITION x0 ()
POSITION y0 ()
POSITION current_distance ()
RADIAN get_stop (void)
SPEED get_global_speed (void)
void WSwrite (void)
void initial_heading (POSITION, POSITION, DEGREE)
 Sets the initial orientation of the robot (should be done before anything).

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.

POSITION centerx ()
POSITION centery ()
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

int32 sDestx (void)
 Returns shared value of x destination coordinate.

int32 sDesty (void)
 Returns shared value of y destination coordinate.

LAUNCH sLaunch (void)
 Returns shared value of launch.

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

 Motion_Driver (void)

Static Protected Member Functions

foo2 callback (void)

Protected Attributes

LAUNCH _launch
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 get_dest (void)

Private Attributes

motion_chain_target
short _ptop
short MM_destx
short MM_desty
int EU_optidestx
int EU_optidesty
bool _waypoint
int _dest_index
bool _reset

Friends

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

Detailed Description

Defines a basic means of traversing a predefined motion queue.

Operation
TBD
Note:
A motion command may break down into several actual primitive motions.


Constructor & Destructor Documentation

Motion_Driver IOLINE  Pencoder,
IOLINE  Sencoder,
IOLINE  f,
PORT  ifp,
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.
word R encoder resolution

Motion_Driver void   )  [protected]
 


Member Function Documentation

void abort bool  icancel = true  ) 
 

Stops robot, and aborts any previously programmed paths if cancel is true (default).

void acquire_targets motion_chain *const  _target  ) 
 

Set new target location for robot to travel. Does not automatically start; call launch to begin.

foo2 callback void   )  [static, protected]
 

Reimplemented from Geometry_Driver.

Reimplemented in Local_Waypoint_Driver.

POSITION centerx  )  [inherited]
 

POSITION centery  )  [inherited]
 

void circular_path int &  ,
int &  ,
oPID ,
bool &  ,
bool & 
[inherited]
 

Control function to maintain a circular path.

bool complete  )  [inherited]
 

Returns true if path is complete.

bool complete  )  [inherited]
 

Returns true if path is complete.

void control_points const point p1,
const point p2
[inherited]
 

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

POSITION current_distance  )  [inherited]
 

MILLIMETER current_distance  )  [static, inherited]
 

short destx  ) 
 

short desty  ) 
 

POSITION distance void   )  [inherited]
 

MILLIMETER distance void   )  [static, inherited]
 

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

DEGREE face void   )  [inherited]
 

Return current facing (degrees).

DEGREE face void   )  [inherited]
 

Return current facing (degrees).

SPEED get_actual_speed void   )  [inherited]
 

MILLIMETER get_actual_speed void   )  [static, inherited]
 

void get_dest void   )  [private]
 

SPEED get_global_speed void   )  [inherited]
 

MILLIMETER get_global_speed void   )  [static, inherited]
 

LAUNCH get_launch void   ) 
 

RADIAN get_stop void   )  [inherited]
 

RADIAN get_stop void   )  [static, inherited]
 

void heading SPEED  s,
DEGREE  destination
[inherited]
 

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
[inherited]
 

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 
[inherited]
 

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

void keep_straight void   )  [inherited]
 

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

:

void keep_straight void   )  [inherited]
 

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

:

void launch motion_chain *const  path  ) 
 

Begin new preprogrammed course.

void linear_path int &  ,
int &  ,
oPID ,
bool &  ,
bool & 
[inherited]
 

control function to maintain a straight line.

void linear_path int &  ,
int &  ,
oPID ,
bool &  ,
bool & 
[inherited]
 

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   )  [inherited]
 

How much we deviate from where we should be.

int offset void   )  [inherited]
 

How much we deviate from where we should be.

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

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

void relaunch void   ) 
 

Continue preprogrammed path.

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.

int32 sDestx void   )  [static]
 

Returns shared value of x destination coordinate.

int32 sDesty void   )  [static]
 

Returns shared value of y destination coordinate.

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

LAUNCH sLaunch void   )  [static]
 

Returns shared value of launch.

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, inherited]
 

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

bool target void   ) 
 

Return whether robot position is at the preprogrammed final target.

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
[inherited]
 

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
[inherited]
 

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
[inherited]
 

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

void travel MOTION  idir  )  [inherited]
 

STOP Only form of travel.

void travel MOTION  idir,
ENCODER_TYPE  EU_s,
MILLIMETER  idistance
[inherited]
 

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

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

travel Forward Only form #1 (point)

void travel MOTION  idir,
ENCODER_TYPE  s,
ENCODER_TYPE  radius,
FIXED_RADIAN  idirection,
FIXED_RADIAN  c
[inherited]
 

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

bool waypoint void   ) 
 

Return whether robot position is at one of the preprogrammed waypoints.

void WSwrite void   )  [inherited]
 

Reimplemented in Local_Waypoint_Driver.

POSITION x0  )  [inherited]
 

MILLIMETER x0  )  [static, inherited]
 

POSITION y0  )  [inherited]
 

MILLIMETER y0  )  [static, inherited]
 


Friends And Related Function Documentation

friend class Geometry_Driver [friend, inherited]
 

friend class Motion_Driver [friend, inherited]
 

void task_keep_straight void   )  [friend, inherited]
 

void task_local_vector_driver void   )  [friend, inherited]
 

Reimplemented from Primitive_Driver.

void task_local_vector_driver void *   )  [friend, inherited]
 

void task_motion_driver void   )  [friend, inherited]
 

Reimplemented from Primitive_Driver.

void task_motion_driver void *   )  [friend]
 


Field Documentation

bool _complete [protected, inherited]
 

int _dest_index [private]
 

int _distance [protected, inherited]
 

MILLIMETER _distance2go [protected, inherited]
 

LAUNCH _launch [protected]
 

oEncodedMotor _Lmotor [inherited]
 

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

point _p1 [protected, inherited]
 

point _p2 [protected, inherited]
 

short _ptop [private]
 

bool _reset [private]
 

oEncodedMotor _Rmotor [inherited]
 

uint8 _status [protected, inherited]
 

motion_chain* _target [private]
 

DEGREE _Tdegree [protected, inherited]
 

bool _teleoperate [static, protected, inherited]
 

bool _waypoint [private]
 

float _weight [protected, inherited]
 

POWER _wrench_effort [protected, inherited]
 

POSITION _x0 [protected, inherited]
 

POSITION _y0 [protected, inherited]
 

Fl_Value_Output* Angle [inherited]
 

Fl_Value_Output* Current_Distance [inherited]
 

Fl_Value_Output* Distance [inherited]
 

Fl_Value_Output* EM2_Speed [inherited]
 

ENCODER_TYPE EU_centerx [protected, inherited]
 

ENCODER_TYPE EU_centery [protected, inherited]
 

ENCODER_TYPE EU_distance [protected, inherited]
 

ENCODER_TYPE EU_distance2go [protected, inherited]
 

ENCODER_TYPE EU_global_speed [protected, inherited]
 

int EU_optidestx [private]
 

int EU_optidesty [private]
 

ENCODER_TYPE EU_x0 [protected, inherited]
 

ENCODER_TYPE EU_y0 [protected, inherited]
 

FIXED_RADIAN F_STOP [protected, inherited]
 

FIXED_RADIAN F_Tradian [protected, inherited]
 

Fl_Value_Input* FL_mapunit [inherited]
 

Fl_Choice* FL_unit [inherited]
 

FIXED_METER FM_offset [protected, inherited]
 

int Label [inherited]
 

Reimplemented from Primitive_Driver.

MILLIMETER MM_current_distance [protected, inherited]
 

short MM_destx [private]
 

short MM_desty [private]
 

Fl_Output* Motion [inherited]
 

Fl_Light_Button* Operate [inherited]
 

jaus_message PD_msg [protected, inherited]
 

Fl_Value_Output* Speed [inherited]
 

Fl_Value_Output* Stop [inherited]
 

Watchdog watchdog [static, inherited]
 

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

Fl_Value_Output* X [inherited]
 

Fl_Value_Output* X0 [inherited]
 

Fl_Value_Output* Y [inherited]
 

Fl_Value_Output* Y0 [inherited]
 


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