Compare commits

..

7 Commits
Race ... main

Author SHA1 Message Date
10de77fbb0 add tests 2023-09-13 15:58:56 +02:00
a04b19b081 fix battery voltage 2023-09-13 13:14:58 +02:00
df63ece978 add full sequence 2023-09-13 13:01:21 +02:00
3777d8bd12 update for debug 2023-09-13 12:58:54 +02:00
c2c1104297 headlights always on because no screen 2023-09-13 12:58:46 +02:00
73b5594786 add boost and check battery 2023-09-13 12:58:27 +02:00
09fb1d10da move uml render 2023-09-13 12:57:23 +02:00
17 changed files with 88 additions and 133 deletions

View File

@ -228,7 +228,8 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){
// TODO display say ALIVE // TODO display say ALIVE
eKart.powerMode = incomeData.separate.byte0; eKart.powerMode = incomeData.separate.byte0;
if (eKart.powerMode == 0) { if (eKart.powerMode == 0) {
CM_HEADLIGHTS(&ALWAYSFALSE); // CM_HEADLIGHTS(&ALWAYSFALSE);
CM_HEADLIGHTS(&ALWAYSTRUE);
} else { } else {
CM_HEADLIGHTS(&ALWAYSTRUE); CM_HEADLIGHTS(&ALWAYSTRUE);
} }
@ -305,6 +306,10 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){
* SUPPLY * * SUPPLY *
**********/ **********/
case 6: case 6:
if(idMsg == 0x1) {
eKart.batteryVoltage = incomeData.full;
}
if(idMsg == 0x4) { if(idMsg == 0x4) {
DRIVE_startBehaviour(drive()); DRIVE_startBehaviour(drive());
STEERING_startBehaviour(steering()); STEERING_startBehaviour(steering());

View File

@ -87,20 +87,8 @@ typedef struct {
bool button; bool button;
uint8_t speed; // 100m/h uint8_t speed; // 100m/h
bool brake; bool brake;
uint8_t powerMode; // 0: eco - 1: normal - 2: race uint8_t powerMode;
/* uint16_t batteryVoltage;
* 0 - ECO MODE
* Eco mod limit to 1/2 of the maximal current.
* Position is 1/2 of the maximal angle
*
* 1 - NORMAL MODE
* Standard ramp for normal mode
* Position is limited to 3/4 of the maximal
*
* 2 - RACE MODE
*
*
*/
} KART_VAR_TYPE; } KART_VAR_TYPE;
KART_VAR_TYPE eKart; KART_VAR_TYPE eKart;

View File

@ -1,5 +1,5 @@
/** /**
* @author Rémi Heredero * @author R<EFBFBD>mi Heredero
* @version. 0.0.0 * @version. 0.0.0
* @date August 2023 * @date August 2023
* @file kartculator.c * @file kartculator.c
@ -242,6 +242,11 @@ void calcTorque(uint8_t joy_pos) {
calcTorque *= 1150; calcTorque *= 1150;
calcTorque /= 1000; calcTorque /= 1000;
} }
if(eKart.batteryVoltage <= 18750) {
calcTorque = 0;
}
eKart.torque = (int16_t) calcTorque; eKart.torque = (int16_t) calcTorque;
} }

View File

@ -124,8 +124,8 @@ void ECAN_Initialize(void)
// filter 1 is message for controller // filter 1 is message for controller
convertCANid2Reg(0x010, dSTANDARD_CAN_MSG_ID_2_0B, &RXF1EIDH, &RXF1EIDL, &RXF1SIDH, &RXF1SIDL); convertCANid2Reg(0x010, dSTANDARD_CAN_MSG_ID_2_0B, &RXF1EIDH, &RXF1EIDL, &RXF1SIDH, &RXF1SIDL);
// filter 2 is message for recipient n°7, not yet defined // filter 2 is message for display (yes i want the message from the display)
convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL); convertCANid2Reg(0x060, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL);
/* /*
* ENABLE FILTERS * ENABLE FILTERS

View File

@ -454,7 +454,7 @@ endif
# Enable dependency checking # Enable dependency checking
.dep.inc: .depcheck-impl .dep.inc: .depcheck-impl
DEPFILES=$(wildcard ${POSSIBLE_DEPFILES}) DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES})
ifneq (${DEPFILES},) ifneq (${DEPFILES},)
include ${DEPFILES} include ${DEPFILES}
endif endif

View File

@ -15,11 +15,11 @@
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
# #
SHELL=cmd.exe SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/ PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.05/mplab_platform/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path. # Adding MPLAB X bin directory to path.
PATH:=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) PATH:=C:/Program Files/Microchip/MPLABX/v6.05/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created # Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.15\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/" MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.05\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/"
OS_CURRENT="$(shell uname -s)" OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe" MP_CC="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
# MP_CPPC is not defined # MP_CPPC is not defined
@ -27,11 +27,11 @@ MP_CC="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
MP_AS="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe" MP_AS="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
MP_LD="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe" MP_LD="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-cc.exe"
MP_AR="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-ar.exe" MP_AR="C:\Program Files\Microchip\xc8\v2.41\bin\xc8-ar.exe"
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.05/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_CC_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
# MP_CPPC_DIR is not defined # MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined # MP_BC_DIR is not defined
MP_AS_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_AS_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
MP_LD_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_LD_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
MP_AR_DIR="C:\Program Files\Microchip\xc8\v2.41\bin" MP_AR_DIR="C:\Program Files\Microchip\xc8\v2.41\bin"
DFP_DIR=C:/Program Files/Microchip/MPLABX/v6.15/packs/Microchip/PIC18F-K_DFP/1.11.281 DFP_DIR=C:/Users/remi/.mchp_packs/Microchip/PIC18F-K_DFP/1.11.281

25
UML/full_sequence.puml Normal file
View File

@ -0,0 +1,25 @@
@startuml
'https://plantuml.com/sequence-diagram
actor User as usr
participant can_message as can
control kartculator as kc
queue XF as xf
entity Drive as drive
entity Steering as steering
usr -\ xf : set message "move"
xf -> can : new value on joystick
== If X axis change value ==
can -> kc : calculate new position
kc -> can : build message
can -> steering : set new position
== If Y axis change value ==
can -> kc : calculate new torque
kc -> can : build message
can -> xf : set message "torque"
xf -> drive : set new torque
@enduml

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

BIN
UML/pdf-png/cas de test.pdf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

BIN
UML/pdf-png/steering.pdf Normal file

Binary file not shown.

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="15.0.0">
<zoom_level>15</zoom_level>
<element>
<id>UMLSpecialState</id>
<coordinates>
<x>315</x>
<y>270</y>
<w>30</w>
<h>30</h>
</coordinates>
<panel_attributes>type=initial</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>315</x>
<y>285</y>
<w>120</w>
<h>105</h>
</coordinates>
<panel_attributes>lt=-&gt;
evWDinit</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>255</x>
<y>360</y>
<w>150</w>
<h>60</h>
</coordinates>
<panel_attributes>STWD_ALIVE</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>180</x>
<y>375</y>
<w>270</w>
<h>135</h>
</coordinates>
<panel_attributes>lt=-&gt;
m1=evWDpoll</panel_attributes>
<additional_attributes>100.0;30.0;100.0;70.0;10.0;70.0;10.0;10.0;50.0;10.0</additional_attributes>
</element>
<element>
<id>UMLNote</id>
<coordinates>
<x>480</x>
<y>360</y>
<w>150</w>
<h>60</h>
</coordinates>
<panel_attributes>send alive
by CAN</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLNote</id>
<coordinates>
<x>375</x>
<y>225</y>
<w>150</w>
<h>60</h>
</coordinates>
<panel_attributes>read time on
EPROM</panel_attributes>
<additional_attributes/>
</element>
</diagram>

View File

@ -326,8 +326,8 @@
<CAN_Signal_Watch> <CAN_Signal_Watch>
<Message> <Message>
<Id>529</Id> <Id>529</Id>
<Signal>posX</Signal>
<Signal>posY</Signal> <Signal>posY</Signal>
<Signal>posX</Signal>
</Message> </Message>
<Message> <Message>
<Id>1040</Id> <Id>1040</Id>
@ -345,8 +345,14 @@
<Id>337</Id> <Id>337</Id>
<Signal>SteeringPosition</Signal> <Signal>SteeringPosition</Signal>
</Message> </Message>
<Message>
<Id>1585</Id>
<Signal>BatteryVoltage</Signal>
</Message>
<Message> <Message>
<Id>1311</Id> <Id>1311</Id>
<Signal>STAT_HOMING_ATTAINED</Signal>
<Signal>STAT_HOMING_ERROR</Signal>
</Message> </Message>
<Message> <Message>
<Id>1294</Id> <Id>1294</Id>
@ -360,18 +366,18 @@
<Signal>headlights</Signal> <Signal>headlights</Signal>
</Message> </Message>
<Window_Position> <Window_Position>
<Visibility>SHOWNORMAL</Visibility> <Visibility>SHOWMINIMIZED</Visibility>
<WindowPlacement>HIDE</WindowPlacement> <WindowPlacement>HIDE</WindowPlacement>
<Top>186</Top> <Top>161</Top>
<Left>513</Left> <Left>610</Left>
<Right>960</Right> <Right>1057</Right>
<Bottom>747</Bottom> <Bottom>722</Bottom>
</Window_Position> </Window_Position>
<COLUMN_WIDTH> <COLUMN_WIDTH>
<MESSAGE_COLUMN>86</MESSAGE_COLUMN> <MESSAGE_COLUMN>0</MESSAGE_COLUMN>
<Raw_Val_Column>86</Raw_Val_Column> <Raw_Val_Column>0</Raw_Val_Column>
<Physical_Val_Column>172</Physical_Val_Column> <Physical_Val_Column>0</Physical_Val_Column>
<Signal_Column>86</Signal_Column> <Signal_Column>0</Signal_Column>
</COLUMN_WIDTH> </COLUMN_WIDTH>
</CAN_Signal_Watch> </CAN_Signal_Watch>
<J1939_Signal_Watch> <J1939_Signal_Watch>
@ -417,17 +423,17 @@
<Axis_Color>255</Axis_Color> <Axis_Color>255</Axis_Color>
<X_Grid_Lines>10</X_Grid_Lines> <X_Grid_Lines>10</X_Grid_Lines>
<Y_Grid_Lines>5</Y_Grid_Lines> <Y_Grid_Lines>5</Y_Grid_Lines>
<Active_Axis>2</Active_Axis> <Active_Axis>1</Active_Axis>
<Selected_Action>0</Selected_Action> <Selected_Action>0</Selected_Action>
<Show_Grid>TRUE</Show_Grid> <Show_Grid>TRUE</Show_Grid>
<Display_Type>NORMAL</Display_Type> <Display_Type>NORMAL</Display_Type>
</GRAPH_PARAMETERS> </GRAPH_PARAMETERS>
<GRAPH_ELEMENT> <GRAPH_ELEMENT>
<Message_ID>1586</Message_ID> <Message_ID>1585</Message_ID>
<Message_Name>DISPLAY_CURRENT</Message_Name> <Message_Name>DISPLAY_VOLTAGE</Message_Name>
<Frame_Format/> <Frame_Format/>
<Element_Name>BatteryCurrent</Element_Name> <Element_Name>BatteryVoltage</Element_Name>
<Value_Type>Physical</Value_Type> <Value_Type>Raw</Value_Type>
<Line_Type>SOLID</Line_Type> <Line_Type>SOLID</Line_Type>
<Line_Color>65280</Line_Color> <Line_Color>65280</Line_Color>
<Point_Type>2</Point_Type> <Point_Type>2</Point_Type>
@ -439,10 +445,10 @@
<Window_Position> <Window_Position>
<Visibility>SHOWNORMAL</Visibility> <Visibility>SHOWNORMAL</Visibility>
<Window_Position>HIDE</Window_Position> <Window_Position>HIDE</Window_Position>
<Top>39</Top> <Top>11</Top>
<Left>74</Left> <Left>290</Left>
<Bottom>586</Bottom> <Bottom>558</Bottom>
<Right>1399</Right> <Right>1615</Right>
</Window_Position> </Window_Position>
<Splitter_Window_Col_0> <Splitter_Window_Col_0>
<CxIdeal>479</CxIdeal> <CxIdeal>479</CxIdeal>
@ -569,10 +575,10 @@
<Interpretation_Window_Position> <Interpretation_Window_Position>
<Visibility>SHOWNORMAL</Visibility> <Visibility>SHOWNORMAL</Visibility>
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement> <WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
<Top>181</Top> <Top>179</Top>
<Left>12</Left> <Left>10</Left>
<Bottom>459</Bottom> <Bottom>457</Bottom>
<Right>361</Right> <Right>359</Right>
</Interpretation_Window_Position> </Interpretation_Window_Position>
</CAN_Message_Window> </CAN_Message_Window>
<J1939_Message_Window> <J1939_Message_Window>
@ -669,10 +675,10 @@
<Interpretation_Window_Position> <Interpretation_Window_Position>
<Visibility>SHOWNORMAL</Visibility> <Visibility>SHOWNORMAL</Visibility>
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement> <WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
<Top>181</Top> <Top>179</Top>
<Left>12</Left> <Left>10</Left>
<Bottom>459</Bottom> <Bottom>457</Bottom>
<Right>361</Right> <Right>359</Right>
</Interpretation_Window_Position> </Interpretation_Window_Position>
</J1939_Message_Window> </J1939_Message_Window>
<LIN_Message_Window> <LIN_Message_Window>
@ -754,20 +760,20 @@
<Interpretation_Window_Position> <Interpretation_Window_Position>
<Visibility>SHOWNORMAL</Visibility> <Visibility>SHOWNORMAL</Visibility>
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement> <WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
<Top>181</Top> <Top>179</Top>
<Left>12</Left> <Left>10</Left>
<Bottom>459</Bottom> <Bottom>457</Bottom>
<Right>361</Right> <Right>359</Right>
</Interpretation_Window_Position> </Interpretation_Window_Position>
</LIN_Message_Window> </LIN_Message_Window>
<CAN_Tx_Window> <CAN_Tx_Window>
<Window_Position> <Window_Position>
<Visibility>SHOWNORMAL</Visibility> <Visibility>SHOWNORMAL</Visibility>
<WindowPlacement>SETMINPOSITION</WindowPlacement> <WindowPlacement>SETMINPOSITION</WindowPlacement>
<Top>4</Top> <Top>-1</Top>
<Left>648</Left> <Left>1035</Left>
<Bottom>659</Bottom> <Bottom>654</Bottom>
<Right>1508</Right> <Right>1895</Right>
</Window_Position> </Window_Position>
<Message_List> <Message_List>
<Message> <Message>