Fastest-lap is a vehicle dynamics simulator. It can be used to understand vehicle dynamics, to learn about driving techniques, to design car prototypes, or just for fun!
MIT License
575
stars
43
forks
source link
libfastestlapc: new functionality: export output names #30
In the C++ core library, a new function is available as
limebeer2014f1<double>::curvilinear_p car(database);
const auto map = car.get_outputs_map()
this get_outputs_map() returns a std::unordered_map<std::string,scalar> with all the possible outputs that can be requested to a Dynamic_model_t. The map key is the name of the outputs, for example:
The task is to implement two functions in libfastestlapc.cpp with prototype:
int vehicle_get_number_of_output_variables(const char* vehicle_name);
void vehicle_get_output_variable_names(char** output_names, const int n_outputs, const int n_char, const char* vehicle_name);
The first one simply computes the map for the vehicle, and returns the number of output variables in the map (i.e. the map size). The second one, returns all the key names into output_names.
no new shall be executed inside the function. In fact, the caller provides the memory associated to the char** through n_outputs (the return from int vehicle_get_number_of_output_variables(const char* vehicle_name);) and n_char (a sufficiently big number).
Hence char** is equivalent to char[n_outputs][n_char]
In the C++ core library, a new function is available as
this
get_outputs_map()
returns astd::unordered_map<std::string,scalar>
with all the possible outputs that can be requested to aDynamic_model_t
. The map key is the name of the outputs, for example:The task is to implement two functions in libfastestlapc.cpp with prototype:
The first one simply computes the map for the vehicle, and returns the number of output variables in the map (i.e. the map size). The second one, returns all the key names into
output_names
.no
new
shall be executed inside the function. In fact, the caller provides the memory associated to thechar**
throughn_outputs
(the return fromint vehicle_get_number_of_output_variables(const char* vehicle_name);
) andn_char
(a sufficiently big number).Hence
char**
is equivalent tochar[n_outputs][n_char]