Skip to content

Commit cc00ac5

Browse files
Clean-up & README update for RC1.
1 parent d85995b commit cc00ac5

File tree

3 files changed

+44
-15
lines changed

3 files changed

+44
-15
lines changed

FS-AI_API/fs-ai_api.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static struct can_frame PCAN_GPS_GPS_Delusions_B;
137137
static struct can_frame PCAN_GPS_GPS_DateTime;
138138

139139
// static local data
140-
static can_stats_struct_t can_stats;
140+
static can_stats_t can_stats;
141141

142142
static volatile boolean_e VCU2AI_Status_fresh = FALSE;
143143
static volatile boolean_e VCU2AI_Drive_F_fresh = FALSE;
@@ -1028,11 +1028,11 @@ void fs_ai_api_gps_get_data(fs_ai_api_gps *data) {
10281028
}
10291029

10301030

1031-
void fs_ai_api_clear_can_stats() {
1032-
memset(&can_stats, 0, sizeof(can_stats));
1031+
void fs_ai_api_get_can_stats(can_stats_t *data) {
1032+
memcpy(data,&can_stats,sizeof(can_stats_t));
10331033
}
10341034

10351035

1036-
void fs_ai_api_get_can_stats(can_stats_struct_t *data) {
1037-
memcpy(data,&can_stats,sizeof(can_stats_struct_t));
1036+
void fs_ai_api_clear_can_stats() {
1037+
memset(&can_stats, 0, sizeof(can_stats_t));
10381038
}

FS-AI_API/fs-ai_api.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ typedef struct can_stats_struct {
270270
volatile uint32_t PCAN_GPS_GPS_Delusions_B_count;
271271
volatile uint32_t PCAN_GPS_GPS_DateTime_count;
272272
volatile uint32_t unhandled_frame_count;
273-
} can_stats_struct_t;
273+
} can_stats_t;
274274

275275
int fs_ai_api_init(char *CAN_interface, int debug, int simulate);
276276

@@ -280,8 +280,8 @@ void fs_ai_api_ai2vcu_set_data(fs_ai_api_ai2vcu *data);
280280
void fs_ai_api_imu_get_data(fs_ai_api_imu *data);
281281
void fs_ai_api_gps_get_data(fs_ai_api_gps *data);
282282

283+
void fs_ai_api_get_can_stats(can_stats_t *data);
283284
void fs_ai_api_clear_can_stats();
284-
void fs_ai_api_get_can_stats(can_stats_struct_t *data);
285285

286286
#ifdef __cplusplus
287287
}

README.md

+37-8
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66
## NOTE:
77

8-
### This *draft* commit of the **FS-AI_API** repository contains the source code for the 2021 software revision version of the IMechE FS-AI ADS-DV.
8+
### This *release candidate* of the **FS-AI_API** repository contains the source code for the 2021 software revision version of the IMechE FS-AI ADS-DV.
99

1010
It has been provided as a reference for teams to start implementing their vehicle interface code.
1111

1212
Previously the 2019 interface was provided as a library 'libfs-ai_api_amd64.a' intended for static linking.
1313

1414
Source code for the library is now released under the MIT license so it may be compiled for any Linux architecture and modified if required.
1515

16-
The 2021 FS-AI ADS-DV has an updated CAN interface.
16+
The 2021 FS-AI ADS-DV has an updated CAN interface to support the new vehicle feature of modulated hydraulic brakes. This interface is backward compatible to the 2019 vehicle.
1717

18-
Further work will be done to improve the quality of the Console & Tester example programmes.
18+
Further work has been done to improve the Console & Tester example programmes.
1919

2020

2121

@@ -52,7 +52,7 @@ NOTE: See `setup.sh` for information on configuring a CAN interface under Linux
5252

5353

5454
## How to use
55-
The library contains 3 functions plus associated data structures and enums:
55+
The library contains 7 functions plus associated data structures and enums:
5656

5757

5858

@@ -77,17 +77,46 @@ Populates an instance of the `fs_ai_api_vcu2ai` data structure with the latest v
7777
### `void fs_ai_api_ai2vcu_set_data(fs_ai_api_ai2vcu *data);`
7878
Transmits the CAN frames associated with the data passed in via the `fs_ai_api_ai2vcu` data structure.
7979

80-
NOTE: This function must be called frequently enough to prevent the CAN timeout diagnostics of the vehicle ECU from triggering. However calling the function too frequently could overload the CAN bus so an internal timer prevents re-transmission of CAN frames at a period less than approx. 4ms. Calling this function every 5ms is optimal, data updates will be sent to the vehicle as fast as possible.
80+
NOTE: This function must be called frequently enough to prevent the CAN timeout diagnostics of the vehicle ECU from triggering. However calling the function too frequently could overload the CAN bus so an internal timer prevents re-transmission of CAN frames at a period less than approx. 8ms. Calling this function every 10ms is optimal, data updates will be sent to the vehicle as fast as possible.
81+
82+
83+
84+
85+
### `void fs_ai_api_imu_get_data(fs_ai_api_imu *data);`
86+
87+
Populates an instance of the `fs_ai_api_imu` data structure with the latest values received from the PCAN-GPS fitted to the vehicle. Data receives are asynchronous - each CAN frame is buffered as it is received.
88+
89+
90+
91+
92+
### `void fs_ai_api_gps_get_data(fs_ai_api_gps *data);`
93+
94+
Populates an instance of the `fs_ai_api_gps` data structure with the latest values received from the PCAN-GPS fitted to the vehicle. Data receives are asynchronous - each CAN frame is buffered as it is received.
95+
96+
97+
98+
### `void fs_ai_api_get_can_stats(can_stats_t *data);`
99+
100+
Populates an instance of the `can_stats_t` data structure with the latest values received from the vehicle. Use this for debugging CAN receives.
101+
102+
103+
104+
### `void fs_ai_api_clear_can_stats();`
105+
106+
Clears the `can_stats_t` data structure.
107+
108+
109+
##
81110

82111

83112

84113

85114
## Further Documentation
86-
Please refer to the full specification document for full information on the FS-AI ADS-DV CAN interface: [ADS-DV Software Interface Specification-v3.0.pdf](./Docs/ADS-DV_Software_Interface_Specification_v3.0.pdf).
115+
Please refer to the full specification document for full information on the FS-AI ADS-DV CAN interface: [ADS-DV Software Interface Specification-v4.0.pdf](./Docs/ADS-DV_Software_Interface_Specification_v4.0.pdf).
87116

88-
(also published on the IMechE website as: https://www.imeche.org/docs/default-source/1-oscar/formula-student/2021/forms/ai/ads-dv-software-interface-specification-v3-0.pdf?sfvrsn=2 ).
117+
(also published on the IMechE website as: https://www.imeche.org/docs/default-source/1-oscar/formula-student/2021/forms/ai/ads-dv-software-interface-specification-v4-0.pdf?sfvrsn=2 ).
89118

90-
The referenced CAN database can be found here: [adsdv_2021_vcu_ai_interface_v1.dbc](./Docs/adsdv_2021_vcu_ai_interface_v1.dbc).
119+
The referenced CAN database can be found here: [ADSDV_2021_VCU_AI_interface_v2.dbc](./Docs/ADSDV_2021_VCU_AI_interface_v2.dbc).
91120

92121
This software library exposes only those aspects of the full interface that are deemed essential for the 2021 Formula Student AI DDT competition using the FS-AI ADS-DV.
93122

0 commit comments

Comments
 (0)