HeRoS: read out and log joint angles and force sensor data from the leg test bench. Now with additional features to read pressure sensors and set the null values of the pressure and force sensors

Dependencies:   SPTE_10Bar_5V mbed AS5048 SDFileSystem MODSERIAL PinDetect Valve LCM101

Fork of heros_leg_readout_torque_addition by K K

Committer:
cnckiwi31
Date:
Tue Feb 25 15:04:21 2020 +0000
Revision:
11:b0a6faaa5e9f
Parent:
10:77fcbad99a31
Manual data logging call

Who changed what in which revision?

UserRevisionLine numberNew contents of line
megrootens 0:3855d4588f76 1 #ifndef _CONSTANTS_HARDWARE_H_
megrootens 0:3855d4588f76 2 #define _CONSTANTS_HARDWARE_H_
megrootens 0:3855d4588f76 3
megrootens 0:3855d4588f76 4 #include "mbed.h"
megrootens 0:3855d4588f76 5
megrootens 0:3855d4588f76 6 #ifndef M_PI
megrootens 0:3855d4588f76 7 #define M_PI 3.14159265359f
megrootens 0:3855d4588f76 8 #endif
megrootens 0:3855d4588f76 9
megrootens 0:3855d4588f76 10 // SPI Communication AS5048 joint encoders
megrootens 0:3855d4588f76 11 #define AS5048_MOSI PTD6 // D11
megrootens 0:3855d4588f76 12 #define AS5048_MISO PTD7 // D12
megrootens 0:3855d4588f76 13 #define AS5048_SCLK PTD5 // D13
megrootens 0:3855d4588f76 14 #define AS5048_CS PTD4 // D10
megrootens 0:3855d4588f76 15
megrootens 0:3855d4588f76 16 // SPI Communication external SD CARD
megrootens 0:3855d4588f76 17 #define SD_MOSI PTC6 // D7
megrootens 0:3855d4588f76 18 #define SD_MISO PTC7
megrootens 0:3855d4588f76 19 #define SD_SCK PTC5
megrootens 0:3855d4588f76 20 #define SD_CS PTC10
megrootens 0:3855d4588f76 21
cnckiwi31 10:77fcbad99a31 22 // SPI Communication MAX5322 DAC
cnckiwi31 10:77fcbad99a31 23 #define DAC_MOSI PTD6 // D11
cnckiwi31 10:77fcbad99a31 24 #define DAC_MISO PTD7 // D12
cnckiwi31 10:77fcbad99a31 25 #define DAC_SCLK PTD5 // D13
cnckiwi31 10:77fcbad99a31 26 #define DAC_CSA D8
cnckiwi31 10:77fcbad99a31 27 #define DAC_CSB D1
cnckiwi31 10:77fcbad99a31 28
megrootens 0:3855d4588f76 29 // LCM101-100 kgf S-beam force sensor
cnckiwi31 4:1cdce6c6c94e 30 #define LCM101 A1
cnckiwi31 4:1cdce6c6c94e 31
cnckiwi31 4:1cdce6c6c94e 32 // SPTE analog output pressure sensors (0-10bar for 0-5V output)
cnckiwi31 4:1cdce6c6c94e 33 #define SPTE_0 A0
cnckiwi31 4:1cdce6c6c94e 34 #define SPTE_1 A5
megrootens 0:3855d4588f76 35
cnckiwi31 5:63063a9fa51c 36 //Festo digital valve (one for inflate)
cnckiwi31 10:77fcbad99a31 37 #define VALVE_PIN D0
cnckiwi31 5:63063a9fa51c 38
megrootens 0:3855d4588f76 39 /**
megrootens 0:3855d4588f76 40 * Sensor settings and calibration data
megrootens 0:3855d4588f76 41 */
megrootens 0:3855d4588f76 42 namespace sensors {
cnckiwi31 5:63063a9fa51c 43 extern const bool use5kN;
megrootens 0:3855d4588f76 44
megrootens 0:3855d4588f76 45 // LCM101-100kgf force sensor
megrootens 0:3855d4588f76 46 extern const float kLcm101Offset;
megrootens 0:3855d4588f76 47 extern const float kLcm101Factor;
megrootens 0:3855d4588f76 48
cnckiwi31 5:63063a9fa51c 49 // Gen5kN force sensor
cnckiwi31 5:63063a9fa51c 50 extern const float kGen5kNOffset;
cnckiwi31 5:63063a9fa51c 51 extern const float kGen5kNFactor;
cnckiwi31 5:63063a9fa51c 52
cnckiwi31 4:1cdce6c6c94e 53 //SPTE pressure sensors (0-10bar for 0-5V output)
cnckiwi31 4:1cdce6c6c94e 54 extern const float kSPTE0Offset;
cnckiwi31 4:1cdce6c6c94e 55 extern const float kSPTE0Factor;
cnckiwi31 4:1cdce6c6c94e 56 extern const float kSPTE1Offset;
cnckiwi31 4:1cdce6c6c94e 57 extern const float kSPTE1Factor;
cnckiwi31 4:1cdce6c6c94e 58
megrootens 0:3855d4588f76 59 // AS5048 abs angle sensor chain
megrootens 0:3855d4588f76 60 extern const int kNumJoints;
megrootens 0:3855d4588f76 61
megrootens 0:3855d4588f76 62 extern const char *kJointNames[];
megrootens 0:3855d4588f76 63 extern const float kOffsetsDegrees[];
megrootens 0:3855d4588f76 64 extern const bool kDirections[];
megrootens 0:3855d4588f76 65 }
megrootens 0:3855d4588f76 66
megrootens 0:3855d4588f76 67 namespace timing {
cnckiwi31 5:63063a9fa51c 68 extern const int LogDataHertz; //data log sample rate
megrootens 0:3855d4588f76 69 extern const int kTimeControlUs; // control loop
cnckiwi31 5:63063a9fa51c 70 extern const int LogDataHertz; // data logging
megrootens 0:3855d4588f76 71 extern const int kTimeLogDataUs; // data logging
cnckiwi31 5:63063a9fa51c 72 extern const int TimeControlHertz; // control loop sample rate
cnckiwi31 5:63063a9fa51c 73 extern const int kTimeSerialPrintUs; // serial printing
megrootens 0:3855d4588f76 74
megrootens 0:3855d4588f76 75 extern const int kSerialBaudrate;
megrootens 0:3855d4588f76 76 }
megrootens 0:3855d4588f76 77
cnckiwi31 5:63063a9fa51c 78 namespace rigStructure {
cnckiwi31 5:63063a9fa51c 79 extern const bool invertedRig; //indicates if rig is inverted or not (for internal torque calculation)
cnckiwi31 5:63063a9fa51c 80 }
megrootens 0:3855d4588f76 81
megrootens 0:3855d4588f76 82 #endif