MyoSyn
A C++ library control synthetic muscles in tendon-driven robots
|
This is the class object for each muscle channel. More...
#include <include/myosyn.h>
Public Member Functions | |
myosyn () | |
Default constructor of the myosyn class. Auto-selects muscle channel when setting up a muscle channel. | |
myosyn (unsigned muscleChannel) | |
Constructor for the myosyn class. User provides the channel number to configure and if it is yet to be configured, the muscle channel is setup and the class object is initialized with the setting and channel ID number. | |
~myosyn () | |
unsigned | getChannelID () |
Returns the channel ID number of the muscle channel. | |
muscleStatus | getMuscleStatus () |
Returns the status of the muscle channel. The possible statuses are listed in the enum muscleStatus. | |
void | setMuscleStatus (muscleStatus newStatus) |
Function sets the status of the muscle channel object. | |
void | windUp () |
Function starts/energizes the motor of the muscle channel to wind up the tendons to prevent slack. | |
void | windDown () |
Function stops/deenergizes the motor of the muscle channel to wind down the tendons before system shutdown. | |
void | setMuscleToneTension (double myMuscleTone_value) |
Sets the minimum tension held by the motor of a muscle channel. Corresponds to muscle tone and is the lower bound of possible muscle tension values. | |
double | getMuscleToneTension () |
Returns the current muscle tone of the muscle channel. | |
void | setMaxMuscleTension (double max_tension) |
Sets the upper limit to possible muscle tension of the motor of the muscle channel as a protection. | |
double | getMaxMuscleTension () |
Returns the upper limit of possible muscle tensions by the motor of the muscle channel. | |
void | setReferenceTension (double myTension) |
The current reference/target muscle tension which the internal closed-loop controller will attempt to achieve on the motor. | |
double | getReferenceTension () |
Returns the current reference/target muscle tension that the motor controller is trying to achieve/maintain. | |
void | calibrateTension (double loadCellGain=NAN) |
Sets the gain to calibrate the transformation of the loadcell voltage to force in newtons. Also winds up and reads the load cell's initial bias voltage to tare the loadcell. | |
double | loadcellV2F (double LCvoltage) |
Returns the force on the loadcell when supplied with the voltage based on the gain and bias set by calibrateTension . | |
void | readMuscleTension () |
Uses the DAQ subsystem to read the muscle tension detected by the loadcell and puts it in the internal memory. Use getMuscleTension to read the value in the internal memory. | |
double | getMuscleTension () |
Returns the current muscle tension value (in newtons) in the internal memory. | |
void | calibrateExcursion (double spoolDiameter=NAN) |
Calibrates the rotary incremental shaft encoder to zero degrees and set the conversion from angle to excursion. This is done by using the diameter of the shaft that spools the tendon. 360 degrees of rotation corresponds to one shaft circumference of excursion. | |
double | encoderAngle2Excursion (double encoderAngle) |
Returns the tendon excursion given an encoder angle. | |
void | readTendonExcursion () |
Uses the DAQ subsystem to read the tendon excursion detected by the shaft encoder and puts it in the internal memory. | |
double | getTendonExcursion () |
Returns the current tendon excursion value (in mm) in the internal memory. | |
void | startMuscleControl () |
Starts the force controller and update the status of the muscle channel. This function only needs to be called for one of the muscle channels. | |
double | getMotorCommand () |
Returns the current motor command that is being commanded to the motor. | |
void | setMotorCommand (double newCommand) |
Sets the current motor command to be sent to the DC motor. | |
void | executeControl () |
Executes the control law set by the controlRoutine function pointer. | |
void | stopMuscleControl () |
Stops the force controller and update the status of the muscle channel. This function only needs to be called for one of the muscle channels. | |
Public Attributes | |
void(* | startDAQ )() |
Function pointer to the global myosynStart function to start data acquisition. Only need to call this for one of the class objects. | |
void(* | stopDAQ )() |
Function pointer to the global myosynStop function to stop data acquisition. Only need to call this for one of the class objects. | |
void(* | controlRoutine )(unsigned numOutputs, double *outputs, unsigned numInputs, double *inputs) |
[FOR FUTURE USE ONLY] Function pointer to any control law you might want the muscle channel to use. | |
myosyn::myosyn | ( | ) |
Default constructor of the myosyn class. Auto-selects muscle channel when setting up a muscle channel.
Definition at line 214 of file myosyn.cpp.
myosyn::myosyn | ( | unsigned | muscleChannel | ) |
Constructor for the myosyn class. User provides the channel number to configure and if it is yet to be configured, the muscle channel is setup and the class object is initialized with the setting and channel ID number.
muscleChannel | The channel number/ID of the muscle channel that is to be configured. |
Definition at line 219 of file myosyn.cpp.
myosyn::~myosyn | ( | ) |
Definition at line 342 of file myosyn.cpp.
void myosyn::calibrateExcursion | ( | double | spoolDiameter = NAN | ) |
Calibrates the rotary incremental shaft encoder to zero degrees and set the conversion from angle to excursion. This is done by using the diameter of the shaft that spools the tendon. 360 degrees of rotation corresponds to one shaft circumference of excursion.
spoolDiameter | The diameter of the shaft (in mm) that is used to spool the tendon. |
Definition at line 536 of file myosyn.cpp.
void myosyn::calibrateTension | ( | double | loadCellGain = NAN | ) |
Sets the gain to calibrate the transformation of the loadcell voltage to force in newtons. Also winds up and reads the load cell's initial bias voltage to tare the loadcell.
loadCellGain | The gain value (units: N/V) |
Definition at line 468 of file myosyn.cpp.
double myosyn::encoderAngle2Excursion | ( | double | encoderAngle | ) |
Returns the tendon excursion given an encoder angle.
encoderAngle | Encoder angle (in degrees). |
Definition at line 563 of file myosyn.cpp.
void myosyn::executeControl | ( | ) |
Executes the control law set by the controlRoutine function pointer.
Definition at line 624 of file myosyn.cpp.
unsigned myosyn::getChannelID | ( | ) |
Returns the channel ID number of the muscle channel.
Definition at line 364 of file myosyn.cpp.
double myosyn::getMaxMuscleTension | ( | ) |
Returns the upper limit of possible muscle tensions by the motor of the muscle channel.
Definition at line 442 of file myosyn.cpp.
double myosyn::getMotorCommand | ( | ) |
Returns the current motor command that is being commanded to the motor.
Definition at line 605 of file myosyn.cpp.
muscleStatus myosyn::getMuscleStatus | ( | ) |
Returns the status of the muscle channel. The possible statuses are listed in the enum muscleStatus.
Definition at line 369 of file myosyn.cpp.
double myosyn::getMuscleTension | ( | ) |
Returns the current muscle tension value (in newtons) in the internal memory.
Definition at line 520 of file myosyn.cpp.
double myosyn::getMuscleToneTension | ( | ) |
Returns the current muscle tone of the muscle channel.
Definition at line 432 of file myosyn.cpp.
double myosyn::getReferenceTension | ( | ) |
Returns the current reference/target muscle tension that the motor controller is trying to achieve/maintain.
Definition at line 462 of file myosyn.cpp.
double myosyn::getTendonExcursion | ( | ) |
Returns the current tendon excursion value (in mm) in the internal memory.
Definition at line 578 of file myosyn.cpp.
double myosyn::loadcellV2F | ( | double | LCvoltage | ) |
Returns the force on the loadcell when supplied with the voltage based on the gain and bias set by calibrateTension .
LCvoltage | The voltage value to be converted to newtons. |
Definition at line 501 of file myosyn.cpp.
void myosyn::readMuscleTension | ( | ) |
Uses the DAQ subsystem to read the muscle tension detected by the loadcell and puts it in the internal memory. Use getMuscleTension to read the value in the internal memory.
Definition at line 506 of file myosyn.cpp.
void myosyn::readTendonExcursion | ( | ) |
Uses the DAQ subsystem to read the tendon excursion detected by the shaft encoder and puts it in the internal memory.
Definition at line 568 of file myosyn.cpp.
void myosyn::setMaxMuscleTension | ( | double | max_tension | ) |
Sets the upper limit to possible muscle tension of the motor of the muscle channel as a protection.
max_tension | The upper limit (in newtons) of the muscle tension of the motor. |
Definition at line 437 of file myosyn.cpp.
void myosyn::setMotorCommand | ( | double | newCommand | ) |
Sets the current motor command to be sent to the DC motor.
newCommand | The new motor command (in volts) to be send to the motor. |
Definition at line 610 of file myosyn.cpp.
void myosyn::setMuscleStatus | ( | muscleStatus | newStatus | ) |
Function sets the status of the muscle channel object.
newStatus | The new status of the object of type muscleStatus . |
Definition at line 374 of file myosyn.cpp.
void myosyn::setMuscleToneTension | ( | double | myMuscleTone_value | ) |
Sets the minimum tension held by the motor of a muscle channel. Corresponds to muscle tone and is the lower bound of possible muscle tension values.
myMuscleTone_value | Muscle tone and minimum muscle tension allowed (in newtons). |
Definition at line 427 of file myosyn.cpp.
void myosyn::setReferenceTension | ( | double | myTension | ) |
The current reference/target muscle tension which the internal closed-loop controller will attempt to achieve on the motor.
myTension | The reference/target muscle tension (in newtons) which the motor controller should try to achieve. |
Definition at line 447 of file myosyn.cpp.
void myosyn::startMuscleControl | ( | ) |
Starts the force controller and update the status of the muscle channel. This function only needs to be called for one of the muscle channels.
Definition at line 589 of file myosyn.cpp.
void myosyn::stopMuscleControl | ( | ) |
Stops the force controller and update the status of the muscle channel. This function only needs to be called for one of the muscle channels.
Definition at line 634 of file myosyn.cpp.
void myosyn::windDown | ( | ) |
Function stops/deenergizes the motor of the muscle channel to wind down the tendons before system shutdown.
Definition at line 400 of file myosyn.cpp.
void myosyn::windUp | ( | ) |
Function starts/energizes the motor of the muscle channel to wind up the tendons to prevent slack.
Definition at line 380 of file myosyn.cpp.
void(* myosyn::controlRoutine) (unsigned numOutputs, double *outputs, unsigned numInputs, double *inputs) |
void(* myosyn::startDAQ) () |
Function pointer to the global myosynStart function to start data acquisition. Only need to call this for one of the class objects.
void(* myosyn::stopDAQ) () |
Function pointer to the global myosynStop function to stop data acquisition. Only need to call this for one of the class objects.