Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::ATISensor Class Reference
[Device]

Derived class for ATI Force/Torque sensors. This class is derived from the abstract template class Sensor<Type>. Since this class is used to sense 6D end-effector force vectors accompanied by an error state, Sensor<Type> is customized to Sensor<Vector7> Note: This implementation of the ATI F/T sensor interfaces through the serial port. However, it can interface through DAQ too. The sensor controller supports tool transformations, temperature compensation, biasing, and a variety of error checking. More...

#include <ATISensor.h>

Inheritance diagram for OSCAR::ATISensor:

Inheritance graph
[legend]
List of all members.

Public Methods

 ATISensor (unsigned int portNo, OSCARError &err=DUMMY_ERROR(noError))
 ~ATISensor ()
virtual bool Initialize ()
virtual bool Read (Vector7Array forces)
bool Read (Vector7 &forces)
bool SendCommand (char *command, String &string)
bool SetSpatialXform (const String &filename)
bool SetSpatialXform (const SpatialXform &spatialxform)
bool GetSpatialXform (SpatialXform &spatialXform) const
bool ApplyTransform (bool aTrans)
bool GetTransformFlag ()
bool SetBias (Vector7 bs)
bool GetBias (Vector7 &bs)
bool Close ()

Protected Methods

bool transformForces (Vector7 &forces)

Private Attributes

unsigned int portNum
bool applyTransform
SpatialXform forceTransform
Vector7 bias

Detailed Description

Author:
Troy Harden, Dinesh Rabindran, Chetan Kapoor


Constructor & Destructor Documentation

OSCAR::ATISensor::ATISensor unsigned int    portNo,
OSCARError   err = DUMMY_ERROR(noError)
 

Constructor for ATISensor Use this to construct a ATISensor object. The ATI F/T sensor interfaces through the serial port.

Parameters:
portNo is the serial port no corresponding to the port to which the sensor is interfaced. The meaning of this number for different platforms is given below. UNIX: portNo = 1 or 2 => "Port 1" or "Port 2" (respectively) WIN: portNo = 1 or 2 => "COM1" or "COM2" (respectively)
err An OSCARError object that on return will hold the value of the error code that was generated when the constructor was called. If this error was not 'noError' you can call GetError() to get the details of the error code.
See also:
~ATISensor()

OSCAR::ATISensor::~ATISensor  
 

Destructor for ATISensor Makes a call to the Close() method if it has not been called.

See also:
ATISensor(unsigned int portNo, OSCARError& err = DUMMY_ERROR(noError))


Member Function Documentation

bool OSCAR::ATISensor::ApplyTransform bool    aTrans
 

A method that lets the user set the data member applyTransform applyTransform is a bool which is set to true by default. applyTransform = true implies that the force vector read from the sensor should be operated upon by the spatial transformation forceTransform so that the result is in the EEF/Task frame. In most cases this would be desirable since applications are often written to work with either joint space or EEF/Task space. applyTransform = false implies that the raw readings from the sensor should be output when a call to one of the Read() methods is made.

Parameters:
aTrans which is set to true if spatial transformation is to be carried out and to false otherwise
Returns:
true or false. true implies applyTransform was set
See also:
Read(Vector7 &forces)

Read(Vector7Array forces)

SetSpatialXform(const String& filename)

SetSpatialXform(const SpatialXform& spatialxform)

GetSpatialXform(SpatialXform& spatialXform) const

GetTransformFlag()

bool OSCAR::ATISensor::Close   [virtual]
 

Overwrites the Close() method in base class. Closes the SCI and deletes the handle/pointer to serial port. A call to this method is made by the destructor.

Returns:
true or false. true implies successful closure of SCI channel
See also:
Initialize()

~ATISensor()

Reimplemented from OSCAR::Device.

bool OSCAR::ATISensor::GetBias Vector7   bs
 

bool OSCAR::ATISensor::GetSpatialXform SpatialXform   spatialXform const
 

Makes forceTransform accessible to the user. Used to obtain the transformation from sensor local frame to the EEF/Task frame.

Parameters:
spatialXform which would hold the one representing the coordinate transformation from sensor local frame to EEF/Task frame from sensor local frame to the EEF/Task frame
See also:
SetSpatialXform(const String& filename)

