fix for go to the kart
This commit is contained in:
parent
7750978f18
commit
84630eb6fd
@ -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
|
if(idMsg == 0xF) { // STEERING_ALIVE
|
||||||
// statusH statusL - -
|
// statusH statusL - -
|
||||||
ALIVE_ISALIVE(&steering()->myChecker);
|
ALIVE_ISALIVE(&steering()->myChecker);
|
||||||
@ -293,6 +298,17 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){
|
|||||||
* SUPPLY *
|
* SUPPLY *
|
||||||
**********/
|
**********/
|
||||||
case 6:
|
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
|
if(idMsg == 0xF) { // BATTERY_ALIVE
|
||||||
// - - - -
|
// - - - -
|
||||||
// TODO battery say ALIVE
|
// TODO battery say ALIVE
|
||||||
|
@ -61,14 +61,14 @@ bool DRIVE_processEvent(Event* ev) {
|
|||||||
if (ev->id == evDRpollTorque) {
|
if (ev->id == evDRpollTorque) {
|
||||||
//if(steeringState == STST_RUN) {
|
//if(steeringState == STST_RUN) {
|
||||||
CM_DRIVE_POWER(&eKart.torque);
|
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) {
|
if (ev->id == evDRpollSpeed) {
|
||||||
CM_DISPLAY_SPEED(&eKart.speed);
|
CM_DISPLAY_SPEED(&eKart.speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
DRIVE_emitPollTorque(me, KART_CST.DRIVE_STOP_TIME*9, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STDR_DEAD:
|
case STDR_DEAD:
|
||||||
@ -104,6 +104,8 @@ bool DRIVE_processEvent(Event* ev) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case STDR_RUN:
|
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) {
|
if (me->run.f != NULL) {
|
||||||
me->run.f(me->run.p);
|
me->run.f(me->run.p);
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,9 @@ void MEM_init(){
|
|||||||
KART_CST.CONTROL_MAX_SPEED_FW = 50;
|
KART_CST.CONTROL_MAX_SPEED_FW = 50;
|
||||||
KART_CST.CONTROL_MAX_SPEED_BW = 25;
|
KART_CST.CONTROL_MAX_SPEED_BW = 25;
|
||||||
|
|
||||||
KART_CST.JOYSTICK_MODE = 0;
|
KART_CST.JOYSTICK_MODE = 0; // mode 0 is time based, mode 1 is change based
|
||||||
KART_CST.JOYSTICK_PARAM1 = 5;
|
KART_CST.JOYSTICK_PARAM1 = 5; // for mode 0, values are send every param1*10ms
|
||||||
KART_CST.JOYSTICK_PARAM2 = 1;
|
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.JOYSTICK_ALIVE_TIME = 25;
|
||||||
|
|
||||||
KART_CST.DISPLAY_ALIVE_TIME = 100;
|
KART_CST.DISPLAY_ALIVE_TIME = 100;
|
||||||
|
@ -72,7 +72,7 @@ void Factory_build() {
|
|||||||
//start all state machines
|
//start all state machines
|
||||||
void Factory_start() {
|
void Factory_start() {
|
||||||
CAN_startBehaviour();
|
CAN_startBehaviour();
|
||||||
|
/*
|
||||||
DRIVE_startBehaviour(drive());
|
DRIVE_startBehaviour(drive());
|
||||||
STEERING_startBehaviour(steering());
|
STEERING_startBehaviour(steering());
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void Factory_start() {
|
|||||||
ALIVE_startBehaviourChecker(ALjoy());
|
ALIVE_startBehaviourChecker(ALjoy());
|
||||||
ALIVE_emitBorn(ALjoy(), 100, 0);
|
ALIVE_emitBorn(ALjoy(), 100, 0);
|
||||||
ALIVE_emitReady(ALjoy(), 200, 0);
|
ALIVE_emitReady(ALjoy(), 200, 0);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ void calcPosition(uint8_t joy_pos){
|
|||||||
}
|
}
|
||||||
lastPos = calcPosition;
|
lastPos = calcPosition;
|
||||||
|
|
||||||
|
calcPosition *= -1; // change left and right
|
||||||
calcPosition *= (int32_t) KART_CST.CONTROL_STEERING_FACTOR;
|
calcPosition *= (int32_t) KART_CST.CONTROL_STEERING_FACTOR;
|
||||||
calcPosition /= 1000;
|
calcPosition /= 1000;
|
||||||
calcPosition += eKart.center;
|
calcPosition += eKart.center;
|
||||||
|
@ -26,6 +26,7 @@ void STEERING_init(STEERING* me){
|
|||||||
me->wait.f = NULL;
|
me->wait.f = NULL;
|
||||||
me->run.f = NULL;
|
me->run.f = NULL;
|
||||||
me->dead.f = NULL;
|
me->dead.f = NULL;
|
||||||
|
eKart.center = 560024;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STEERING_startBehaviour(STEERING* me){
|
void STEERING_startBehaviour(STEERING* me){
|
||||||
|
@ -67,7 +67,7 @@ bool ALIVE_processEvent(Event* ev) {
|
|||||||
case STAL_BORN:
|
case STAL_BORN:
|
||||||
if (ev->id == evALready) {
|
if (ev->id == evALready) {
|
||||||
me->state = STAL_WAIT;
|
me->state = STAL_WAIT;
|
||||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
ALIVE_emitPoll(me, me->aliveTime*20, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ bool ALIVE_processEvent(Event* ev) {
|
|||||||
}
|
}
|
||||||
} else if (me->isAlive){
|
} else if (me->isAlive){
|
||||||
me->state = STAL_WAIT;
|
me->state = STAL_WAIT;
|
||||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
ALIVE_emitPoll(me, me->aliveTime*20, 0);
|
||||||
} else {
|
} else {
|
||||||
me->state = STAL_DEAD;
|
me->state = STAL_DEAD;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ bool ALIVE_processEvent(Event* ev) {
|
|||||||
me->state = STAL_BREAK;
|
me->state = STAL_BREAK;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
ALIVE_emitPoll(me, me->aliveTime*20, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -272,6 +272,7 @@
|
|||||||
<property key="debugoptions.useswbreakpoints" value="false"/>
|
<property key="debugoptions.useswbreakpoints" value="false"/>
|
||||||
<property key="event.recorder.enabled" value="false"/>
|
<property key="event.recorder.enabled" value="false"/>
|
||||||
<property key="event.recorder.scvd.files" value=""/>
|
<property key="event.recorder.scvd.files" value=""/>
|
||||||
|
<property key="firmware.download.all" value="false"/>
|
||||||
<property key="hwtoolclock.frcindebug" value="false"/>
|
<property key="hwtoolclock.frcindebug" value="false"/>
|
||||||
<property key="lastid" value=""/>
|
<property key="lastid" value=""/>
|
||||||
<property key="memories.aux" value="false"/>
|
<property key="memories.aux" value="false"/>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -46,10 +46,10 @@
|
|||||||
<Window_Position>
|
<Window_Position>
|
||||||
<Visibility>SHOWNORMAL</Visibility>
|
<Visibility>SHOWNORMAL</Visibility>
|
||||||
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
|
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
|
||||||
<Top>522</Top>
|
<Top>195</Top>
|
||||||
<Left>622</Left>
|
<Left>426</Left>
|
||||||
<Bottom>1019</Bottom>
|
<Bottom>692</Bottom>
|
||||||
<Right>1044</Right>
|
<Right>848</Right>
|
||||||
</Window_Position>
|
</Window_Position>
|
||||||
</Bus_Statistics>
|
</Bus_Statistics>
|
||||||
<J1939_Database_Files/>
|
<J1939_Database_Files/>
|
||||||
@ -327,8 +327,8 @@
|
|||||||
<Message>
|
<Message>
|
||||||
<Id>529</Id>
|
<Id>529</Id>
|
||||||
<Signal>posX</Signal>
|
<Signal>posX</Signal>
|
||||||
<Signal>button</Signal>
|
|
||||||
<Signal>posY</Signal>
|
<Signal>posY</Signal>
|
||||||
|
<Signal>button</Signal>
|
||||||
</Message>
|
</Message>
|
||||||
<Message>
|
<Message>
|
||||||
<Id>1040</Id>
|
<Id>1040</Id>
|
||||||
@ -348,9 +348,9 @@
|
|||||||
</Message>
|
</Message>
|
||||||
<Message>
|
<Message>
|
||||||
<Id>336</Id>
|
<Id>336</Id>
|
||||||
<Signal>HOMING</Signal>
|
|
||||||
<Signal>SET_CENTER</Signal>
|
|
||||||
<Signal>RESET</Signal>
|
<Signal>RESET</Signal>
|
||||||
|
<Signal>SET_CENTER</Signal>
|
||||||
|
<Signal>HOMING</Signal>
|
||||||
</Message>
|
</Message>
|
||||||
<Message>
|
<Message>
|
||||||
<Id>82</Id>
|
<Id>82</Id>
|
||||||
@ -363,16 +363,16 @@
|
|||||||
<Window_Position>
|
<Window_Position>
|
||||||
<Visibility>SHOWNORMAL</Visibility>
|
<Visibility>SHOWNORMAL</Visibility>
|
||||||
<WindowPlacement>HIDE</WindowPlacement>
|
<WindowPlacement>HIDE</WindowPlacement>
|
||||||
<Top>151</Top>
|
<Top>456</Top>
|
||||||
<Left>608</Left>
|
<Left>632</Left>
|
||||||
<Right>1098</Right>
|
<Right>1079</Right>
|
||||||
<Bottom>582</Bottom>
|
<Bottom>744</Bottom>
|
||||||
</Window_Position>
|
</Window_Position>
|
||||||
<COLUMN_WIDTH>
|
<COLUMN_WIDTH>
|
||||||
<MESSAGE_COLUMN>94</MESSAGE_COLUMN>
|
<MESSAGE_COLUMN>151</MESSAGE_COLUMN>
|
||||||
<Raw_Val_Column>94</Raw_Val_Column>
|
<Raw_Val_Column>137</Raw_Val_Column>
|
||||||
<Physical_Val_Column>172</Physical_Val_Column>
|
<Physical_Val_Column>172</Physical_Val_Column>
|
||||||
<Signal_Column>94</Signal_Column>
|
<Signal_Column>86</Signal_Column>
|
||||||
</COLUMN_WIDTH>
|
</COLUMN_WIDTH>
|
||||||
</CAN_Signal_Watch>
|
</CAN_Signal_Watch>
|
||||||
<J1939_Signal_Watch>
|
<J1939_Signal_Watch>
|
||||||
@ -562,9 +562,9 @@
|
|||||||
<Window_Position>
|
<Window_Position>
|
||||||
<Visibility>SHOWNORMAL</Visibility>
|
<Visibility>SHOWNORMAL</Visibility>
|
||||||
<WindowPlacement>SETMINPOSITION</WindowPlacement>
|
<WindowPlacement>SETMINPOSITION</WindowPlacement>
|
||||||
<Top>0</Top>
|
<Top>3</Top>
|
||||||
<Left>0</Left>
|
<Left>0</Left>
|
||||||
<Bottom>810</Bottom>
|
<Bottom>627</Bottom>
|
||||||
<Right>606</Right>
|
<Right>606</Right>
|
||||||
</Window_Position>
|
</Window_Position>
|
||||||
<Interpretation_Window_Position>
|
<Interpretation_Window_Position>
|
||||||
@ -653,7 +653,7 @@
|
|||||||
<ID>Data Byte(s)</ID>
|
<ID>Data Byte(s)</ID>
|
||||||
<Order>13</Order>
|
<Order>13</Order>
|
||||||
<IsVisible>1</IsVisible>
|
<IsVisible>1</IsVisible>
|
||||||
<Width>701</Width>
|
<Width>643</Width>
|
||||||
</COLUMN>
|
</COLUMN>
|
||||||
<IsHex>1</IsHex>
|
<IsHex>1</IsHex>
|
||||||
<IsAppend>0</IsAppend>
|
<IsAppend>0</IsAppend>
|
||||||
@ -665,7 +665,7 @@
|
|||||||
<Top>0</Top>
|
<Top>0</Top>
|
||||||
<Left>0</Left>
|
<Left>0</Left>
|
||||||
<Bottom>549</Bottom>
|
<Bottom>549</Bottom>
|
||||||
<Right>1614</Right>
|
<Right>1556</Right>
|
||||||
</Window_Position>
|
</Window_Position>
|
||||||
<Interpretation_Window_Position>
|
<Interpretation_Window_Position>
|
||||||
<Visibility>SHOWNORMAL</Visibility>
|
<Visibility>SHOWNORMAL</Visibility>
|
||||||
@ -738,7 +738,7 @@
|
|||||||
<ID>Checksum</ID>
|
<ID>Checksum</ID>
|
||||||
<Order>10</Order>
|
<Order>10</Order>
|
||||||
<IsVisible>1</IsVisible>
|
<IsVisible>1</IsVisible>
|
||||||
<Width>715</Width>
|
<Width>657</Width>
|
||||||
</COLUMN>
|
</COLUMN>
|
||||||
<IsHex>1</IsHex>
|
<IsHex>1</IsHex>
|
||||||
<IsAppend>0</IsAppend>
|
<IsAppend>0</IsAppend>
|
||||||
@ -750,7 +750,7 @@
|
|||||||
<Top>0</Top>
|
<Top>0</Top>
|
||||||
<Left>0</Left>
|
<Left>0</Left>
|
||||||
<Bottom>549</Bottom>
|
<Bottom>549</Bottom>
|
||||||
<Right>1614</Right>
|
<Right>1556</Right>
|
||||||
</Window_Position>
|
</Window_Position>
|
||||||
<Interpretation_Window_Position>
|
<Interpretation_Window_Position>
|
||||||
<Visibility>SHOWNORMAL</Visibility>
|
<Visibility>SHOWNORMAL</Visibility>
|
||||||
@ -765,10 +765,10 @@
|
|||||||
<Window_Position>
|
<Window_Position>
|
||||||
<Visibility>SHOWNORMAL</Visibility>
|
<Visibility>SHOWNORMAL</Visibility>
|
||||||
<WindowPlacement>SETMINPOSITION</WindowPlacement>
|
<WindowPlacement>SETMINPOSITION</WindowPlacement>
|
||||||
<Top>3</Top>
|
<Top>4</Top>
|
||||||
<Left>1052</Left>
|
<Left>648</Left>
|
||||||
<Bottom>658</Bottom>
|
<Bottom>659</Bottom>
|
||||||
<Right>1912</Right>
|
<Right>1508</Right>
|
||||||
</Window_Position>
|
</Window_Position>
|
||||||
<Message_List>
|
<Message_List>
|
||||||
<Message>
|
<Message>
|
||||||
@ -885,7 +885,7 @@
|
|||||||
<IsExtended>FALSE</IsExtended>
|
<IsExtended>FALSE</IsExtended>
|
||||||
<IsRtr>FALSE</IsRtr>
|
<IsRtr>FALSE</IsRtr>
|
||||||
<DLC>3</DLC>
|
<DLC>3</DLC>
|
||||||
<DataBytes>25,0,0</DataBytes>
|
<DataBytes>25,50,0</DataBytes>
|
||||||
<Repetion>10</Repetion>
|
<Repetion>10</Repetion>
|
||||||
<Repetition_Enabled>FALSE</Repetition_Enabled>
|
<Repetition_Enabled>FALSE</Repetition_Enabled>
|
||||||
<Key_Value>a</Key_Value>
|
<Key_Value>a</Key_Value>
|
||||||
@ -899,7 +899,43 @@
|
|||||||
<DLC>2</DLC>
|
<DLC>2</DLC>
|
||||||
<DataBytes>0,0</DataBytes>
|
<DataBytes>0,0</DataBytes>
|
||||||
<Repetion>500</Repetion>
|
<Repetion>500</Repetion>
|
||||||
<Repetition_Enabled>TRUE</Repetition_Enabled>
|
<Repetition_Enabled>FALSE</Repetition_Enabled>
|
||||||
|
<Key_Value>a</Key_Value>
|
||||||
|
<Key_Enabled>FALSE</Key_Enabled>
|
||||||
|
</Message>
|
||||||
|
<Message>
|
||||||
|
<Channel>1</Channel>
|
||||||
|
<Message_ID>543</Message_ID>
|
||||||
|
<IsExtended>FALSE</IsExtended>
|
||||||
|
<IsRtr>FALSE</IsRtr>
|
||||||
|
<DLC>1</DLC>
|
||||||
|
<DataBytes>0</DataBytes>
|
||||||
|
<Repetion>100</Repetion>
|
||||||
|
<Repetition_Enabled>FALSE</Repetition_Enabled>
|
||||||
|
<Key_Value>a</Key_Value>
|
||||||
|
<Key_Enabled>FALSE</Key_Enabled>
|
||||||
|
</Message>
|
||||||
|
<Message>
|
||||||
|
<Channel>1</Channel>
|
||||||
|
<Message_ID>23</Message_ID>
|
||||||
|
<IsExtended>FALSE</IsExtended>
|
||||||
|
<IsRtr>FALSE</IsRtr>
|
||||||
|
<DLC>4</DLC>
|
||||||
|
<DataBytes>250,0,0,0</DataBytes>
|
||||||
|
<Repetion>10</Repetion>
|
||||||
|
<Repetition_Enabled>FALSE</Repetition_Enabled>
|
||||||
|
<Key_Value>a</Key_Value>
|
||||||
|
<Key_Enabled>FALSE</Key_Enabled>
|
||||||
|
</Message>
|
||||||
|
<Message>
|
||||||
|
<Channel>1</Channel>
|
||||||
|
<Message_ID>1540</Message_ID>
|
||||||
|
<IsExtended>FALSE</IsExtended>
|
||||||
|
<IsRtr>FALSE</IsRtr>
|
||||||
|
<DLC>4</DLC>
|
||||||
|
<DataBytes>0,0,0,0</DataBytes>
|
||||||
|
<Repetion>10</Repetion>
|
||||||
|
<Repetition_Enabled>FALSE</Repetition_Enabled>
|
||||||
<Key_Value>a</Key_Value>
|
<Key_Value>a</Key_Value>
|
||||||
<Key_Enabled>FALSE</Key_Enabled>
|
<Key_Enabled>FALSE</Key_Enabled>
|
||||||
</Message>
|
</Message>
|
||||||
|
Reference in New Issue
Block a user