Motor identification and testing

This commit is contained in:
evlryah 2023-09-29 18:22:46 -05:00
parent 3cb21d195f
commit 2e95e6afdc
3 changed files with 16 additions and 10 deletions

View File

@ -16,7 +16,7 @@ extern long last_p;
// Loop timing
// TODO TEMPORARY CHANGED TO 1000, NORMAL 50
#define LOOP_DELAY_MS_CORE_0 5000 // Minimum milliseconds between the start of each loop, accounting for processing time during each loop
#define LOOP_DELAY_MS_CORE_0 500 // Minimum milliseconds between the start of each loop, accounting for processing time during each loop
#define LOOP_DELAY_SECONDS_CORE_0 ((float)LOOP_DELAY_MS_CORE_0 / 1000.0f) // Previous number expressed in seconds
#define LOOP_DELAY_MS_CORE_1 50 // Minimum milliseconds between the start of each loop, accounting for processing time during each loop

View File

@ -983,18 +983,22 @@ void loop() {
set_motor(FRDRIVE, swrv.front_right_power);
set_motor(BLDRIVE, swrv.back_left_power);
*/
for(int i = 0; i < 8; i++) {
if(i == loop_counter_core_0 % 8) {
set_motor(i + 1, 127);
Serial.print("Powering motor");
Serial.println(i + 1);
} else {
set_motor(i + 1, 0);
int loop_motor_change_interval = 8;
if(loop_counter_core_0 % loop_motor_change_interval == 0) { // Only change motors every 20 loops, or 2 seconds
int target_active_motor = ((loop_counter_core_0 / loop_motor_change_interval) % 4) + 5;
for(int i = 5; i <= 8; i++) {
// 20 for drive motors, 120 for steering motors
set_motor(i, (20 + (100 * (i < 4))) * (i == target_active_motor));
}
Serial.print("Powering motor");
Serial.println(target_active_motor);
}
// update stepper motors
set_motor(LIFTALL, clawarm.arm_set_motor_int);
// TESTING temporarily disabled for motor testing above on 20230929
//set_motor(LIFTALL, clawarm.arm_set_motor_int);
// update servos
/*

View File

@ -81,7 +81,8 @@ void comm_parse() {
}
}
}
// TESTING: temporarily disabled for motor testing on 20230929
/*
if(millis()-ptime > FAILTIME){
//digitalWrite(13,LOW);
SerCommDbg.println("No input recieved, sending safe inputs");
@ -89,4 +90,5 @@ void comm_parse() {
memcpy(astate,&safe,sizeof(packet_t));
comm_ok=0;
}
*/
}