Robotcode  1.0
ManipulandumDR Class Reference

Class for control of the 2-link dual arm robot under a s626 io board in QS17, B05. More...

#include <ManipulandumDR.h>

List of all members.

Public Member Functions

 ManipulandumDR (void)
 Constructor.
 ~ManipulandumDR ()
 Destructor.
void init (string paramfile)
 initialize the manipulandum with parameter file
void update ()
 Updates the sensory state of the robot.
void update (double dt)
 Updates the sensory state of the robot for time dt.
void recenter ()
 Put (0,0) of world at current position.
void getCounter (long &sh, long &el)
 Get the raw counter values.
void getPosition (Vector2D &thePos)
 Get Positions.
Vector2D getPosition ()
 Get Position.
void getVelocity (Vector2D &theVel)
 Get Velocities.
Vector2D getVelocity ()
 Get Velocity.
void getAngles (Vector2D &theAngles)
 Get angles of the Shoulder and Elbow.
Vector2D getAngles ()
void setForce (Vector2D theForce)
 Get the Shoulder and Elbow angle in radians.
void setVolts (double v0, double v1)
 sets voltages to shoulder and elbow directly
Vector2D ati2World (Vector2D atiforce)
 computes the force in world coordinate based on ATI force readings
void printState (int col=0)
 prints the state of a robot on the text display
void setFromLocal (const Matrix2D &, const Vector2D &)
 Sets the Transformation between local (Robot) coordinates and the World.

Public Attributes

Vector2D position
 robot values that can be read
Vector2D velocity
 Current velocity, unfiltered in m/s.
Vector2D positionFilt
 Position after Kalmanfiltering.
Vector2D velocityFilt
 Velocity estimate after Kalman filtering.
Vector2D force
 Current Force Goal in global cooridinates.
Vector2D forceProd
 Current estimate of force produced in global coordinates.
double dt
 default update rate
string paramfilename
 robot parameters determined from calibration file
int board_cnt [2]
 Board for encoder channels.
int channel [2]
 Channels for counters.
int board_da
 Board number used for force output.
int da_offset
 Channel number of da offset.
double ang_ati2arm
 Angle from ATI force tranducer to arm coordinates.
Matrix2D AFromLocal
 rotation Robot->World x_world = A * x_robot + v
Vector2D vFromLocal
 offset Robot->World x_world = A * x_robot + v
Matrix2D AToLocal
 inverse (AFromLocal)
Vector2D vToLocal
 vFromLocal
Vector2D jointLength
 Length of robot joints.
Vector2D offset
 Offset for 0 degrees on Shoulder/ Elbow encoder.
Vector2D dir_cnt
 Counting direction of Encoders.
Vector2D torque2volts
 Torque to volts transversion at motors.
bool isFirstUpdate
 robot values that are updated by update step
KalmanFilter< 2 > filter
 Kalman filter for optimal velocity and position estimation.
long sh_cnt
 Shoulder encoder count.
long el_cnt
 Elbow encoder count.
Vector2D theta
 Angles of shoulder joint [0] and elbow joint [1].
Vector2D torque
 Current Torques of shoulder [0] and elbow [1].
Vector2D positionLocal
 position in robot space
Vector2D lastPosition
 Last position.
Matrix2D Jdx_dtheta
 Jacobian dx/theta.
Vector2D volts
bool errorState

Detailed Description

Class for control of the 2-link dual arm robot under a s626 io board in QS17, B05.

Function init is called with a parameter file that contains the data from the Calibration. Then you only have to call update() in regular intervals in the updateHaptics() loop, and you have access to estimates of position and velocity. Manipulandum uses a KalmanFilter for smoothing.

Author:
Joern Diedrichsen, 2009-2011

Constructor & Destructor Documentation

ManipulandumDR::ManipulandumDR ( void  )

Constructor.

The Constructor really doesn't anything

ManipulandumDR::~ManipulandumDR ( )

Destructor.

Destructor does nothing Should probably free the channels allocated on the s626 board


Member Function Documentation

void ManipulandumDR::init ( string  paramfile)

initialize the manipulandum with parameter file

Reads a configuration file for the robot and initializes io channels

Parameters:
paramfileParameter files The file contains
  • Board for Shoulder Encoder
  • Channel for Shoulder Encoder
  • Direction for Shoulder Encoder
  • Board for Elbow Encoder
  • Channel for Elbow Encoder
  • Direction for Elbow Encoder
  • Board for DA-piston forces
  • Board for DA-piston forces
  • Offset for Shoulder encoder [deg]
  • Offset for Elbow Enconder [deg]
  • Length of upper arm length [m]
  • Length of lower arm [m]
  • Tranformation Nm to V at shoulder
  • Tranformation Nm to V at elbow
  • Angle of ATI transducer to arm
  • Transformation (x-shift) from Local to Global coordinates
  • Transformation (y-shift) from Local to Global coordinates
  • Transformation (rotation 1,1) from Local to Global coordinates
  • Transformation (rotation 1,2) from Local to Global coordinates
  • Transformation (rotation 2,1) from Local to Global coordinates
  • Transformation (rotation 2,2) from Local to Global coordinates
void ManipulandumDR::update ( double  dt)

Updates the sensory state of the robot for time dt.

Main routine that does all the heavy work with update frequency

Parameters:
dttime in ms since last update
void ManipulandumDR::recenter ( )

Put (0,0) of world at current position.

Set the current position of the robot to be (0,0)

void ManipulandumDR::getCounter ( long &  sh,
long &  el 
)

Get the raw counter values.

Gets the raw counter values by reference

Parameters:
shthis is where the shoulder counter will be dumped
elthis is where the elbow counter will be dumped
void ManipulandumDR::setForce ( Vector2D  force)

Get the Shoulder and Elbow angle in radians.

sets forces in Euclidean cooridinates

Sets the force output for the robot in Eucledian coordinates using the current state of the robot. This needs to be called again as position of the robot changes.

Parameters:
forceVector of forces in N
void ManipulandumDR::setVolts ( double  v0,
double  v1 
)

sets voltages to shoulder and elbow directly

Sets the voltage output to the Motors directly

Parameters:
v0volts to the shoulder motor
v1volts to the elbow motor
Vector2D ManipulandumDR::ati2World ( Vector2D  atiforce)

computes the force in world coordinate based on ATI force readings

translates the ATI readings into world coordinates

Parameters:
forcereadingin ATI coordinate frame
Returns:
Force in world coordinate
void ManipulandumDR::setFromLocal ( const Matrix2D A,
const Vector2D v 
)

Sets the Transformation between local (Robot) coordinates and the World.

Set the transformation from local (robot) to World coordinates also set the inverse transform

Parameters:
A2x2 rotation matrix
v2x1 shift vector

Member Data Documentation

robot values that can be read

Current position, unfiltered in m

robot parameters determined from calibration file

name of current parameter file

robot values that are updated by update step

is first update?


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