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

Local_Waypoint_Driver Class Reference

A class for driving a mobile robot between waypoints similar to Motion_Driver but allows final orientation and callback routine. More...

#include <local_waypoint_driver.h>

Inheritance diagram for Local_Waypoint_Driver:

Motion_Driver Geometry_Driver Primitive_Driver

Public Member Functions

 Local_Waypoint_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 begin (void)
 Travel to preset mission_profile waypoints (no command set).

void failure (void)
bool function (foo func, void *d, short ifn)
void WSwrite (void)
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 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

foo2 callback (void)
 Provides JAUS Message Callback fuction for Object_List.

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 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 Make_Command_Chain (command_chain &_commands)
void clear_path (const command_chain &cc, int starting_x, int starting_y, atomic_rotation start_face)
void cluttered_flood_path (const command_chain &cc)
void cluttered_astar_path (const command_chain &cc)

Private Attributes

function_list _callbacks

Friends

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

Detailed Description

A class for driving a mobile robot between waypoints similar to Motion_Driver but allows final orientation and callback routine.

Class Local_Waypoint_Driver Purpose: motivation was to provide a methodology of traversing a set of waypoints; in addition, I wanted to be able to:

Note:
A 999 final orientation signifies to ignore the final orientation, and only travel to waypoint.
Operation
The Local_Waypoint_Driver class generates a simple motion chain for each waypoint and uses the Motion_Driver class for travel.
Note:
The occupancy grid is defined from the scene definition which should have been downloaded into the robot's pre-allocated persistent map memory.
Warning:
Currently uses Persistent memories mapping() method to decide whether to do dynamic mapping. If this value has not been initialized, then it will probably be random whether it performs dynamic mapping. This is usually downloaded with the platform specification (see platform_specification).


Constructor & Destructor Documentation

Local_Waypoint_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


Member Function Documentation

void abort bool  icancel = true  )  [inherited]
 

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

void acquire_targets motion_chain *const  _target  )  [inherited]
 

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

void begin void   ) 
 

Travel to preset mission_profile waypoints (no command set).

foo2 callback void   )  [static]
 

Provides JAUS Message Callback fuction for Object_List.

Reimplemented from Motion_Driver.

POSITION centerx  )  [inherited]
 

POSITION centery  )  [inherited]
 

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

Control function to maintain a circular path.

void clear_path const command_chain cc,
int  starting_x,
int  starting_y,
atomic_rotation  start_face
[private]
 

void cluttered_astar_path const command_chain cc  )  [private]
 

void cluttered_flood_path const command_chain cc  )  [private]
 

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

short desty  )  [inherited]
 

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).

void failure void   ) 
 

Abort waypoint mission. Assign functin to callback table. Returns false if an error occurs.

bool function foo  func,
void *  d,
short  ifn
 

SPEED get_actual_speed void   )  [inherited]
 

MILLIMETER get_actual_speed void   )  [static, inherited]
 

SPEED get_global_speed void   )  [inherited]
 

MILLIMETER get_global_speed void   )  [static, inherited]
 

LAUNCH get_launch void   )  [inherited]
 

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

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.

void Make_Command_Chain command_chain _commands  )  [private]
 

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

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

Returns shared value of x destination coordinate.

int32 sDesty void   )  [static, inherited]
 

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

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

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

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

void WSwrite void   ) 
 

Reimplemented from Geometry_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, inherited]
 


Field Documentation

function_list _callbacks [private]
 

bool _complete [protected, inherited]
 

int _distance [protected, inherited]
 

MILLIMETER _distance2go [protected, inherited]
 

LAUNCH _launch [protected, inherited]
 

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]
 

oEncodedMotor _Rmotor [inherited]
 

uint8 _status [protected, inherited]
 

DEGREE _Tdegree [protected, inherited]
 

bool _teleoperate [static, protected, inherited]
 

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]