MyoSyn
A C++ library control synthetic muscles in tendon-driven robots
Loading...
Searching...
No Matches
myosyn.h File Reference
#include <iostream>
#include <quickDAQ.h>

Go to the source code of this file.

Classes

class  myosyn
 This is the class object for each muscle channel. More...
 
class  T5encoder
 
class  T5control
 

Macros

#define MYOSYN_H
 
#define eprintf(_STR, ...)   fprintf(ERRSTREAM, _STR, __VA_ARGS__)
 
#define DIGITAL_HIGH_VOLTS   5.0
 
#define DIGITAL_LOW_VOLTS   0.0
 
#define WIND_UP_VOLTS   0.8
 
#define WIND_DOWN_VOLTS   0.0
 
#define DEFAULT_MUSCLE_TONE   1.0
 
#define MAX_MUSCLE_TENSION   30.0
 
#define MOTOR_SHAFT_DIAMTR   6
 
#define LOADCELL_TARE_NSAMP   100
 

Typedefs

typedef enum _DAQarrangement DAQarrangement
 Enumerates the different types of configurations supported by myosyn.
 
typedef enum _muscleStatus muscleStatus
 This ENUM lists the possible statuses of each muscle channel.
 

Enumerations

enum  _DAQarrangement { RING_OF_FIRE = 0 , QUADRUPED = 1 , MUSCLE_MODULE = 2 }
 Enumerates the different types of configurations supported by myosyn. More...
 
enum  _muscleStatus { MYOSYN_DISABLED = 0 , MYOSYN_READY_WINDDOWN = 1 , MYOSYN_ENABLED_WINDUP = 2 , MYOSYN_CLOSEDLOOP = 3 }
 This ENUM lists the possible statuses of each muscle channel. More...
 

Functions

unsigned myosynNumMuscles ()
 Returns the number of muscles configured by the library.
 
DAQarrangement myosynGetConfiguration ()
 
void myosynSetConfiguration (DAQarrangement DAQconfiguration)
 Set the muscle configuration/arrangement type of the library. List of possibilities in the DAQarrangement enum.
 
double myosynSamplingRate (double newSamplingRate=myosyn_samplingRate_global)
 Sets the sampling rate of the data acquisition and controller of all the muscle channels. The default rate is 1000Hz.
 
void myosynStart ()
 This routine starts the data acquisition on all muscle channels that haven't already been started so long as at least one channel has been configured.
 
void myosynStop ()
 This function sops the data acquisition of all muscle channels that were started (ie. active).
 
void myosynSetLeaderChannel (int newLeader)
 Sets the leader/master muscle channel which governs/triggers data acquisition on all other muscles.
 
int myosynGetLeaderChannel ()
 Returns the leader muscle channel which governs/triggers data acquisition on all other muscles.
 
void myosynReadInputs ()
 Global function to read all DAQ inputs in a synchronized manner. The results are put into the class objects of each muscle channel.
 
void myosynWriteOutputs ()
 Global function to write all DAQ outputs in a synchronized manner. The results are put into the class objects of each muscle channel.
 
void myosynWaitForClock ()
 This blocking function waits for the clock period to finish between two function calls. So, if the sampling period is 1ms, the second call of this function will block until 1ms has passed betwen two function calls.
 

Variables

DAQarrangement myosynConfiguration
 
unsigned numConfiguredMuscles
 
int myosynLeader
 
double myosyn_samplingRate_global
 
unsigned muscle_mtr_val [16][2]
 
unsigned muscle_mtr_en [16][2]
 
unsigned muscle_enc_ring [8][2]
 
unsigned muscle_enc_kleo [8][2]
 
unsigned muscle_enc_mtr [12][2]
 
unsigned muscle_enc_spl [12][2]
 
unsigned muscle_ld_cell [8][2]
 
double loadcell_calib [8][2]
 
double mtr_trque_calib [16][2]
 

Macro Definition Documentation

◆ DEFAULT_MUSCLE_TONE

#define DEFAULT_MUSCLE_TONE   1.0

Definition at line 14 of file myosyn.h.

◆ DIGITAL_HIGH_VOLTS

#define DIGITAL_HIGH_VOLTS   5.0

Definition at line 10 of file myosyn.h.

◆ DIGITAL_LOW_VOLTS

#define DIGITAL_LOW_VOLTS   0.0

Definition at line 11 of file myosyn.h.

◆ eprintf

#define eprintf (   _STR,
  ... 
)    fprintf(ERRSTREAM, _STR, __VA_ARGS__)

Definition at line 8 of file myosyn.h.

◆ LOADCELL_TARE_NSAMP

#define LOADCELL_TARE_NSAMP   100

Definition at line 17 of file myosyn.h.

◆ MAX_MUSCLE_TENSION

#define MAX_MUSCLE_TENSION   30.0

Definition at line 15 of file myosyn.h.

◆ MOTOR_SHAFT_DIAMTR

#define MOTOR_SHAFT_DIAMTR   6

Definition at line 16 of file myosyn.h.

◆ MYOSYN_H

#define MYOSYN_H

Definition at line 3 of file myosyn.h.

◆ WIND_DOWN_VOLTS

#define WIND_DOWN_VOLTS   0.0

Definition at line 13 of file myosyn.h.

◆ WIND_UP_VOLTS

#define WIND_UP_VOLTS   0.8

Definition at line 12 of file myosyn.h.

