From: Jiri Vlasak Date: Mon, 3 Jan 2022 13:44:28 +0000 (+0100) Subject: Add entry positions range executable X-Git-Tag: v0.8.0~4 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/bcar.git/commitdiff_plain/8c32272cb26aefffdaaa2358e097c0c6b7a67934 Add entry positions range executable --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6625d7a..dc978e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,9 @@ target_link_libraries(compute_pslot_table pslot) add_executable(prove_parallel_slot src/prove_parallel_slot.cc) target_link_libraries(prove_parallel_slot pslot) +add_executable(entry_positions_range src/entry_positions_range.cc) +target_link_libraries(entry_positions_range pslot) + add_executable(compare_to_vorobieva src/compare_to_vorobieva.cc) target_link_libraries(compare_to_vorobieva pslot) diff --git a/src/entry_positions_range.cc b/src/entry_positions_range.cc new file mode 100644 index 0000000..6bc82a3 --- /dev/null +++ b/src/entry_positions_range.cc @@ -0,0 +1,74 @@ +/* + * SPDX-FileCopyrightText: 2021 Jiri Vlasak + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#include +#include +#include "pslot.hh" + +#define CAR_CURB_TO_CURB 10.802166641822163 +#define CAR_FRONT_TRACK 1.511 +#define CAR_WIDTH 1.771 +#define CAR_WHEELBASE 2.588 +#define CAR_DISTANCE_FROM_REAR_AXLE_TO_FRONT 3.427 +#define CAR_LENGTH 4.084 + +#define SLOT_MAX_WIDTH (CAR_WIDTH + 0.5) +#define SLOT_STEP_WIDTH 0.01 + +#define PARKING_SPEED -0.001 +#define DELTA_ANGLE_TO_SLOT 0.0001 + +int main(int argc, char** argv) +{ + if (argc != 3) { + std::cerr << "Number of direction changes needed." << std::endl; + exit(1); + } + int max_cusp = atoi(argv[1]); + double slot_length = atof(argv[2]); + std::cout << std::fixed; + std::cerr << std::fixed; + + bcar::BicycleCar c; + c.ctc(CAR_CURB_TO_CURB); + c.ft(CAR_FRONT_TRACK); + c.w(CAR_WIDTH); + c.wb(CAR_WHEELBASE); + c.df(CAR_DISTANCE_FROM_REAR_AXLE_TO_FRONT); + c.len(CAR_LENGTH); + + bcar::Point zp(0.0, 0.0); + double zh = 0.0; + + for (double w = c.w() + 4.5 * SLOT_STEP_WIDTH; w < SLOT_MAX_WIDTH; + w += SLOT_STEP_WIDTH) { + bcar::ParkingSlot s(zp, zh, w, slot_length); + s.set_parking_speed(PARKING_SPEED); + s.set_max_cusp(max_cusp); + s.set_delta_angle_to_slot(DELTA_ANGLE_TO_SLOT); + auto pr = s.fe(c); + double d = 0; + double fd = 0; + unsigned int cd = 0; + if (s._entries.size() > 0) { + for (unsigned int i = 1; i < s._entries.size(); i++) { + double dd = std::abs(s._entries[i].front().h() + - s._entries[i - 1].front().h()); + if (dd <= 0.0001) { + d += dd; + } else { + fd += dd; + cd += 1; + } + } + std::cout << w << " " << slot_length << " "; + std::cout << max_cusp << " "; + std::cout << d << " " << fd << " " << cd; + std::cout << std::endl; + } + } + return 0; +}