From 9e01d7de6cfb0c62c41d8c3ddfe44c3c9577c0a1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Apr 2016 10:05:04 +1000 Subject: [PATCH] SITL: added support for "quad-fast" frame much more powerful copter for testing nav at high speed --- libraries/SITL/SIM_Frame.cpp | 10 ++++++---- libraries/SITL/SIM_Multicopter.cpp | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libraries/SITL/SIM_Frame.cpp b/libraries/SITL/SIM_Frame.cpp index 36ddf64f9f..c7e8e1ff59 100644 --- a/libraries/SITL/SIM_Frame.cpp +++ b/libraries/SITL/SIM_Frame.cpp @@ -115,7 +115,8 @@ static const Motor firefly_motors[] = }; /* - table of supported frame types + table of supported frame types. String order is important for + partial name matching */ static Frame supported_frames[] = { @@ -123,10 +124,10 @@ static Frame supported_frames[] = Frame("quad", 4, quad_plus_motors), Frame("copter", 4, quad_plus_motors), Frame("x", 4, quad_x_motors), - Frame("hexa", 6, hexa_motors), Frame("hexax", 6, hexax_motors), - Frame("octa", 8, octa_motors), + Frame("hexa", 6, hexa_motors), Frame("octa-quad", 8, octa_quad_motors), + Frame("octa", 8, octa_motors), Frame("tri", 3, tri_motors), Frame("y6", 6, y6_motors), Frame("firefly", 6, firefly_motors) @@ -152,7 +153,8 @@ void Frame::init(float _mass, float hover_throttle, float _terminal_velocity, fl Frame *Frame::find_frame(const char *name) { for (uint8_t i=0; i < ARRAY_SIZE(supported_frames); i++) { - if (strcasecmp(name, supported_frames[i].name) == 0) { + // do partial name matching to allow for frame variants + if (strncasecmp(name, supported_frames[i].name, strlen(supported_frames[i].name)) == 0) { return &supported_frames[i]; } } diff --git a/libraries/SITL/SIM_Multicopter.cpp b/libraries/SITL/SIM_Multicopter.cpp index 01c9bc9a32..96edcea837 100644 --- a/libraries/SITL/SIM_Multicopter.cpp +++ b/libraries/SITL/SIM_Multicopter.cpp @@ -33,7 +33,11 @@ MultiCopter::MultiCopter(const char *home_str, const char *frame_str) : printf("Frame '%s' not found", frame_str); exit(1); } - frame->init(1.5, 0.51, 15, 4*radians(360)); + if (strstr(frame_str, "-fast")) { + frame->init(1.5, 0.5, 85, 4*radians(360)); + } else { + frame->init(1.5, 0.51, 15, 4*radians(360)); + } frame_height = 0.1; }