Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ArmController Class Reference

Listens to control commands coming in from the command port for remotely controlling the arm. More...

#include <ArmController.h>

Inheritance diagram for ArmController:

Detailed Description

Listens to control commands coming in from the command port for remotely controlling the arm.

The communication protocol is a very simple binary format, shared with WalkControllerBehavior. Each command is sent as a 5-byte group. The first byte is a command selector, and the following 4 bytes are a floating point argument:

  • <char: command indicator>
  • <float: value>

The valid values for command indicator are given by CMD_shoulder, CMD_elbow, or CMD_wrist ('s', 'e', or 'w' respectively).

Definition at line 31 of file ArmController.h.

List of all members.

Static Public Member Functions

static int mechacmd_callback (char *buf, int bytes)
 called by wireless when there's new data

Static Public Attributes

static ArmControllertheOne = NULL
 Points to the one ArmController object that the input command stream is talking to.

Protected Types

enum  DisplayMode_t { pitchAndYaw = 0, yawOnly, pitchOnly }
 

Controls whether we have one or two Point Pickers, and which kind.

More...

Protected Attributes

MotionManager::MC_ID armMCID
 The ArmMC, for moving individual joints.
MotionManager::MC_ID pidMCID
 The PIDMC.
MotionManager::MC_ID seqMCID
 Used to run motion sequences for smooth paths to points picked in the ArmGUI.
KinematicJointgripperFrameKJ
 Kinematic Joint for the Gripper Frame.
KinematicJointsuccessJ
 To test for valid points, we use a separate kinematic chain.
KinematicJointKJjoints [NumArmJoints]
 All of the joints in the arm.
float horScale
 Horizontal scaling factor for the Point Picker.
float verScale
 Vertical scaling factor for the Point Picker.
unsigned int numSteps
 Number of interpolation steps to take when moving from one point to the next.
std::queue< fmat::Column< 3 > > steps
 Interpolation steps: every time we receive a joint update, we fire another.
enum ArmController::DisplayMode_t displayMode
 Controls whether we have one or two Point Pickers, and which kind.

Command Bytes



float theta
 Angle between base horizontal joint and gripper, as from a bird's eye view.
float z
 Height of point picked.
fmat::Column< 3 > horToBase
 First horizontal joint location, relative to base.
fmat::Column< 3 > verToBase
 First vertical joint location, relative to base.
float speed
 Maximum speed for every joint.
fmat::Quaternion orientation [2]
 Target arm orientations for IKSolver.
int orientationIndex
 Currently selected orientation (0 - side, 1 - overhead).
unsigned int numYawJoints
 Number of yaw joints.
unsigned int numPitchJoints
 Number of pitch joints.
unsigned int linksToDisplay
 Total number of links to display (numYawJoints + numPitchJoints).
TimeET reachablePointsDelay
 Delay between sending reachable points.
char armConfig [NumArmJoints]
 Whether each joint is horizontal or vertical.
float yawCoords [NumArmJoints][2]
 Horizontal joint coordinates.
float pitchCoords [NumArmJoints][2]
 Vertical joint coordinates.
ArmControllertheLastOne
 The last HPCB object that was theOne.
Socketcmdsock
 The input command stream socket.
static const char cmdUnrelax = 'u'
 Angle between base horizontal joint and gripper, as from a bird's eye view.
static const char cmdRelax = 'v'
 Angle between base horizontal joint and gripper, as from a bird's eye view.
static const char cmdGripper = 'w'
 Angle between base horizontal joint and gripper, as from a bird's eye view.
static const char cmdPoint = 'x'
 Angle between base horizontal joint and gripper, as from a bird's eye view.
static const char cmdSpeed = 'y'
 Angle between base horizontal joint and gripper, as from a bird's eye view.
static const char cmdConnect = 'z'
 Angle between base horizontal joint and gripper, as from a bird's eye view.
static const char cmdOrientation = 'o'
 Angle between base horizontal joint and gripper, as from a bird's eye view.
static std::string getClassDescription ()
 Angle between base horizontal joint and gripper, as from a bird's eye view.
void runCommand (unsigned char *command)
 Executes a command. Called by mechacmd_callback.
void doEvent ()
 Angle between base horizontal joint and gripper, as from a bird's eye view.
void connect ()
 Possible commands from ArmGUI.
void pointPicked (float param, float param2, float param3, int cmdno)
 Angle between base horizontal joint and gripper, as from a bird's eye view.
void gripper (float param, int cmdno)
 Angle between base horizontal joint and gripper, as from a bird's eye view.
void relax ()
 Angle between base horizontal joint and gripper, as from a bird's eye view.
void unrelax ()
 Angle between base horizontal joint and gripper, as from a bird's eye view.
void setJoint (unsigned int joint, float param)
 Angle between base horizontal joint and gripper, as from a bird's eye view.
 ArmController (const ArmController &)
 don't call
ArmController operator= (const ArmController &)
 don't call
 ArmController ()
 constructor
virtual ~ArmController ()
 destructor
virtual void doStart ()
 Setup the scale and the joints quantity to display.
