| 9 | #include <iostream> |
| 10 | |
| 11 | int main() { |
| 12 | // Import field |
| 13 | F2CField field = f2c::Parser::importFieldGml(std::string(DATA_PATH) + "test1.xml"); |
| 14 | F2CField orig_field = field.clone(); |
| 15 | // Transform into UTM to work in meters |
| 16 | f2c::Transform::transformToUTM(field); |
| 17 | |
| 18 | F2CRobot robot (2.0, 6.0); |
| 19 | f2c::hg::ConstHL const_hl; |
| 20 | F2CCells no_hl = const_hl.generateHeadlands(field.getField(), 3.0 * robot.getWidth()); |
| 21 | f2c::sg::BruteForce bf; |
| 22 | F2CSwaths swaths = bf.generateSwaths(M_PI, robot.getCovWidth(), no_hl.getGeometry(0)); |
| 23 | f2c::rp::SnakeOrder snake_sorter; |
| 24 | swaths = snake_sorter.genSortedSwaths(swaths); |
| 25 | f2c::pp::PathPlanning path_planner; |
| 26 | robot.setMinTurningRadius(2); // m |
| 27 | f2c::pp::DubinsCurves dubins; |
| 28 | F2CPath path = path_planner.planPath(robot, swaths, dubins); |
| 29 | |
| 30 | |
| 31 | f2c::Visualizer::figure(); |
| 32 | f2c::Visualizer::plot(field); |
| 33 | f2c::Visualizer::plot(no_hl); |
| 34 | f2c::Visualizer::plot(path); |
| 35 | f2c::Visualizer::save("Tutorial_8_1_UTM.png"); |
| 36 | |
| 37 | |
| 38 | // Transform the generated path back to the previousa CRS. |
| 39 | F2CPath path_gps = f2c::Transform::transformToPrevCRS(path, field); |
| 40 | f2c::Transform::transformToPrevCRS(field); |
| 41 | |
| 42 | f2c::Visualizer::figure(); |
| 43 | f2c::Visualizer::plot(orig_field.getCellsAbsPosition()); |
| 44 | f2c::Visualizer::plot(path_gps); |
| 45 | f2c::Visualizer::save("Tutorial_8_1_GPS.png"); |
| 46 | |
| 47 | return 0; |
| 48 | } |
| 49 | |
| 50 |
nothing calls this directly
no test coverage detected