-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from MissouriMRDT/2022_Rev1
2022 Competition Powerboard Code
- Loading branch information
Showing
2 changed files
with
229 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,107 @@ | ||
|
||
#include "Energia.h" | ||
#ifndef POWERBOARD_H | ||
#define POWERBOARD_H | ||
#include "RoveComm.h" | ||
|
||
// Numbers of Toggleable Ports | ||
#define NUM_12V_PORTS 8 // Everything except Aux cuz Manifest | ||
#define NUM_MOTORS 7 | ||
|
||
IntervalTimer Telemetry; | ||
|
||
//12V Current Sensing | ||
#define AUX_MOUNT_SENSE PK_3 | ||
#define MULTIMEDIA_SENSE PK_2 | ||
#define LOW_CURRENT_SENSE PK_1 | ||
#define GIMBAL_SENSE PK_0 | ||
|
||
#define MULTIMEDIA_SENSE A11 | ||
#define NAV_SENSE A12 | ||
#define GIMBAL_ACT_SENSE A10 | ||
#define DRIVE_SENSE A0 | ||
#define CAM1_SENSE A2 | ||
#define CAM2_SENSE A1 | ||
#define BBB_SENSE A3 | ||
#define AUX_SENSE A4 | ||
#define SPARE_12V_SENSE A13 | ||
|
||
#define OVERCURRENT_PACK 19500 //mA | ||
#define OVERCURRENT_12V 4800 //mA | ||
#define CURRENT_ADC_MIN 0 | ||
#define CURRENT_ADC_MAX 4096 | ||
#define CURRENT_mA_MIN 0 | ||
#define CURRENT_mA_MAX 20000 | ||
|
||
//12V CTL | ||
#define MULTIMEDIA_LOG_CTL PK_5 | ||
#define MULTIMEDIA_ACT_CTL PM_0 | ||
#define AUX_LOG_CTL PM_1 | ||
#define AUX_ACT_CTL PM_2 | ||
#define GIMBAL_LOG_CTL PH_0 | ||
#define GIMBAL_ACT_CTL PH_1 | ||
#define NAV_BOARD_CTL PK_7 | ||
#define CAM_CTL PP_3 | ||
#define EXTRA_CTL PQ_1 | ||
#define DRIVE_CTL PM_6 | ||
#define SPARE_CTL 0 | ||
#define NAV_CTL 1 | ||
#define MULTIMEDIA_CTL 2 | ||
#define GIMBAL_CTL 3 | ||
#define DRIVE_CTL 4 | ||
#define CAM2_CTL 5 | ||
#define CAM1_CTL 6 | ||
#define BBB_CTL 7 | ||
#define AUX_CTL 8 | ||
|
||
|
||
//PACK CURRENT | ||
#define P_MOTOR1_SENSE PD_5 | ||
#define P_MOTOR2_SENSE PD_4 | ||
#define P_MOTOR3_SENSE PD_2 | ||
#define P_MOTOR4_SENSE PD_3 | ||
#define P_SPARE_SENSE PE_4 | ||
#define P_ROCKET_SENSE PD_0 | ||
#define P_TWELVE_SENSE PD_1 | ||
#define P_VACUUM_SENSE PE_1 | ||
#define P_DRIVE_SENSE PE_5 | ||
#define P_AUX_SENSE PE_3 | ||
#define P_MOTOR1_SENSE A14 | ||
#define P_MOTOR2_SENSE A15 | ||
#define P_MOTOR3_SENSE A16 | ||
#define P_MOTOR4_SENSE A17 | ||
#define P_MOTOR5_SENSE A5 | ||
#define P_MOTOR6_SENSE A6 | ||
#define P_MOTOR7_SENSE A7 | ||
#define P_POE_SENSE A8 | ||
|
||
// Current sensing variables | ||
|
||
float MOTORBUSSENSEPINS[NUM_MOTORS] = {P_MOTOR1_SENSE, P_MOTOR2_SENSE, P_MOTOR3_SENSE, P_MOTOR4_SENSE, P_MOTOR5_SENSE, P_MOTOR6_SENSE, P_MOTOR7_SENSE}; | ||
float TWELVELOGICBUSPINS[NUM_12V_PORTS] = {GIMBAL_ACT_SENSE, DRIVE_SENSE, MULTIMEDIA_SENSE, NAV_SENSE, CAM1_SENSE, CAM2_SENSE, BBB_SENSE, SPARE_12V_SENSE}; | ||
|
||
float P_MOTOR1_CURRENT = 0; | ||
float P_MOTOR2_CURRENT = 0; | ||
float P_MOTOR3_CURRENT = 0; | ||
float P_MOTOR4_CURRENT = 0; | ||
float P_MOTOR5_CURRENT = 0; | ||
float P_MOTOR6_CURRENT = 0; | ||
float P_MOTOR7_CURRENT = 0; | ||
|
||
float AUX_CURRENT = 0; | ||
|
||
float GIMBAL_ACT_CURRENT = 0; | ||
float DRIVE_CURRENT = 0; | ||
float MULTIMEDIA_CURRENT = 0; | ||
float NAV_CURRENT = 0; | ||
float CAM1_CURRENT = 0; | ||
float CAM2_CURRENT = 0; | ||
float BBB_CURRENT = 0; | ||
float SPARE_12V_CURRENT = 0; | ||
|
||
float MOTORBUSCURRENTS[NUM_MOTORS] = {P_MOTOR1_CURRENT, P_MOTOR2_CURRENT, P_MOTOR3_CURRENT, P_MOTOR4_CURRENT, P_MOTOR5_CURRENT, P_MOTOR6_CURRENT, P_MOTOR7_CURRENT}; | ||
float TWELVELOGICBUSCURRENTS[NUM_12V_PORTS] = {GIMBAL_ACT_CURRENT, DRIVE_CURRENT, MULTIMEDIA_CURRENT, NAV_CURRENT, CAM1_CURRENT, CAM2_CURRENT, BBB_CURRENT, SPARE_12V_CURRENT}; | ||
|
||
uint8_t motorOverCurrent = 0; | ||
uint8_t twelveActOverCurrent = 0; | ||
uint8_t twelveLogicOverCurrent = 0; | ||
|
||
//PACK BUSSES | ||
#define P_MOTOR1_CTL PQ_0 | ||
#define P_MOTOR2_CTL PP_1 | ||
#define P_MOTOR3_CTL PP_0 | ||
#define P_MOTOR4_CTL PC_7 | ||
#define P_SPARE_CTL PC_4 | ||
#define P_ROCKET_CTL PN_2 | ||
#define P_TWELVE_CTL PH_3 | ||
#define P_VACUUM_CTL PE_0 | ||
#define P_DRIVE_CTL PC_6 | ||
#define P_AUX_CTL PE_2 | ||
|
||
#define MOTOR_DELAY 5000 | ||
#define DRIVE_DELAY 5000 | ||
|
||
uint8_t currentSense12V[4] = { AUX_MOUNT_SENSE, MULTIMEDIA_SENSE, GIMBAL_SENSE, LOW_CURRENT_SENSE}; | ||
uint8_t actuation12V[3] = { GIMBAL_ACT_CTL, MULTIMEDIA_ACT_CTL, AUX_ACT_CTL}; | ||
uint8_t logic12V[7] = {GIMBAL_LOG_CTL, MULTIMEDIA_LOG_CTL, AUX_LOG_CTL, DRIVE_CTL, NAV_BOARD_CTL, CAM_CTL, EXTRA_CTL}; | ||
uint8_t drivePack = P_DRIVE_CTL; | ||
uint8_t currentSensePack[10] = { P_MOTOR1_SENSE, P_MOTOR2_SENSE, P_MOTOR3_SENSE, P_MOTOR4_SENSE, P_SPARE_SENSE, P_ROCKET_SENSE, P_TWELVE_SENSE, P_VACUUM_SENSE, P_DRIVE_SENSE, P_AUX_SENSE}; | ||
uint8_t bussesPackStart[3] = { P_ROCKET_CTL, P_TWELVE_CTL, P_AUX_CTL}; | ||
uint8_t bussesPack[4] = { P_TWELVE_CTL, P_ROCKET_CTL, P_AUX_CTL, P_DRIVE_CTL}; | ||
uint8_t vacuumCtrl[1] = {P_VACUUM_CTL}; | ||
uint8_t bussesMotor[5] = {P_MOTOR1_CTL, P_MOTOR2_CTL, P_MOTOR3_CTL, P_MOTOR4_CTL, P_SPARE_CTL}; | ||
#define POE_CTL 29 | ||
#define PACK_SPARE_CTL 37 | ||
|
||
#define MOTOR1_CTL 33 | ||
#define MOTOR2_CTL 32 | ||
#define MOTOR3_CTL 34 | ||
#define MOTOR4_CTL 31 | ||
#define MOTOR5_CTL 35 | ||
#define MOTOR6_CTL 30 | ||
#define MOTORS_CTL 36 | ||
|
||
#define MOTOR_DELAY 500 | ||
|
||
//uint8_t currentSense12V[] = {MULTIMEDIA_SENSE, NAV_SENSE, GIMBAL_ACT_SENSE, DRIVE_SENSE, SCISENSOR_ACT_SENSE, NETSWITCH_SENSE, CAM1_SENSE, CAM2_SENSE, BBB_SENSE, AUX_LOG_SENSE}; | ||
uint8_t twelveVoltBusses[NUM_12V_PORTS] = {GIMBAL_CTL, DRIVE_CTL, MULTIMEDIA_CTL, NAV_CTL, CAM1_CTL, CAM2_CTL, BBB_CTL, SPARE_CTL}; | ||
//uint8_t currentSensePack[9] = {P_MOTOR1_SENSE, P_MOTOR2_SENSE, P_MOTOR3_SENSE, P_MOTOR4_SENSE, P_MOTOR5_SENSE, P_MOTOR6_SENSE, P_MOTOR7_SENSE, P_POE_SENSE, P_AUX_SENSE}; | ||
uint8_t motorBusses[NUM_MOTORS] = {MOTOR1_CTL, MOTOR2_CTL, MOTOR3_CTL, MOTOR4_CTL, MOTOR5_CTL, MOTOR6_CTL, MOTORS_CTL}; | ||
|
||
RoveCommEthernet RoveComm; | ||
rovecomm_packet packet; | ||
uint8_t* data; | ||
EthernetServer TCPServer(RC_ROVECOMM_POWERBOARD_PORT); | ||
|
||
#endif |
Oops, something went wrong.