virtual void doStop ()
 Angle between base horizontal joint and gripper, as from a bird's eye view.
void computeCoords ()
 Compute the joint positions.
void sendCoords ()
 Send the joint positions to the ArmGUI.
void sendReachablePoints (DisplayMode_t d)
 Compute and send reachable points w/ given orientation.
virtual std::string getDescription () const
 Angle between base horizontal joint and gripper, as from a bird's eye view.

Member Enumeration Documentation

enum ArmController::DisplayMode_t [protected]

Controls whether we have one or two Point Pickers, and which kind.

Enumerator:
pitchAndYaw 
yawOnly 
pitchOnly 

Definition at line 71 of file ArmController.h.


Constructor & Destructor Documentation

ArmController::ArmController ( const ArmController  )  [protected]

don't call

ArmController::ArmController (  ) 

constructor

Definition at line 158 of file ArmController.h.

virtual ArmController::~ArmController (  )  [virtual]

destructor

Definition at line 199 of file ArmController.h.


Member Function Documentation

void ArmController::computeCoords (  ) 

Compute the joint positions.

Definition at line 558 of file ArmController.cc.

Referenced by connect(), doEvent(), pointPicked(), and setJoint().

void ArmController::connect (  )  [protected]

Possible commands from ArmGUI.

Definition at line 294 of file ArmController.cc.

Referenced by runCommand().

void ArmController::doEvent (  )  [protected, virtual]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Reimplemented from BehaviorBase.

Definition at line 124 of file ArmController.cc.

void ArmController::doStart (  )  [virtual]

Setup the scale and the joints quantity to display.

Reimplemented from BehaviorBase.

Definition at line 25 of file ArmController.cc.

void ArmController::doStop (  )  [virtual]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Reimplemented from BehaviorBase.

Definition at line 113 of file ArmController.cc.

static std::string ArmController::getClassDescription (  )  [static]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Reimplemented from BehaviorBase.

Definition at line 221 of file ArmController.h.

Referenced by getDescription().

virtual std::string ArmController::getDescription (  )  const [virtual]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Reimplemented from BehaviorBase.

Definition at line 227 of file ArmController.h.