SetSpatialXform(const SpatialXform& spatialxform)

ApplyTransform(bool aTrans)

bool OSCAR::ATISensor::GetTransformFlag  
 

A method that lets the user query the data member applyTransform applyTransform is a bool which is set to true by default. applyTransform = true implies that the force vector read from the sensor should be operated upon by the spatial transformation forceTransform so that the result is in the EEF/Task frame. In most cases this would be desirable since applications are often written to work with either joint space or EEF/Task space. applyTransform = false implies that the raw readings from the sensor should be output when a call to one of the Read() methods is made.

Returns:
The Data Member applyTransform
See also:
Read(Vector7 &forces)

Read(Vector7Array forces)

SetSpatialXform(const String& filename)

SetSpatialXform(const SpatialXform& spatialxform)

GetSpatialXform(SpatialXform& spatialXform) const

ApplyTransform(bool aTrans)

virtual bool OSCAR::ATISensor::Initialize   [virtual]
 

Initializes the ATI F/T Sensor serial communication interface (SCI) Opens the communication channel and sets up the SCI parameters such as the baudrate,bytesize, parity, stopbits etc. A call to this method is *MANDATORY* before any other method can be called.

Returns:
true or false. true implies successful initialization of the SCI false implies that initialize failed. If false, call GetError() for the causative error
Exceptions:
portOpenFailure portOpenFailure
See also:
Close()

Reimplemented from OSCAR::Device.

bool OSCAR::ATISensor::Read Vector7   forces
 

This overloaded method facilitates the storage of ONE force reading in an Vector7 object. For the ATI F/T Sensor the sensor read command is "control T". Hence this method performs a "control T" sensor read, collects the characters read, parses the force vector elements from them and finally multiplies each reading by the const double ConvertFromCounts = 40.0 to convert the readings to lbs and lbs-in units. Checks for sensor errors (Saturation, Tranducer Errors) The final reading is stored in the param passed.

Parameters:
forces is the Vector7 object in which the final force readings from the sensor are stored. The elements of this vector are as follows: forces.at(0) = Error Code forces.at(1) = Force (X) (lbs) forces.at(2) = Force (Y) (lbs) forces.at(3) = Force (Z) (lbs) forces.at(4) = Moment(X) (lbs-in) forces.at(5) = Moment(Y) (lbs-in) forces.at(6) = Moment(Z) (lbs-in)
Error Code == 1: Saturation Error (System is forced beyond its rated range. The red LED on the controller lights up) Error Code == 2: Transducer Error (Occurs when there is a broken gage or tranducer cable inside the sensor) Error Code == 3: Both of the above occur simultaneously.

Returns:
true or false. true implies successful sensor read out false implies that readings could not be taken succesfully. If false, call GetError() for the causative error
See also:
transformForces(Vector7 &forces)
Exceptions:
notInitialized notInitialized
atisensorSaturationError atisensorSaturationError
atisensorTransducerError atisensorTransducerError
atisensorMultipleError atisensorMultipleError

virtual bool OSCAR::ATISensor::Read Vector7Array    forces [virtual]
 

This overloaded method facilitates the storage of a stream of force readings or multiple force readings in an Vector7Array object (This 'type' is defined in this header file as an array of Vector7 objects) Makes multiple calls to the Read(Vector7, unsigned int) method. The number of readings need to be specified in the interface as given below.

Parameters:
forces in which the stream of readings is stored. The number of force readings that will be taken will be equal to the size of forces.
Returns:
true or false. true implies successful sensor read out false implies that readings could not be taken succesfully. If false, call GetError() for the causative error

bool OSCAR::ATISensor::SendCommand char *    command,
String   string
 

Sends a command to the F/T sensor. This method essentially writes the command to the serial port buffer, reads the acknowledgement and stores it in the String object parameter. Note that this method *CANNOT* be used for query commands "control T" & "control N" and the QS stream return command.

