Code for the COVR project DROPSAW project test rig (previously used for the Heros testing).

Dependencies:   SPTE_10Bar_5V mbed AS5048 SDFileSystem MODSERIAL LCM101_DROPSAW LinearActuator

Committer:
cnckiwi31
Date:
Mon Oct 26 11:55:27 2020 +0000
Revision:
15:a84d54e25775
Parent:
11:fc82dd22a527
Code ready for inclusion in documentation (compiles, but no last check on runBenchmarkExperiment1() code done)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cnckiwi31 15:a84d54e25775 1 /* Copyright 2020 Allan Joshua Veale
cnckiwi31 15:a84d54e25775 2
cnckiwi31 15:a84d54e25775 3 Licensed under the Apache License, Version 2.0 (the "License");
cnckiwi31 15:a84d54e25775 4 you may not use this file except in compliance with the License.
cnckiwi31 15:a84d54e25775 5 You may obtain a copy of the License at
cnckiwi31 15:a84d54e25775 6
cnckiwi31 15:a84d54e25775 7 http://www.apache.org/licenses/LICENSE-2.0
cnckiwi31 15:a84d54e25775 8
cnckiwi31 15:a84d54e25775 9 Unless required by applicable law or agreed to in writing, software
cnckiwi31 15:a84d54e25775 10 distributed under the License is distributed on an "AS IS" BASIS,
cnckiwi31 15:a84d54e25775 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
cnckiwi31 15:a84d54e25775 12 See the License for the specific language governing permissions and
cnckiwi31 15:a84d54e25775 13 limitations under the License.
cnckiwi31 15:a84d54e25775 14 */
cnckiwi31 15:a84d54e25775 15
megrootens 0:3855d4588f76 16 #ifndef _CONSTANTS_HARDWARE_H_
megrootens 0:3855d4588f76 17 #define _CONSTANTS_HARDWARE_H_
megrootens 0:3855d4588f76 18
megrootens 0:3855d4588f76 19 #include "mbed.h"
megrootens 0:3855d4588f76 20
megrootens 0:3855d4588f76 21 #ifndef M_PI
megrootens 0:3855d4588f76 22 #define M_PI 3.14159265359f
megrootens 0:3855d4588f76 23 #endif
megrootens 0:3855d4588f76 24
cnckiwi31 15:a84d54e25775 25 /**
cnckiwi31 15:a84d54e25775 26 * Hardware connections to the mbed
cnckiwi31 15:a84d54e25775 27 */
cnckiwi31 15:a84d54e25775 28
megrootens 0:3855d4588f76 29 // SPI Communication AS5048 joint encoders
megrootens 0:3855d4588f76 30 #define AS5048_MOSI PTD6 // D11
megrootens 0:3855d4588f76 31 #define AS5048_MISO PTD7 // D12
megrootens 0:3855d4588f76 32 #define AS5048_SCLK PTD5 // D13
megrootens 0:3855d4588f76 33 #define AS5048_CS PTD4 // D10
megrootens 0:3855d4588f76 34
megrootens 0:3855d4588f76 35 // SPI Communication external SD CARD
megrootens 0:3855d4588f76 36 #define SD_MOSI PTC6 // D7
megrootens 0:3855d4588f76 37 #define SD_MISO PTC7
megrootens 0:3855d4588f76 38 #define SD_SCK PTC5
megrootens 0:3855d4588f76 39 #define SD_CS PTC10
megrootens 0:3855d4588f76 40
cnckiwi31 10:77fcbad99a31 41 // SPI Communication MAX5322 DAC
cnckiwi31 10:77fcbad99a31 42 #define DAC_MOSI PTD6 // D11
cnckiwi31 10:77fcbad99a31 43 #define DAC_MISO PTD7 // D12
cnckiwi31 10:77fcbad99a31 44 #define DAC_SCLK PTD5 // D13
cnckiwi31 10:77fcbad99a31 45 #define DAC_CSA D8
cnckiwi31 10:77fcbad99a31 46 #define DAC_CSB D1
cnckiwi31 10:77fcbad99a31 47
megrootens 0:3855d4588f76 48 // LCM101-100 kgf S-beam force sensor
cnckiwi31 4:1cdce6c6c94e 49 #define LCM101 A1
cnckiwi31 4:1cdce6c6c94e 50
cnckiwi31 4:1cdce6c6c94e 51 // SPTE analog output pressure sensors (0-10bar for 0-5V output)
cnckiwi31 15:a84d54e25775 52 #define SPTE_0 A0 //this is the one currently in use
cnckiwi31 15:a84d54e25775 53 #define SPTE_1 A5 //this one is not used, and its use on this pin needs to be tested - hence not in schematics
megrootens 0:3855d4588f76 54
cnckiwi31 5:63063a9fa51c 55 //Festo digital valve (one for inflate)
cnckiwi31 10:77fcbad99a31 56 #define VALVE_PIN D0
cnckiwi31 5:63063a9fa51c 57
surajgiri 11:fc82dd22a527 58 //Linear actuator
surajgiri 11:fc82dd22a527 59 #define LINACT_DIR_PIN D5
surajgiri 11:fc82dd22a527 60 #define LINACT_PWM_PIN D6
surajgiri 11:fc82dd22a527 61
megrootens 0:3855d4588f76 62 /**
megrootens 0:3855d4588f76 63 * Sensor settings and calibration data
megrootens 0:3855d4588f76 64 */
megrootens 0:3855d4588f76 65 namespace sensors {
cnckiwi31 5:63063a9fa51c 66 extern const bool use5kN;
megrootens 0:3855d4588f76 67
megrootens 0:3855d4588f76 68 // LCM101-100kgf force sensor
megrootens 0:3855d4588f76 69 extern const float kLcm101Offset;
megrootens 0:3855d4588f76 70 extern const float kLcm101Factor;
megrootens 0:3855d4588f76 71
cnckiwi31 5:63063a9fa51c 72 // Gen5kN force sensor
cnckiwi31 5:63063a9fa51c 73 extern const float kGen5kNOffset;
cnckiwi31 5:63063a9fa51c 74 extern const float kGen5kNFactor;
cnckiwi31 5:63063a9fa51c 75
cnckiwi31 4:1cdce6c6c94e 76 //SPTE pressure sensors (0-10bar for 0-5V output)
cnckiwi31 4:1cdce6c6c94e 77 extern const float kSPTE0Offset;
cnckiwi31 4:1cdce6c6c94e 78 extern const float kSPTE0Factor;
cnckiwi31 4:1cdce6c6c94e 79 extern const float kSPTE1Offset;
cnckiwi31 4:1cdce6c6c94e 80 extern const float kSPTE1Factor;
cnckiwi31 4:1cdce6c6c94e 81
megrootens 0:3855d4588f76 82 // AS5048 abs angle sensor chain
megrootens 0:3855d4588f76 83 extern const int kNumJoints;
megrootens 0:3855d4588f76 84
megrootens 0:3855d4588f76 85 extern const char *kJointNames[];
megrootens 0:3855d4588f76 86 extern const float kOffsetsDegrees[];
megrootens 0:3855d4588f76 87 extern const bool kDirections[];
megrootens 0:3855d4588f76 88 }
megrootens 0:3855d4588f76 89
megrootens 0:3855d4588f76 90 namespace timing {
cnckiwi31 5:63063a9fa51c 91 extern const int LogDataHertz; //data log sample rate
megrootens 0:3855d4588f76 92 extern const int kTimeControlUs; // control loop
cnckiwi31 5:63063a9fa51c 93 extern const int LogDataHertz; // data logging
megrootens 0:3855d4588f76 94 extern const int kTimeLogDataUs; // data logging
cnckiwi31 5:63063a9fa51c 95 extern const int TimeControlHertz; // control loop sample rate
cnckiwi31 5:63063a9fa51c 96 extern const int kTimeSerialPrintUs; // serial printing
cnckiwi31 15:a84d54e25775 97 extern const int minKeyInt; //key interval time out value
surajgiri 11:fc82dd22a527 98
cnckiwi31 15:a84d54e25775 99 extern const int kSerialBaudrate; //frequency of serial port
surajgiri 11:fc82dd22a527 100
surajgiri 11:fc82dd22a527 101 extern const int PWMHertz; //Linear actuator frequency for pwm
megrootens 0:3855d4588f76 102 }
megrootens 0:3855d4588f76 103
cnckiwi31 5:63063a9fa51c 104 namespace rigStructure {
cnckiwi31 5:63063a9fa51c 105 extern const bool invertedRig; //indicates if rig is inverted or not (for internal torque calculation)
cnckiwi31 5:63063a9fa51c 106 }
megrootens 0:3855d4588f76 107
megrootens 0:3855d4588f76 108 #endif