MyoSyn
A C++ library control synthetic muscles in tendon-driven robots
Loading...
Searching...
No Matches
myosyn Class Reference

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.
 

Detailed Description

This is the class object for each muscle channel.

Definition at line 129 of file myosyn.h.

Constructor & Destructor Documentation

◆ myosyn() [1/2]

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() [2/2]

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.

Parameters
muscleChannelThe channel number/ID of the muscle channel that is to be configured.

Definition at line 219 of file myosyn.cpp.

◆ ~myosyn()

myosyn::~myosyn ( )

Definition at line 342 of file myosyn.cpp.

Member Function Documentation

◆ calibrateExcursion()

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.

Parameters
spoolDiameterThe diameter of the shaft (in mm) that is used to spool the tendon.

Definition at line 536 of file myosyn.cpp.

◆ calibrateTension()

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.

Parameters
loadCellGainThe gain value (units: N/V)

Definition at line 468 of file myosyn.cpp.

◆ encoderAngle2Excursion()

double myosyn::encoderAngle2Excursion ( double  encoderAngle)

Returns the tendon excursion given an encoder angle.

Parameters
encoderAngleEncoder angle (in degrees).
Returns
Tendon excursion (in mm).

Definition at line 563 of file myosyn.cpp.

◆ executeControl()

void myosyn::executeControl ( )

Executes the control law set by the controlRoutine function pointer.

Definition at line 624 of file myosyn.cpp.

◆ getChannelID()

unsigned myosyn::getChannelID ( )

Returns the channel ID number of the muscle channel.

Returns
The channel number of the muscle (values greater than or equal to 0 possible).

Definition at line 364 of file myosyn.cpp.

◆ getMaxMuscleTension()

double myosyn::getMaxMuscleTension ( )

Returns the upper limit of possible muscle tensions by the motor of the muscle channel.

Returns
The upper limit (in newtons) of the motor of the muscle channel.

Definition at line 442 of file myosyn.cpp.

◆ getMotorCommand()

double myosyn::getMotorCommand ( )

Returns the current motor command that is being commanded to the motor.

Returns
Current motor command by the motor controller (in volts)

Definition at line 605 of file myosyn.cpp.

◆ getMuscleStatus()

muscleStatus myosyn::getMuscleStatus ( )

Returns the status of the muscle channel. The possible statuses are listed in the enum muscleStatus.

Returns
Returns the muscle status as a muscleStatus type-defined enum.

Definition at line 369 of file myosyn.cpp.

◆ getMuscleTension()

double myosyn::getMuscleTension ( )

Returns the current muscle tension value (in newtons) in the internal memory.

Returns
The current muscle tension value (in newtons) stored in the muscle channel object.

Definition at line 520 of file myosyn.cpp.

◆ getMuscleToneTension()

double myosyn::getMuscleToneTension ( )

Returns the current muscle tone of the muscle channel.

Returns
The currently set muscle tone of the channel (in newtons).

Definition at line 432 of file myosyn.cpp.

◆ getReferenceTension()

double myosyn::getReferenceTension ( )

Returns the current reference/target muscle tension that the motor controller is trying to achieve/maintain.

Returns
The current reference/target muscle tension (in newtons) that the motor controller is trying to achieve/maintain.

Definition at line 462 of file myosyn.cpp.

◆ getTendonExcursion()

double myosyn::getTendonExcursion ( )

Returns the current tendon excursion value (in mm) in the internal memory.

Returns
The current tendon excursion value (in mm) stored in the muscle channel object.

Definition at line 578 of file myosyn.cpp.

◆ loadcellV2F()

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 .

Parameters
LCvoltageThe voltage value to be converted to newtons.
Returns
The force/tension (in newtons) corresponding to the voltage supplied.

Definition at line 501 of file myosyn.cpp.

◆ readMuscleTension()

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.

◆ readTendonExcursion()

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.

◆ setMaxMuscleTension()

void myosyn::setMaxMuscleTension ( double  max_tension)

Sets the upper limit to possible muscle tension of the motor of the muscle channel as a protection.

Parameters
max_tensionThe upper limit (in newtons) of the muscle tension of the motor.

Definition at line 437 of file myosyn.cpp.

◆ setMotorCommand()

void myosyn::setMotorCommand ( double  newCommand)

Sets the current motor command to be sent to the DC motor.

Parameters
newCommandThe new motor command (in volts) to be send to the motor.

Definition at line 610 of file myosyn.cpp.

◆ setMuscleStatus()

void myosyn::setMuscleStatus ( muscleStatus  newStatus)

Function sets the status of the muscle channel object.

Parameters
newStatusThe new status of the object of type muscleStatus .

Definition at line 374 of file myosyn.cpp.

◆ setMuscleToneTension()

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.

Parameters
myMuscleTone_valueMuscle tone and minimum muscle tension allowed (in newtons).

Definition at line 427 of file myosyn.cpp.

◆ setReferenceTension()

void myosyn::setReferenceTension ( double  myTension)

The current reference/target muscle tension which the internal closed-loop controller will attempt to achieve on the motor.

Parameters
myTensionThe reference/target muscle tension (in newtons) which the motor controller should try to achieve.

Definition at line 447 of file myosyn.cpp.

◆ startMuscleControl()

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.

◆ stopMuscleControl()

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.

◆ windDown()

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.

◆ windUp()

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.

Member Data Documentation

◆ controlRoutine

void(* myosyn::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.

Definition at line 341 of file myosyn.h.

◆ startDAQ

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.

Definition at line 204 of file myosyn.h.

◆ stopDAQ

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.

Definition at line 210 of file myosyn.h.


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