void ArmController::gripper ( float  param,
int  cmdno 
) [protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 477 of file ArmController.cc.

Referenced by runCommand().

int ArmController::mechacmd_callback ( char *  buf,
int  bytes 
) [static]

called by wireless when there's new data

Definition at line 147 of file ArmController.cc.

Referenced by doStart().

ArmController ArmController::operator= ( const ArmController  )  [protected]

don't call

void ArmController::pointPicked ( float  param,
float  param2,
float  param3,
int  cmdno 
) [protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 363 of file ArmController.cc.

Referenced by runCommand().

void ArmController::relax (  )  [protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 500 of file ArmController.cc.

Referenced by runCommand().

void ArmController::runCommand ( unsigned char *  command  )  [protected]

Executes a command. Called by mechacmd_callback.

Definition at line 193 of file ArmController.cc.

Referenced by mechacmd_callback().

void ArmController::sendCoords (  ) 

Send the joint positions to the ArmGUI.

Definition at line 609 of file ArmController.cc.

Referenced by connect(), doEvent(), pointPicked(), and setJoint().

void ArmController::sendReachablePoints ( DisplayMode_t  d  ) 

Compute and send reachable points w/ given orientation.

Only applicable for robots with vertical joints. param = 1.0 for horizontal and 2.0 for vertical.

Definition at line 625 of file ArmController.cc.

Referenced by connect(), pointPicked(), and runCommand().

void ArmController::setJoint ( unsigned int  joint,
float  param 
) [protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 515 of file ArmController.cc.

Referenced by runCommand().

void ArmController::unrelax (  )  [protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 508 of file ArmController.cc.

Referenced by runCommand().


Member Data Documentation

char ArmController::armConfig[NumArmJoints] [protected]

Whether each joint is horizontal or vertical.

Definition at line 122 of file ArmController.h.

Referenced by ArmController(), computeCoords(), connect(), and doStart().

The ArmMC, for moving individual joints.

Definition at line 41 of file ArmController.h.

Referenced by doStart(), doStop(), and setJoint().

const char ArmController::cmdConnect = 'z' [static, protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 83 of file ArmController.h.

Referenced by runCommand().

const char ArmController::cmdGripper = 'w' [static, protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 80 of file ArmController.h.

Referenced by runCommand().

const char ArmController::cmdOrientation = 'o' [static, protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 84 of file ArmController.h.

Referenced by runCommand().

const char ArmController::cmdPoint = 'x' [static, protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 81 of file ArmController.h.

Referenced by runCommand().

const char ArmController::cmdRelax = 'v' [static, protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 79 of file ArmController.h.

Referenced by runCommand().

The input command stream socket.

Definition at line 139 of file ArmController.h.

Referenced by connect(), doEvent(), doStart(), doStop(), gripper(), pointPicked(), sendCoords(), sendReachablePoints(), and setJoint().

const char ArmController::cmdSpeed = 'y' [static, protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 82 of file ArmController.h.

Referenced by runCommand().

const char ArmController::cmdUnrelax = 'u' [static, protected]

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 78 of file ArmController.h.

Referenced by runCommand().

Controls whether we have one or two Point Pickers, and which kind.

Referenced by computeCoords(), connect(), doEvent(), pointPicked(), runCommand(), sendCoords(), and setJoint().

Kinematic Joint for the Gripper Frame.

Definition at line 50 of file ArmController.h.

Referenced by ArmController(), computeCoords(), doStart(), pointPicked(), and ~ArmController().

Horizontal scaling factor for the Point Picker.

Definition at line 59 of file ArmController.h.

Referenced by connect(), doEvent(), doStart(), pointPicked(), sendCoords(), sendReachablePoints(), and setJoint().

First horizontal joint location, relative to base.

Definition at line 95 of file ArmController.h.

Referenced by doStart(), pointPicked(), and sendReachablePoints().

KinematicJoint* ArmController::KJjoints[NumArmJoints] [protected]

All of the joints in the arm.

Definition at line 56 of file ArmController.h.

Referenced by computeCoords(), doStart(), pointPicked(), sendReachablePoints(), and setJoint().

unsigned int ArmController::linksToDisplay [protected]

Total number of links to display (numYawJoints + numPitchJoints).

Definition at line 116 of file ArmController.h.

Referenced by computeCoords(), doStart(), and pointPicked().

unsigned int ArmController::numPitchJoints [protected]

Number of pitch joints.

Definition at line 113 of file ArmController.h.

Referenced by computeCoords(), connect(), doEvent(), doStart(), pointPicked(), sendCoords(), and setJoint().

unsigned int ArmController::numSteps [protected]

Number of interpolation steps to take when moving from one point to the next.

Definition at line 65 of file ArmController.h.

unsigned int ArmController::numYawJoints [protected]

Number of yaw joints.

Definition at line 110 of file ArmController.h.

Referenced by computeCoords(), connect(), doEvent(), doStart(), pointPicked(), sendCoords(), and setJoint().

Target arm orientations for IKSolver.

Definition at line 104 of file ArmController.h.

Referenced by ArmController(), pointPicked(), and sendReachablePoints().

Currently selected orientation (0 - side, 1 - overhead).

Definition at line 107 of file ArmController.h.

Referenced by pointPicked(), runCommand(), and sendReachablePoints().

The PIDMC.

Definition at line 44 of file ArmController.h.

Referenced by doStart(), doStop(), relax(), and unrelax().

float ArmController::pitchCoords[NumArmJoints][2] [protected]

Vertical joint coordinates.

Definition at line 128 of file ArmController.h.

Referenced by computeCoords(), connect(), doEvent(), pointPicked(), sendCoords(), and setJoint().

Delay between sending reachable points.

Definition at line 119 of file ArmController.h.

Referenced by pointPicked().

Used to run motion sequences for smooth paths to points picked in the ArmGUI.

Definition at line 47 of file ArmController.h.

Referenced by doStart(), doStop(), pointPicked(), and setJoint().

Maximum speed for every joint.

Definition at line 101 of file ArmController.h.

Referenced by pointPicked(), runCommand(), and setJoint().

std::queue<fmat::Column<3> > ArmController::steps [protected]

Interpolation steps: every time we receive a joint update, we fire another.

Definition at line 68 of file ArmController.h.

To test for valid points, we use a separate kinematic chain.

Definition at line 53 of file ArmController.h.

Referenced by ArmController(), and sendReachablePoints().

The last HPCB object that was theOne.

So we can restore it to prominence when we die. This is a nice gesture, but it doesn't really make sense since we're all using the same port. But just in case something changes and we don't do that, this mechanism is in place.

Definition at line 136 of file ArmController.h.

Referenced by doStart(), doStop(), and ~ArmController().

Points to the one ArmController object that the input command stream is talking to.

A kludge. Dunno how you're going to make sure you're not using this uninitialized.

Definition at line 36 of file ArmController.h.

Referenced by doStart(), doStop(), and ~ArmController().

Angle between base horizontal joint and gripper, as from a bird's eye view.

To be kept constant between point picks.

Definition at line 88 of file ArmController.h.

Referenced by doStart(), pointPicked(), and sendReachablePoints().

Vertical scaling factor for the Point Picker.

Definition at line 62 of file ArmController.h.

Referenced by connect(), doEvent(), doStart(), pointPicked(), sendCoords(), sendReachablePoints(), and setJoint().

First vertical joint location, relative to base.

Definition at line 98 of file ArmController.h.

Referenced by doStart(), pointPicked(), and sendReachablePoints().

float ArmController::yawCoords[NumArmJoints][2] [protected]

Horizontal joint coordinates.

Definition at line 125 of file ArmController.h.

Referenced by computeCoords(), connect(), doEvent(), pointPicked(), sendCoords(), and setJoint().

float ArmController::z [protected]

Height of point picked.

To be kept constant between point picks.

Definition at line 92 of file ArmController.h.

Referenced by pointPicked(), and sendReachablePoints().


The documentation for this class was generated from the following files:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:05 2016 by Doxygen 1.6.3