Typedef Documentation

◆ DAQarrangement

Enumerates the different types of configurations supported by myosyn.

◆ muscleStatus

This ENUM lists the possible statuses of each muscle channel.

Enumeration Type Documentation

◆ _DAQarrangement

Enumerates the different types of configurations supported by myosyn.

Enumerator
RING_OF_FIRE 
QUADRUPED 
MUSCLE_MODULE 

Definition at line 22 of file myosyn.h.

◆ _muscleStatus

This ENUM lists the possible statuses of each muscle channel.

Enumerator
MYOSYN_DISABLED 
MYOSYN_READY_WINDDOWN 
MYOSYN_ENABLED_WINDUP 
MYOSYN_CLOSEDLOOP 

Definition at line 32 of file myosyn.h.

Function Documentation

◆ myosynGetConfiguration()

DAQarrangement myosynGetConfiguration ( )

Definition at line 122 of file myosyn.cpp.

◆ myosynGetLeaderChannel()

int myosynGetLeaderChannel ( )

Returns the leader muscle channel which governs/triggers data acquisition on all other muscles.

Returns
If successful, the postive/zero leader muscle channel number. Otherwise, a negative error code.

Definition at line 181 of file myosyn.cpp.

◆ myosynNumMuscles()

unsigned myosynNumMuscles ( )

Returns the number of muscles configured by the library.

Returns
Unsigned integer number of muscles.

Definition at line 117 of file myosyn.cpp.

◆ myosynReadInputs()

void myosynReadInputs ( )

Global function to read all DAQ inputs in a synchronized manner. The results are put into the class objects of each muscle channel.

Definition at line 191 of file myosyn.cpp.

◆ myosynSamplingRate()

double myosynSamplingRate ( double  newSamplingRate = myosyn_samplingRate_global)

Sets the sampling rate of the data acquisition and controller of all the muscle channels. The default rate is 1000Hz.

Parameters
newSamplingRateThe global sampling rate of the DAQ subsystem. Cannot be overriden.
Returns
If successful, returns the positive sampling rate that was set. Otherwise, it returns a negative error code.

Definition at line 136 of file myosyn.cpp.

◆ myosynSetConfiguration()

void myosynSetConfiguration ( DAQarrangement  DAQconfiguration)

Set the muscle configuration/arrangement type of the library. List of possibilities in the DAQarrangement enum.

Parameters
DAQconfigurationThe muscle configuration type (from the DAQarrangement enum) to which the library muscle be set.

Definition at line 126 of file myosyn.cpp.

◆ myosynSetLeaderChannel()

void myosynSetLeaderChannel ( int  newLeader)

Sets the leader/master muscle channel which governs/triggers data acquisition on all other muscles.

Parameters
newLeaderThe muscle channel which needs to be set as a leader.

Definition at line 186 of file myosyn.cpp.

◆ myosynStart()

void myosynStart ( )

This routine starts the data acquisition on all muscle channels that haven't already been started so long as at least one channel has been configured.

Definition at line 146 of file myosyn.cpp.

◆ myosynStop()

void myosynStop ( )

This function sops the data acquisition of all muscle channels that were started (ie. active).

Definition at line 168 of file myosyn.cpp.

◆ myosynWaitForClock()

void myosynWaitForClock ( )

This blocking function waits for the clock period to finish between two function calls. So, if the sampling period is 1ms, the second call of this function will block until 1ms has passed betwen two function calls.

Definition at line 208 of file myosyn.cpp.

◆ myosynWriteOutputs()

void myosynWriteOutputs ( )

Global function to write all DAQ outputs in a synchronized manner. The results are put into the class objects of each muscle channel.

Definition at line 203 of file myosyn.cpp.

Variable Documentation

◆ loadcell_calib

double loadcell_calib[8][2]
extern

Definition at line 97 of file myosyn.cpp.

◆ mtr_trque_calib

double mtr_trque_calib[16][2]
extern

◆ muscle_enc_kleo

unsigned muscle_enc_kleo[8][2]
extern

Definition at line 53 of file myosyn.cpp.

◆ muscle_enc_mtr

unsigned muscle_enc_mtr[12][2]
extern

Definition at line 62 of file myosyn.cpp.

◆ muscle_enc_ring

unsigned muscle_enc_ring[8][2]
extern

Definition at line 44 of file myosyn.cpp.

◆ muscle_enc_spl

unsigned muscle_enc_spl[12][2]
extern

Definition at line 75 of file myosyn.cpp.

◆ muscle_ld_cell

unsigned muscle_ld_cell[8][2]
extern

Definition at line 88 of file myosyn.cpp.

◆ muscle_mtr_en

unsigned muscle_mtr_en[16][2]
extern

Definition at line 27 of file myosyn.cpp.

◆ muscle_mtr_val

unsigned muscle_mtr_val[16][2]
extern

Definition at line 10 of file myosyn.cpp.

◆ myosyn_samplingRate_global

double myosyn_samplingRate_global
extern

Definition at line 114 of file myosyn.cpp.

◆ myosynConfiguration

DAQarrangement myosynConfiguration
extern

Definition at line 111 of file myosyn.cpp.

◆ myosynLeader

int myosynLeader
extern

Definition at line 113 of file myosyn.cpp.

◆ numConfiguredMuscles

unsigned numConfiguredMuscles
extern

Definition at line 112 of file myosyn.cpp.