Parameters:
command is the command to be written to the serial port Note: command *CANNOT* be either of "control T", "control N" or the QS stream return command
string is String object in which the echoed character is stored
Returns:
true or false. true implies that command was succesfully written to the serial port and appropriately acknowledged. false indicates failure to send command. If false, call GetError() for the causative error
Exceptions:
notInitialized notInitialized
registerWriteFailure (If failed to write to the Serial Port)
registerReadFailure (If failed to read from the Serial Port)
See also:
transformForces(Vector7 &forces)

bool OSCAR::ATISensor::SetBias Vector7    bs
 

bool OSCAR::ATISensor::SetSpatialXform const SpatialXform   spatialxform
 

Overloaded method to set the data member forceTransform which is a 6x6 Force Transformation Matrix associated with the spatial force vector, from an input SpatialXform object. The spatial transformation is the one which maps the 6D force vector readings from the sensor's local frame to the end-effector(EEF) or task frame This matrix has the general form X = [R O; pxR R] (Matlab Notation) where R: The rotation matrix from sensor reference frame to EEF frame p: Position vector of origin of sensor reference frame in the EEF frame O: 6 by 6 zero matrix x: The vector cross-product operator.

Parameters:
spatialxform is an SpatialXform object corresponding to the spatial transformation matrix
Returns:
true or false. true implies that forceTransform was set succesfully. false indicates failure to set forceTransform. If false, call GetError() for the causative error
See also:
SetSpatialXform(const String& filename)

GetSpatialXform(SpatialXform& spatialXform) const

ApplyTransform(bool aTrans)

bool OSCAR::ATISensor::SetSpatialXform const String   filename
 

Overloaded method to set the data member forceTransform which is a 6x6 Force Transformation Matrix associated with the spatial force vector, from a datafile.

Parameters:
filename This is a file that contains the Spatial Transformation in a matrix format of size 6 by 6. The spatial transformation is the one which maps the 6D force vector readings from the sensor's local frame to the end-effector or task frame This matrix has the general form X = [R O; pxR R] (Matlab Notation) where R: The rotation matrix from sensor reference frame to EEF frame p: Position vector of origin of sensor reference frame in the EEF frame O: 3 by 3 zero matrix x: The vector cross-product operator ----------------------------------------------------------------------------------------- # This is a spatial transform file for the ATI F/T sensor mounted on KB2017 # Column 1 Column 2 Column 3 Column 4 Column 5 Column 6 0.1543 -0.988 0 0 0 0 0.988 1 0 0 0 0 0 0 1 0 0 0 -2.9641 -0.4628 0 0.1543 -0.988 0 0.4628 -2.9641 -1 0.988 0.1543 1 0.988 0.1543 0 0 0 1
# Note: p = [1 0 3]' and R = Rot(-81 degrees, Z-axis) # The numbers above are only illustrative and should not be used for applications # with the dual arm. The entries should be determined through a calibration process -------------------------------------------------------------------------------------------

Returns:
true or false. true implies that forceTransform was set succesfully. false indicates failure to set forceTransform. If false, call GetError() for the causative error
See also:
SetSpatialXform(const SpatialXform& spatialxform)

GetSpatialXform(SpatialXform& spatialXform) const

ApplyTransform(bool aTrans)

Exceptions:
fileOpenError fileOpenError
dataSizeNotMatch dataSizeNotMatch

bool OSCAR::ATISensor::transformForces Vector7   forces [protected]
 

A Vector7 object holding entries corresponding to Raw Force Readings in the sensor's local frame is premultiplied by the forceTransform data member of this class to result in the input force vector transformed to the EEF/Task space.

Parameters:
forces to which the trasformed forces are assigned
Returns:
true or false. true implies successful transformation. false implies failure to carry out the transformation. If false, invoke GetError() to obtain error state
See also:
Read(Vector7 &forces)

Read(Vector7Array forces)

SetSpatialXform(const String& filename)

SetSpatialXform(const SpatialXform& spatialxform)

GetSpatialXform(SpatialXform& spatialXform) const

ApplyTransform()


Member Data Documentation

bool OSCAR::ATISensor::applyTransform [private]
 

Vector7 OSCAR::ATISensor::bias [private]
 

SpatialXform OSCAR::ATISensor::forceTransform [private]
 

unsigned int OSCAR::ATISensor::portNum [private]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations