MyoSyn
A C++ library control synthetic muscles in tendon-driven robots
Loading...
Searching...
No Matches
myosyn.cpp
Go to the documentation of this file.
1// myosyn.cpp : This file contains the 'main' function. Program execution begins and ends there.
2//
3
4#include <iostream>
5#include <quickDAQ.h>
6#include "..\include\myosyn.h"
7#define _USE_MATH_DEFINES
8#include <math.h>
9
10unsigned muscle_mtr_val[16][2] = {{2, 0}, // Muscle Channel 0 : {Device Number, Pin Number}
11 {2, 1}, // Muscle Channel 1
12 {2, 2}, // Muscle Channel 2
13 {2, 3}, // Muscle Channel 3
14 {2, 4}, // Muscle Channel 4
15 {2, 5}, // Muscle Channel 5
16 {2, 6}, // Muscle Channel 6
17 {2, 7}, // Muscle Channel 7
18 {2, 8}, // Muscle Channel 8
19 {2, 9}, // Muscle Channel 9
20 {2,10}, // Muscle Channel 10
21 {2,11}, // Muscle Channel 11
22 {2,12}, // Muscle Channel 12
23 {2,13}, // Muscle Channel 13
24 {2,14}, // Muscle Channel 14
25 {2,15}};// Muscle Channel 15
26
27unsigned muscle_mtr_en [16][2] = {{2, 0}, // Muscle Channel 0 : {Device Number, Pin Number}
28 {2, 1}, // Muscle Channel 1
29 {2, 2}, // Muscle Channel 2
30 {2, 3}, // Muscle Channel 3
31 {2, 4}, // Muscle Channel 4
32 {2, 5}, // Muscle Channel 5
33 {2, 6}, // Muscle Channel 6
34 {2, 7}, // Muscle Channel 7
35 {2,16}, // Muscle Channel 8
36 {2,17}, // Muscle Channel 9
37 {2,18}, // Muscle Channel 10
38 {2,19}, // Muscle Channel 11
39 {2,20}, // Muscle Channel 12
40 {2,21}, // Muscle Channel 13
41 {2,22}, // Muscle Channel 14
42 {2,23}}; // Muscle Channel 15
43
44unsigned muscle_enc_ring [8][2] = {{3, 0}, // Muscle Channel 0 : {Device Number, Pin Number}
45 {3, 1}, // Muscle Channel 1
46 {3, 2}, // Muscle Channel 2
47 {3, 3}, // Muscle Channel 3
48 {3, 4}, // Muscle Channel 4
49 {3, 5}, // Muscle Channel 5
50 {3, 6}, // Muscle Channel 6
51 {3, 7}}; // Muscle Channel 7
52
53unsigned muscle_enc_kleo [8][2] = {{7, 0}, // Muscle Channel 0 : {Device Number, Pin Number}
54 {7, 1}, // Muscle Channel 1
55 {7, 2}, // Muscle Channel 2
56 {7, 3}, // Muscle Channel 3
57 {7, 4}, // Muscle Channel 4
58 {7, 5}, // Muscle Channel 5
59 {7, 6}, // Muscle Channel 6
60 {7, 7}}; // Muscle Channel 7
61
62unsigned muscle_enc_mtr[12][2] = {{3, 0}, // Muscle Channel 0 : {Device Number, Pin Number}
63 {3, 2}, // Muscle Channel 1
64 {3, 4}, // Muscle Channel 2
65 {3, 6}, // Muscle Channel 3
66 {7, 0}, // Muscle Channel 4
67 {7, 2}, // Muscle Channel 5
68 {7, 4}, // Muscle Channel 6
69 {7, 6}, // Muscle Channel 7
70 {8, 0}, // Muscle Channel 8
71 {8, 2}, // Muscle Channel 9
72 {8, 4}, // Muscle Channel 10
73 {8, 6}}; // Muscle Channel 11
74
75unsigned muscle_enc_spl[12][2] = {{3, 1}, // Muscle Channel 0 : {Device Number, Pin Number}
76 {3, 3}, // Muscle Channel 1
77 {3, 5}, // Muscle Channel 2
78 {3, 7}, // Muscle Channel 3
79 {7, 1}, // Muscle Channel 4
80 {7, 3}, // Muscle Channel 5
81 {7, 5}, // Muscle Channel 6
82 {7, 7}, // Muscle Channel 7
83 {8, 1}, // Muscle Channel 8
84 {8, 3}, // Muscle Channel 9
85 {8, 5}, // Muscle Channel 10
86 {8, 7}}; // Muscle Channel 11
87
88unsigned muscle_ld_cell [8][2] = {{5, 0}, // Muscle Channel 0 : {Device Number, Pin Number}
89 {5, 8}, // Muscle Channel 1
90 {5, 1}, // Muscle Channel 2
91 {5, 9}, // Muscle Channel 3
92 {5, 2}, // Muscle Channel 4
93 {5,10}, // Muscle Channel 5
94 {5,11}, // Muscle Channel 6
95 {5, 3}}; // Muscle Channel 7
96
97double loadcell_calib[8][2] = {{1, 0}, // Muscle Channel 0 - Gain, Bias
98 {1, 0}, // Muscle Channel 1
99 {1/0.020997, 0.138763}, // Muscle Channel 2
100 {1/0.019916,-0.062009}, // Muscle Channel 3
101 {1, 0}, // Muscle Channel 4
102 {1, 0}, // Muscle Channel 5
103 {1, 0}, // Muscle Channel 6
104 {0, 0}}; // Muscle Channel 7
105
106unsigned channel_limits[3][2] = {{ 7, 7},
107 {12, 0},
108 {12,12}};
109
110//int T5_quickDAQstatus = 0;
114double myosyn_samplingRate_global = 1000.0; // Sampling rate in Hz
115
116// Global myosyn function defintions
117/*inline*/ unsigned myosynNumMuscles()
118{
120}
121
123{
124 return myosynConfiguration;
125}
126/*inline*/ void myosynSetConfiguration(DAQarrangement DAQconfiguration)
127{
128 if (myosynNumMuscles() == 0) {
129 myosynConfiguration = DAQconfiguration;
130 }
131 else {
132 // print error/warning message?
133 }
134}
135
136/*inline*/ double myosynSamplingRate(double newSamplingRate/* = myosyn_samplingRate_global*/)
137{
138 if (quickDAQgetStatus() <= STATUS_INIT) {
139 myosyn_samplingRate_global = newSamplingRate;
141 }
142 // print error/warning?
143 return -1;
144}
145
146/*inline*/ void myosynStart()
147{
148 if (myosynNumMuscles() > 0) {
149 switch (quickDAQgetStatus())
150 {
151 case STATUS_INIT:
152 // Setup DAQ sampling rate and trigger mode
153 setSampleClockTiming((samplingModes)HW_CLOCKED, (float64)myosynSamplingRate(), DAQmxClockSource, (triggerModes)DAQmxTriggerEdge, DAQmxNumDataPointsPerSample, TRUE);
154
155 case STATUS_READY:
156 // Start quickDAQ - only need to call this once
157 quickDAQstart();
158 case STATUS_RUNNING:
159 // you need to do nothing here
160 break;
161 default:
162 // Print some error message
163 break;
164 }
165 }
166}
167
168/*inline*/ void myosynStop()
169{
170 switch (quickDAQgetStatus())
171 {
172 case STATUS_RUNNING:
173 quickDAQstop();
174 break;
175 default:
176 // print some error message?
177 break;
178 }
179}
180
182{
183 return myosynLeader;
184}
185
186void myosynSetLeaderChannel(int newLeader)
187{
188 myosynLeader = newLeader;
189}
190
191/*inline*/ void myosynReadInputs()
192{
193 if (quickDAQgetStatus() == STATUS_RUNNING && myosynNumMuscles() > 0) {
195 readAnalog_intBuf(myosynLeader);
196 }
197 }
198 else {
199 // print and return something?
200 }
201}
202
203/*inline*/ void myosynWriteOutputs()
204{
205 // write the code here
206}
207
208/*inline*/ void myosynWaitForClock()
209{
210 syncSampling();
211}
212
213// Constructors and destructor
215{
217}
218
219myosyn::myosyn(unsigned muscleChannel)
220{
221 // Initialize myosyn object basic settings
222 this->channelID = muscleChannel;
223 this->myDAQarrangement = &myosynConfiguration;
224
225 // Initialize quickDAQ library
226 if (quickDAQgetStatus() == (int)STATUS_NASCENT) {
227 quickDAQinit();
228 }
231 controlRoutine = NULL;
232
233 // Acquire pin configurations based on DAQ arrangement
234 maxChannels_enc = 0;
235 maxChannels_mtr = 0;
236 encoder_opt_config = NULL;
237
238 switch (myosynGetConfiguration())
239 {
240 case RING_OF_FIRE:
241 maxChannels_mtr = 7;
242 motor_enable_config = muscle_mtr_en;
243 motor_value_config = muscle_mtr_val;
244
245 maxChannels_enc = 7;
246 encoder_config = muscle_enc_ring;
247 encoder_opt_config = NULL;
248
249 loadcell_config = muscle_ld_cell;
250 loadcell_gain = loadcell_config[channelID][0];
251 loadcell_offset = loadcell_config[channelID][1];
252
253 break;
254
255 case QUADRUPED:
256 maxChannels_mtr = 12;
257 motor_enable_config = muscle_mtr_en;
258 motor_value_config = muscle_mtr_val;
259
260 maxChannels_enc = 0;
261 encoder_config = muscle_enc_kleo;
262 encoder_opt_config = NULL;
263
264 loadcell_config = NULL;
265 loadcell_gain = 0;
266 loadcell_offset = 0;
267 break;
268
269 case MUSCLE_MODULE:
270 maxChannels_mtr = 12;
271 motor_enable_config = muscle_mtr_en;
272 motor_value_config = muscle_mtr_val;
273
274 maxChannels_enc = 12;
275 encoder_config = muscle_enc_spl;
276 encoder_opt_config = muscle_enc_mtr;
277
278 loadcell_config = NULL;
279 loadcell_gain = 0;
280 loadcell_offset = 0;
281 break;
282
283 default:
284 fprintf(ERRSTREAM, "ERROR: MyoSyn: Invalid DAQ arrangement selected. Program will terminate.");
285 quickDAQTerminate();
286 exit(-1);
287 break;
288 }
289
290 // Initialize calibration parameters
291 muscleToneTension = DEFAULT_MUSCLE_TONE;
292 maxMuscleTension = MAX_MUSCLE_TENSION;
293 encoder_angle_to_excursion_ratio = (M_PI/360.00) * MOTOR_SHAFT_DIAMTR; // circumference with conversion from mm to meters
294
295 // Set pin modes for all pins based on DAQ arrangement
296 if (channelID < maxChannels_mtr) {
297 // LOAD CELL INPUT
299 {
300 pinMode(loadcell_config[channelID][0], ANALOG_IN, loadcell_config[channelID][1]);
301 }
302
303 // MOTOR VALUE OUTPUT
304 pinMode(motor_value_config[channelID][0], ANALOG_OUT, motor_value_config[channelID][1]);
305
306 // MOTOR ENABLE (ACTIVE HIGH OUTPUT)
307 if (motor_enable_config[channelID][0] == 2) {
308 if (motor_enable_config[channelID][1] < 8) { // For digital output pins of NI-DAQmx
309 pinMode(motor_enable_config[channelID][0], DIGITAL_OUT, 0);
310 }
311 else if (motor_enable_config[channelID][1] > 15 && motor_enable_config[channelID][1] < 24) { // For analog output pins of NI-DAQmx to behave like digital output pins
312 pinMode(motor_enable_config[channelID][0], ANALOG_OUT, motor_enable_config[channelID][1]);
313 }
314 }
315
316 // ENCODER INPUT
318 {
319 // Main encoder
320 pinMode(encoder_config[channelID][0], CTR_ANGLE_IN, encoder_config[channelID][1]);
321
322 // Optional encoder
323 if (encoder_opt_config != NULL && myosynGetConfiguration() == MUSCLE_MODULE) {
324 pinMode(encoder_opt_config[channelID][0], CTR_ANGLE_IN, encoder_opt_config[channelID][1]);
325 }
326 }
327 }
328 else {
329 fprintf(ERRSTREAM, "ERROR: MyoSyn: Requested channel ID %d is greater than the number of available motor channels %d. Program will terminate.", channelID, maxChannels_mtr);
330 exit(-1);
331 }
332
333 // Set muscle status and increment numActiveMuscles
335 eprintf("myosyn: Muscle %d enabled.\n", channelID);
337 if (myosynNumMuscles() == 1) {
338 myosynSetLeaderChannel(channelID);
339 }
340}
341
343{
345 switch (getMuscleStatus()) {
347 // Call the function that shuts down closed loop controller
349 windDown();
350 default:
351 this->status = MYOSYN_DISABLED;
352 }
353 if (numConfiguredMuscles == 1 && quickDAQgetStatus() > STATUS_NASCENT) {
354 (*stopDAQ)();
355 quickDAQTerminate();
356 }
358 }
360 eprintf("myosyn: Muscle %d disabled.\n", channelID);
361}
362
363// myosyn support functions
364/*inline*/ unsigned myosyn::getChannelID()
365{
366 return this->channelID;
367}
368
370{
371 return this->status;
372}
373
374/*inline*/ void myosyn::setMuscleStatus(muscleStatus newStatus)
375{
376 this->status = newStatus;
377}
378
379// Muscle open-loop operations
381{
383 (*startDAQ)();
384 if (motor_enable_config[channelID][1] < 8) {
385 writeDigitalPin(motor_enable_config[channelID][0], 0, motor_enable_config[channelID][1], TRUE);
386 }
387 else if (motor_enable_config[channelID][1] > 15 && motor_enable_config[channelID][1] < 24) {
388 setAnalogOutPin(motor_enable_config[channelID][0], motor_enable_config[channelID][1], (float64)DIGITAL_HIGH_VOLTS);
389 writeAnalog_intBuf(motor_enable_config[channelID][0]);
390 }
391 setAnalogOutPin(motor_value_config[channelID][0], motor_value_config[channelID][1], (float64)WIND_UP_VOLTS);
392 writeAnalog_intBuf(motor_value_config[channelID][0]);
394 }
395 else {
396 // print warning and return something?
397 }
398}
399
401{
402 switch (getMuscleStatus())
403 {
405 // do stuff pertaining to active closed loop control
407 if (motor_enable_config[channelID][1] < 8) {
408 writeDigitalPin(motor_enable_config[channelID][0], 0, motor_enable_config[channelID][1], FALSE);
409 }
410 else if (motor_enable_config[channelID][1] > 15 && motor_enable_config[channelID][1] < 24) {
411 setAnalogOutPin(motor_enable_config[channelID][0], motor_enable_config[channelID][1], (float64)DIGITAL_LOW_VOLTS);
412 }
413 setAnalogOutPin(motor_value_config [channelID][0], motor_value_config [channelID][1], (float64)WIND_DOWN_VOLTS);
414 writeAnalog_intBuf(motor_enable_config[channelID][0]);
416 if (numConfiguredMuscles == 1) {
417 (*stopDAQ)();
418 }
419 break;
420 default:
421 // print error
422 break;
423 }
424}
425
426// Functions for muscle closed-loop parameter settings
427/*inline*/ void myosyn::setMuscleToneTension(double myMuscleTone_value)
428{
429 this->muscleToneTension = myMuscleTone_value;
430}
431
433{
434 return this->muscleToneTension;
435}
436
437/*inline*/ void myosyn::setMaxMuscleTension(double max_tension)
438{
439 this->maxMuscleTension = max_tension;
440}
441
443{
444 return this->maxMuscleTension;
445}
446
447/*inline*/ void myosyn::setReferenceTension(double refTension)
448{
449 this->refMuscleTension = refTension;
450
451 // Sanity check the reference tension
452 if (this->refMuscleTension < this->muscleToneTension) {
453 this->refMuscleTension = this->muscleToneTension;
454 // print a warning?
455 }
456 else if (this->refMuscleTension > this->maxMuscleTension) {
457 this->refMuscleTension = this->maxMuscleTension;
458 // print a warning?
459 }
460}
461
463{
464 return this->refMuscleTension;
465}
466
467// Functions to read and scale sensor data
468/*inline*/ void myosyn::calibrateTension(double loadCellGain/* = NAN*/)
469{
470 unsigned i;
471 this->loadcell_gain = (isnan(loadCellGain)) ? loadcell_calib[channelID][0] : loadCellGain;
472 switch (getMuscleStatus()) {
474 //shut down loop
476 windDown();
478 (*startDAQ)();
480 for (i = 0, loadcell_offset = 0.0; i < LOADCELL_TARE_NSAMP; i++) {
481 readAnalog_intBuf(loadcell_config[channelID][0]);
482 loadcell_offset += (double) getAnalogInPin(loadcell_config[channelID][0], loadcell_config[channelID][1]);
483 syncSampling();
484 }
485 loadcell_offset /= LOADCELL_TARE_NSAMP;
486 }
488 // calibrate second encoder on the side of the spool
489 }
490 else {
491 // print some error message
492 }
493 case MYOSYN_DISABLED:
494 // print something
495 break;
496 default:
497 break;
498 }
499}
500
501/*inline*/ double myosyn::loadcellV2F(double LCvoltage)
502{
503 return ((LCvoltage - loadcell_offset) * loadcell_gain);
504}
505
507{
509 //myosynReadInputs();
510 readAnalog_intBuf(muscle_ld_cell[channelID][0]);
511 }
513 readCounterAngle_intBuf(encoder_opt_config[channelID][0], encoder_opt_config[channelID][1]);
514 }
515 else {
516 // print warning or something?
517 }
518}
519
520/*inline*/ double myosyn::getMuscleTension()
521{
523 // print error or something
524 return NAN;
525 }
526 (*startDAQ)();
528 return loadcellV2F( (double)getAnalogInPin(loadcell_config[channelID][0], loadcell_config[channelID][1]) );
529 }
531 return encoderAngle2Excursion((double)getCounterAngle(encoder_config[channelID][0], encoder_config[channelID][1]));
532 }
533 return NAN;
534}
535
536void myosyn::calibrateExcursion(double spoolDiameter/* = NAN*/) // diameter in mm
537{
538 switch (getMuscleStatus()) {
540 // shut down closed loop
541 break;
543 windUp();
544 break;
545 default:
546 // do nothing
547 break;
548 }
549 if (isnan(spoolDiameter))
550 spoolDiameter = MOTOR_SHAFT_DIAMTR;
551 this->encoder_angle_to_excursion_ratio = (M_PI/360.00) * spoolDiameter;
553 readCounterAngle_intBuf(encoder_config[channelID][0], encoder_config[channelID][1]);
554 encoder_offset_angle = (double)getCounterAngle(encoder_config[channelID][0], encoder_config[channelID][1]);
555 syncSampling();
556 }
557 else {
558 // print something?
559 }
560
561}
562
563/*inline*/ double myosyn::encoderAngle2Excursion(double encoderAngle)
564{
565 return ((encoderAngle - this->encoder_offset_angle) * 4.096 * this->encoder_angle_to_excursion_ratio);
566}
567
569{
570 if (quickDAQgetStatus() == STATUS_RUNNING) {
571 readCounterAngle_intBuf(encoder_config[channelID][0], encoder_config[channelID][1]);
572 }
573 else {
574 // print and return something?
575 }
576}
577
578/*inline*/ double myosyn::getTendonExcursion()
579{
581 // print error or something
582 return NAN;
583 }
584 (*startDAQ)();
585 return encoderAngle2Excursion((double)getCounterAngle(encoder_config[channelID][0], encoder_config[channelID][1]));
586}
587
588// Functions for controller and output write ops
590{
591 switch (getMuscleStatus()) {
593 windUp();
596 break;
598 //do nothing except maybe print a message
599 default:
600 //print error/warning
601 break;
602 }
603}
604
606{
607 return this->motorCommand;
608}
609
610void myosyn::setMotorCommand(double newCommand)
611{
612
613 //write data into quickDAQ internal buffer
615 // print warning or error
616 }
617 else {
618 this->motorCommand = newCommand;
619 setAnalogOutPin(motor_value_config[channelID][0], motor_value_config[channelID][1], (float64)this->motorCommand);
620 }
621
622}
623
625{
626 if (controlRoutine != NULL) {
627 //call control routine
628 }
629 if (myosynNumMuscles() > 0) {
630 writeAnalog_intBuf(motor_value_config[channelID][0]);
631 }
632}
633
635{
638 }
639 else {
640 //print error/warning
641 }
642}
643// End of file
void windUp()
Function starts/energizes the motor of the muscle channel to wind up the tendons to prevent slack.
Definition: myosyn.cpp:380
void stopMuscleControl()
Stops the force controller and update the status of the muscle channel. This function only needs to b...
Definition: myosyn.cpp:634
double getMaxMuscleTension()
Returns the upper limit of possible muscle tensions by the motor of the muscle channel.
Definition: myosyn.cpp:442
double getMuscleToneTension()
Returns the current muscle tone of the muscle channel.
Definition: myosyn.cpp:432
void setReferenceTension(double myTension)
The current reference/target muscle tension which the internal closed-loop controller will attempt to...
Definition: myosyn.cpp:447
double loadcellV2F(double LCvoltage)
Returns the force on the loadcell when supplied with the voltage based on the gain and bias set by ca...
Definition: myosyn.cpp:501
~myosyn()
Definition: myosyn.cpp:342
myosyn()
Default constructor of the myosyn class. Auto-selects muscle channel when setting up a muscle channel...
Definition: myosyn.cpp:214
void readMuscleTension()
Uses the DAQ subsystem to read the muscle tension detected by the loadcell and puts it in the interna...
Definition: myosyn.cpp:506
void calibrateTension(double loadCellGain=NAN)
Sets the gain to calibrate the transformation of the loadcell voltage to force in newtons....
Definition: myosyn.cpp:468
void setMuscleToneTension(double myMuscleTone_value)
Sets the minimum tension held by the motor of a muscle channel. Corresponds to muscle tone and is the...
Definition: myosyn.cpp:427
void startMuscleControl()
Starts the force controller and update the status of the muscle channel. This function only needs to ...
Definition: myosyn.cpp:589
double encoderAngle2Excursion(double encoderAngle)
Returns the tendon excursion given an encoder angle.
Definition: myosyn.cpp:563
void setMuscleStatus(muscleStatus newStatus)
Function sets the status of the muscle channel object.
Definition: myosyn.cpp:374
void executeControl()
Executes the control law set by the controlRoutine function pointer.
Definition: myosyn.cpp:624
muscleStatus getMuscleStatus()
Returns the status of the muscle channel. The possible statuses are listed in the enum muscleStatus.
Definition: myosyn.cpp:369
double getReferenceTension()
Returns the current reference/target muscle tension that the motor controller is trying to achieve/ma...
Definition: myosyn.cpp:462
void(* stopDAQ)()
Function pointer to the global myosynStop function to stop data acquisition. Only need to call this f...
Definition: myosyn.h:210
double getTendonExcursion()
Returns the current tendon excursion value (in mm) in the internal memory.
Definition: myosyn.cpp:578
double getMuscleTension()
Returns the current muscle tension value (in newtons) in the internal memory.
Definition: myosyn.cpp:520
void(* startDAQ)()
Function pointer to the global myosynStart function to start data acquisition. Only need to call this...
Definition: myosyn.h:204
void windDown()
Function stops/deenergizes the motor of the muscle channel to wind down the tendons before system shu...
Definition: myosyn.cpp:400
void readTendonExcursion()
Uses the DAQ subsystem to read the tendon excursion detected by the shaft encoder and puts it in the ...
Definition: myosyn.cpp:568
void setMaxMuscleTension(double max_tension)
Sets the upper limit to possible muscle tension of the motor of the muscle channel as a protection.
Definition: myosyn.cpp:437
unsigned getChannelID()
Returns the channel ID number of the muscle channel.
Definition: myosyn.cpp:364
void setMotorCommand(double newCommand)
Sets the current motor command to be sent to the DC motor.
Definition: myosyn.cpp:610
void calibrateExcursion(double spoolDiameter=NAN)
Calibrates the rotary incremental shaft encoder to zero degrees and set the conversion from angle to ...
Definition: myosyn.cpp:536
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.
Definition: myosyn.h:341
double getMotorCommand()
Returns the current motor command that is being commanded to the motor.
Definition: myosyn.cpp:605
unsigned myosynNumMuscles()
Returns the number of muscles configured by the library.
Definition: myosyn.cpp:117
unsigned muscle_ld_cell[8][2]
Definition: myosyn.cpp:88
double myosynSamplingRate(double newSamplingRate)
Sets the sampling rate of the data acquisition and controller of all the muscle channels....
Definition: myosyn.cpp:136
unsigned muscle_mtr_en[16][2]
Definition: myosyn.cpp:27
unsigned muscle_enc_kleo[8][2]
Definition: myosyn.cpp:53
DAQarrangement myosynGetConfiguration()
Definition: myosyn.cpp:122
int myosynGetLeaderChannel()
Returns the leader muscle channel which governs/triggers data acquisition on all other muscles.
Definition: myosyn.cpp:181
void myosynStart()
This routine starts the data acquisition on all muscle channels that haven't already been started so ...
Definition: myosyn.cpp:146
double loadcell_calib[8][2]
Definition: myosyn.cpp:97
unsigned muscle_enc_ring[8][2]
Definition: myosyn.cpp:44
void myosynWriteOutputs()
Global function to write all DAQ outputs in a synchronized manner. The results are put into the class...
Definition: myosyn.cpp:203
void myosynWaitForClock()
This blocking function waits for the clock period to finish between two function calls....
Definition: myosyn.cpp:208
unsigned numConfiguredMuscles
Definition: myosyn.cpp:112
void myosynReadInputs()
Global function to read all DAQ inputs in a synchronized manner. The results are put into the class o...
Definition: myosyn.cpp:191
void myosynStop()
This function sops the data acquisition of all muscle channels that were started (ie....
Definition: myosyn.cpp:168
double myosyn_samplingRate_global
Definition: myosyn.cpp:114
unsigned muscle_enc_spl[12][2]
Definition: myosyn.cpp:75
DAQarrangement myosynConfiguration
Definition: myosyn.cpp:111
void myosynSetConfiguration(DAQarrangement DAQconfiguration)
Set the muscle configuration/arrangement type of the library. List of possibilities in the DAQarrange...
Definition: myosyn.cpp:126
int myosynLeader
Definition: myosyn.cpp:113
unsigned muscle_mtr_val[16][2]
Definition: myosyn.cpp:10
unsigned muscle_enc_mtr[12][2]
Definition: myosyn.cpp:62
void myosynSetLeaderChannel(int newLeader)
Sets the leader/master muscle channel which governs/triggers data acquisition on all other muscles.
Definition: myosyn.cpp:186
unsigned channel_limits[3][2]
Definition: myosyn.cpp:106
unsigned myosynNumMuscles()
Returns the number of muscles configured by the library.
Definition: myosyn.cpp:117
#define DIGITAL_LOW_VOLTS
Definition: myosyn.h:11
unsigned muscle_ld_cell[8][2]
Definition: myosyn.cpp:88
@ QUADRUPED
Definition: myosyn.h:25
@ RING_OF_FIRE
Definition: myosyn.h:24
@ MUSCLE_MODULE
Definition: myosyn.h:26
unsigned muscle_mtr_en[16][2]
Definition: myosyn.cpp:27
#define WIND_DOWN_VOLTS
Definition: myosyn.h:13
#define eprintf(_STR,...)
Definition: myosyn.h:8
unsigned muscle_enc_kleo[8][2]
Definition: myosyn.cpp:53
enum _muscleStatus muscleStatus
This ENUM lists the possible statuses of each muscle channel.
DAQarrangement myosynGetConfiguration()
Definition: myosyn.cpp:122
@ MYOSYN_DISABLED
Definition: myosyn.h:34
@ MYOSYN_CLOSEDLOOP
Definition: myosyn.h:37
@ MYOSYN_ENABLED_WINDUP
Definition: myosyn.h:36
@ MYOSYN_READY_WINDDOWN
Definition: myosyn.h:35
int myosynGetLeaderChannel()
Returns the leader muscle channel which governs/triggers data acquisition on all other muscles.
Definition: myosyn.cpp:181
void myosynStart()
This routine starts the data acquisition on all muscle channels that haven't already been started so ...
Definition: myosyn.cpp:146
double loadcell_calib[8][2]
Definition: myosyn.cpp:97
unsigned muscle_enc_ring[8][2]
Definition: myosyn.cpp:44
#define WIND_UP_VOLTS
Definition: myosyn.h:12
unsigned numConfiguredMuscles
Definition: myosyn.cpp:112
void myosynStop()
This function sops the data acquisition of all muscle channels that were started (ie....
Definition: myosyn.cpp:168
#define MAX_MUSCLE_TENSION
Definition: myosyn.h:15
#define MOTOR_SHAFT_DIAMTR
Definition: myosyn.h:16
enum _DAQarrangement DAQarrangement
Enumerates the different types of configurations supported by myosyn.
unsigned muscle_enc_spl[12][2]
Definition: myosyn.cpp:75
DAQarrangement myosynConfiguration
Definition: myosyn.cpp:111
#define LOADCELL_TARE_NSAMP
Definition: myosyn.h:17
#define DEFAULT_MUSCLE_TONE
Definition: myosyn.h:14
unsigned muscle_mtr_val[16][2]
Definition: myosyn.cpp:10
unsigned muscle_enc_mtr[12][2]
Definition: myosyn.cpp:62
void myosynSetLeaderChannel(int newLeader)
Sets the leader/master muscle channel which governs/triggers data acquisition on all other muscles.
Definition: myosyn.cpp:186
#define DIGITAL_HIGH_VOLTS
Definition: myosyn.h:10