fix for go to the kart

This commit is contained in:
2023-09-06 21:03:23 +02:00
parent 7750978f18
commit 84630eb6fd
10 changed files with 137 additions and 80 deletions

View File

@ -269,6 +269,11 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){
}
if(idMsg == 0xE) { // DRIVE_BRAKE
// status - - -
eKart.brake = incomeData.separate.byte0;
}
if(idMsg == 0xF) { // STEERING_ALIVE
// statusH statusL - -
ALIVE_ISALIVE(&steering()->myChecker);
@ -293,6 +298,17 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){
* SUPPLY *
**********/
case 6:
if(idMsg == 0x4) {
DRIVE_startBehaviour(drive());
STEERING_startBehaviour(steering());
ALIVE_startBehaviourSender(ALcontroller());
ALIVE_startBehaviourChecker(ALjoy());
ALIVE_emitBorn(ALjoy(), 100, 0);
ALIVE_emitReady(ALjoy(), 200, 0);
}
if(idMsg == 0xF) { // BATTERY_ALIVE
// - - - -
// TODO battery say ALIVE

View File

@ -61,14 +61,14 @@ bool DRIVE_processEvent(Event* ev) {
if (ev->id == evDRpollTorque) {
//if(steeringState == STST_RUN) {
CM_DRIVE_POWER(&eKart.torque);
if (KART_CST.DRIVE_STOP_TIME == 0) KART_CST.DRIVE_STOP_TIME = 1;
DRIVE_emitPollTorque(me, KART_CST.DRIVE_STOP_TIME*5, 0);
//}
}
if (ev->id == evDRpollSpeed) {
CM_DISPLAY_SPEED(&eKart.speed);
}
DRIVE_emitPollTorque(me, KART_CST.DRIVE_STOP_TIME*9, 0);
break;
case STDR_DEAD:
@ -104,6 +104,8 @@ bool DRIVE_processEvent(Event* ev) {
break;
case STDR_RUN:
if (KART_CST.DRIVE_STOP_TIME == 0) KART_CST.DRIVE_STOP_TIME = 1;
DRIVE_emitPollTorque(me, KART_CST.DRIVE_STOP_TIME*5, 0);
if (me->run.f != NULL) {
me->run.f(me->run.p);
}

View File

@ -31,9 +31,9 @@ void MEM_init(){
KART_CST.CONTROL_MAX_SPEED_FW = 50;
KART_CST.CONTROL_MAX_SPEED_BW = 25;
KART_CST.JOYSTICK_MODE = 0;
KART_CST.JOYSTICK_PARAM1 = 5;
KART_CST.JOYSTICK_PARAM2 = 1;
KART_CST.JOYSTICK_MODE = 0; // mode 0 is time based, mode 1 is change based
KART_CST.JOYSTICK_PARAM1 = 5; // for mode 0, values are send every param1*10ms
KART_CST.JOYSTICK_PARAM2 = 1; // for mode 0, values need to change param2 at least for sending
KART_CST.JOYSTICK_ALIVE_TIME = 25;
KART_CST.DISPLAY_ALIVE_TIME = 100;

View File

@ -72,7 +72,7 @@ void Factory_build() {
//start all state machines
void Factory_start() {
CAN_startBehaviour();
/*
DRIVE_startBehaviour(drive());
STEERING_startBehaviour(steering());
@ -81,7 +81,7 @@ void Factory_start() {
ALIVE_startBehaviourChecker(ALjoy());
ALIVE_emitBorn(ALjoy(), 100, 0);
ALIVE_emitReady(ALjoy(), 200, 0);
*/
}

View File

@ -45,6 +45,7 @@ void calcPosition(uint8_t joy_pos){
}
lastPos = calcPosition;
calcPosition *= -1; // change left and right
calcPosition *= (int32_t) KART_CST.CONTROL_STEERING_FACTOR;
calcPosition /= 1000;
calcPosition += eKart.center;

View File

@ -26,6 +26,7 @@ void STEERING_init(STEERING* me){
me->wait.f = NULL;
me->run.f = NULL;
me->dead.f = NULL;
eKart.center = 560024;
}
void STEERING_startBehaviour(STEERING* me){

View File

@ -67,7 +67,7 @@ bool ALIVE_processEvent(Event* ev) {
case STAL_BORN:
if (ev->id == evALready) {
me->state = STAL_WAIT;
ALIVE_emitPoll(me, me->aliveTime*10, 0);
ALIVE_emitPoll(me, me->aliveTime*20, 0);
}
break;
@ -80,7 +80,7 @@ bool ALIVE_processEvent(Event* ev) {
}
} else if (me->isAlive){
me->state = STAL_WAIT;
ALIVE_emitPoll(me, me->aliveTime*10, 0);
ALIVE_emitPoll(me, me->aliveTime*20, 0);
} else {
me->state = STAL_DEAD;
}
@ -105,7 +105,7 @@ bool ALIVE_processEvent(Event* ev) {
me->state = STAL_BREAK;
}
} else {
ALIVE_emitPoll(me, me->aliveTime*10, 0);
ALIVE_emitPoll(me, me->aliveTime*20, 0);
}
}
break;

View File

@ -272,6 +272,7 @@
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/>
<property key="firmware.download.all" value="false"/>
<property key="hwtoolclock.frcindebug" value="false"/>
<property key="lastid" value=""/>
<property key="memories.aux" value="false"/>

File diff suppressed because one or more lines are too long