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

Go to the source code of this file.

Macros

#define _USE_MATH_DEFINES
 

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)
 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).
 
int myosynGetLeaderChannel ()
 Returns the leader muscle channel which governs/triggers data acquisition on all other muscles.
 
void myosynSetLeaderChannel (int newLeader)
 Sets the leader/master 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

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]
 
unsigned channel_limits [3][2]
 
DAQarrangement myosynConfiguration = RING_OF_FIRE
 
unsigned numConfiguredMuscles = 0
 
int myosynLeader = -1
 
double myosyn_samplingRate_global = 1000.0
 

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Definition at line 7 of file myosyn.cpp.

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

◆ channel_limits

unsigned channel_limits[3][2]
Initial value:
= {{ 7, 7},
{12, 0},
{12,12}}

Definition at line 106 of file myosyn.cpp.

◆ loadcell_calib

double loadcell_calib[8][2]
Initial value:
= {{1, 0},
{1, 0},
{1/0.020997, 0.138763},
{1/0.019916,-0.062009},
{1, 0},
{1, 0},
{1, 0},
{0, 0}}

Definition at line 97 of file myosyn.cpp.

◆ muscle_enc_kleo

unsigned muscle_enc_kleo[8][2]
Initial value:
= {{7, 0},
{7, 1},
{7, 2},
{7, 3},
{7, 4},
{7, 5},
{7, 6},
{7, 7}}

Definition at line 53 of file myosyn.cpp.

◆ muscle_enc_mtr

unsigned muscle_enc_mtr[12][2]
Initial value:
= {{3, 0},
{3, 2},
{3, 4},
{3, 6},
{7, 0},
{7, 2},
{7, 4},
{7, 6},
{8, 0},
{8, 2},
{8, 4},
{8, 6}}

Definition at line 62 of file myosyn.cpp.

◆ muscle_enc_ring

unsigned muscle_enc_ring[8][2]
Initial value:
= {{3, 0},
{3, 1},
{3, 2},
{3, 3},
{3, 4},
{3, 5},
{3, 6},
{3, 7}}

Definition at line 44 of file myosyn.cpp.

◆ muscle_enc_spl

unsigned muscle_enc_spl[12][2]
Initial value:
= {{3, 1},
{3, 3},
{3, 5},
{3, 7},
{7, 1},
{7, 3},
{7, 5},
{7, 7},
{8, 1},
{8, 3},
{8, 5},
{8, 7}}

Definition at line 75 of file myosyn.cpp.

◆ muscle_ld_cell

unsigned muscle_ld_cell[8][2]
Initial value:
= {{5, 0},
{5, 8},
{5, 1},
{5, 9},
{5, 2},
{5,10},
{5,11},
{5, 3}}

Definition at line 88 of file myosyn.cpp.

◆ muscle_mtr_en

unsigned muscle_mtr_en[16][2]
Initial value:
= {{2, 0},
{2, 1},
{2, 2},
{2, 3},
{2, 4},
{2, 5},
{2, 6},
{2, 7},
{2,16},
{2,17},
{2,18},
{2,19},
{2,20},
{2,21},
{2,22},
{2,23}}

Definition at line 27 of file myosyn.cpp.

◆ muscle_mtr_val

unsigned muscle_mtr_val[16][2]
Initial value:
= {{2, 0},
{2, 1},
{2, 2},
{2, 3},
{2, 4},
{2, 5},
{2, 6},
{2, 7},
{2, 8},
{2, 9},
{2,10},
{2,11},
{2,12},
{2,13},
{2,14},
{2,15}}

Definition at line 10 of file myosyn.cpp.

◆ myosyn_samplingRate_global

double myosyn_samplingRate_global = 1000.0

Definition at line 114 of file myosyn.cpp.

◆ myosynConfiguration

DAQarrangement myosynConfiguration = RING_OF_FIRE

Definition at line 111 of file myosyn.cpp.

◆ myosynLeader

int myosynLeader = -1

Definition at line 113 of file myosyn.cpp.

◆ numConfiguredMuscles

unsigned numConfiguredMuscles = 0

Definition at line 112 of file myosyn.cpp.