Robotcode
1.0
|
Class for control of the 2-link fMRI compatible robot. More...
#include <ManipulandumMR.h>
Public Member Functions | |
ManipulandumMR (void) | |
Constructor. | |
~ManipulandumMR () | |
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) 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 | setValves (double v0, double v1, double v2, double v3) |
sets voltages of valves directly | |
void | printState () |
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. | |
Vector2D | forcePiston |
Current Force Goal at each of the pistons. | |
Vector2D | forcePistonProd |
Current estimate of force produced at the pistons (assuming a 60ms time constant) | |
double | offsetPiston |
Offset of valves to avoid starting hysterisis. | |
double | dt |
default update rate | |
double | overdrive |
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. | |
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 | linkLength |
Length of links between axle and pistons. | |
Vector2D | offset |
Offset for 0 degrees on Shoulder/ Elbow encoder. | |
Vector2D | dir_cnt |
Counting direction of Encoders. | |
Vector2D | alpha |
Angle between axle and positon base. | |
Vector2D | diagLength |
Length of diagonal between axle and piston base. | |
double | force2volts |
Force to volts transversion at pistons. | |
double | tauPiston |
Time constant of force production at the pistons. | |
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 | phi |
angles relative to attachment of pistons | |
Vector2D | positionLocal |
position in robot space | |
Vector2D | lastPosition |
Last position. | |
Vector2D | pistonLength |
Length of the pistons. | |
Matrix2D | Jdx_dtheta |
Jacobian dx/theta. | |
Matrix2D | Jdtheta_dl |
jacobian dtheta to dl | |
double | volts [4] |
bool | errorState |
Class for control of the 2-link fMRI compatible robot.
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.
ManipulandumMR::ManipulandumMR | ( | void | ) |
Constructor.
< Time constant for the pistons
void ManipulandumMR::init | ( | string | paramfile | ) |
initialize the manipulandum with parameter file
reads calibration from parameter file and calculates all required variables from that
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
Offset for Shoulder encoder [deg]
Offset for Elbow Enconder [deg]
Length of upper arm length [m]
Length of lower arm [m]
Link Length for Piston, Shoulder [m]
Link Length for Piston, Elbow [m]
Tranformation N to V at pistons
Time constant for the pistons [ms]
void ManipulandumMR::update | ( | double | dt | ) |
Updates the sensory state of the robot for time dt.
ManipulandumMR::update Updates the sensory state of the robot uses kalman filter to estimate velocity and position
Store the last update
Get the counters and calculate the angles
Calculate the piston length
Calculate Jacobians
robot end effector postion, in Cartesian coord centered at robot shoulder joint
robot end effector velocity
Forces produced at the pistons and endpoint
void ManipulandumMR::recenter | ( | ) |
Put (0,0) at current position.
Set the current position of the robot to be (0,0)
void ManipulandumMR::getCounter | ( | long & | sh, |
long & | el | ||
) |
Get the raw counter values.
Gets the raw counter values by reference.
void ManipulandumMR::setForce | ( | Vector2D | force | ) |
Get the Shoulder and Elbow angle in radians.
sets forces in Eucledian cooridinates
ManipulandumMR :: setForce Sets the force output for the robot in Eucledian coordinates using the current state of the robot (needs to be called again as the robot moves Valve 0: Shoulder push Valve 1: Shoulder pull Valve 2: Elbow push Valve 3: Elbow pull
void ManipulandumMR::setValves | ( | double | v0, |
double | v1, | ||
double | v2, | ||
double | v3 | ||
) |
sets voltages of valves directly
ManipulandumMR :: setValves Sets the voltage output to the Valves directly
Sets the Transformation between local (Robot) coordinates and the World.
Set the transformation from local (robot) to World coordinates also set the inverse transform
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?