From 256d280b71b97d7595e384cac40a248982edc09d Mon Sep 17 00:00:00 2001 From: duongtd Date: Thu, 27 Aug 2026 10:09:25 +0700 Subject: [PATCH] =?UTF-8?q?pnkx=5Fnav=5Fcore=201.0=20=E2=80=94=20every=20p?= =?UTF-8?q?ackage=20with=20a=20remote=20is=20a=20submodule,=20and=20the=20?= =?UTF-8?q?root=20CMake=20builds=20them=20all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A single commit on an orphan branch: the whole tree as it should land on a robot, with no history from the branch it grew out of. The rule applied: a package that has its own remote becomes a submodule; a package that only ever lived inside this repository stays as ordinary files. That comes to 29 submodules, 18 registered here for the first time. They were sitting in the tree as plain clones, which looks right locally and is empty on the robot - a clone of this repository would have carried the directory names and none of the contents. .gitignore is fixed at the source rather than patched per path. The rule **/[Pp]ackages/* comes from the Visual Studio template and targets NuGet's generated packages/ folder; here Packages/ is a SOURCE directory, so it hid whole packages from git status - and a missing package then becomes invisible to exactly the command you would use to look for one. It cost move_base2, dock_pattern_action and sbpl_recovery, and sbpl_recovery surfaced only by walking the tree for .git directories and diffing against .gitmodules. The exception now re-includes src/*/Packages/** wholesale, placed immediately after the NuGet rule so the build-artifact rules further down still win. Listing paths one by one is what let one slip in the first place. The root CMakeLists.txt described a tree that no longer exists. Its second half was a migration shim that looked for a sibling Test/ directory from AMR_T800 and added packages out of it; PNKX_NAV_CORE_BUILD_TEST_PACKAGES defaults to ON, so with the migration finished it would have hit FATAL_ERROR at configure time. That is gone, and every package is added in dependency order at its real in-tree path. Three guard names are traps worth naming, because a guard that never matches adds the subdirectory twice on a re-entrant configure: - src/Libraries/angles is project robot_angles_prv, and a DIFFERENT package called angles lives at src/Algorithms/Libraries/angles. Both are in the tree; guarding on `angles` would silently skip the first. - dock_pattern_action's library target is dock_pattern_action_handler. - move_base2's is move_base2_core. sbpl_recovery and dock_pattern_action had no standalone branch - catkin was required at top level, so a build without it died at configure time pointing at packages that are present. Both now detect the mode and name their CMake targets directly in standalone, and both drop their plugin at the top of the build tree, because boost::dll loads by filename and PluginLoaderHelper resolves that against the build directory: left in a subdirectory a plugin builds and is then invisible at runtime. grid_map_core and image_geometry were added because hybrid_local_planner and depth_image_proc link robot_grid_map_core and robot_image_geometry, and neither was in the tree - found by scanning every CMakeLists for internal library names and diffing against the targets the tree defines, then confirmed by the build. Every submodule points at the tip of the branch it was already pinned to, not blindly at main. costmap_2d stays on dev_cam_intel; that branch exists for a reason, and this tree carries field calibration that does not belong on main. config/ is flattened into config/runtime/, matching the layout the nav core reads. The .zip snapshots of old package states are gone - manual backups, not build inputs. Verified: cmake configure returns 0 and a full standalone build returns 0, producing 48 shared libraries with nothing gated off. --- .gitignore | 442 +++ .gitmodules | 87 + CATKIN_BUILD_README.md | 63 + CMAKE_BUILD_README.md | 402 +++ CMakeLists.txt | 273 ++ README.md | 3 + config/runtime/action_handlers_params.yaml | 505 ++++ config/runtime/compound_actions_params.yaml | 91 + config/runtime/config/costmap_params.yaml | 36 + .../config/inflation_layer_params.yaml | 5 + .../runtime/config/obstacle_layer_params.yaml | 19 + .../runtime/config/static_layer_params.yaml | 11 + config/runtime/config/voxel_layer_params.yaml | 15 + config/runtime/costmap_common_params.yaml | 94 + config/runtime/costmap_global_params.yaml | 29 + ...lobal_params_plugins_no_virtual_walls.yaml | 10 + config/runtime/costmap_local_params.yaml | 38 + ...local_params_plugins_no_virtual_walls.yaml | 9 + config/runtime/custom_global_params.yaml | 35 + config/runtime/dock_global_params.yaml | 154 ++ .../runtime/hybrid_local_planner_params.yaml | 540 ++++ config/runtime/maker_sources.yaml | 93 + config/runtime/mission_adapters_params.yaml | 104 + config/runtime/move_base_common_params.yaml | 307 +++ config/runtime/mppi_local_planner_params.yaml | 309 +++ .../mprim/base_local_planner_params.yaml | 48 + .../mprim/dwa_local_planner_params.yaml | 55 + config/runtime/mprim/ekf.yaml | 217 ++ .../mprim/genmprim_unicycle_highcost_5cm.m | 280 ++ .../mprim/genmprim_unicycle_highcost_5cm.py | 416 +++ config/runtime/mprim/localization.yaml | 36 + config/runtime/mprim/mapping.yaml | 63 + .../mprim/mpc_local_planner_params.yaml | 106 + config/runtime/mprim/mqtt_general.yaml | 8 + .../mprim/ros_diff_drive_controller.yaml | 71 + config/runtime/mprim/sbpl_global_params.yaml | 10 + .../runtime/mprim/sick_line_guidance_mls.yaml | 61 + config/runtime/mprim/unicycle_5cm.mprim | 1203 +++++++++ ...unicycle_5cm_expensive_turn_in_place.mprim | 1683 ++++++++++++ ...5cm_expensive_turn_in_place_highcost.mprim | 1683 ++++++++++++ .../unicycle_5cm_noreverse_trolley.mprim | 2403 +++++++++++++++++ .../mprim/unicycle_highcost_10cm.mprim | 1683 ++++++++++++ .../runtime/mprim/unicycle_highcost_1cm.mprim | 1683 ++++++++++++ .../mprim/unicycle_highcost_2_5cm.mprim | 1683 ++++++++++++ .../runtime/mprim/unicycle_highcost_2cm.mprim | 1683 ++++++++++++ .../runtime/mprim/unicycle_highcost_5cm.mprim | 1683 ++++++++++++ config/runtime/pnkx_local_planner_params.yaml | 203 ++ .../runtime/priest_local_planner_params.yaml | 259 ++ config/runtime/recovery_behaviors_params.yaml | 310 +++ config/runtime/sbpl_global_params.yaml | 15 + config/runtime/sensor_store_params.yaml | 74 + .../runtime/stanley_local_planner_params.yaml | 615 +++++ config/runtime/two_points_global_params.yaml | 3 + doc/architecture_discussion.md | 673 +++++ doc/diff_drive_c.drawio | 1282 +++++++++ doc/folders.md | 99 + doc/implementation_plan.md | 230 ++ doc/readme.md | 15 + examples/NavigationExample/NavigationAPI.cs | 287 ++ .../NavigationExample.csproj | 15 + examples/NavigationExample/Program.cs | 498 ++++ examples/NavigationExample/TF3API.cs | 133 + examples/NavigationExample/libnav_c_api.so | Bin 0 -> 309296 bytes examples/NavigationExample/maze.png | Bin 0 -> 2539 bytes examples/NavigationExample/maze.yaml | 6 + examples/NavigationExample/msgs/CommonMsgs.cs | 274 ++ .../msgs/ProtocolMsgsTypes.cs | 109 + examples/NavigationExample/msgs/SensorMsgs.cs | 0 examples/QUICK_START.md | 148 + examples/README.md | 142 + examples/START_HERE.md | 83 + examples/dotnet-install.sh | 1887 +++++++++++++ examples/run_example.sh | 123 + pnkx_nav_core.sln | 29 + robotapp.db | 0 setup_catkin_workspace.sh | 116 + src/APIs/c_api/CMakeLists.txt | 161 ++ src/APIs/c_api/C_API_AUDIT.md | 500 ++++ src/APIs/c_api/NAV_C_API_2_GUIDE.md | 1951 +++++++++++++ src/APIs/c_api/include/convertor.h | 217 ++ src/APIs/c_api/include/convertor_2.h | 51 + src/APIs/c_api/include/geometry_msgs/Accel.h | 22 + .../include/geometry_msgs/AccelStamped.h | 23 + .../geometry_msgs/AccelWithCovariance.h | 22 + .../AccelWithCovarianceStamped.h | 23 + .../c_api/include/geometry_msgs/Inertia.h | 28 + .../include/geometry_msgs/InertiaStamped.h | 23 + src/APIs/c_api/include/geometry_msgs/Point.h | 21 + .../c_api/include/geometry_msgs/Point32.h | 22 + .../include/geometry_msgs/PointStamped.h | 23 + .../c_api/include/geometry_msgs/Polygon.h | 22 + .../include/geometry_msgs/PolygonStamped.h | 23 + src/APIs/c_api/include/geometry_msgs/Pose.h | 23 + src/APIs/c_api/include/geometry_msgs/Pose2D.h | 22 + .../c_api/include/geometry_msgs/PoseArray.h | 24 + .../c_api/include/geometry_msgs/PoseStamped.h | 23 + .../geometry_msgs/PoseWithCovariance.h | 23 + .../geometry_msgs/PoseWithCovarianceStamped.h | 23 + .../c_api/include/geometry_msgs/Quaternion.h | 23 + .../include/geometry_msgs/QuaternionStamped.h | 23 + .../c_api/include/geometry_msgs/Transform.h | 23 + .../include/geometry_msgs/TransformStamped.h | 24 + src/APIs/c_api/include/geometry_msgs/Twist.h | 22 + .../include/geometry_msgs/TwistStamped.h | 23 + .../geometry_msgs/TwistWithCovariance.h | 23 + .../TwistWithCovarianceStamped.h | 23 + .../c_api/include/geometry_msgs/Vector3.h | 22 + .../include/geometry_msgs/Vector3Stamped.h | 23 + src/APIs/c_api/include/geometry_msgs/Wrench.h | 22 + .../include/geometry_msgs/WrenchStamped.h | 23 + .../include/map_msgs/OccupancyGridUpdate.h | 33 + .../include/nav_2d_msgs/ComplexPolygon2D.h | 23 + .../c_api/include/nav_2d_msgs/NavGridInfo.h | 25 + .../include/nav_2d_msgs/NavGridOfChars.h | 25 + .../nav_2d_msgs/NavGridOfCharsUpdate.h | 25 + .../include/nav_2d_msgs/NavGridOfDoubles.h | 25 + .../nav_2d_msgs/NavGridOfDoublesUpdate.h | 25 + src/APIs/c_api/include/nav_2d_msgs/Path2D.h | 24 + src/APIs/c_api/include/nav_2d_msgs/Point2D.h | 21 + .../c_api/include/nav_2d_msgs/Polygon2D.h | 22 + .../include/nav_2d_msgs/Polygon2DCollection.h | 27 + .../include/nav_2d_msgs/Polygon2DStamped.h | 23 + src/APIs/c_api/include/nav_2d_msgs/Pose2D32.h | 22 + .../c_api/include/nav_2d_msgs/Pose2DStamped.h | 23 + .../c_api/include/nav_2d_msgs/SwitchPlugin.h | 23 + .../include/nav_2d_msgs/SwitchPluginRequest.h | 20 + .../nav_2d_msgs/SwitchPluginResponse.h | 21 + src/APIs/c_api/include/nav_2d_msgs/Twist2D.h | 22 + .../c_api/include/nav_2d_msgs/Twist2D32.h | 22 + .../include/nav_2d_msgs/Twist2DStamped.h | 23 + .../c_api/include/nav_2d_msgs/UIntBounds.h | 23 + src/APIs/c_api/include/nav_c_api.h | 533 ++++ src/APIs/c_api/include/nav_c_api_2.h | 323 +++ src/APIs/c_api/include/nav_msgs/ActionTypes.h | 29 + src/APIs/c_api/include/nav_msgs/GetMap.h | 23 + .../c_api/include/nav_msgs/GetMapAction.h | 25 + .../include/nav_msgs/GetMapActionFeedback.h | 25 + .../c_api/include/nav_msgs/GetMapActionGoal.h | 25 + .../include/nav_msgs/GetMapActionResult.h | 25 + .../c_api/include/nav_msgs/GetMapFeedback.h | 20 + src/APIs/c_api/include/nav_msgs/GetMapGoal.h | 20 + .../c_api/include/nav_msgs/GetMapRequest.h | 20 + .../c_api/include/nav_msgs/GetMapResponse.h | 21 + .../c_api/include/nav_msgs/GetMapResult.h | 21 + src/APIs/c_api/include/nav_msgs/GetPlan.h | 23 + .../c_api/include/nav_msgs/GetPlanRequest.h | 23 + .../c_api/include/nav_msgs/GetPlanResponse.h | 21 + src/APIs/c_api/include/nav_msgs/GridCells.h | 26 + src/APIs/c_api/include/nav_msgs/LoadMap.h | 23 + .../c_api/include/nav_msgs/LoadMapRequest.h | 20 + .../c_api/include/nav_msgs/LoadMapResponse.h | 23 + src/APIs/c_api/include/nav_msgs/MapMetaData.h | 26 + .../c_api/include/nav_msgs/OccupancyGrid.h | 25 + src/APIs/c_api/include/nav_msgs/Odometry.h | 35 + src/APIs/c_api/include/nav_msgs/Path.h | 24 + src/APIs/c_api/include/nav_msgs/SetMap.h | 23 + .../c_api/include/nav_msgs/SetMapRequest.h | 23 + .../c_api/include/nav_msgs/SetMapResponse.h | 21 + src/APIs/c_api/include/protocol_msgs/Action.h | 30 + .../include/protocol_msgs/ActionParameter.h | 21 + .../include/protocol_msgs/ControlPoint.h | 22 + src/APIs/c_api/include/protocol_msgs/Edge.h | 42 + src/APIs/c_api/include/protocol_msgs/Error.h | 28 + .../include/protocol_msgs/ErrorReference.h | 21 + src/APIs/c_api/include/protocol_msgs/Info.h | 28 + .../include/protocol_msgs/InfoReference.h | 21 + .../c_api/include/protocol_msgs/Information.h | 22 + src/APIs/c_api/include/protocol_msgs/Node.h | 28 + .../include/protocol_msgs/NodePosition.h | 26 + src/APIs/c_api/include/protocol_msgs/Order.h | 33 + .../c_api/include/protocol_msgs/Trajectory.h | 25 + .../c_api/include/sensor_msgs/BatteryState.h | 38 + .../c_api/include/sensor_msgs/CameraInfo.h | 33 + .../include/sensor_msgs/ChannelFloat32.h | 22 + .../include/sensor_msgs/CompressedImage.h | 24 + .../include/sensor_msgs/DepthCameraData.h | 36 + .../c_api/include/sensor_msgs/FluidPressure.h | 23 + .../c_api/include/sensor_msgs/Illuminance.h | 23 + src/APIs/c_api/include/sensor_msgs/Image.h | 28 + src/APIs/c_api/include/sensor_msgs/Imu.h | 29 + .../c_api/include/sensor_msgs/JointState.h | 29 + src/APIs/c_api/include/sensor_msgs/Joy.h | 25 + .../c_api/include/sensor_msgs/JoyFeedback.h | 22 + .../include/sensor_msgs/JoyFeedbackArray.h | 22 + .../c_api/include/sensor_msgs/LaserEcho.h | 21 + .../c_api/include/sensor_msgs/LaserScan.h | 32 + .../include/sensor_msgs/MultiEchoLaserScan.h | 33 + .../c_api/include/sensor_msgs/PointCloud.h | 27 + .../c_api/include/sensor_msgs/PointCloud2.h | 33 + .../c_api/include/sensor_msgs/PointField.h | 23 + src/APIs/c_api/include/sensor_msgs/Range.h | 26 + .../include/sensor_msgs/RegionOfInterest.h | 25 + .../include/sensor_msgs/RelativeHumidity.h | 23 + .../c_api/include/sensor_msgs/Temperature.h | 23 + .../c_api/include/sensor_msgs/TimeReference.h | 24 + src/APIs/c_api/include/std_msgs/Bool.h | 20 + src/APIs/c_api/include/std_msgs/Byte.h | 20 + .../c_api/include/std_msgs/ByteMultiArray.h | 23 + src/APIs/c_api/include/std_msgs/Char.h | 20 + src/APIs/c_api/include/std_msgs/ColorRGBA.h | 23 + src/APIs/c_api/include/std_msgs/Duration.h | 21 + src/APIs/c_api/include/std_msgs/Empty.h | 20 + src/APIs/c_api/include/std_msgs/Float32.h | 20 + .../include/std_msgs/Float32MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/Float64.h | 20 + .../include/std_msgs/Float64MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/Header.h | 45 + src/APIs/c_api/include/std_msgs/Int16.h | 20 + .../c_api/include/std_msgs/Int16MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/Int32.h | 20 + .../c_api/include/std_msgs/Int32MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/Int64.h | 20 + .../c_api/include/std_msgs/Int64MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/Int8.h | 20 + .../c_api/include/std_msgs/Int8MultiArray.h | 23 + .../include/std_msgs/MultiArrayDimension.h | 22 + .../c_api/include/std_msgs/MultiArrayLayout.h | 23 + src/APIs/c_api/include/std_msgs/String.h | 20 + src/APIs/c_api/include/std_msgs/Time.h | 27 + src/APIs/c_api/include/std_msgs/UInt16.h | 20 + .../c_api/include/std_msgs/UInt16MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/UInt32.h | 20 + .../c_api/include/std_msgs/UInt32MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/UInt64.h | 20 + .../c_api/include/std_msgs/UInt64MultiArray.h | 23 + src/APIs/c_api/include/std_msgs/UInt8.h | 20 + .../c_api/include/std_msgs/UInt8MultiArray.h | 23 + .../nav-c-api-2-csharp-integration-report.md | 501 ++++ src/APIs/c_api/src/convertor.cpp | 871 ++++++ src/APIs/c_api/src/convertor_2.cpp | 78 + src/APIs/c_api/src/nav_c_api.cpp | 1285 +++++++++ src/APIs/c_api/src/nav_c_api_2.cpp | 445 +++ src/APIs/c_api/src/std_msgs/Header.cpp | 37 + src/APIs/c_api/src/std_msgs/Time.cpp | 12 + src/APIs/c_api/test/test_convertor.cpp | 473 ++++ .../Cores/score_algorithm/CMakeLists.txt | 162 ++ .../Cores/score_algorithm/README.md | 44 + .../include/score_algorithm/goal_checker.h | 56 + .../include/score_algorithm/score_algorithm.h | 178 ++ .../score_algorithm/trajectory_generator.h | 143 + .../Cores/score_algorithm/package.xml | 37 + .../score_algorithm/src/score_algorithm.cpp | 487 ++++ .../Libraries/angles/CMakeLists.txt | 129 + .../Libraries/angles/include/angles/angles.h | 48 + src/Algorithms/Libraries/angles/package.xml | 22 + .../Libraries/kalman/CMakeLists.txt | 181 ++ src/Algorithms/Libraries/kalman/README.md | 18 + .../Libraries/kalman/include/kalman/kalman.h | 91 + src/Algorithms/Libraries/kalman/package.xml | 22 + .../Libraries/kalman/src/kalman-test.cpp | 77 + .../Libraries/kalman/src/kalman.cpp | 96 + .../Libraries/mkt_algorithm/CMakeLists.txt | 190 ++ .../Libraries/mkt_algorithm/README.md | 0 .../include/mkt_algorithm/bicycle/bicycle.h | 108 + .../mkt_algorithm/bicycle/equation_line.h | 74 + .../mkt_algorithm/bicycle/go_straight.h | 70 + .../mkt_algorithm/bicycle/goal_checker.h | 45 + .../include/mkt_algorithm/bicycle/pta.h | 60 + .../mkt_algorithm/bicycle/rotate_to_goal.h | 74 + .../mkt_algorithm/diff/diff_go_straight.h | 49 + .../diff/diff_predictive_trajectory.h | 433 +++ .../mkt_algorithm/diff/diff_rotate_to_goal.h | 68 + .../Libraries/mkt_algorithm/package.xml | 44 + .../src/bicycle/bicycel_go_straight.cpp | 68 + .../src/bicycle/bicycle_pure_pursuit.cpp | 641 +++++ .../src/bicycle/bicycle_rotate_to_goal.cpp | 78 + .../mkt_algorithm/src/diff/Hermite.md | 126 + .../mkt_algorithm/src/diff/Hermite.pdf | Bin 0 -> 35440 bytes .../src/diff/diff_go_straight.cpp | 224 ++ .../src/diff/diff_predictive_trajectory.cpp | 1705 ++++++++++++ .../src/diff/diff_rotate_to_goal.cpp | 101 + .../src/diff/hermite_trajectory.svg | 40 + .../Libraries/mkt_msgs/CMakeLists.txt | 144 + .../mkt_msgs/include/mkt_msgs/Trajectory2D.h | 66 + src/Algorithms/Libraries/mkt_msgs/package.xml | 27 + .../Libraries/mkt_plugins/CMakeLists.txt | 208 ++ .../mkt_plugins/doc/VelocitySpace.png | Bin 0 -> 34570 bytes .../Libraries/mkt_plugins/doc/lim_pv.png | Bin 0 -> 29306 bytes .../Libraries/mkt_plugins/doc/std_pv.png | Bin 0 -> 31906 bytes .../include/mkt_plugins/equation_line.h | 74 + .../include/mkt_plugins/goal_checker.h | 57 + .../mkt_plugins/kinematic_parameters.h | 318 +++ .../mkt_plugins/limited_accel_generator.h | 51 + .../mkt_plugins/one_d_velocity_iterator.h | 220 ++ .../include/mkt_plugins/simple_goal_checker.h | 77 + .../mkt_plugins/standard_traj_generator.h | 205 ++ .../include/mkt_plugins/velocity_iterator.h | 67 + .../include/mkt_plugins/xy_theta_iterator.h | 90 + .../Libraries/mkt_plugins/package.xml | 49 + .../mkt_plugins/src/equation_line.cpp | 118 + .../mkt_plugins/src/goal_checker.cpp | 115 + .../mkt_plugins/src/kinematic_parameters.cpp | 243 ++ .../src/limited_accel_generator.cpp | 59 + .../mkt_plugins/src/simple_goal_checker.cpp | 81 + .../src/standard_traj_generator.cpp | 287 ++ .../mkt_plugins/src/xy_theta_iterator.cpp | 92 + .../Packages/actions/dock_pattern_action | 1 + .../Packages/global_planners/custom_planner | 1 + .../Packages/global_planners/dock_planner | 1 + .../global_planners/sbpl_lattice_planner | 1 + .../two_points_planner/CMakeLists.txt | 176 ++ .../two_points_planner/two_points_planner.h | 83 + .../two_points_planner/package.xml | 52 + .../src/two_points_planner.cpp | 246 ++ .../local_planners/hybrid_local_planner | 1 + .../local_planners/mppi_local_planner | 1 + .../pnkx_local_planner/CMakeLists.txt | 244 ++ .../pnkx_docking_local_planner.h | 182 ++ .../pnkx_go_straight_local_planner.h | 85 + .../pnkx_local_planner/pnkx_local_planner.h | 212 ++ .../pnkx_rotate_local_planner.h | 85 + .../include/pnkx_local_planner/transforms.h | 50 + .../pnkx_local_planner/package.xml | 67 + .../src/pnkx_docking_local_planner.cpp | 835 ++++++ .../src/pnkx_go_straight_local_planner.cpp | 260 ++ .../src/pnkx_local_planner.cpp | 494 ++++ .../src/pnkx_rotate_local_planner.cpp | 247 ++ .../pnkx_local_planner/src/transforms.cpp | 206 ++ .../local_planners/priest_local_planner | 1 + .../Packages/recoveries/sbpl_recovery | 1 + src/Libraries/action_core | 1 + src/Libraries/angles | 1 + src/Libraries/common_msgs | 1 + src/Libraries/costmap_2d | 1 + src/Libraries/data_convert | 1 + src/Libraries/depth_image_proc | 1 + src/Libraries/dock_pattern_detector | 1 + src/Libraries/geometry2 | 1 + src/Libraries/grid_map_core | 1 + src/Libraries/image_geometry | 1 + src/Libraries/laser_filter | 1 + src/Libraries/laser_geometry | 1 + src/Libraries/mission_adapters | 1 + src/Libraries/recovery_core | 1 + src/Libraries/robot_cpp/CMakeLists.txt | 269 ++ src/Libraries/robot_cpp/INIT_USAGE.md | 483 ++++ src/Libraries/robot_cpp/LICENSE | 5 + .../robot_cpp/PLUGIN_LOADER_README.md | 133 + src/Libraries/robot_cpp/README.md | 252 ++ .../robot_cpp/include/robot/console.h | 525 ++++ src/Libraries/robot_cpp/include/robot/init.h | 134 + .../robot_cpp/include/robot/node_handle.h | 657 +++++ .../include/robot/plugin_loader_helper.h | 106 + src/Libraries/robot_cpp/include/robot/robot.h | 18 + src/Libraries/robot_cpp/package.xml | 30 + .../robot_cpp/robot_cppConfig.cmake.in | 20 + src/Libraries/robot_cpp/src/console.cpp | 476 ++++ src/Libraries/robot_cpp/src/init.cpp | 139 + src/Libraries/robot_cpp/src/node_handle.cpp | 2062 ++++++++++++++ .../robot_cpp/src/plugin_loader_helper.cpp | 443 +++ .../robot_cpp/test/test_node_handle.cpp | 839 ++++++ src/Libraries/robot_line_extraction | 1 + .../robot_nav_2d_msgs/CMakeLists.txt | 149 + .../robot_nav_2d_msgs/ComplexPolygon2D.h | 74 + .../include/robot_nav_2d_msgs/NavGridInfo.h | 94 + .../robot_nav_2d_msgs/NavGridOfChars.h | 80 + .../robot_nav_2d_msgs/NavGridOfCharsUpdate.h | 80 + .../robot_nav_2d_msgs/NavGridOfDoubles.h | 80 + .../NavGridOfDoublesUpdate.h | 80 + .../include/robot_nav_2d_msgs/Path2D.h | 69 + .../include/robot_nav_2d_msgs/Point2D.h | 72 + .../include/robot_nav_2d_msgs/Polygon2D.h | 67 + .../robot_nav_2d_msgs/Polygon2DCollection.h | 81 + .../robot_nav_2d_msgs/Polygon2DStamped.h | 74 + .../include/robot_nav_2d_msgs/Pose2D32.h | 78 + .../include/robot_nav_2d_msgs/Pose2DStamped.h | 74 + .../include/robot_nav_2d_msgs/SwitchPlugin.h | 30 + .../robot_nav_2d_msgs/SwitchPluginRequest.h | 66 + .../robot_nav_2d_msgs/SwitchPluginResponse.h | 72 + .../include/robot_nav_2d_msgs/Twist2D.h | 78 + .../include/robot_nav_2d_msgs/Twist2D32.h | 78 + .../robot_nav_2d_msgs/Twist2DStamped.h | 74 + .../include/robot_nav_2d_msgs/UIntBounds.h | 84 + src/Libraries/robot_nav_2d_msgs/package.xml | 26 + .../robot_nav_2d_utils/CMakeLists.txt | 261 ++ src/Libraries/robot_nav_2d_utils/README.md | 10 + .../robot_nav_2d_utils/doc/Conversions.md | 54 + .../robot_nav_2d_utils/doc/PluginMux.md | 39 + .../doc/PolygonsAndFootprints.md | 52 + .../robot_nav_2d_utils/include/mapbox/LICENSE | 15 + .../robot_nav_2d_utils/include/mapbox/NOTES | 2 + .../include/mapbox/earcut.hpp | 776 ++++++ .../include/robot_nav_2d_utils/bounds.h | 91 + .../include/robot_nav_2d_utils/conversions.h | 106 + .../include/robot_nav_2d_utils/footprint.h | 54 + .../robot_nav_2d_utils/geometry_help.h | 85 + .../robot_nav_2d_utils/odom_subscriber.h | 87 + .../include/robot_nav_2d_utils/parameters.h | 153 ++ .../include/robot_nav_2d_utils/path_ops.h | 88 + .../include/robot_nav_2d_utils/plugin_mux.h | 275 ++ .../include/robot_nav_2d_utils/polygons.h | 200 ++ .../include/robot_nav_2d_utils/tf_help.h | 103 + src/Libraries/robot_nav_2d_utils/package.xml | 37 + src/Libraries/robot_nav_2d_utils/setup.py | 11 + .../robot_nav_2d_utils/src/bounds.cpp | 102 + .../robot_nav_2d_utils/src/conversions.cpp | 338 +++ .../robot_nav_2d_utils/src/footprint.cpp | 67 + .../robot_nav_2d_utils/src/path_ops.cpp | 194 ++ .../robot_nav_2d_utils/src/polygons.cpp | 503 ++++ .../robot_nav_2d_utils/src/tf_help.cpp | 118 + .../robot_nav_2d_utils/test/bounds_test.cpp | 199 ++ .../robot_nav_2d_utils/test/compress_test.cpp | 97 + .../robot_nav_2d_utils/test/param_tests.cpp | 146 + .../test/param_tests.launch | 34 + .../robot_nav_2d_utils/test/polygon_tests.cpp | 185 ++ .../test/resolution_test.cpp | 78 + src/Libraries/robot_sensor_ports | 1 + src/Libraries/robot_time | 1 + src/Libraries/sbpl | 1 + src/Libraries/voxel_grid | 1 + src/Libraries/xmlrpcpp | 1 + .../Cores/move_base_core/.gitignore | 414 +++ .../Cores/move_base_core/CMakeLists.txt | 155 ++ .../Cores/move_base_core/README.md | 257 ++ .../include/move_base_core/common.h | 18 + .../include/move_base_core/navigation.h | 548 ++++ .../Cores/move_base_core/package.xml | 45 + .../Cores/robot_nav_core/CHANGELOG.rst | 112 + .../Cores/robot_nav_core/CMakeLists.txt | 147 + .../robot_nav_core/base_global_planner.h | 112 + .../robot_nav_core/base_local_planner.h | 180 ++ .../include/robot_nav_core/parameter_magic.h | 86 + .../robot_nav_core/recovery_behavior.h | 77 + .../Cores/robot_nav_core/package.xml | 31 + .../Cores/robot_nav_core2/CMakeLists.txt | 154 ++ .../Cores/robot_nav_core2/README.md | 52 + .../Cores/robot_nav_core2/doc/exceptions.png | Bin 0 -> 38943 bytes .../include/robot_nav_core2/basic_costmap.h | 68 + .../include/robot_nav_core2/bounds.h | 209 ++ .../include/robot_nav_core2/common.h | 42 + .../include/robot_nav_core2/costmap.h | 157 ++ .../include/robot_nav_core2/exceptions.h | 321 +++ .../include/robot_nav_core2/global_planner.h | 86 + .../include/robot_nav_core2/local_planner.h | 187 ++ .../Cores/robot_nav_core2/package.xml | 40 + .../robot_nav_core2/src/basic_costmap.cpp | 60 + .../robot_nav_core2/test/bounds_test.cpp | 124 + .../robot_nav_core2/test/exception_test.cpp | 133 + .../robot_nav_core_adapter/CMakeLists.txt | 244 ++ .../Cores/robot_nav_core_adapter/README.md | 48 + .../cfg/NavCoreAdapter.cfg | 9 + .../robot_nav_core_adapter/costmap_adapter.h | 85 + .../global_planner_adapter.h | 75 + .../local_planner_adapter.h | 220 ++ .../robot_nav_core_adapter/shared_pointers.h | 67 + .../Cores/robot_nav_core_adapter/package.xml | 40 + .../src/costmap_adapter.cpp | 119 + .../src/global_planner_adapter.cpp | 102 + .../src/local_planner_adapter.cpp | 452 ++++ .../test/unload_test.cpp | 69 + .../test/unload_test.launch | 3 + .../Libraries/nav_grid/CMakeLists.txt | 159 ++ src/Navigations/Libraries/nav_grid/README.md | 39 + .../Libraries/nav_grid/doc/change_info.png | Bin 0 -> 9816 bytes .../Libraries/nav_grid/doc/coords.png | Bin 0 -> 56655 bytes .../Libraries/nav_grid/doc/nav_grid.png | Bin 0 -> 15299 bytes .../include/nav_grid/coordinate_conversion.h | 168 ++ .../nav_grid/include/nav_grid/index.h | 99 + .../nav_grid/include/nav_grid/nav_grid.h | 157 ++ .../nav_grid/include/nav_grid/nav_grid_info.h | 92 + .../include/nav_grid/vector_nav_grid.h | 239 ++ .../Libraries/nav_grid/package.xml | 22 + .../Libraries/nav_grid/test/utest.cpp | 522 ++++ .../robot_actionlib_msgs/CMakeLists.txt | 154 ++ .../include/robot_actionlib_msgs/GoalID.h | 65 + .../include/robot_actionlib_msgs/GoalStatus.h | 112 + .../robot_actionlib_msgs/GoalStatusArray.h | 64 + .../robot_actionlib_msgs/package.xml | 27 + .../CMakeLists.txt | 144 + .../clear_costmap_recovery.h | 68 + .../robot_clear_costmap_recovery/package.xml | 27 + .../src/clear_costmap_recovery.cpp | 337 +++ .../test/clear_tester.cpp | 95 + .../test/clear_tests.launch | 6 + .../test/params.yaml | 13 + .../robot_move_base_msgs/CMakeLists.txt | 156 ++ .../robot_move_base_msgs/MoveBaseAction.h | 69 + .../MoveBaseActionFeedback.h | 68 + .../robot_move_base_msgs/MoveBaseActionGoal.h | 69 + .../MoveBaseActionResult.h | 68 + .../robot_move_base_msgs/MoveBaseFeedback.h | 58 + .../robot_move_base_msgs/MoveBaseGoal.h | 57 + .../robot_move_base_msgs/MoveBaseResult.h | 39 + .../robot_move_base_msgs/RecoveryStatus.h | 71 + .../robot_move_base_msgs/package.xml | 30 + src/Navigations/Packages/move_base2 | 1 + 486 files changed, 72597 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 CATKIN_BUILD_README.md create mode 100644 CMAKE_BUILD_README.md create mode 100644 CMakeLists.txt create mode 100644 README.md create mode 100644 config/runtime/action_handlers_params.yaml create mode 100644 config/runtime/compound_actions_params.yaml create mode 100644 config/runtime/config/costmap_params.yaml create mode 100644 config/runtime/config/inflation_layer_params.yaml create mode 100644 config/runtime/config/obstacle_layer_params.yaml create mode 100644 config/runtime/config/static_layer_params.yaml create mode 100644 config/runtime/config/voxel_layer_params.yaml create mode 100755 config/runtime/costmap_common_params.yaml create mode 100755 config/runtime/costmap_global_params.yaml create mode 100755 config/runtime/costmap_global_params_plugins_no_virtual_walls.yaml create mode 100755 config/runtime/costmap_local_params.yaml create mode 100755 config/runtime/costmap_local_params_plugins_no_virtual_walls.yaml create mode 100644 config/runtime/custom_global_params.yaml create mode 100644 config/runtime/dock_global_params.yaml create mode 100644 config/runtime/hybrid_local_planner_params.yaml create mode 100644 config/runtime/maker_sources.yaml create mode 100644 config/runtime/mission_adapters_params.yaml create mode 100644 config/runtime/move_base_common_params.yaml create mode 100644 config/runtime/mppi_local_planner_params.yaml create mode 100644 config/runtime/mprim/base_local_planner_params.yaml create mode 100755 config/runtime/mprim/dwa_local_planner_params.yaml create mode 100755 config/runtime/mprim/ekf.yaml create mode 100755 config/runtime/mprim/genmprim_unicycle_highcost_5cm.m create mode 100755 config/runtime/mprim/genmprim_unicycle_highcost_5cm.py create mode 100644 config/runtime/mprim/localization.yaml create mode 100644 config/runtime/mprim/mapping.yaml create mode 100755 config/runtime/mprim/mpc_local_planner_params.yaml create mode 100644 config/runtime/mprim/mqtt_general.yaml create mode 100755 config/runtime/mprim/ros_diff_drive_controller.yaml create mode 100755 config/runtime/mprim/sbpl_global_params.yaml create mode 100644 config/runtime/mprim/sick_line_guidance_mls.yaml create mode 100755 config/runtime/mprim/unicycle_5cm.mprim create mode 100755 config/runtime/mprim/unicycle_5cm_expensive_turn_in_place.mprim create mode 100755 config/runtime/mprim/unicycle_5cm_expensive_turn_in_place_highcost.mprim create mode 100755 config/runtime/mprim/unicycle_5cm_noreverse_trolley.mprim create mode 100755 config/runtime/mprim/unicycle_highcost_10cm.mprim create mode 100755 config/runtime/mprim/unicycle_highcost_1cm.mprim create mode 100755 config/runtime/mprim/unicycle_highcost_2_5cm.mprim create mode 100755 config/runtime/mprim/unicycle_highcost_2cm.mprim create mode 100755 config/runtime/mprim/unicycle_highcost_5cm.mprim create mode 100644 config/runtime/pnkx_local_planner_params.yaml create mode 100644 config/runtime/priest_local_planner_params.yaml create mode 100644 config/runtime/recovery_behaviors_params.yaml create mode 100644 config/runtime/sbpl_global_params.yaml create mode 100644 config/runtime/sensor_store_params.yaml create mode 100644 config/runtime/stanley_local_planner_params.yaml create mode 100644 config/runtime/two_points_global_params.yaml create mode 100644 doc/architecture_discussion.md create mode 100755 doc/diff_drive_c.drawio create mode 100644 doc/folders.md create mode 100644 doc/implementation_plan.md create mode 100644 doc/readme.md create mode 100644 examples/NavigationExample/NavigationAPI.cs create mode 100644 examples/NavigationExample/NavigationExample.csproj create mode 100644 examples/NavigationExample/Program.cs create mode 100644 examples/NavigationExample/TF3API.cs create mode 100755 examples/NavigationExample/libnav_c_api.so create mode 100644 examples/NavigationExample/maze.png create mode 100644 examples/NavigationExample/maze.yaml create mode 100644 examples/NavigationExample/msgs/CommonMsgs.cs create mode 100644 examples/NavigationExample/msgs/ProtocolMsgsTypes.cs create mode 100644 examples/NavigationExample/msgs/SensorMsgs.cs create mode 100644 examples/QUICK_START.md create mode 100644 examples/README.md create mode 100644 examples/START_HERE.md create mode 100755 examples/dotnet-install.sh create mode 100755 examples/run_example.sh create mode 100644 pnkx_nav_core.sln create mode 100644 robotapp.db create mode 100755 setup_catkin_workspace.sh create mode 100644 src/APIs/c_api/CMakeLists.txt create mode 100644 src/APIs/c_api/C_API_AUDIT.md create mode 100644 src/APIs/c_api/NAV_C_API_2_GUIDE.md create mode 100644 src/APIs/c_api/include/convertor.h create mode 100644 src/APIs/c_api/include/convertor_2.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Accel.h create mode 100644 src/APIs/c_api/include/geometry_msgs/AccelStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/AccelWithCovariance.h create mode 100644 src/APIs/c_api/include/geometry_msgs/AccelWithCovarianceStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Inertia.h create mode 100644 src/APIs/c_api/include/geometry_msgs/InertiaStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Point.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Point32.h create mode 100644 src/APIs/c_api/include/geometry_msgs/PointStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Polygon.h create mode 100644 src/APIs/c_api/include/geometry_msgs/PolygonStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Pose.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Pose2D.h create mode 100644 src/APIs/c_api/include/geometry_msgs/PoseArray.h create mode 100644 src/APIs/c_api/include/geometry_msgs/PoseStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/PoseWithCovariance.h create mode 100644 src/APIs/c_api/include/geometry_msgs/PoseWithCovarianceStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Quaternion.h create mode 100644 src/APIs/c_api/include/geometry_msgs/QuaternionStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Transform.h create mode 100644 src/APIs/c_api/include/geometry_msgs/TransformStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Twist.h create mode 100644 src/APIs/c_api/include/geometry_msgs/TwistStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/TwistWithCovariance.h create mode 100644 src/APIs/c_api/include/geometry_msgs/TwistWithCovarianceStamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Vector3.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Vector3Stamped.h create mode 100644 src/APIs/c_api/include/geometry_msgs/Wrench.h create mode 100644 src/APIs/c_api/include/geometry_msgs/WrenchStamped.h create mode 100644 src/APIs/c_api/include/map_msgs/OccupancyGridUpdate.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/ComplexPolygon2D.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/NavGridInfo.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/NavGridOfChars.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/NavGridOfCharsUpdate.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoubles.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoublesUpdate.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Path2D.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Point2D.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Polygon2D.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Polygon2DCollection.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Polygon2DStamped.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Pose2D32.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Pose2DStamped.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/SwitchPlugin.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/SwitchPluginRequest.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/SwitchPluginResponse.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Twist2D.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Twist2D32.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/Twist2DStamped.h create mode 100644 src/APIs/c_api/include/nav_2d_msgs/UIntBounds.h create mode 100644 src/APIs/c_api/include/nav_c_api.h create mode 100644 src/APIs/c_api/include/nav_c_api_2.h create mode 100644 src/APIs/c_api/include/nav_msgs/ActionTypes.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMap.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapAction.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapActionFeedback.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapActionGoal.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapActionResult.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapFeedback.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapGoal.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapRequest.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapResponse.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetMapResult.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetPlan.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetPlanRequest.h create mode 100644 src/APIs/c_api/include/nav_msgs/GetPlanResponse.h create mode 100644 src/APIs/c_api/include/nav_msgs/GridCells.h create mode 100644 src/APIs/c_api/include/nav_msgs/LoadMap.h create mode 100644 src/APIs/c_api/include/nav_msgs/LoadMapRequest.h create mode 100644 src/APIs/c_api/include/nav_msgs/LoadMapResponse.h create mode 100644 src/APIs/c_api/include/nav_msgs/MapMetaData.h create mode 100644 src/APIs/c_api/include/nav_msgs/OccupancyGrid.h create mode 100644 src/APIs/c_api/include/nav_msgs/Odometry.h create mode 100644 src/APIs/c_api/include/nav_msgs/Path.h create mode 100644 src/APIs/c_api/include/nav_msgs/SetMap.h create mode 100644 src/APIs/c_api/include/nav_msgs/SetMapRequest.h create mode 100644 src/APIs/c_api/include/nav_msgs/SetMapResponse.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Action.h create mode 100644 src/APIs/c_api/include/protocol_msgs/ActionParameter.h create mode 100644 src/APIs/c_api/include/protocol_msgs/ControlPoint.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Edge.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Error.h create mode 100644 src/APIs/c_api/include/protocol_msgs/ErrorReference.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Info.h create mode 100644 src/APIs/c_api/include/protocol_msgs/InfoReference.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Information.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Node.h create mode 100644 src/APIs/c_api/include/protocol_msgs/NodePosition.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Order.h create mode 100644 src/APIs/c_api/include/protocol_msgs/Trajectory.h create mode 100644 src/APIs/c_api/include/sensor_msgs/BatteryState.h create mode 100644 src/APIs/c_api/include/sensor_msgs/CameraInfo.h create mode 100644 src/APIs/c_api/include/sensor_msgs/ChannelFloat32.h create mode 100644 src/APIs/c_api/include/sensor_msgs/CompressedImage.h create mode 100644 src/APIs/c_api/include/sensor_msgs/DepthCameraData.h create mode 100644 src/APIs/c_api/include/sensor_msgs/FluidPressure.h create mode 100644 src/APIs/c_api/include/sensor_msgs/Illuminance.h create mode 100644 src/APIs/c_api/include/sensor_msgs/Image.h create mode 100644 src/APIs/c_api/include/sensor_msgs/Imu.h create mode 100644 src/APIs/c_api/include/sensor_msgs/JointState.h create mode 100644 src/APIs/c_api/include/sensor_msgs/Joy.h create mode 100644 src/APIs/c_api/include/sensor_msgs/JoyFeedback.h create mode 100644 src/APIs/c_api/include/sensor_msgs/JoyFeedbackArray.h create mode 100644 src/APIs/c_api/include/sensor_msgs/LaserEcho.h create mode 100644 src/APIs/c_api/include/sensor_msgs/LaserScan.h create mode 100644 src/APIs/c_api/include/sensor_msgs/MultiEchoLaserScan.h create mode 100644 src/APIs/c_api/include/sensor_msgs/PointCloud.h create mode 100644 src/APIs/c_api/include/sensor_msgs/PointCloud2.h create mode 100644 src/APIs/c_api/include/sensor_msgs/PointField.h create mode 100644 src/APIs/c_api/include/sensor_msgs/Range.h create mode 100644 src/APIs/c_api/include/sensor_msgs/RegionOfInterest.h create mode 100644 src/APIs/c_api/include/sensor_msgs/RelativeHumidity.h create mode 100644 src/APIs/c_api/include/sensor_msgs/Temperature.h create mode 100644 src/APIs/c_api/include/sensor_msgs/TimeReference.h create mode 100644 src/APIs/c_api/include/std_msgs/Bool.h create mode 100644 src/APIs/c_api/include/std_msgs/Byte.h create mode 100644 src/APIs/c_api/include/std_msgs/ByteMultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/Char.h create mode 100644 src/APIs/c_api/include/std_msgs/ColorRGBA.h create mode 100644 src/APIs/c_api/include/std_msgs/Duration.h create mode 100644 src/APIs/c_api/include/std_msgs/Empty.h create mode 100644 src/APIs/c_api/include/std_msgs/Float32.h create mode 100644 src/APIs/c_api/include/std_msgs/Float32MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/Float64.h create mode 100644 src/APIs/c_api/include/std_msgs/Float64MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/Header.h create mode 100644 src/APIs/c_api/include/std_msgs/Int16.h create mode 100644 src/APIs/c_api/include/std_msgs/Int16MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/Int32.h create mode 100644 src/APIs/c_api/include/std_msgs/Int32MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/Int64.h create mode 100644 src/APIs/c_api/include/std_msgs/Int64MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/Int8.h create mode 100644 src/APIs/c_api/include/std_msgs/Int8MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/MultiArrayDimension.h create mode 100644 src/APIs/c_api/include/std_msgs/MultiArrayLayout.h create mode 100644 src/APIs/c_api/include/std_msgs/String.h create mode 100644 src/APIs/c_api/include/std_msgs/Time.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt16.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt16MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt32.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt32MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt64.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt64MultiArray.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt8.h create mode 100644 src/APIs/c_api/include/std_msgs/UInt8MultiArray.h create mode 100644 src/APIs/c_api/nav-c-api-2-csharp-integration-report.md create mode 100644 src/APIs/c_api/src/convertor.cpp create mode 100644 src/APIs/c_api/src/convertor_2.cpp create mode 100644 src/APIs/c_api/src/nav_c_api.cpp create mode 100644 src/APIs/c_api/src/nav_c_api_2.cpp create mode 100644 src/APIs/c_api/src/std_msgs/Header.cpp create mode 100644 src/APIs/c_api/src/std_msgs/Time.cpp create mode 100644 src/APIs/c_api/test/test_convertor.cpp create mode 100644 src/Algorithms/Cores/score_algorithm/CMakeLists.txt create mode 100644 src/Algorithms/Cores/score_algorithm/README.md create mode 100755 src/Algorithms/Cores/score_algorithm/include/score_algorithm/goal_checker.h create mode 100755 src/Algorithms/Cores/score_algorithm/include/score_algorithm/score_algorithm.h create mode 100755 src/Algorithms/Cores/score_algorithm/include/score_algorithm/trajectory_generator.h create mode 100644 src/Algorithms/Cores/score_algorithm/package.xml create mode 100644 src/Algorithms/Cores/score_algorithm/src/score_algorithm.cpp create mode 100644 src/Algorithms/Libraries/angles/CMakeLists.txt create mode 100644 src/Algorithms/Libraries/angles/include/angles/angles.h create mode 100644 src/Algorithms/Libraries/angles/package.xml create mode 100755 src/Algorithms/Libraries/kalman/CMakeLists.txt create mode 100755 src/Algorithms/Libraries/kalman/README.md create mode 100755 src/Algorithms/Libraries/kalman/include/kalman/kalman.h create mode 100644 src/Algorithms/Libraries/kalman/package.xml create mode 100755 src/Algorithms/Libraries/kalman/src/kalman-test.cpp create mode 100755 src/Algorithms/Libraries/kalman/src/kalman.cpp create mode 100644 src/Algorithms/Libraries/mkt_algorithm/CMakeLists.txt create mode 100644 src/Algorithms/Libraries/mkt_algorithm/README.md create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/bicycle.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/equation_line.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/go_straight.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/goal_checker.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/pta.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/rotate_to_goal.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_go_straight.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_predictive_trajectory.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_rotate_to_goal.h create mode 100644 src/Algorithms/Libraries/mkt_algorithm/package.xml create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycel_go_straight.cpp create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_pure_pursuit.cpp create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_rotate_to_goal.cpp create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/diff/Hermite.md create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/diff/Hermite.pdf create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_go_straight.cpp create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_predictive_trajectory.cpp create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_rotate_to_goal.cpp create mode 100644 src/Algorithms/Libraries/mkt_algorithm/src/diff/hermite_trajectory.svg create mode 100644 src/Algorithms/Libraries/mkt_msgs/CMakeLists.txt create mode 100644 src/Algorithms/Libraries/mkt_msgs/include/mkt_msgs/Trajectory2D.h create mode 100644 src/Algorithms/Libraries/mkt_msgs/package.xml create mode 100644 src/Algorithms/Libraries/mkt_plugins/CMakeLists.txt create mode 100644 src/Algorithms/Libraries/mkt_plugins/doc/VelocitySpace.png create mode 100644 src/Algorithms/Libraries/mkt_plugins/doc/lim_pv.png create mode 100644 src/Algorithms/Libraries/mkt_plugins/doc/std_pv.png create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/equation_line.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/goal_checker.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/kinematic_parameters.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/limited_accel_generator.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/one_d_velocity_iterator.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/simple_goal_checker.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/standard_traj_generator.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/velocity_iterator.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/xy_theta_iterator.h create mode 100644 src/Algorithms/Libraries/mkt_plugins/package.xml create mode 100644 src/Algorithms/Libraries/mkt_plugins/src/equation_line.cpp create mode 100644 src/Algorithms/Libraries/mkt_plugins/src/goal_checker.cpp create mode 100644 src/Algorithms/Libraries/mkt_plugins/src/kinematic_parameters.cpp create mode 100644 src/Algorithms/Libraries/mkt_plugins/src/limited_accel_generator.cpp create mode 100644 src/Algorithms/Libraries/mkt_plugins/src/simple_goal_checker.cpp create mode 100644 src/Algorithms/Libraries/mkt_plugins/src/standard_traj_generator.cpp create mode 100644 src/Algorithms/Libraries/mkt_plugins/src/xy_theta_iterator.cpp create mode 160000 src/Algorithms/Packages/actions/dock_pattern_action create mode 160000 src/Algorithms/Packages/global_planners/custom_planner create mode 160000 src/Algorithms/Packages/global_planners/dock_planner create mode 160000 src/Algorithms/Packages/global_planners/sbpl_lattice_planner create mode 100755 src/Algorithms/Packages/global_planners/two_points_planner/CMakeLists.txt create mode 100755 src/Algorithms/Packages/global_planners/two_points_planner/include/two_points_planner/two_points_planner.h create mode 100644 src/Algorithms/Packages/global_planners/two_points_planner/package.xml create mode 100755 src/Algorithms/Packages/global_planners/two_points_planner/src/two_points_planner.cpp create mode 160000 src/Algorithms/Packages/local_planners/hybrid_local_planner create mode 160000 src/Algorithms/Packages/local_planners/mppi_local_planner create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/CMakeLists.txt create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_docking_local_planner.h create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_go_straight_local_planner.h create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_local_planner.h create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_rotate_local_planner.h create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/transforms.h create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/package.xml create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_docking_local_planner.cpp create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_go_straight_local_planner.cpp create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_local_planner.cpp create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_rotate_local_planner.cpp create mode 100644 src/Algorithms/Packages/local_planners/pnkx_local_planner/src/transforms.cpp create mode 160000 src/Algorithms/Packages/local_planners/priest_local_planner create mode 160000 src/Algorithms/Packages/recoveries/sbpl_recovery create mode 160000 src/Libraries/action_core create mode 160000 src/Libraries/angles create mode 160000 src/Libraries/common_msgs create mode 160000 src/Libraries/costmap_2d create mode 160000 src/Libraries/data_convert create mode 160000 src/Libraries/depth_image_proc create mode 160000 src/Libraries/dock_pattern_detector create mode 160000 src/Libraries/geometry2 create mode 160000 src/Libraries/grid_map_core create mode 160000 src/Libraries/image_geometry create mode 160000 src/Libraries/laser_filter create mode 160000 src/Libraries/laser_geometry create mode 160000 src/Libraries/mission_adapters create mode 160000 src/Libraries/recovery_core create mode 100644 src/Libraries/robot_cpp/CMakeLists.txt create mode 100644 src/Libraries/robot_cpp/INIT_USAGE.md create mode 100644 src/Libraries/robot_cpp/LICENSE create mode 100644 src/Libraries/robot_cpp/PLUGIN_LOADER_README.md create mode 100644 src/Libraries/robot_cpp/README.md create mode 100644 src/Libraries/robot_cpp/include/robot/console.h create mode 100644 src/Libraries/robot_cpp/include/robot/init.h create mode 100644 src/Libraries/robot_cpp/include/robot/node_handle.h create mode 100644 src/Libraries/robot_cpp/include/robot/plugin_loader_helper.h create mode 100644 src/Libraries/robot_cpp/include/robot/robot.h create mode 100644 src/Libraries/robot_cpp/package.xml create mode 100644 src/Libraries/robot_cpp/robot_cppConfig.cmake.in create mode 100644 src/Libraries/robot_cpp/src/console.cpp create mode 100644 src/Libraries/robot_cpp/src/init.cpp create mode 100644 src/Libraries/robot_cpp/src/node_handle.cpp create mode 100644 src/Libraries/robot_cpp/src/plugin_loader_helper.cpp create mode 100644 src/Libraries/robot_cpp/test/test_node_handle.cpp create mode 160000 src/Libraries/robot_line_extraction create mode 100755 src/Libraries/robot_nav_2d_msgs/CMakeLists.txt create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/ComplexPolygon2D.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridInfo.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfChars.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfCharsUpdate.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoubles.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoublesUpdate.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Path2D.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Point2D.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2D.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DCollection.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DStamped.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2D32.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2DStamped.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPlugin.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginRequest.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginResponse.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D32.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2DStamped.h create mode 100644 src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/UIntBounds.h create mode 100755 src/Libraries/robot_nav_2d_msgs/package.xml create mode 100755 src/Libraries/robot_nav_2d_utils/CMakeLists.txt create mode 100755 src/Libraries/robot_nav_2d_utils/README.md create mode 100755 src/Libraries/robot_nav_2d_utils/doc/Conversions.md create mode 100755 src/Libraries/robot_nav_2d_utils/doc/PluginMux.md create mode 100755 src/Libraries/robot_nav_2d_utils/doc/PolygonsAndFootprints.md create mode 100755 src/Libraries/robot_nav_2d_utils/include/mapbox/LICENSE create mode 100755 src/Libraries/robot_nav_2d_utils/include/mapbox/NOTES create mode 100755 src/Libraries/robot_nav_2d_utils/include/mapbox/earcut.hpp create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/bounds.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/conversions.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/footprint.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/geometry_help.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/odom_subscriber.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/parameters.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/path_ops.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/plugin_mux.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/polygons.h create mode 100755 src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/tf_help.h create mode 100755 src/Libraries/robot_nav_2d_utils/package.xml create mode 100755 src/Libraries/robot_nav_2d_utils/setup.py create mode 100755 src/Libraries/robot_nav_2d_utils/src/bounds.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/src/conversions.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/src/footprint.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/src/path_ops.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/src/polygons.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/src/tf_help.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/test/bounds_test.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/test/compress_test.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/test/param_tests.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/test/param_tests.launch create mode 100755 src/Libraries/robot_nav_2d_utils/test/polygon_tests.cpp create mode 100755 src/Libraries/robot_nav_2d_utils/test/resolution_test.cpp create mode 160000 src/Libraries/robot_sensor_ports create mode 160000 src/Libraries/robot_time create mode 160000 src/Libraries/sbpl create mode 160000 src/Libraries/voxel_grid create mode 160000 src/Libraries/xmlrpcpp create mode 100755 src/Navigations/Cores/move_base_core/.gitignore create mode 100644 src/Navigations/Cores/move_base_core/CMakeLists.txt create mode 100755 src/Navigations/Cores/move_base_core/README.md create mode 100644 src/Navigations/Cores/move_base_core/include/move_base_core/common.h create mode 100755 src/Navigations/Cores/move_base_core/include/move_base_core/navigation.h create mode 100644 src/Navigations/Cores/move_base_core/package.xml create mode 100755 src/Navigations/Cores/robot_nav_core/CHANGELOG.rst create mode 100644 src/Navigations/Cores/robot_nav_core/CMakeLists.txt create mode 100755 src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_global_planner.h create mode 100755 src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_local_planner.h create mode 100755 src/Navigations/Cores/robot_nav_core/include/robot_nav_core/parameter_magic.h create mode 100755 src/Navigations/Cores/robot_nav_core/include/robot_nav_core/recovery_behavior.h create mode 100644 src/Navigations/Cores/robot_nav_core/package.xml create mode 100755 src/Navigations/Cores/robot_nav_core2/CMakeLists.txt create mode 100755 src/Navigations/Cores/robot_nav_core2/README.md create mode 100755 src/Navigations/Cores/robot_nav_core2/doc/exceptions.png create mode 100755 src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/basic_costmap.h create mode 100755 src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/bounds.h create mode 100755 src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/common.h create mode 100755 src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/costmap.h create mode 100755 src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/exceptions.h create mode 100755 src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/global_planner.h create mode 100755 src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/local_planner.h create mode 100644 src/Navigations/Cores/robot_nav_core2/package.xml create mode 100755 src/Navigations/Cores/robot_nav_core2/src/basic_costmap.cpp create mode 100755 src/Navigations/Cores/robot_nav_core2/test/bounds_test.cpp create mode 100755 src/Navigations/Cores/robot_nav_core2/test/exception_test.cpp create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/CMakeLists.txt create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/README.md create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/cfg/NavCoreAdapter.cfg create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/costmap_adapter.h create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/global_planner_adapter.h create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/local_planner_adapter.h create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/shared_pointers.h create mode 100644 src/Navigations/Cores/robot_nav_core_adapter/package.xml create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/src/costmap_adapter.cpp create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/src/global_planner_adapter.cpp create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/src/local_planner_adapter.cpp create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.cpp create mode 100755 src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.launch create mode 100755 src/Navigations/Libraries/nav_grid/CMakeLists.txt create mode 100755 src/Navigations/Libraries/nav_grid/README.md create mode 100755 src/Navigations/Libraries/nav_grid/doc/change_info.png create mode 100755 src/Navigations/Libraries/nav_grid/doc/coords.png create mode 100755 src/Navigations/Libraries/nav_grid/doc/nav_grid.png create mode 100755 src/Navigations/Libraries/nav_grid/include/nav_grid/coordinate_conversion.h create mode 100755 src/Navigations/Libraries/nav_grid/include/nav_grid/index.h create mode 100755 src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid.h create mode 100755 src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid_info.h create mode 100755 src/Navigations/Libraries/nav_grid/include/nav_grid/vector_nav_grid.h create mode 100644 src/Navigations/Libraries/nav_grid/package.xml create mode 100755 src/Navigations/Libraries/nav_grid/test/utest.cpp create mode 100644 src/Navigations/Libraries/robot_actionlib_msgs/CMakeLists.txt create mode 100644 src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalID.h create mode 100644 src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatus.h create mode 100644 src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatusArray.h create mode 100644 src/Navigations/Libraries/robot_actionlib_msgs/package.xml create mode 100644 src/Navigations/Libraries/robot_clear_costmap_recovery/CMakeLists.txt create mode 100755 src/Navigations/Libraries/robot_clear_costmap_recovery/include/robot_clear_costmap_recovery/clear_costmap_recovery.h create mode 100644 src/Navigations/Libraries/robot_clear_costmap_recovery/package.xml create mode 100755 src/Navigations/Libraries/robot_clear_costmap_recovery/src/clear_costmap_recovery.cpp create mode 100755 src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tester.cpp create mode 100755 src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tests.launch create mode 100755 src/Navigations/Libraries/robot_clear_costmap_recovery/test/params.yaml create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/CMakeLists.txt create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseAction.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionFeedback.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionGoal.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionResult.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseFeedback.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseGoal.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseResult.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/RecoveryStatus.h create mode 100644 src/Navigations/Libraries/robot_move_base_msgs/package.xml create mode 160000 src/Navigations/Packages/move_base2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3975074 --- /dev/null +++ b/.gitignore @@ -0,0 +1,442 @@ +# ---> VisualStudio +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* + +# --- `Packages/` trong cây nguồn KHÔNG phải thư mục NuGet ---------------------------------------- +# +# Luật ngay trên đến từ mẫu .gitignore của Visual Studio và nhắm vào thư mục `packages/` do NuGet +# sinh ra. Trong repo này `Packages/` là thư mục NGUỒN, nên luật đó giấu nguyên cả gói khỏi +# `git status` — và một gói thiếu trở thành VÔ HÌNH với đúng cái lệnh người ta dùng để tìm nó. +# +# Đã mất gói thật vì chuyện này: `move_base2`, `dock_pattern_action` và `sbpl_recovery` đều không +# vào được submodule, và `sbpl_recovery` chỉ lộ ra khi duyệt cây tìm thư mục `.git` rồi đối chiếu +# với `.gitmodules`. Bản clone trên robot khi đó thiếu hẳn gói mà không có một dấu hiệu nào. +# +# Mở lại TOÀN BỘ cây nguồn thay vì liệt kê từng đường dẫn: liệt kê từng cái nghĩa là mỗi gói mới +# lại phải nhớ thêm một dòng, và quên một lần là hỏng trong im lặng — đúng cái đã xảy ra. +# +# Đặt ở ĐÂY chứ không phải cuối file là có chủ đích: các luật lọc build artifact (`build/`, `*.o`, +# `devel/`…) nằm phía dưới nên vẫn thắng, tức rác build bên trong gói vẫn bị bỏ qua như thường. +!src/*/Packages/ +!src/*/Packages/** +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# except move_base package in Navigations +!src/Navigations/Packages/move_base/ +# except packages in Algorithms +!src/Algorithms/Packages/ +!src/Algorithms/Packages/global_planners/ +!src/Algorithms/Packages/local_planners/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +# ---> VisualStudioCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +build +install +devel + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7536352 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,87 @@ +[submodule "src/Libraries/common_msgs"] + path = src/Libraries/common_msgs + url = https://git.pnkr.asia/DuongTD/common_msgs.git +[submodule "src/Libraries/costmap_2d"] + path = src/Libraries/costmap_2d + url = https://git.pnkr.asia/DuongTD/costmap_2d.git +[submodule "src/Libraries/geometry2"] + path = src/Libraries/geometry2 + url = https://git.pnkr.asia/DuongTD/geometry2.git +[submodule "src/Libraries/laser_geometry"] + path = src/Libraries/laser_geometry + url = https://git.pnkr.asia/DuongTD/laser_geometry.git +[submodule "src/Libraries/robot_time"] + path = src/Libraries/robot_time + url = https://git.pnkr.asia/DuongTD/robot_time.git +[submodule "src/Libraries/voxel_grid"] + path = src/Libraries/voxel_grid + url = https://git.pnkr.asia/DuongTD/voxel_grid.git +[submodule "src/Libraries/data_convert"] + path = src/Libraries/data_convert + url = https://git.pnkr.asia/DuongTD/data_convert.git +[submodule "src/Algorithms/Packages/global_planners/custom_planner"] + path = src/Algorithms/Packages/global_planners/custom_planner + url = https://git.pnkr.asia/DuongTD/custom_planner.git +[submodule "src/Algorithms/Packages/global_planners/dock_planner"] + path = src/Algorithms/Packages/global_planners/dock_planner + url = https://git.pnkr.asia/DuongTD/dock_planner.git +[submodule "src/Libraries/xmlrpcpp"] + path = src/Libraries/xmlrpcpp + url = https://git.pnkr.asia/DuongTD/xmlrpcpp.git +[submodule "src/Libraries/laser_filter"] + path = src/Libraries/laser_filter + url = https://git.pnkr.asia/DuongTD/laser_filter.git +[submodule "src/Navigations/Packages/move_base2"] + path = src/Navigations/Packages/move_base2 + url = https://git.pnkr.asia/DuongTD/move_base2.git +[submodule "src/Algorithms/Packages/actions/dock_pattern_action"] + path = src/Algorithms/Packages/actions/dock_pattern_action + url = https://git.pnkr.asia/DuongTD/dock_pattern_action.git +[submodule "src/Algorithms/Packages/global_planners/sbpl_lattice_planner"] + path = src/Algorithms/Packages/global_planners/sbpl_lattice_planner + url = https://git.pnkr.asia/DuongTD/sbpl_lattice_planner.git +[submodule "src/Algorithms/Packages/local_planners/hybrid_local_planner"] + path = src/Algorithms/Packages/local_planners/hybrid_local_planner + url = https://git.pnkr.asia/DuongTD/hybrid_local_planner.git +[submodule "src/Algorithms/Packages/local_planners/mppi_local_planner"] + path = src/Algorithms/Packages/local_planners/mppi_local_planner + url = https://git.pnkr.asia/DuongTD/mppi_local_planner.git +[submodule "src/Algorithms/Packages/local_planners/priest_local_planner"] + path = src/Algorithms/Packages/local_planners/priest_local_planner + url = https://git.pnkr.asia/DuongTD/priest_local_planner.git +[submodule "src/Libraries/action_core"] + path = src/Libraries/action_core + url = https://git.pnkr.asia/DuongTD/action_core.git +[submodule "src/Libraries/angles"] + path = src/Libraries/angles + url = https://git.pnkr.asia/DuongTD/angles.git +[submodule "src/Libraries/depth_image_proc"] + path = src/Libraries/depth_image_proc + url = https://git.pnkr.asia/DuongTD/depth_image_proc.git +[submodule "src/Libraries/dock_pattern_detector"] + path = src/Libraries/dock_pattern_detector + url = https://git.pnkr.asia/DuongTD/dock_pattern_detector.git +[submodule "src/Libraries/mission_adapters"] + path = src/Libraries/mission_adapters + url = https://git.pnkr.asia/DuongTD/mission_adapters.git +[submodule "src/Libraries/recovery_core"] + path = src/Libraries/recovery_core + url = https://git.pnkr.asia/DuongTD/recovery_core.git +[submodule "src/Libraries/robot_line_extraction"] + path = src/Libraries/robot_line_extraction + url = https://git.pnkr.asia/DuongTD/robot_line_extraction.git +[submodule "src/Libraries/robot_sensor_ports"] + path = src/Libraries/robot_sensor_ports + url = https://git.pnkr.asia/DuongTD/robot_sensor_ports.git +[submodule "src/Libraries/sbpl"] + path = src/Libraries/sbpl + url = https://git.pnkr.asia/DuongTD/sbpl.git +[submodule "src/Algorithms/Packages/recoveries/sbpl_recovery"] + path = src/Algorithms/Packages/recoveries/sbpl_recovery + url = https://git.pnkr.asia/DuongTD/sbpl_recovery.git +[submodule "src/Libraries/image_geometry"] + path = src/Libraries/image_geometry + url = https://git.pnkr.asia/DuongTD/image_geometry.git +[submodule "src/Libraries/grid_map_core"] + path = src/Libraries/grid_map_core + url = https://git.pnkr.asia/DuongTD/grid_map_core.git diff --git a/CATKIN_BUILD_README.md b/CATKIN_BUILD_README.md new file mode 100644 index 0000000..6add951 --- /dev/null +++ b/CATKIN_BUILD_README.md @@ -0,0 +1,63 @@ +# Catkin Build Instructions + +## Vấn đề + +Thư mục này có `CMakeLists.txt` ở root để hỗ trợ **standalone CMake build**. +Tuy nhiên, **catkin workspace không được phép có CMakeLists.txt ở root**. + +Khi chạy `catkin_make` trong thư mục này, bạn sẽ gặp lỗi: +``` +The specified base path contains a CMakeLists.txt but "catkin_make" must be invoked in the root of workspace +``` + +## Giải pháp + +### Option 1: Sử dụng script tự động (Khuyến nghị) + +```bash +# Chạy script setup +./setup_catkin_workspace.sh + +# Build trong workspace mới +cd ../pnkx_nav_catkin_ws +rm -rf build devel +catkin_make -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer" \ + -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer" \ + -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" +source devel/setup.bash +``` + +### Option 2: Tạo workspace thủ công + +```bash +# Tạo workspace +mkdir -p ~/pnkx_nav_catkin_ws/src +cd ~/pnkx_nav_catkin_ws/src + +# Link các packages có package.xml +ln -s /path/to/pnkx_nav_core/src/Navigations/Packages/move_base move_base +# ... link các packages khác nếu cần + +# Build +cd ~/pnkx_nav_catkin_ws +catkin_make +``` + +## Build Systems + +Project này hỗ trợ **2 build systems**: + +1. **Standalone CMake** (mặc định) + - Build trực tiếp trong thư mục này: `mkdir build && cd build && cmake .. && make` + - Không cần catkin workspace + +2. **Catkin** (cho ROS integration) + - Cần tạo workspace riêng (xem hướng dẫn trên) + - Packages tự động detect catkin mode khi build trong workspace + +## Chi tiết + +Xem `src/Navigations/Packages/move_base/BUILD_INSTRUCTIONS.md` để biết chi tiết về cách build package `move_base` với cả hai hệ thống. + + diff --git a/CMAKE_BUILD_README.md b/CMAKE_BUILD_README.md new file mode 100644 index 0000000..4361fd5 --- /dev/null +++ b/CMAKE_BUILD_README.md @@ -0,0 +1,402 @@ +# Hướng dẫn Build bằng CMake + +Hướng dẫn chi tiết để build project `pnkx_nav_core` sử dụng CMake standalone (không cần Catkin workspace). + +## Mục lục + +1. [Yêu cầu hệ thống](#yêu-cầu-hệ-thống) +2. [Cài đặt Dependencies](#cài-đặt-dependencies) +3. [Build Project](#build-project) +4. [Các tùy chọn Build](#các-tùy-chọn-build) +5. [Install](#install) +6. [Sử dụng trong project khác](#sử-dụng-trong-project-khác) +7. [Troubleshooting](#troubleshooting) + +--- + +## Yêu cầu hệ thống + +### Hệ điều hành +- Linux (Ubuntu 18.04+ hoặc tương đương) +### Compiler +- **GCC**: phiên bản 7.0 trở lên (hỗ trợ C++17) +- **Clang**: phiên bản 5.0 trở lên + +### CMake +- **CMake**: phiên bản 3.10 trở lên + +Kiểm tra phiên bản: +```bash +cmake --version +g++ --version +``` + +--- + +## Cài đặt Dependencies + +### Linux (Ubuntu/Debian) + +```bash +# Cập nhật package list +sudo apt-get update + +# Cài đặt CMake và build tools +sudo apt-get install -y cmake build-essential + +# Cài đặt các thư viện cần thiết +sudo apt-get install -y \ + libboost-all-dev \ + libeigen3-dev \ + libyaml-cpp-dev \ + libpcl-dev \ + libgoogle-glog-dev +sudo apt install liborocos-kdl-dev + +# Optional: Cài đặt Google Test (nếu muốn build tests) +sudo apt-get install -y libgtest-dev +``` + +**Lưu ý:** Hướng dẫn này dành cho hệ thống Linux. Nếu sử dụng các distro khác (CentOS, Fedora, Arch, etc.), vui lòng cài đặt các packages tương ứng bằng package manager của distro đó. + +--- + +## Build Project + +### Bước 1: Clone repository + +```bash +git clone https://git.pnkr.asia/HiepLM/pnkx_nav_core.git +cd pnkx_nav_core +git submodule init +git submodule update +``` + +### Bước 2: Tạo thư mục build + +```bash +mkdir build +cd build +``` + +### Bước 3: Cấu hình với CMake + +```bash +# Cấu hình cơ bản (Release mode) +cmake .. + +# Hoặc chỉ định build type rõ ràng +cmake -DCMAKE_BUILD_TYPE=Release .. + +# Hoặc Debug mode (để debug) +cmake -DCMAKE_BUILD_TYPE=Debug .. +``` + +### Bước 4: Build + +```bash +# Build tất cả targets +make + +# Hoặc build với nhiều cores (nhanh hơn) +make -j$(nproc) +``` + +### Bước 5: Kiểm tra build thành công + +```bash +# Kiểm tra các thư viện đã được build +ls -la lib/ + +# Kiểm tra các executable (nếu có) +ls -la bin/ +``` + +--- + +## Các tùy chọn Build + +### Build Type + +```bash +# Release mode (mặc định) - tối ưu hóa +cmake -DCMAKE_BUILD_TYPE=Release .. + +# Debug mode - với debug symbols +cmake -DCMAKE_BUILD_TYPE=Debug .. + +# RelWithDebInfo - Release với debug info +cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. + +# MinSizeRel - Tối ưu kích thước +cmake -DCMAKE_BUILD_TYPE=MinSizeRel .. +``` + +### Build chỉ một target cụ thể + +```bash +# Build chỉ một library +make robot_cpp_node_handle + +# Build chỉ move_base +make move_base + +# Build chỉ C API +make navigation_c_api +``` + +### Các tùy chọn CMake khác + +```bash +# Tắt warnings (đã được cấu hình sẵn trong CMakeLists.txt) +cmake -DCMAKE_CXX_FLAGS="-w" .. + +# Chỉ định compiler +cmake -DCMAKE_CXX_COMPILER=g++-9 .. + +# Chỉ định install prefix +cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. + +# Build tests (nếu có) +cmake -DBUILD_TESTS=ON .. +``` + +--- + +## Install + +Sau khi build thành công, bạn có thể install các thư viện và headers vào hệ thống: + +```bash +# Install vào thư mục mặc định (/usr/local) +sudo make install + +# Hoặc install vào thư mục tùy chỉnh +cmake -DCMAKE_INSTALL_PREFIX=/opt/pnkx_nav_core .. +make install +``` + +Cấu trúc sau khi install: +``` +/usr/local/ +├── include/ +│ ├── robot/ +│ ├── nav_core2/ +│ ├── mkt_algorithm/ +│ └── ... +├── lib/ +│ ├── librobot_cpp_node_handle.so +│ ├── libmove_base.so +│ └── ... +└── lib/cmake/ + ├── robot_cpp/ + ├── move_base/ + └── ... +``` + +--- + +## Sử dụng trong project khác + +### Sử dụng với CMake + +Sau khi install, bạn có thể sử dụng trong CMakeLists.txt của project khác: + +```cmake +cmake_minimum_required(VERSION 3.10) +project(my_project) + +# Tìm các packages +find_package(robot_cpp REQUIRED) +find_package(move_base REQUIRED) +find_package(navigation_c_api REQUIRED) + +# Link libraries +add_executable(my_app main.cpp) +target_link_libraries(my_app + PRIVATE + robot_cpp + move_base + navigation_c_api +) +``` + +### Sử dụng C API (cho .NET/C#) + +Xem hướng dẫn chi tiết trong `examples/README.md` và `examples/QUICK_START.md`. + +Tóm tắt: +```bash +# Copy shared library +cp build/src/APIs/c_api/libnavigation_c_api.so /path/to/your/project/ + +# Sử dụng trong C# +[DllImport("libnavigation_c_api.so")] +public static extern IntPtr create_navigation(); +``` + +--- + +## Troubleshooting + +### Lỗi: "Could not find Boost" + +```bash +# Kiểm tra Boost đã được cài đặt +dpkg -l | grep libboost + +# Cài đặt lại nếu thiếu +sudo apt-get install libboost-all-dev +``` + +### Lỗi: "Could not find Eigen3" + +```bash +# Cài đặt Eigen3 +sudo apt-get install libeigen3-dev + +# Hoặc chỉ định đường dẫn +cmake -DEigen3_DIR=/usr/include/eigen3 .. +``` + +### Lỗi: "Could not find yaml-cpp" + +```bash +# Cài đặt yaml-cpp +sudo apt-get install libyaml-cpp-dev +``` + +### Lỗi: "undefined reference" + +Đảm bảo tất cả dependencies đã được build theo đúng thứ tự: +1. Core libraries (tf3, robot_time, xmlrpcpp, robot_cpp) +2. Geometry và messages (geometry2, common_msgs) +3. Navigation cores (nav_core, nav_core2) +4. Algorithms (score_algorithm, mkt_algorithm) +5. Main packages (move_base) + +Build lại từ đầu: +```bash +cd build +rm -rf * +cmake .. +make -j$(nproc) +``` + +### Lỗi: "Permission denied" khi install + +```bash +# Sử dụng sudo cho system-wide install +sudo make install + +# Hoặc install vào user directory +cmake -DCMAKE_INSTALL_PREFIX=$HOME/local .. +make install +``` + +### Build chậm + +```bash +# Sử dụng nhiều cores +make -j$(nproc) + +# Chỉ build target cần thiết +make robot_cpp_node_handle # Thay vì make all +``` + +### Clean build + +```bash +# Xóa toàn bộ build directory +cd build +rm -rf * + +# Hoặc xóa chỉ các file object +make clean +``` + +--- + +## Cấu trúc Build Output + +Sau khi build, cấu trúc thư mục `build/` sẽ như sau: + +``` +build/ +├── CMakeCache.txt +├── CMakeFiles/ +├── cmake_install.cmake +├── Makefile +├── lib/ +│ ├── librobot_cpp_console.so +│ ├── librobot_cpp_node_handle.so +│ ├── libmove_base.so +│ ├── libnavigation_c_api.so +│ └── ... +├── src/ +│ ├── Libraries/ +│ │ ├── robot_cpp/ +│ │ └── ... +│ ├── Navigations/ +│ │ └── ... +│ └── Algorithms/ +│ └── ... +└── bin/ # (nếu có executables) +``` + +--- + +## Environment Variables + +Một số biến môi trường hữu ích: + +```bash +# Chỉ định config directory cho NodeHandle +export PNKX_NAV_CORE_CONFIG_DIR=/path/to/config + +# Chỉ định workspace directory +export PNKX_NAV_CORE_DIR=/path/to/pnkx_nav_core + +# LD_LIBRARY_PATH (nếu không install) +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/pnkx_nav_core/build/lib +``` + +--- + +## Quick Reference + +### Build nhanh (một lệnh) + +```bash +mkdir -p build && cd build && cmake .. && make -j$(nproc) +``` + +### Build và Install + +```bash +mkdir -p build && cd build && cmake .. && make -j$(nproc) && sudo make install +``` + +### Rebuild từ đầu + +```bash +rm -rf build && mkdir build && cd build && cmake .. && make -j$(nproc) +``` + +--- + +## Liên kết hữu ích + +- [CMake Documentation](https://cmake.org/documentation/) +- [C++17 Reference](https://en.cppreference.com/w/cpp/17) +- [Examples](./examples/README.md) +- [Catkin Build Guide](./CATKIN_BUILD_README.md) + +--- + +## Ghi chú + +- Project này sử dụng **C++17** standard +- Warnings đã được tắt trong build configuration (`-w` flag) +- Tất cả libraries được build dưới dạng **shared libraries** (.so) +- Build type mặc định là **Release** với optimization `-O3` diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..eb3adbb --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,273 @@ +# ======================================================== +# ROOT CMakeLists.txt +# Đặt ở: Navigations/CMakeLists.txt +# ======================================================== +cmake_minimum_required(VERSION 3.0.2) +project(navigations VERSION 1.0.0 LANGUAGES CXX) + +# Chuẩn C++ +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Build type +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# Flags chung +# Warning flags - disabled to suppress warnings during build +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") # -w suppresses all warnings +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") + +message(STATUS "========================================") +message(STATUS "Building Navigations Project") +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") +message(STATUS "========================================") + +# Build các packages theo thứ tự phụ thuộc +# 1. Core libraries (header-only hoặc base libraries) + +if (NOT TARGET robot_time) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/robot_time) +endif() + +if (NOT TARGET xmlrpcpp) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/xmlrpcpp) +endif() + +if (NOT TARGET robot_cpp) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/robot_cpp) +endif() + +if (NOT TARGET data_convert) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/data_convert) +endif() + +if (NOT TARGET geometry2) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/geometry2) +endif() + +if (NOT TARGET common_msgs) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/common_msgs) +endif() + +if (NOT TARGET laser_geometry) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/laser_geometry) +endif() + +if (NOT TARGET voxel_grid) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/voxel_grid) +endif() + +if (NOT TARGET robot_nav_2d_msgs) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/robot_nav_2d_msgs) +endif() + +if (NOT TARGET costmap_2d) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/costmap_2d) +endif() + +if (NOT TARGET robot_nav_2d_utils) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/robot_nav_2d_utils) +endif() + +if (NOT TARGET laser_filter) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/laser_filter) +endif() + +# Port của ROS `angles`. KHÔNG phải gói `angles` ở src/Algorithms/Libraries — đó là package khác, +# target tên `angles`, và cả hai cùng có mặt trong cây. Project lẫn target của gói này đều tên +# `robot_angles_prv`, nên guard phải kiểm ĐÚNG tên đó: kiểm `angles` sẽ trúng gói kia và gói này +# lặng lẽ không bao giờ được add. +if (NOT TARGET robot_angles_prv) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/angles) +endif() + +# Lõi hình học thuần, không phụ thuộc gói nào trong cây ngoài robot_cpp. Đặt sớm vì +# dock_pattern_detector khớp đường tròn trên chính đoạn thẳng mà gói này trích ra. +if (NOT TARGET robot_line_extraction) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/robot_line_extraction) +endif() + +if (NOT TARGET dock_pattern_detector) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/dock_pattern_detector) +endif() + +# Lõi grid map. hybrid_local_planner link thẳng vào `robot_grid_map_core`, nên nó phải có trước. +# Project và target đều tên `robot_grid_map_core`, không phải `grid_map_core`. +if (NOT TARGET robot_grid_map_core) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/grid_map_core) +endif() + +# Port của ROS `image_geometry`. Project và target đều tên `robot_image_geometry`, không phải +# `image_geometry` — guard phải kiểm đúng tên đó. +if (NOT TARGET robot_image_geometry) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/image_geometry) +endif() + +# Phải đứng SAU robot_image_geometry: nhánh standalone của nó link thẳng vào target đó. +if (NOT TARGET robot_depth_image_proc) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/depth_image_proc) +endif() + +# Kho cảm biến thô dùng chung. move_base2 ĐẨY vào đây từ bên trong addLaserScan/addPointCloud2/..., +# còn bộ dò dock và (sau này) RL planner ĐỌC ra — nên nó phải có trước cả hai. +if (NOT TARGET robot_sensor_ports) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/robot_sensor_ports) +endif() + +# Bộ giải lattice. sbpl_lattice_planner link vào nó, nên thứ tự này là ràng buộc thật. +if (NOT TARGET sbpl) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/sbpl) +endif() + +if (NOT TARGET robot_nav_core) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Cores/robot_nav_core) +endif() + +if (NOT TARGET nav_grid) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Libraries/nav_grid) +endif() + +if (NOT TARGET robot_nav_core2) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Cores/robot_nav_core2) +endif() + +if (NOT TARGET robot_nav_core_adapter) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Cores/robot_nav_core_adapter) +endif() + +if (NOT TARGET move_base_core) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Cores/move_base_core) +endif() + +if (NOT TARGET mkt_msgs) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Libraries/mkt_msgs) +endif() + +if (NOT TARGET angles) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Libraries/angles) +endif() + +if (NOT TARGET kalman) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Libraries/kalman) +endif() + +if (NOT TARGET score_algorithm) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Cores/score_algorithm) +endif() + +if (NOT TARGET mkt_plugins) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Libraries/mkt_plugins) +endif() + +if (NOT TARGET mkt_algorithm) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Libraries/mkt_algorithm) +endif() + +if (NOT TARGET two_points_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/global_planners/two_points_planner) +endif() + +if (NOT TARGET custom_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/global_planners/custom_planner) +endif() + +if (NOT TARGET dock_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/global_planners/dock_planner) +endif() + +# Phải đứng SAU `sbpl`: đây là plugin bọc bộ giải đó. +if (NOT TARGET sbpl_lattice_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/global_planners/sbpl_lattice_planner) +endif() + +if (NOT TARGET pnkx_local_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/local_planners/pnkx_local_planner) +endif() + +# Ba local planner hiện thực interface robot_nav_core2::LocalPlanner, được gọi tới qua +# LocalPlannerAdapter. Đều cần robot_nav_core2 + robot_costmap_2d đã có ở trên. +# +# ⚠ move_base_common_params.yaml đang trỏ `PriestLocalPlanner` và `HybridDockingLocalPlanner`. +# Thiếu một trong hai .so là move_base2 chết ngay ở `initialize()`. +if (NOT TARGET hybrid_local_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/local_planners/hybrid_local_planner) +endif() + +if (NOT TARGET mppi_local_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/local_planners/mppi_local_planner) +endif() + +if (NOT TARGET priest_local_planner) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/local_planners/priest_local_planner) +endif() + +if (NOT TARGET robot_actionlib_msgs) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Libraries/robot_actionlib_msgs) +endif() + +if (NOT TARGET robot_move_base_msgs) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Libraries/robot_move_base_msgs) +endif() + +if (NOT TARGET robot_clear_costmap_recovery) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Libraries/robot_clear_costmap_recovery) +endif() + +# 3. Mission / action / recovery framework, rồi navigation runtime +# +# Trước đây khối này là một shim di trú: nó đi tìm thư mục `Test/` bên cạnh (của AMR_T800) và add +# gói từ đó. Cây này đã di trú xong — mọi gói nằm in-tree dưới dạng git submodule — nên shim bị gỡ +# hẳn. Giữ lại là một quả bom hẹn giờ: `PNKX_NAV_CORE_BUILD_TEST_PACKAGES` mặc định ON, không tìm +# thấy `Test/` là FATAL_ERROR ngay lúc configure. +# +# Thứ tự dưới đây là RÀNG BUỘC THẬT, không phải phong cách. move_base2 tiêu thụ API của cả ba gói +# framework (ActionRunner <- action_core, RecoveryRunner <- recovery_core, MissionLayer <- +# mission_adapters) nên nó phải đứng cuối cùng. + +if (NOT TARGET action_core) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/action_core) +endif() + +if (NOT TARGET recovery_core) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/recovery_core) +endif() + +if (NOT TARGET mission_adapters) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Libraries/mission_adapters) +endif() + +# Guard là `move_base2_core`, không phải `move_base2`: project tên một đằng còn target thư viện tên +# một nẻo, và guard sai tên thì không bao giờ khớp — subdirectory được add hai lần khi configure +# lại, lỗi hiện ra dưới dạng "target đã tồn tại". +if (NOT TARGET move_base2_core) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Navigations/Packages/move_base2) +endif() + +# Recovery vòng đường, dựng plan tránh trên costmap gộp. Cần CẢ recovery_core (interface) lẫn +# sbpl_lattice_planner (bộ lập plan nó gọi tới). +if (NOT TARGET sbpl_recovery) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/recoveries/sbpl_recovery) +endif() + +# Bộ dò biên dạng dock từ scan LiDAR thô, nạp như một action handler. +# +# ⚠ Guard kiểm `dock_pattern_action_handler`, KHÔNG phải `dock_pattern_action`: project tên một +# đằng còn target thư viện tên một nẻo. +if (NOT TARGET dock_pattern_action_handler) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/Algorithms/Packages/actions/dock_pattern_action) +endif() + +# C API for .NET/C# integration. Target is `nav_c_api` — the guard must name the same target, +# otherwise it never matches and the subdirectory is added twice on a re-entrant configure. +if (NOT TARGET nav_c_api) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/APIs/c_api) +endif() + +message(STATUS "========================================") +message(STATUS "All packages configured successfully") +message(STATUS "========================================") diff --git a/README.md b/README.md new file mode 100644 index 0000000..f2aa7bb --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# pnkx_nav_core + +Phần mềm quản lý việc di chuyển navigation \ No newline at end of file diff --git a/config/runtime/action_handlers_params.yaml b/config/runtime/action_handlers_params.yaml new file mode 100644 index 0000000..bb0041f --- /dev/null +++ b/config/runtime/action_handlers_params.yaml @@ -0,0 +1,505 @@ +# ================================================================================================= +# action_core — action handler của move_base2. +# +# Quy ước comment: dòng mô tả = LÀ GÌ / vì sao; `► Chỉnh:` = tăng giảm theo triệu chứng nào. +# +# D8: navigation runtime chạy TRỌN một mission — đi tới đích xong thì chạy nốt action của chặng rồi +# mới báo kết quả. Trong lúc chạy action robot KHÔNG phát cmd_vel. +# +# Handler là plugin của gói `action_core`, nạp qua Boost.DLL đúng như planner/recovery. Thêm một +# loại action mới = viết một `.so` + thêm một dòng ở đây, không phải sửa dòng nào của navigation. +# +# Vì sao file này tồn tại: thiếu handler thì `ActionRunner::start` từ chối và chặng mang action đi +# thẳng tới ABORTED — tức mọi order VDA5050 có node action fail ở chặng đầu tiên. +# +# BA TẦNG TIMEOUT, đừng lẫn: +# 1. `timeout` của chính handler (trong khối handler bên dưới) — handler tự biết thiết bị của nó; +# 2. `action_patience` của state machine — lưới chung cho MỌI action, mặc định tắt; +# 3. `mission_timeout` của mission layer — lưới cho cả chặng nav + action. +# ================================================================================================= + +actions: + # Danh sách handler được nạp. + # name: tên instance = namespace param riêng bên dưới + # type: alias Boost.DLL, phải có `library_path` ở cuối file + # + # ► Chỉnh: một `type` được phép khai nhiều `name` để có nhiều instance khác tuning. Handler nào + # không khai `action_types` sẽ không bao giờ được gọi. + handlers: + # Dò: lấy mẫu frame thô của LiDAR/camera, lọc, ghi ra `dock_target` cho chặng sau tra. + # + # HAI BỘ DÒ, cùng hợp đồng đầu ra (TF tĩnh vào `output_frame`), đổi bằng cách hoán hai dòng + # dưới đây — không phải sửa gì ở move_base2, dock_planner hay mission_adapters: + # + # FrameSamplerActionHandler lấy pose perception đã tính sẵn qua TF. Trong sim nó chạy chế độ + # `use_simulated_goal: true`, tức pose BỊA — không dò gì cả. + # DockPatternActionHandler tự dò biên dạng từ scan LiDAR THÔ. Cần vật thể THẬT trong world; + # xem khối `detect_lidar` bên dưới và launch spawn_dock_plate. + - {name: detect_pallet, type: FrameSamplerActionHandler} + - {name: detect_lidar, type: DockPatternActionHandler} + + # --- detect: lấy mẫu frame đích rồi ghi ra một frame TF ổn định --------------------------------- + # + # BỐN NHÓM KHOÁ, đọc từ trên xuống: + # (1) ĐỊNH TUYẾN — action nào vào handler này, kết quả ghi ra frame nào, dò frame nào. + # (2) CHỌN CHẾ ĐỘ — hai công tắc quyết định các nhóm sau có hiệu lực hay không: + # use_simulated_goal: true -> pose BỊA cho sim; MỌI khoá nhóm (3)(4) bị bỏ qua hết. + # filter_enabled: false -> chốt ngay mẫu THỨ HAI; nhóm (4) bị bỏ qua, chỉ còn + # settle_delay + timeout của nhóm (3) có hiệu lực. + # (3) THỜI GIAN LẤY MẪU — settle/cửa sổ/nhịp mẫu/timeout. + # (4) CỔNG CHẤT LƯỢNG — độ tản, giữ trạng thái, lọc cụm chống TF nhảy. + detect_pallet: + # ---- (1) ĐỊNH TUYẾN & CONTRACT TF ---- + # actionType nào được handler này nhận. Phải khớp CHÍNH XÁC chuỗi trong order / trong + # `compound_actions_params.yaml`. + # ► Chỉnh: đây là bảng định tuyến, không phải số tinh chỉnh. Sai một chữ = action rơi vào hư + # không và chặng ABORT. + action_types: [DetectPallet] + + # Tên frame TF mà handler ghi ra; chặng docking trỏ `move_to` vào đây. + # ► Chỉnh: đổi thì phải đổi đồng bộ `move_to: dock_target` bên compound_actions_params.yaml. + output_frame: dock_target + + # Frame THÔ để lấy mẫu (do perception publish). CỐ Ý KHÔNG KHAI: mặc định là chuỗi rỗng, nghĩa + # là handler lấy frame từ `goal_frame` của chính action trong order — linh hoạt hơn, thêm một + # trạm mới không phải sửa file này. Khai chuỗi rỗng trong YAML dễ bị parse thành `null` (khác + # `""`), nên để trống hẳn thay vì khai. + # ► Chỉnh: chỉ khai khi perception publish một frame CỐ ĐỊNH cho mọi lần dò, ví dụ: + # input_frame: charger_raw + # Đây là khoá quyết định handler dò CÁI GÌ khi tắt `use_simulated_goal` để chạy robot thật. + + # ---- (2) CHỌN CHẾ ĐỘ ---- + # STUB chỉ cho Gazebo/dev: thay perception bằng target cố định trong `base_link`. Handler quy nó + # sang `map` MỘT LẦN rồi ghi `dock_target` tĩnh vào tf3, nên target không chạy theo robot khi + # chặng docking bắt đầu. Bật lên thì TOÀN BỘ nhóm (3)(4) bên dưới bị bỏ qua. + # ► Chỉnh: PHẢI đặt false trước khi chạy robot thật, để handler lấy frame do perception publish. + # Để true trên robot thật = robot tiến vào một điểm bịa. + use_simulated_goal: true + # Ba offset dưới đây CHỈ có nghĩa khi use_simulated_goal: true — pose giả trong parent frame. + simulated_parent_frame: base_link + simulated_offset_x: 1.6 # [m] Đặt theo vị trí vật thể giả trong world Gazebo. + simulated_offset_y: 0.0 # [m] + simulated_offset_yaw: 0.12 # [rad] + + # Công tắc TẦNG LỌC. false = chốt ngay mẫu THỨ HAI nhận được, không cửa sổ, không độ tản, không + # cụm — nhóm (4) bị bỏ qua toàn bộ, nhóm (3) chỉ còn settle_delay + timeout có hiệu lực. Lấy mẫu + # thứ hai chứ không phải thứ nhất: lookup đầu sau khi action bắt đầu có thể trả detection CŨ còn + # sót trong buffer; mẫu thứ hai (stamp khác) chứng minh nguồn còn sống. + # ► Chỉnh: chỉ tắt khi debug (loại trừ tầng lọc) hoặc khi perception đã tự lọc và publish pose + # chốt. Tắt = tin mẫu đơn lẻ 100%, mọi cú nhảy TF đi thẳng vào dock_target. + filter_enabled: true + + # ---- (3) THỜI GIAN LẤY MẪU ---- + # Ngân sách dò mục tiêu: ca sạch chốt tại settle_delay + sample_window ≈ 1.5 s. + # [s] Chờ robot đứng hẳn trước khi lấy mẫu — pose lúc vừa dừng còn dao động cơ khí. + # ► Chỉnh: TĂNG nếu robot nặng/treo mềm và mẫu đầu bị lệch. GIẢM để rút ngắn chu kỳ dock. + # 0.4 đặt theo ngân sách dò 1–2 s, CHƯA đo dao động dừng trên robot thật. + settle_delay: 0.4 + + # [s] Độ dài CỬA SỔ TRƯỢT. Handler chỉ xét `sample_window` giây mẫu gần nhất, và đánh giá lại + # mỗi tick cho tới khi đạt hoặc hết `timeout` — mẫu xấu lúc perception mới bám không làm hỏng cả + # lượt dò như trước. Đây cũng là thời điểm đánh giá LẦN ĐẦU (sau settle_delay). + # ► Chỉnh: TĂNG cùng `min_samples` khi perception publish thưa hoặc nhiễu; GIẢM để dock nhanh + # hơn khi frame đã rất ổn định. 1.1 ≈ 11 mẫu @ perception 10 Hz. + sample_window: 1.1 + + # Số mẫu tối thiểu phải có TRONG cửa sổ để cửa sổ đó được đánh giá. Thiếu thì handler chờ tiếp, + # tới hết `timeout` mới -> kFailed. + # ► Chỉnh: đặt ~= (tần số publish của perception) x `sample_window` x 0.7. Đặt cao quá là action + # fail dù frame vẫn tốt. 8 ≈ 10 Hz x 1.1 s x 0.7. + min_samples: 8 + + # [s] Hết khoảng này mà chưa cửa sổ nào đạt -> kFailed. Bao cả ca frame thô không hề xuất hiện. + # ► Chỉnh: phải > settle_delay + sample_window + hold_time (0.4 + 1.1 + 0.0). Đây chính là thời + # gian handler CHO PHÉP dữ liệu hội tụ, nên TĂNG khi perception cần lâu mới bám ổn định. + timeout: 15.0 + + # ---- (4) CỔNG CHẤT LƯỢNG ---- + # Độ tản tối đa của cửa sổ (của CỤM được chọn khi bật lọc cụm). Chưa đạt tới lúc hết `timeout` + # -> kFailed, KHÔNG lùi vào. + # ► Chỉnh: đây là chốt AN TOÀN, không phải nút để "cho qua". Nới ra nghĩa là chấp nhận tiến vào + # một đích đo không chắc. Log lúc fail in ra cửa sổ TỐT NHẤT từng thấy kèm % so với ngưỡng — + # đọc con số đó rồi đặt ~1.5 lần độ tản thật, đừng đoán. + max_spread_xy: 0.03 # [m] + max_spread_yaw: 0.05 # [rad] + + # [s] Phải giữ trạng thái đạt liên tục ngần này mới chốt; tản trở lại một tick là reset đồng hồ. + # ► Chỉnh: 0 = chốt ngay cửa sổ đạt đầu tiên. Đặt > 0 (0.5–1.0) khi perception thỉnh thoảng bám + # nhầm vật thể khác một cách ỔN ĐỊNH — khi ấy mẫu vẫn chụm, chỉ là chụm quanh sai chỗ, và một + # cửa sổ đơn lẻ không phân biệt được. Cộng thẳng vào thời gian dock. + hold_time: 0.0 + + # -- Lọc cụm chống TF nhảy -- + # Localization sửa map->odom giữa lúc dò là mẫu ĐÃ THU nhảy sang hệ toạ độ khác: cửa sổ chứa + # hai cụm cách nhau cả nửa mét, spread toàn cửa sổ vượt ngưỡng mãi dù phép dò không có lỗi gì. + # Bật jump_threshold thì handler gom mẫu thành cụm (đo tới TÂM cụm), chỉ đo spread trên cụm + # QUÁ BÁN còn nhận mẫu mới; mẫu nhảy thành cụm thiểu số và bị loại. + # [m] Khoảng cách tới TÂM cụm để mẫu được gom chung. 0 = tắt lọc cụm (hành vi cũ nguyên vẹn). + # ► Chỉnh: đặt giữa độ tản dò thật (mm–cm) và biên độ TF nhảy (log fail in bbox + bố cục cụm — + # đọc khoảng cách giữa các cụm ở đó). Phải > max_spread_xy, không thì configure từ chối. + jump_threshold: 0.15 + + # [s] Cụm không nhận mẫu mới hơn ngần này thì không được chốt — cụm "đa số nhưng NGUỘI" là toạ + # độ TRƯỚC khi localization sửa, chốt theo nó là dock vào hệ toạ độ đã bị vứt bỏ. + # ► Chỉnh: ~2.5–3 lần chu kỳ publish của perception (10 Hz -> 0.25–0.3). Dài quá thì chậm nhận + # ra TF đã đổi hẳn; ngắn quá thì jitter publish làm cụm tốt bị chê oan. + cluster_recency: 0.3 + + # Tỉ lệ tổng mẫu cửa sổ mà cụm phải chiếm mới được chốt. Phải > 0.5: quá bán thì tối đa MỘT cụm + # đạt — hai hệ toạ độ giằng co 50/50 thì không phe nào đủ và handler chờ, không đoán bừa giữa + # hai tâm cách nhau cả mét. + # ► Chỉnh: HẠ về gần 0.5 khi TF nhảy chiếm tỉ lệ lớn mà vẫn muốn chốt theo phe đông; NÂNG khi + # muốn khắt khe hơn. Đặt đúng 0.5 thì configure từ chối. + min_cluster_fraction: 0.51 + + # Sàn mẫu tuyệt đối của cụm được chốt — dưới sàn này median/spread không còn nghĩa thống kê. + # ► Chỉnh: giữ >= 5; bắt buộc <= min_samples, không thì configure từ chối. + min_cluster_samples: 5 + + # --- detect_lidar: dò biên dạng trạm từ scan LiDAR THÔ ------------------------------------------- + # + # ĐANG TẮT. Bật bằng cách hoán hai dòng trong `handlers:` bên trên. + # + # Khác `detect` ở NGUỒN: `detect` nhận pose perception đã tính sẵn qua TF (và trong sim thì bịa + # hẳn pose). Handler này tự tính từ mảng `ranges`, nên nó loại được ứng viên sai ngay tại MỘT scan + # — số tia đỡ mỗi cánh, sai số khớp, góc kẹp lệch, chiều dài cánh lệch — thay vì chỉ dựa vào + # thống kê nhiều mẫu. + # + # ⚠ CẦN VẬT THỂ THẬT TRONG WORLD. Sim hiện không có tấm dock nào (đó chính là lý do `detect` phải + # chạy `use_simulated_goal: true`). Dựng tấm trước khi bật: + # roslaunch dock_pattern_action spawn_dock_plate.launch x:=3.0 y:=0.0 yaw:=3.14159 + # Hình học của model đó KHỚP profile `v_std` bên dưới. Đổi model thì phải đổi profile theo, nếu + # không cổng `wing_length` sẽ loại đúng cái tấm vừa dựng. + detect_lidar: + action_types: [DetectCharger] + + # Frame TF ghi ra; chặng docking trỏ `move_to` vào đây. Giống hệt `detect`. + output_frame: dock_target + + # PHẢI khớp một `topic` đã khai trong sensor_store_params.yaml. Gõ sai là handler TỪ CHỐI NẠP + # lúc boot kèm danh sách topic có thật — không để nó thành một lượt dò hết giờ. + scan_topic: /b_scan + + # [s] Chờ robot đứng hẳn trước khi lấy mẫu — pose lúc vừa dừng còn dao động cơ khí. + settle_delay: 0.4 + + # [s] Hết giờ mà chưa chốt -> kFailed. Phải > settle_delay + sample_window + hold_time. + timeout: 15.0 + + # --- Chọn profile lúc chạy --- + # Order mang khoá `dock_profile` trong actionParameters thì handler dùng profile đó; không mang + # thì dùng `default_profile`. Xin profile KHÔNG TỒN TẠI là action FAIL kèm danh sách tên có + # thật — không âm thầm rơi về default, vì dùng nhầm hình học là dock vào sai chỗ. + default_profile: arc_std + profile_param_key: dock_profile + + # --- Bộ lọc mẫu: CÙNG tập khoá với `detect` --- + # Ở đây bộ lọc chỉ là tuyến phòng thủ THỨ HAI (chống rung giữa các scan, chống cú nhảy + # map->odom). Cổng chính chống nhầm nằm ở hình học, nên `min_samples` thấp hơn `detect` nhiều. + filter_enabled: true + + # [s] Độ dài cửa sổ trượt. + # + # ► Robot ĐỨNG YÊN suốt lượt dò (D8: trong EXECUTING_ACTIONS không ai phát cmd_vel), nên mẫu + # thu cách đây 3 giây vẫn ứng với đúng hiện trạng — không có lý do gì phải ép cửa sổ ngắn. + # Ngắn quá là tự trói: đo thật trong kho cho ~1.6 lần dò trúng mỗi giây (24 lần trong 15 s), + # nên cửa sổ 1.0 s không bao giờ gom đủ `min_samples`, dù mỗi lần dò đều tốt. + # 3.0 s cho ~5 mẫu — vừa đủ, và mẫu nhiều hơn thì trung vị càng bền. + # + # Nới cửa sổ KHÔNG che được phép dò tồi: `max_spread_*` vẫn xét, và mẫu nào cũng phải qua + # toàn bộ cổng hình học trước khi vào đây. + sample_window: 3.0 + + min_samples: 5 + max_spread_xy: 0.03 # [m] + max_spread_yaw: 0.05 # [rad] + hold_time: 0.0 # [s] + jump_threshold: 0.0 # [m] 0 = tắt lọc cụm. Bật khi hiện trường có TF nhảy. + cluster_recency: 0.3 # [s] + min_cluster_fraction: 0.51 + min_cluster_samples: 3 + + # --- Trích đoạn thẳng: theo CẢM BIẾN, không theo cái sạc --- + # ► Chỉnh: `min_split_dist` là khoá quan trọng nhất — nó quyết định "thẳng tới mức nào thì coi + # là một đường". Đặt nhỏ hơn bề dày tấm là hai mặt của cùng một cánh thành hai đoạn. + line_extraction: + min_split_dist: 0.02 # [m] + max_line_gap: 0.08 # [m] khe rộng hơn ngần này thì tách, dù hai bên vẫn thẳng hàng + min_line_length: 0.05 # [m] + min_line_points: 5 + outlier_dist: 0.10 # [m] + min_range: 0.05 # [m] + max_range: 20.0 # [m] + + # --- Hình học + offset của TỪNG cái sạc --- + # ⚠ MỌI SỐ Ở ĐÂY PHẢI LÀ SỐ ĐO trên trạm thật. Giá trị dưới đây khớp model Gazebo + # `dock_plate_v`, tức là số cho SIM — chưa đo trạm nào. + profiles: + v_std: + pattern: v # v | recess | cylinder | arc (ba dạng sau CHƯA hiện thực) + + # [rad] Góc TRONG tại đỉnh, giữa hai CÁNH (không phải giữa hai pháp tuyến — hai cách trùng + # nhau ở đúng 90 độ và lệch nhau ở mọi góc khác). 1.5708 = tấm mở 90 độ. + vertex_angle: 1.5708 + wing_length: 0.30 # [m] từ đỉnh ra đầu mút + + angle_tolerance: 0.20 # [rad] sai lệch góc đỉnh còn chấp nhận + length_tolerance: 0.06 # [m] sai lệch chiều dài cánh + + # [m] Hai đầu cánh phải nằm trong ngần này quanh giao điểm hai đường. + # ► Đây là cổng phân biệt chữ V THẬT với hai bức tường cắt nhau ở xa: hai đường không song + # song nào cũng có giao điểm, nhưng chỉ chữ V mới có hai đoạn KẾT THÚC tại đó. + vertex_gap: 0.05 + + # Số tia đỡ tối thiểu cho MỘT cánh. + # + # ► Khoá này quyết định GÓC NHÌN CHO PHÉP nhiều hơn là tầm xa. Nhìn tấm chếch thì cánh xa + # gần như song song với tia, rất ít tia trúng nó. Đo trên scan tổng hợp (541 tia, nhiễu + # 3 mm), tỉ lệ dò trúng theo độ nghiêng của tấm: + # nghiêng 30°/2.5m 40°/1.2m 50°/1.2m + # = 8 0% 0% 0% + # = 5 77% 80% 82% + # Hạ xuống 5 là đánh đổi: ít tia hơn thì phép khớp yếu hơn, nhưng `min_confidence` và + # cổng chiều dài vẫn giữ. Nâng lên khi hiện trường có nhiều vật giống hình. + min_wing_points: 5 + + # [-] Điểm tin tối thiểu, trong [0, 1]. Lấy trục TỆ NHẤT trong (góc, cánh 1, cánh 2, số tia). + min_confidence: 0.4 + + # --- Cổng tìm kiếm: chống dương tính giả --- + # [rad] Nửa góc quạt quanh trục x của CẢM BIẾN (không phải của robot). 0 = không giới hạn. + # + # Đang TẮT vì trong sim ta không biết trước robot đứng chếch bao nhiêu so với tấm — bật sẵn + # 0.6 rad (±34°) đã loại đúng cái tấm dò được: log báo "matched the shape but fell outside + # the search gate". Thông điệp đó giờ in kèm toạ độ và bearing của ứng viên bị loại, dùng + # con số ĐÓ để đặt quạt thay vì đoán. + # + # ⚠ TRÊN ROBOT THẬT PHẢI BẬT LẠI. Trong kho, hai pallet vuông góc bất kỳ cũng là một chữ V, + # và đây là cổng rẻ nhất chặn chúng. Cách đặt: chạy một lượt với quạt tắt, đọc bearing + # trong log, rồi đặt rộng hơn con số đó chừng 0.2 rad. + search_fov: 0.0 + + # [m] Lùi từ ĐỈNH hình ra pose `base_link` phải đạt, dọc pháp tuyến hướng RA phía robot. + # + # ⚠ ĐÂY LÀ POSE CỦA `base_link`, KHÔNG PHẢI CỦA MÉP ROBOT. `dock_planner` cố ý không có + # khoá standoff nào — nó suy mép nào áp dock từ phía robot đứng so với goal, và suy được + # là nhờ goal ĐÃ là pose base_link phải đạt. Nghĩa là **không ai cộng footprint hộ**: + # quên nửa thân xe ở đây là robot lùi xuyên qua tấm rồi kẹt, bánh quay mà xe không đi. + # + # Công thức: + # offset_x >= |footprint sau| + footprint_padding + # + wing_length * sin((pi - vertex_angle)/2) <-- đầu cánh nhô về phía robot + # + khe hở + # + # Với T800 + tấm v_std: 0.583 + 0.070 + 0.30*sin(45°)=0.212 + 0.08 = 0.945 + # + # ► Lấy số ở ĐÂU — chỗ này dễ đi tìm sai file nhất: + # |footprint sau| = 0.583 <- `footprint:` trong amr_startup/config/maker_sources.yaml, + # do amr_control đọc từ param server rồi đẩy xuống nav core. + # `footprint:` trong config/costmap_params.yaml của cây này + # khai [±0.3] nhưng bị host GHI ĐÈ lúc chạy — đừng dùng nó. + # `footprint_dock` trong maker_sources.yaml là kích thước + # ĐỐI TƯỢNG DOCK, không phải robot, dù trùng số. + # footprint_padding = 0.070 <- hybrid_local_planner_params.yaml, block + # HybridDockingLocalPlanner. KHÔNG phải khoá cùng tên trong + # costmap_common_params.yaml (ở đó đang 0.0). + # Cách chắc nhất: đọc dòng `footprint x: ...` mà controller in ra lúc nhận plan. + # + # ► Chỉnh: đổi xe, đổi padding hoặc đổi tấm thì PHẢI tính lại — con số này gắn với CẢ xe + # lẫn tấm, không phải chỉ tấm. + offset_x: 0.95 + offset_y: 0.0 # [m] bù tấm lắp lệch NGANG so với đầu cắm + offset_yaw: 0.0 # [rad] bù tấm lắp XOAY so với đầu cắm + + # --- Dải phản quang: dữ liệu THÊM cho việc dò hình --- + # + # ĐANG TẮT ở profile này. Bật thì ứng viên nào đã qua hết cổng hình học còn phải mang đúng + # chữ ký phản quang mới được nhận. Hình vẫn quyết định đỉnh nằm ở đâu — dải chỉ trả lời một + # câu khác mà hình học một mình không trả lời được: "có đúng là cái sạc không". + # + # ► Vì sao đáng bật ngoài kho: mọi góc tường, mọi góc pallet đều là một chữ V. Không góc nào + # trong số đó có hai dải phản quang cách nhau đúng `tape_spacing`. Và khác cổng hình học, + # nó KHÔNG yếu đi theo tầm — hình mờ dần khi tia thưa ra, cường độ thì không. + # + # ► Cần gì để bật: cảm biến phải publish `intensities`. Không có thì handler nói thẳng ra + # ("no intensity data") chứ không âm thầm dò mãi không xong. + # + # Xem profile `v_tape` bên dưới để biết bộ khoá đầy đủ. + tape_enabled: false + + # Ví dụ profile thứ hai — order gửi `dock_profile: v_wide` là chọn nó. + v_wide: + pattern: v + vertex_angle: 2.0944 # [rad] 120 độ + wing_length: 0.25 # [m] + angle_tolerance: 0.20 + length_tolerance: 0.06 + vertex_gap: 0.05 + min_wing_points: 5 # xem ghi chú ở v_std + min_confidence: 0.4 + search_fov: 0.0 # [rad] xem ghi chú ở v_std + # 0.583 + 0.070 + 0.25*sin(30°)=0.125 + 0.08 = 0.858 — xem công thức ở v_std. + offset_x: 0.86 + tape_enabled: false # xem ghi chú ở v_std + + # Cùng HÌNH với `v_std`, khác đúng một chuyện: bắt buộc phải thấy dải phản quang. + # + # Tách thành profile riêng thay vì bật thẳng trong `v_std` là có chủ đích — `v_std` đang chạy + # được, và một tính năng mới không nên đổi hành vi của thứ đang chạy. Thử bằng: + # rosrun amr_comunication send_dock_to.py --profile v_tape + # Chạy ổn rồi thì chép nhóm `tape_*` sang `v_std` và bỏ profile này đi. + # + # ⚠ Số dưới đây khớp model Gazebo `dock_plate_v` — đó là số cho SIM, chưa đo trạm nào. + v_tape: + pattern: v + vertex_angle: 1.5708 # [rad] xem ghi chú ở v_std + wing_length: 0.30 # [m] + angle_tolerance: 0.20 # [rad] + length_tolerance: 0.06 # [m] + vertex_gap: 0.05 # [m] + min_wing_points: 5 + min_confidence: 0.4 + search_fov: 0.0 # [rad] + offset_x: 0.95 # [m] xem công thức ở v_std + offset_y: 0.0 + offset_yaw: 0.0 + + # ---- Nhóm dải phản quang ---- + tape_enabled: true + + # [m] Khoảng cách giữa TÂM hai dải, đo THẲNG từ dải này sang dải kia — không đi vòng theo + # cánh, không qua đỉnh. + # ► Chỉnh: cầm thước đo trên trạm thật. Model `dock_plate_v` là 0.1945 (hai dải ở giữa hai + # cánh 0.30 m của tấm mở 90 độ). + tape_spacing: 0.1945 + + # [m] Chiều dài MỘT dải, đo dọc theo cánh. + # ► Chỉnh: đây cũng là khoá quyết định dải phải RỘNG bao nhiêu mới dò được ở tầm xa. Số tia + # trúng dải ≈ tape_width * cos(độ chếch) / (tầm * bước tia). nanoscan3 có bước tia + # 0.00689 rad, nên ở 3 m một dải 0.12 m nhìn chính diện chỉ cho ~6 tia; hẹp hơn 0.09 m là + # không đủ tia để đo chiều dài nữa. Dán rộng ra rẻ hơn nhiều so với chỉnh phần mềm. + tape_width: 0.12 + + # [m] Sai lệch khoảng cách hai dải còn chấp nhận. + # ► Chỉnh: TĂNG nếu dải dán tay lệch nhau giữa các trạm; GIẢM để chặt hơn với vật giống hình. + # Không được >= tape_spacing, vì khi ấy hai dải chồng lên nhau cũng lọt. + tape_spacing_tolerance: 0.04 + + # [m] Sai lệch chiều dài dải còn chấp nhận. + # ► Chỉnh: đo được đã tự bù phần hụt do tia thưa, nên dung sai này chỉ cần phủ sai số dán và + # phần dải bị che. TĂNG khi dải hay bị bẩn/bong một đầu. + tape_width_tolerance: 0.05 + + # [-] Cường độ từ ngần này trở lên thì tia đó coi như trúng dải. + # + # ⚠ ĐƠN VỊ RIÊNG CỦA TỪNG CẢM BIẾN, không có chuẩn chung. Gazebo trả thẳng `laser_retro` + # (model `dock_plate_v` khai 2000, mọi vật khác 0), nanoscan3 thật trả một thang khác hẳn. + # ► Chỉnh: PHẢI đo, đừng chép. Chĩa vào dải rồi + # rostopic echo /b_scan/intensities + # chĩa ra chỗ khác đọc lại, rồi lấy khoảng giữa hai giá trị. Đặt thấp quá thì mọi bề mặt + # sáng đều thành dải; cao quá thì dải bẩn hoặc nhìn chếch biến mất và trạm thật bị từ chối. + tape_min_intensity: 500.0 + + # --- Máng cong LÕM: biên dạng thứ hai, đi qua ArcPatternMatcher --- + # + # ⚠ Số dưới đây khớp model Gazebo `dock_cradle_arc` — số cho SIM, chưa đo trạm nào. + # Dựng model: roslaunch dock_pattern_action spawn_dock_cradle.launch x:=3.0 y:=0.0 + arc_std: + pattern: arc + + # [m] Bán kính máng. ► Chỉnh: cầm thước đo trên trạm thật. + arc_radius: 0.40 + arc_radius_tolerance: 0.06 # [m] sai lệch bán kính còn chấp nhận + + # [rad] Góc mở TOÀN PHẦN của máng — bao nhiêu cung THẬT SỰ tồn tại trên tấm. + # + # ⚠ KIỂM HAI PHÍA, khác hẳn luật chiều dài cánh chữ V. Với chữ V, đỉnh và phân giác là thuộc + # tính nội tại — thấy một cánh ngắn vẫn suy ra đúng hướng. Với cung tròn thì KHÔNG: một + # ĐƯỜNG TRÒN không có trục nào cả, trục chỉ suy được từ hai ĐẦU MÚT của cung. Che mất một + # mép là trục lệch, và lệch âm thầm. + # + # Quan hệ đo được: sai yaw ≈ (arc_span − góc mở đo được) / 2 + # + # ► Đặt bằng góc mở THẬT của máng, KHÔNG cộng dư. Cộng dư là tự nới cổng theo chiều nguy + # hiểm — nhận cả những lượt chỉ nhìn thấy một phần cung. + arc_span: 2.0 + + # [rad] Sai lệch góc mở còn chấp nhận, HAI CHIỀU. + # + # ► Đây chính là ngân sách sai hướng nhân đôi. 0.15 rad cho phép nhìn chếch tới khoảng 30 + # độ, đổi lại sai hướng tối đa ~2.4 độ. Đo trên máng 0.40 m / 2.0 rad, nhiễu 3 mm: + # goc lech cho dung 0 10 20 30 40 do + # goc mo do duoc 1.96 1.98 1.94 1.86 1.81 + # sai yaw 0.2 0.2 0.3 2.4 3.9 do + # ► Bộ trích đoạn luôn cắt vài tia ở hai mép, nên ngay cả nhìn chính diện góc mở đo được vẫn + # hụt ~0.04 rad. Dung sai phải phủ phần đó trước đã. + arc_span_tolerance: 0.15 + + # [rad] Góc mở tối thiểu quan sát được thì mới tin phép khớp. + # + # ► KHÔNG phải cổng hình học mà là cổng SỐ HỌC. Khớp đường tròn trên mẩu cung quá ngắn thì + # bán kính lệch nhanh. Đo trên cung 0.40 m, nhiễu 3 mm, trung bình 200 hạt giống: + # góc mở 45 độ 30 độ 20 độ + # lệch +1.9mm +8.6mm +25.4mm + # Dưới 30 độ, máng 0.40 m có thể bị chấm thành 0.43 m rồi rớt cổng bán kính. 0.52 rad + # = 30 độ, đặt đúng theo bảng đó. + arc_min_span: 0.52 + + # [m] Sai số khớp tối đa của điểm so với đường tròn. + # + # ► CỔNG CHÍNH chống nhầm. Mọi tập điểm đều khớp được vào một đường tròn NÀO ĐÓ — kể cả hai + # bức tường gặp nhau ở góc vuông. Thứ phân biệt cung thật với khúc gãy là sai số khớp, + # không phải việc có khớp được hay không. + # ► Đặt theo nhiễu tầm của cảm biến, cỡ 2-3 lần lệch chuẩn. nanoscan3 sim có 3 mm. + arc_max_rms: 0.010 + + # [m] Hai đoạn cách nhau xa hơn ngần này thì KHÔNG gộp vào cùng một cung. + # + # ► Liền nhau theo SỐ TIA không có nghĩa là liền nhau trong KHÔNG GIAN: tia kế tiếp có thể + # rơi xuống một mặt cách đó vài mét. Đo thật trong sim: bốn đoạn của cái máng bị gom + # chung với bức tường 6.6 m ngay sau nó (chỉ cách 2 tia), khớp tròn trên cả cụm cho bán + # kính 3.2 m và sai số 0.11 m — cái máng thật bị loại vì một thứ không thuộc về nó. + # ► Đặt BẰNG hoặc NHỎ HƠN `max_line_gap` của khối `line_extraction` (đang 0.08). Lớn hơn + # thì matcher gộp lại đúng những gì bộ trích đoạn vừa tách ra, mà tách ra là có lý do. + arc_max_point_gap: 0.05 + + # Số điểm tối thiểu trên cung. Quyết định TẦM DÒ giống `min_wing_points` của chữ V. + min_arc_points: 8 + + min_confidence: 0.4 + search_fov: 0.0 # [rad] xem ghi chú ở v_std + + # [m] Lùi từ ĐIỂM SÂU NHẤT của máng ra pose `base_link` phải đạt. + # + # ⚠ Chỗ tiếp xúc KHÔNG phải điểm sâu nhất. Miệng máng chỉ rộng 0.673 m trong khi + # robot rộng 0.960 m, nên robot KHÔNG lọt vào lòng máng — nó chạm hai MÉP MIỆNG. Mép + # miệng nhô về phía robot 0.1839 m so với điểm sâu nhất: + # + # R - R*cos(arc_span/2) = 0.4 - 0.4*cos(1.0) = 0.1839 m + # + # Công thức: + # offset_x >= |footprint sau| + footprint_padding + (mép miệng nhô ra) + khe hở + # = 0.583 + 0.070 + 0.184 + 0.08 = 0.917 + # + # ► Lấy 0.583 và 0.070 ở đâu: xem ghi chú dài trong `v_std`, đó là chỗ dễ tìm nhầm file nhất. + # ► Đổi `arc_span` hoặc `arc_radius` là PHẢI tính lại — mép miệng dịch theo cả hai. + offset_x: 0.92 + offset_y: 0.0 # [m] + offset_yaw: 0.0 # [rad] + + # tape_enabled KHÔNG khai được cho biên dạng arc: handler từ chối ngay lúc boot. `findTape` + # quét theo chỉ số tia của một ĐOẠN THẲNG, mà cung tròn không sinh ra đoạn nào. + + + # ⚠ CỐ Ý KHÔNG KHAI: khoá `hang` (mặc định false) là TEST HOOK làm handler treo vĩnh viễn, chỉ + # dùng để kiểm đường timeout trong unit test. Khai `hang: true` trên robot = chặng đứng im cho + # tới khi hết `timeout` ở trên. Đừng thêm vào file runtime. + +# Bảng symbol -> thư viện cho Boost.DLL. KHÔNG phải tham số tinh chỉnh — thiếu `library_path` là +# nguyên nhân phổ biến nhất của lỗi "plugin build xong nhưng runtime báo không tìm thấy". +FrameSamplerActionHandler: + library_path: libaction_core_frame_sampler_action_handler + +# Bộ dò biên dạng từ LiDAR thô. Gói riêng (`dock_pattern_action`), không thuộc action_core. +DockPatternActionHandler: + library_path: libdock_pattern_action_handler diff --git a/config/runtime/compound_actions_params.yaml b/config/runtime/compound_actions_params.yaml new file mode 100644 index 0000000..ba1577c --- /dev/null +++ b/config/runtime/compound_actions_params.yaml @@ -0,0 +1,91 @@ +# ================================================================================================= +# action_core / mission_adapters — compound action: "phải dò rồi mới biết đích". +# +# Quy ước comment: dòng mô tả = LÀ GÌ / vì sao; `► Chỉnh:` = sửa thế nào cho đúng. +# +# Đây là bảng mở rộng của `VDA5050SourceAdapter`: một action của fleet được DỊCH thành một chuỗi +# chặng (nav + action) trước khi xuống navigation. Fleet chỉ gửi `charge`; `DetectCharger` và +# `startCharging` là actionType NỘI BỘ do adapter sinh ra, không bao giờ xuất hiện trong order JSON. +# +# File riêng thay vì sửa `mission_adapters_params.yaml`: file đó là symlink sang cây config của +# `pnkx_nav_core` (submodule). `robot::NodeHandle` gộp mọi file YAML trong thư mục config vào một +# cây, nên khoá `vda5050_src` ở đây hợp nhất với khoá cùng tên bên kia. +# +# ── Bảng này chỉ giữ CẤU TRÚC ──────────────────────────────────────────────────────────────────── +# +# Tên frame cụ thể đến từ `actionParameters` của chính order, nên thêm một trạm sạc mới KHÔNG phải +# sửa file này. +# +# Bốn từ khoá của một step, phải có ĐÚNG MỘT: +# action: chặng chỉ-action; mang nguyên actionParameters của action gốc +# move_to: chặng nav, frame cố định +# move_to_param: chặng nav, frame lấy từ actionParameters[] của action gốc +# move: chặng nav tương đối; dương = tiến, âm = lùi +# +# Tuỳ chọn cho step navigation: profile (position | docking | go_straight | rotate), marker. +# `marker` chỉ hợp lệ với `profile: docking`: nó chọn override trong +# maker_sources.yaml/docking_marker_profiles. Không khai = dùng cặp docking mặc định. +# Tolerance thuộc YAML riêng của local planner đang được profile chọn, không khai ở đây. +# +# ── Ba quy tắc khi sửa ─────────────────────────────────────────────────────────────────────────── +# 1. Mỗi `action: X` thêm mới PHẢI có handler nhận `X` trong `action_handlers_params.yaml` +# (`action_types`), nếu không chặng đó ABORT. +# 2. `clear_queue_on_failure: true` (mission_adapters_params.yaml) là thứ ngăn robot chạy bước +# thiết bị khi bước dò/bước tiến vào đã hỏng — đừng tắt khi còn dùng compound action. +# 3. Thứ tự step là hợp đồng an toàn: dò -> vào vị trí -> mới thao tác thiết bị. Đảo thứ tự nghĩa +# là đóng relay / nâng càng khi chưa vào đúng chỗ. +# ================================================================================================= + +vda5050_src: + compound_actions: + # --- charge: vào trạm sạc --------------------------------------------------------------------- + CHARGE: + steps: + # 1. Dò: đứng yên lấy mẫu frame thô, lọc nhiễu, ghi ra `dock_target`. + # Robot không phát cmd_vel trong EXECUTING_ACTIONS nên đây đúng là lúc để lọc. + # Tham số lọc (sample_window, max_spread_*) nằm ở khối `detect` bên action_handlers. + - {action: DetectCharger} + + # 2. Tiến vào đích vừa dò được bằng profile docking. Sai số do local planner đọc từ YAML + # của chính plugin đó (hybrid_local_planner_params.yaml), KHÔNG khai ở đây. + - {move_to: dock_target, profile: docking, marker: charger} + + # --- PickUp: lấy kệ --------------------------------------------------------------------------- + PICKUP: + steps: + - {action: DetectPallet} + - {move_to: dock_target, profile: docking, marker: pallet} + # Lùi ra khỏi khe kệ. Quãng đường tương đối được quy ra pose tuyệt đối tại `submit`, từ pose + # LÚC ĐÓ — lúc adapter sinh chặng thì robot còn chưa tới nơi. + # ► Chỉnh: [m] âm = lùi. Đặt đủ dài để càng nâng ra hẳn khỏi khe kệ trước khi robot xoay; + # quá ngắn thì kệ quệt vào giá, quá dài thì tốn thời gian và có thể lùi vào lối đi chung. + # - {move: -0.5, profile: go_straight} + + + # --- UnDockFromStation: lùi ra khỏi trạm -------------------------------------------------------- + # Trước đây action này chạy phía host bằng `moveStraightTo`, một entry point đã bị gỡ vì nó đẩy + # goal thẳng vào lõi và cướp được chặng mà mission layer đang chạy. Ở đây nó là một chặng bình + # thường: cùng mission id, cùng lifecycle, cùng đường cancel. + # + # ⚠ Khác biệt so với bản host cũ: quãng lùi giờ là HẰNG SỐ CỦA CẤU HÌNH, không còn lấy từ + # `actionParameters.distance` của từng order — step `move:` chỉ nhận số, không có biến thể đọc + # param. Trạm nào cần quãng lùi khác thì phải khai một compound action riêng. + UNDOCK: + steps: + # ► Chỉnh: [m] âm = lùi. Đủ dài để robot ra hẳn khỏi trạm trước khi được phép xoay. Profile + # `go_straight` KHÔNG tránh vật cản — chỉ đúng khi phía sau trạm là vùng đã biết là trống. + - {move: -1.0, profile: go_straight} + + # --- GoStraight / Rotate: hai lệnh chuyển động trần, dùng để kiểm thử và cho quy trình đơn giản + GOSTRAIGHT: + steps: + # ► Chỉnh: [m] dương = tiến, âm = lùi. Profile `go_straight` không tránh vật cản dọc đường — + # chỉ dùng cho quãng ngắn đã biết là trống. + - {move: 1.0, profile: go_straight} + + # ROTATE: + # steps: + # # ► Chỉnh: `move: 0.0` = không tịnh tiến; góc quay lấy từ actionParameters của order. + # # Profile `rotate` dùng PNKXRotateLocalPlanner, tham số ở YAML của plugin đó. + # - {move: 0.0, profile: rotate} + diff --git a/config/runtime/config/costmap_params.yaml b/config/runtime/config/costmap_params.yaml new file mode 100644 index 0000000..35e2c17 --- /dev/null +++ b/config/runtime/config/costmap_params.yaml @@ -0,0 +1,36 @@ +robot_costmap_2d: + global_frame: map + robot_base_frame: base_link + rolling_window: false + track_unknown_space: false + + plugins: + - name: static_layer + type: StaticLayer + + - name: inflation_layer + type: InflationLayer + + - name: obstacle_layer + type: ObstacleLayer + + - name: voxel_layer + type: VoxelLayer + + library_path: ./libplugins.so + footprint: + - [0.3, 0.3] + - [0.3, -0.3] + - [-0.3, -0.3] + - [-0.3, 0.3] + + transform_tolerance: 0.0 + update_frequency: 1.0 + width: 0.0 + height: 0.0 + resolution: 0.0 + origin_x: 0.0 + origin_y: 0.0 + + footprint_padding: 0.0 + robot_radius: 0.0 \ No newline at end of file diff --git a/config/runtime/config/inflation_layer_params.yaml b/config/runtime/config/inflation_layer_params.yaml new file mode 100644 index 0000000..d17193e --- /dev/null +++ b/config/runtime/config/inflation_layer_params.yaml @@ -0,0 +1,5 @@ +inflation_layer: + enabled: true + inflate_unknown: false + cost_scaling_factor: 15.0 + inflation_radius: 0.55 \ No newline at end of file diff --git a/config/runtime/config/obstacle_layer_params.yaml b/config/runtime/config/obstacle_layer_params.yaml new file mode 100644 index 0000000..af1fab9 --- /dev/null +++ b/config/runtime/config/obstacle_layer_params.yaml @@ -0,0 +1,19 @@ +obstacle_layer: + enabled: true + track_unknown_space: true + transform_tolerance: 0.2 + topic: "map" + sensor_frame: laser_frame + observation_persistence: 0.0 + expected_update_rate: 0.0 + data_type: PointCloud + min_obstacle_height: 0.0 + max_obstacle_height: 2.0 + inf_is_valid: false + clearing: false + marking: true + obstacle_range: 2.5 + raytrace_range: 3.0 + footprint_clearing_enabled: true + combination_method: 1 + diff --git a/config/runtime/config/static_layer_params.yaml b/config/runtime/config/static_layer_params.yaml new file mode 100644 index 0000000..e8e6acd --- /dev/null +++ b/config/runtime/config/static_layer_params.yaml @@ -0,0 +1,11 @@ +static_layer: + enabled: true + map_topic: "map" + first_map_only: false + subscribe_to_updates: false + track_unknown_space: true + use_maximum: false + lethal_cost_threshold: 100 + unknown_cost_value: -1 + trinary_costmap: true + base_frame_id: "map" diff --git a/config/runtime/config/voxel_layer_params.yaml b/config/runtime/config/voxel_layer_params.yaml new file mode 100644 index 0000000..b168fdd --- /dev/null +++ b/config/runtime/config/voxel_layer_params.yaml @@ -0,0 +1,15 @@ +voxel_layer: + enabled: true + footprint_clearing_enabled: true + max_obstacle_height: 3.0 + origin_z: 0.0 + z_resolution: 0.2 + z_voxels: 16 + unknown_threshold: 15.0 + mark_threshold: 0 + combination_method: 1 + frustum_clearing_enabled: true + frustum_clearing_pixel_step: 8 + frustum_min_range: 0.20 + frustum_max_range: 3.0 + frustum_depth_camera_topic: /camera/depth/data diff --git a/config/runtime/costmap_common_params.yaml b/config/runtime/costmap_common_params.yaml new file mode 100755 index 0000000..7246602 --- /dev/null +++ b/config/runtime/costmap_common_params.yaml @@ -0,0 +1,94 @@ +robot_base_frame: base_link +transform_tolerance: 1.0 +performance_metrics_enabled: true +performance_metrics_period: 5.0 +obstacle_range: 3.0 +#mark_threshold: 1 +publish_voxel_map: true +footprint_padding: 0.0 + +navigation_map: + map_topic: /map + map_pkg: managerments + map_file: maze + +virtual_walls_map: + map_topic: /map + namespace: /virtual_walls + map_pkg: managerments + map_file: maze + use_maximum: true + lethal_cost_threshold: 100 + +obstacles: + observation_sources: f_scan b_scan # pc_marking pc_clearing pc_r_marking pc_r_clearing + f_scan: + topic: /f_scan + data_type: LaserScan + clearing: true + marking: true + inf_is_valid: true + frustum_clearing_enabled: false + min_obstacle_height: 0.0 + max_obstacle_height: 0.25 + + b_scan: + topic: /b_scan + data_type: LaserScan + clearing: true + marking: true + inf_is_valid: true + frustum_clearing_enabled: false + min_obstacle_height: 0.0 + max_obstacle_height: 0.25 + + # pc_marking: + # topic: /camera/depth/points_proc + # data_type: PointCloud2 + # clearing: false + # marking: true + # inf_is_valid: false + # frustum_clearing_enabled: false + # observation_persistence: 0.0 + # expected_update_rate: 0.8 + # obstacle_range: 2.5 + # raytrace_range: 3.0 + # min_obstacle_height: 0.1 + # max_obstacle_height: 1.0 + + # pc_clearing: + # topic: /camera/depth/data + # data_type: DepthCameraData + # clearing: false + # marking: true + # frustum_clearing_enabled: true + # frustum_clearing_pixel_step: 8 + # frustum_min_range: 0.20 + # frustum_max_range: 3.5 + + # pc_r_marking: + # topic: /camera_right/depth/points_proc + # data_type: PointCloud2 + # clearing: false + # marking: true + # inf_is_valid: false + # frustum_clearing_enabled: false + # observation_persistence: 0.0 + # expected_update_rate: 0.8 + # obstacle_range: 2.5 + # raytrace_range: 3.0 + # min_obstacle_height: 0.1 + # max_obstacle_height: 1.0 + + # pc_r_clearing: + # topic: /camera_right/depth/data + # data_type: DepthCameraData + # clearing: false + # marking: true + # frustum_clearing_enabled: true + # frustum_clearing_pixel_step: 8 + # frustum_min_range: 0.20 + # frustum_max_range: 3.5 + + # Depth camera clearing is handled by VoxelLayer frustum clearing from + # /camera/depth/image_raw + /camera/depth/camera_info. /camera_right/depth/data diff --git a/config/runtime/costmap_global_params.yaml b/config/runtime/costmap_global_params.yaml new file mode 100755 index 0000000..79203f7 --- /dev/null +++ b/config/runtime/costmap_global_params.yaml @@ -0,0 +1,29 @@ +global_costmap: + library_path: libplugins + robot_base_frame: base_link + global_frame: map + update_frequency: 1.0 + publish_frequency: 1.0 + # [bool] Bật log thống kê thời gian update costmap (avg/p95/p99 mỗi cycle + per-layer). + # Chỉ dùng khi đo đạc/tối ưu; log in mỗi performance_metrics_period giây, tắt đi khi chạy thật. + # Lưu ý: key này phải nằm TRONG namespace local_costmap/global_costmap — đặt ở root file common là key chết. + performance_metrics_enabled: false + # [s] Chu kỳ in báo cáo thống kê. Tăng lên thì log thưa hơn, số trung bình mượt hơn. + performance_metrics_period: 5.0 + # [0..2] Mức chi tiết debug trong báo cáo thống kê, chỉ có tác dụng khi performance_metrics_enabled: true. + # 0 = giữ nguyên output cũ; 1 = thêm dòng lock_wait/lock_hold (tranh chấp mutex với planner), + # kích thước window update [cells] và số cycle rỗng; 2 = thêm per-layer: layer nào nở bounds bao nhiêu [m^2]. + debug_level: 0 + # [bool] Reader tính toán trên BẢN COPY (snapshot) của costmap thay vì lưới live — xem giải thích + # ở costmap_local_params.yaml. Global costmap để false: global planner chưa chuyển sang snapshot + # (planner_runner vẫn dùng khoá dài), và global đang idle nên không có tranh chấp đáng kể. + snapshot_for_readers: false + raytrace_range: 3.0 + resolution: 0.05 + z_resolution: 0.2 + rolling_window: false + z_voxels: 10 + inflation: + cost_scaling_factor: 10.0 # Exponential rate at which the obstacle cost drops off (default: 10). Must be chosen so that the cost value is > 0 at robot's circumscribed radius. + inflation_radius: 0.6 # Max. distance from an obstacle at which costs are incurred for planning paths. Must be > robot's circumscribed radius. + diff --git a/config/runtime/costmap_global_params_plugins_no_virtual_walls.yaml b/config/runtime/costmap_global_params_plugins_no_virtual_walls.yaml new file mode 100755 index 0000000..30a3e96 --- /dev/null +++ b/config/runtime/costmap_global_params_plugins_no_virtual_walls.yaml @@ -0,0 +1,10 @@ +global_costmap: + frame_id: map + plugins: + - {name: navigation_map, type: "StaticLayer" } + # - {name: virtual_walls_map, type: "StaticLayer" } + - {name: obstacles, type: "VoxelLayer" } + - {name: inflation, type: "InflationLayer" } + obstacles: + enabled: false + footprint_clearing_enabled: true \ No newline at end of file diff --git a/config/runtime/costmap_local_params.yaml b/config/runtime/costmap_local_params.yaml new file mode 100755 index 0000000..71217e7 --- /dev/null +++ b/config/runtime/costmap_local_params.yaml @@ -0,0 +1,38 @@ +local_costmap: + library_path: libplugins + global_frame: odom + robot_base_frame: base_link + # [Hz] Tần số update local costmap. Nâng 6 -> 10 sau khi bật snapshot_for_readers (hết tranh chấp + # mutex với planner): latency vật cản vào costmap 167 ms -> 100 ms. Trần hữu ích ~15 Hz (bằng tần số + # sensor); nâng cao hơn nữa chỉ tốn CPU, không thêm thông tin. + update_frequency: 10.0 + publish_frequency: 6.0 + # [bool] Bật log thống kê thời gian update costmap (avg/p95/p99 mỗi cycle + per-layer). + # Chỉ dùng khi đo đạc/tối ưu; log in mỗi performance_metrics_period giây, tắt đi khi chạy thật. + # Lưu ý: key này phải nằm TRONG namespace local_costmap/global_costmap — đặt ở root file common là key chết. + performance_metrics_enabled: false + # [s] Chu kỳ in báo cáo thống kê. Tăng lên thì log thưa hơn, số trung bình mượt hơn. + performance_metrics_period: 5.0 + # [0..2] Mức chi tiết debug trong báo cáo thống kê, chỉ có tác dụng khi performance_metrics_enabled: true. + # 0 = giữ nguyên output cũ; 1 = thêm dòng lock_wait/lock_hold (tranh chấp mutex với planner), + # kích thước window update [cells] và số cycle rỗng; 2 = thêm per-layer: layer nào nở bounds bao nhiêu [m^2]. + debug_level: 0 + # [bool] Local planner tính toán trên BẢN COPY (snapshot) của costmap thay vì lưới live. + # true: mỗi control cycle copy lưới dưới lock ~vài us rồi planner solve trên bản copy — thread + # update costmap không còn bị planner chặn 20-50 ms mỗi lần solve (lock_wait trong Costmap debug + # phải tụt về ~0). Planner vẫn thấy lưới "đông cứng" suốt lượt tính, y như khoá dài trước đây. + # false: hành vi cũ — giữ mutex suốt computeVelocityCommands. Đây là công tắc rollback: có vấn đề + # thì đặt false, không cần build lại. + snapshot_for_readers: true + rolling_window: true + raytrace_range: 3.0 + resolution: 0.05 + z_resolution: 0.15 + z_voxels: 8 + inflation: + cost_scaling_factor: 10.0 # Exponential rate at which the obstacle cost drops off (default: 10). Must be chosen so that the cost value is > 0 at robot's circumscribed radius. + inflation_radius: 0.3 # Max. distance from an obstacle at which costs are incurred for planning paths. Must be > robot's circumscribed radius. + width: 8.0 + height: 8.0 + origin_x: 0.0 + origin_y: 0.0 \ No newline at end of file diff --git a/config/runtime/costmap_local_params_plugins_no_virtual_walls.yaml b/config/runtime/costmap_local_params_plugins_no_virtual_walls.yaml new file mode 100755 index 0000000..a9309cb --- /dev/null +++ b/config/runtime/costmap_local_params_plugins_no_virtual_walls.yaml @@ -0,0 +1,9 @@ +local_costmap: + frame_id: odom + plugins: + # - {name: virtual_walls_map, type: "StaticLayer" } + - {name: obstacles, type: "VoxelLayer" } + - {name: inflation, type: "InflationLayer" } + obstacles: + enabled: true + footprint_clearing_enabled: true diff --git a/config/runtime/custom_global_params.yaml b/config/runtime/custom_global_params.yaml new file mode 100644 index 0000000..12ed66f --- /dev/null +++ b/config/runtime/custom_global_params.yaml @@ -0,0 +1,35 @@ +# custom_planner — tham số runtime, đọc qua robot::NodeHandle("CustomPlanner"). +# Thiếu key nào thì dùng default trong CustomPlannerConfig (cùng giá trị ghi ở đây). +CustomPlanner: + library_path: libcustom_planner + + # [m] start/goal cách pathway dưới ngưỡng này thì coi là đã bám vào pathway + # (quyết định cách nối NURBS start/goal vào tuyến). + pathway_attach_distance: 0.1 + + # [m] order không có node/edge (goal trần): chỉ nhận khi start-goal gần hơn + # ngưỡng này, ngược lại trả false để move_base2 dùng backup planner. + bare_goal_max_distance: 0.2 + + # Bước tham số u trong [0,1] khi đo chiều dài NURBS một cạnh (không phải mét). + nurbs_length_t_interval: 0.01 + + # [m] khoảng cách mong muốn giữa hai pose khi lấy mẫu NURBS nối start/goal. + nurbs_point_spacing: 0.05 + + # [rad] hai cạnh thẳng đầu gãy dưới góc này thì bỏ cạnh đầu khi tính yaw. + skip_edge_angle: 0.4712 # = 0.15*pi + + # [rad] góc nối giữa hai cạnh <= tight: gãy gắt (cost 20); < wide: gãy vừa (cost 10). + cost_angle_tight: 0.3142 # = 0.1*pi + cost_angle_wide: 1.4137 # = 0.45*pi + + # [rad] cửa sổ góc đổi hướng cần chèn chuỗi pose xoay tại chỗ giữa hai cạnh. + rotation_insert_min: 1.4137 # = 0.45*pi + rotation_insert_max: 2.6704 # = 0.85*pi + + # [rad] bước yaw giữa hai pose xoay tại chỗ được chèn. + rotation_step: 0.1571 # = 0.05*pi + + # [rad] |yaw goal - hướng cạnh cuối| vượt ngưỡng này thì đoạn cuối đi lùi. + backward_decision_angle: 1.5708 # = 0.5*pi diff --git a/config/runtime/dock_global_params.yaml b/config/runtime/dock_global_params.yaml new file mode 100644 index 0000000..b63d588 --- /dev/null +++ b/config/runtime/dock_global_params.yaml @@ -0,0 +1,154 @@ +# DockPlanner — global planner sinh đường vào dock. +# +# Ba kiểu đường. Planner thử theo thứ tự và lấy kiểu ĐẦU TIÊN dựng được; kiểu nào +# không dựng được thì rơi xuống kiểu kế tiếp, KHÔNG bao giờ biến thành lỗi: +# 1. direct_entry — một cung hội tụ vào trục goal rồi đi thẳng vào. Một chiều +# chạy, không dừng, không xoay. Rẻ nhất khi chạy. +# 2. single_cusp — cua rời XA dock tới điểm đổi chiều (cusp) rồi lùi thẳng vào. +# Lấn thêm chỗ về phía xa dock đúng bằng quãng phải đi ra. +# 3. straight_pivot_straight — một đoạn thẳng, một cú XOAY TẠI CHỖ ghi tường +# minh vào path (một khối pose cùng vị trí, yaw tăng dần), rồi một đoạn +# thẳng vào goal. Điểm xoay nằm GIỮA robot và dock nên KHÔNG lấn thêm một +# mét nào, đổi lại có thêm một lần dừng để xoay. +# Thứ tự ưu tiên giữa 2 và 3 do `kinematics/model` và `maneuver/*` quyết định — +# xem comment của từng khoá. +# Đoạn cuối của cả ba kiểu luôn THẲNG và trùng hướng yaw của goal: robot phải đạt +# đúng hướng trước khi chui vào dock — đi cong vào gầm trolley rất dễ va. +# +# Mép nào của robot áp vào dock được SUY RA theo từng lần lập plan, dựa vào phía +# robot đang đứng so với goal. Không khai báo bằng tham số: +# robot ở phía +X của goal -> lead-in đi TIẾN, đoạn cuối đi LÙI +# (mép sau áp dock: càng nâng chui vào pallet) +# robot ở phía -X của goal -> lead-in đi LÙI, đoạn cuối đi TIẾN +# (mép trước áp dock: chấu sạc ở đầu xe) +# Suy được như vậy vì goal đã được offset sẵn từ tầng trên, sao cho base_link +# dừng đúng tại goal khi manơ hoàn tất. +# +# Kiểm tra va chạm / vùng trống CỐ Ý chưa cấu hình ở đây: DockPlanner hiện chỉ +# sinh hình học. Đừng thêm cost_threshold, allow_unknown hay check_free_space +# cho tới khi phần kiểm va chạm được hiện thực. +DockPlanner: + # Thư viện Boost.DLL chứa symbol export tên "DockPlanner". + library_path: libdock_planner + + # ══════════════════════════════════════════════════════════════════════════════ + # ĐỘNG HỌC — khoá nào có tác dụng phụ thuộc `model`. Khoá của model KIA được + # đọc vào nhưng KHÔNG dùng và KHÔNG kiểm tra, nên để lại giá trị cũ vô hại. + # + # khoá ackermann differential + # ───────────────────────────── ─────────── ──────────── + # front_axle_frame DÙNG bỏ qua + # rear_axle_frame DÙNG bỏ qua + # max_steering_angle DÙNG bỏ qua + # minimum_turning_radius bỏ qua DÙNG + # ══════════════════════════════════════════════════════════════════════════════ + kinematics: + # Mô hình dẫn động. Quyết định planner ĐO hay ĐỌC bán kính cua nhỏ nhất, và + # robot có được xoay tại chỗ hay không. + # ackermann — có trục lái. R_min được ĐO: wheel_base lấy từ TF hai frame + # trục bánh, chia cho tan(max_steering_angle). Robot không + # đổi được hướng nếu không di chuyển. + # differential — hai bánh chủ động độc lập. KHÔNG có trục lái nên KHÔNG tra + # TF trục bánh. R_min ĐỌC thẳng từ minimum_turning_radius. + # ► Chỉnh: để nhầm `ackermann` cho robot vi sai thì plugin KHÔNG NẠP ĐƯỢC — + # nó đi tra frame `steer_link` mà robot vi sai không hề có. + model: differential + + # ── chỉ có tác dụng khi model: ackermann ───────────────────────────────────── + + # Hai frame trục bánh, dùng để ĐO wheel_base từ TF. Phải trùng cặp frame + # StanleyControl đang dùng, lệch là bán kính cua tính ra sai. + front_axle_frame: "steer_link" + rear_axle_frame: "base_link" + + # [rad] Góc lái lớn nhất của mô hình xe đạp tương đương khi đang chạy. + # PHẢI đo trên robot thật. KHÔNG phải tick servo, KHÔNG phải góc vô lăng, + # cũng KHÔNG phải góc pivot tại chỗ. + # R_min = wheel_base / tan(góc này). + # Khai lớn hơn thực tế -> sinh cung robot bám không nổi, robot lệch path. + # Khai nhỏ hơn thực tế -> đường vòng rộng, tốn không gian. + max_steering_angle: 0.5 + + # ── chỉ có tác dụng khi model: differential ────────────────────────────────── + + # [m] Bán kính cua nhỏ nhất, khai trực tiếp vì robot vi sai không có góc lái. + # 0 — CHO PHÉP xoay tại chỗ. Đây là giá trị bình thường của robot vi sai, + # và nó bật kiểu đường 3 (thẳng + xoay + thẳng) làm kiểu CHÍNH: kiểu + # này không lấn thêm một mét nào về phía xa dock. + # > 0 — CẤM xoay tại chỗ (ví dụ đang chở tải cao, xoay tại chỗ dễ đổ). + # Planner quay về dùng cung y như ackermann, bán kính tối thiểu đúng + # bằng số này, và kiểu 3 chỉ còn bật qua pivot_fallback_extension. + minimum_turning_radius: 1.0 + + maneuver: + # [m] Cusp đặt cách điểm xuất phát ít nhất khoảng này, đo theo hướng RỜI XA + # dock. Bảo đảm luôn có đoạn lead-in thật trước khi đổi chiều, thay vì cusp + # trùng ngay vị trí robot. + minimum_forward_distance: 0.25 + + # [m] Cusp phải nằm xa hơn khoảng này so với điểm xuất phát thì kiểu 2 bị + # LOẠI (không phải fail): planner chuyển sang kiểu khác, chỉ khi không kiểu + # nào dựng được mới trả lỗi. + # Tăng lên nếu robot đứng lệch nhiều mà vẫn muốn giữ đường có cusp; giảm + # xuống để đẩy sớm sang kiểu 3. + maximum_forward_extension: 0.5 + + # [m] Bật kiểu 1 (direct_entry — một cung hội tụ vào trục goal rồi đi thẳng + # vào, giữ nguyên một chiều chạy) khi khoảng chỗ còn lại cho cung — khoảng + # cách dọc trục từ robot tới goal trừ độ dài đoạn thẳng cuối — vượt số này. + # Bán kính cung VẪN bị kiểm với R_min. Trượt phép kiểm nào thì rơi xuống + # kiểu sau, nên khoá này chỉ có thể BỚT một lần đổi chiều, không bao giờ thêm. + # 0 = tắt hẳn kiểu 1. + direct_entry_min_curve_room: 0.3 + + # [m] Chuyển từ kiểu 2 (cusp) sang kiểu 3 (thẳng + xoay + thẳng) khi cusp bắt + # robot chạy RA XA dock thêm quá số này, đo từ chỗ robot ĐANG ĐỨNG. + # So sánh cố ý là TƯƠNG ĐỐI. Lấy một con số tuyệt đối kiểu "chiều sâu lối đi" + # rồi so với vị trí robot là tính cả chỗ robot đang đứng vào phần "cần thêm", + # và mọi manơ xuất phát từ khoảng cách bình thường đều bị loại sạch. + # 0 — TẮT hẳn kiểu 3 (hành vi cũ, luôn lập đường có cusp). + # nhỏ hơn — chuyển sang xoay tại chỗ sớm hơn: tiết kiệm lối đi, thêm 1 lần dừng. + # lớn hơn — ưu tiên cusp: chạy mượt hơn, chiếm nhiều lối đi hơn. + # ⚠ Chỉ khai > 0 khi CHẮC robot xoay tại chỗ được quanh base_link. + # KHÔNG có tác dụng khi model=differential VÀ minimum_turning_radius=0 — lúc + # đó kiểu 3 đã là kiểu chính rồi, không cần ngưỡng nào bật nó. + pivot_fallback_extension: 1.2 + + # [m] Khoảng hở giữa vòng tròn thân robot quét khi xoay tại chỗ và mặt gần + # của dock. Áp dụng cho CẢ HAI model, mỗi khi kiểu 3 được dùng. + # Xoay tại chỗ quay MỌI điểm footprint quanh base_link, nên kích thước phải + # tính là BÁN KÍNH NGOẠI TIẾP, luôn lớn hơn phần nhô mép dùng cho đoạn thẳng + # cuối. Ví dụ footprint 1.65/0.35 x ±0.40: ngoại tiếp 1.698 m trong khi mép + # sau chỉ 0.35 m — chênh 1.35 m. + # Điểm xoay đặt tại: max(độ dài đoạn thẳng cuối, ngoại tiếp + nửa thân dock + # phía tiếp cận + số này). + # Tăng lên: điểm xoay lùi ra xa dock hơn, an toàn hơn. Tăng quá thì điểm xoay + # vượt qua chỗ robot đứng, kiểu 3 bị loại và planner quay về cusp. + pivot_safety_margin: 0.15 + + terminal: + # [m] Khoảng hở CỘNG THÊM cho đoạn thẳng cuối, ngoài phần thân robot nhô ra ở + # mép áp dock (rear_extent khi đoạn cuối đi lùi, front_extent khi đi tiến) và, + # nếu dock_anchor=center, ngoài nửa thân dock phía tiếp cận. + # Tăng lên nếu thấy robot dừng quá sát dock. + reverse_distance_padding: 0.0 + + # [m] Độ dài đoạn thẳng cuối MONG MUỐN. Giá trị thực tế là + # max(giá trị này, phần nhô mép áp dock + nửa thân dock + padding), nên đặt 0 + # là chỉ dùng khoảng hở tối thiểu. + # Tăng lên thì robot có quãng thẳng dài hơn để chỉnh hết sai số hướng trước + # khi vào dock, ĐỔI LẠI ăn vào chỗ dành cho cung, nên đặt lớn quá sẽ đẩy plan + # sang kiểu có cusp hoặc kiểu xoay tại chỗ. + straight_length: 0.4 + + sampling: + # [m] Khoảng cách lớn nhất giữa hai điểm liên tiếp trên đường, áp dụng cho cả + # đoạn cung lẫn đoạn thẳng. Nhỏ hơn = đường mượt hơn nhưng nhiều điểm hơn. + path_point_spacing: 0.05 + + # footprint_dock và dock_anchor KHÔNG khai ở đây. move_base2 chọn theo từng + # marker rồi rót vào namespace này trước khi khởi tạo plugin. + # + # dock_anchor: 'center' (mặc định) — goal nằm ở tâm dock; nửa thân dock phía + # tiếp cận (lấy từ footprint_dock) được cộng vào khoảng hở cusp. + # 'face' — goal đã nằm sẵn trên mặt tiếp cận; footprint_dock bị bỏ qua. diff --git a/config/runtime/hybrid_local_planner_params.yaml b/config/runtime/hybrid_local_planner_params.yaml new file mode 100644 index 0000000..dd2567c --- /dev/null +++ b/config/runtime/hybrid_local_planner_params.yaml @@ -0,0 +1,540 @@ +LocalPlannerAdapter: + library_path: liblocal_planner_adapter + yaw_goal_tolerance: 0.017 + xy_goal_tolerance: 0.03 + min_approach_linear_velocity: 0.06 + +# HybridLocalPlanner — local planner lai Pure Pursuit + DWA. +# +# Phân vai rõ giữa hai tầng: +# - DWA quyết định VẬN TỐC TIẾN: lấy mẫu quỹ đạo, chấm điểm theo vật cản, +# khoảng cách tới path và tới goal. Nó cũng là tầng duy nhất ra được lệnh +# xoay tại chỗ (v = 0, omega khác 0). +# - Pure Pursuit chỉ ĐÁNH LÁI: omega = |v| * pp_weight_omega * sin(err) / lookahead. +# Luật này suy biến ở v = 0 nên dưới pp_min_steering_velocity quyền quay được +# trả về cho DWA. +# +# Khi vật cản chắn path, latch né vật cản bật lên: DWA lái một mình (bỏ path cost), +# Pure Pursuit bị bỏ qua, trần vận tốc hạ về avoidance_max_velocity. +# +# Bật log để soi luồng đó: xem nhóm "Debug" ở cuối file. +HybridLocalPlanner: + library_path: libhybrid_local_planner + + # ===== Giới hạn vận tốc ===== + max_forward_velocity: 1.0 # [m/s] trần vận tốc tiến khi bám path + max_reverse_velocity: 0.25 # [m/s] trần vận tốc lùi, ghi bằng ĐỘ LỚN DƯƠNG + avoidance_max_velocity: 0.4 # [m/s] trần vận tốc khi đang né vật cản. Thấp hơn + # max_forward_velocity để còn kịp phanh trong không gian hẹp + max_angular_velocity: 0.6 # [rad/s] trần tốc độ quay + min_velocity: 0.0 # [m/s] sàn của cửa sổ động DWA. Đặt khác 0 là ép robot + # không bao giờ được đứng yên — nguy hiểm + min_yawrate: 0.05 # [rad/s] độ lớn quay tối thiểu khi DWA đã quyết định quay. + # Dưới ngưỡng này servo không thắng nổi ma sát tĩnh + + # ===== Giới hạn gia tốc — CÓ HAI TẦNG, đừng nhầm ===== + # Tầng cửa sổ DWA (acc_lim_*, decel_lim_x): dựng dải vận tốc mà bộ lấy mẫu + # ĐƯỢC PHÉP cân nhắc. Đây là thứ quyết định DWA nghĩ tới những lệnh nào. + # Tầng kẹp đầu ra (output_acc_lim_*): kẹp lệnh cuối so với vận tốc đo từ odom, + # chạy ở cuối mỗi chu kỳ. Đây là thứ quyết định bánh xe bị yêu cầu đổi gấp đến đâu. + # Để tầng cửa sổ chặt hơn tầng đầu ra (như bản đang chạy) thì DWA tự giới hạn + # trước, tầng đầu ra gần như không cắn. Đặt ngược lại thì lệnh bị cắt SAU khi + # đã chấm điểm — DWA chọn một đằng, robot chạy một nẻo. Code sẽ cảnh báo nếu vậy. + acc_lim_x: 0.5 # [m/s^2] cửa sổ DWA, tăng tốc + decel_lim_x: 0.5 # [m/s^2] cửa sổ DWA, giảm tốc (độ lớn dương) + acc_lim_theta: 3.2 # [rad/s^2] cửa sổ DWA, gia tốc góc + output_acc_lim_x: 1.0 # [m/s^2] kẹp đầu ra, tịnh tiến + output_acc_lim_theta: 2.0 # [rad/s^2] kẹp đầu ra, quay. Ở 20 Hz, giá trị 2.0 + output_decel_lim_theta: 6.0 # [rad/s^2] kẹp đầu ra khi lệnh quay đi VỀ PHÍA 0. + # Cùng lý do với output_decel_lim_x, và cùng kiểu hỏng khi thiếu: + # gần goal planner đòi -0.222 rad/s trong khi robot đang quay + # +0.59, giới hạn đối xứng 2.0 xuất ra +0.490 — robot quay SAI + # CHIỀU suốt 8 chu kỳ và sai số yaw tăng gấp đôi trước khi gỡ được. + # Giảm |omega| luôn khả thi về vật lý (ma sát giúp), nên số này + # đặt cao hơn hẳn giới hạn tăng tốc được + output_decel_lim_x: 2.0 # [m/s^2] kẹp đầu ra khi lệnh đi VỀ PHÍA 0 (đang phanh). + # Tách riêng khỏi output_acc_lim_x có chủ đích: giới hạn tăng tốc + # là chuyện êm ái, giới hạn giảm tốc là chuyện robot có dừng được + # hay không. Một giới hạn đối xứng đã từng TỪ CHỐI lệnh phanh — + # creep clamp đòi 0.40 m/s, tầng kẹp xuất ra 1.37 m/s và robot + # vọt qua goal. Phải LỚN HƠN output_acc_lim_x, nhưng đừng đặt vô + # cùng lớn: lệnh nhảy từ tốc độ cao về 0 trong một chu kỳ làm + # xê dịch hàng đang chở + brake_margin: 0.15 # [m] biên trừ vào quãng đường còn lại trước khi tính trần phanh + # trong DWA. Bù thời gian phản ứng một chu kỳ và dung sai goal + # cho phép omega đổi 0.1 rad/s mỗi chu kỳ + + # ===== Quay tại chỗ ===== + max_in_place_angular_velocity: 0.6 # [rad/s] trần tốc độ quay tại chỗ + min_in_place_angular_velocity: 0.3 # [rad/s] sàn tốc độ quay tại chỗ. Phải <= trần, + # nếu lớn hơn thì validate() tự hạ xuống và cảnh báo + + # ===== Hình học robot và kiểm va chạm ===== + min_turn_radius: 0.0 # [m] bán kính cua nhỏ nhất. 0 = không ràng buộc (vi sai). + # Khác 0 sẽ kẹp omega theo |v| / min_turn_radius + robot_radius: 0.1 # [m] bán kính robot, CHỈ dùng khi use_footprint = false + footprint_padding: 0.07 # [m] nới footprint ra mọi phía để có biên an toàn. + # Tăng = an toàn hơn nhưng khe hẹp sẽ bị coi là chặn. + # Mỗi 0.01 ở đây là 0.02 bề rộng khe cần thêm + use_footprint: true # true = kiểm va chạm theo footprint đa giác; + # false = coi robot là hình tròn bán kính robot_radius + turn_around_priority: true # true = khi lệch hướng quá lớn thì dừng hẳn (v = 0) và + # xoay cho đúng hướng trước, thay vì vừa đi vừa lượn + + # ===== Dung sai goal ===== + xy_goal_tolerance: 0.02 # [m] sai số vị trí chấp nhận là đã tới goal + yaw_goal_tolerance: 0.02 # [rad] sai số góc chấp nhận là đã tới goal + goal_yaw_gain: 1.0 # [1/s] hệ số tỉ lệ của pha xoay cuối: omega = gain * sai_số_yaw. + # Trước đây ngầm định 1.0 và không chỉnh được từ config. Bộ P + # thuần nối vào một tầng giới hạn tốc độ thay đổi là công thức + # kinh điển của dao động — còn lắc thì HẠ số này trước tiên + goal_yaw_deadband: 0.05 # [rad/s] vùng chết của pha xoay cuối: lệnh nhỏ hơn ngưỡng này + # bị ĐẨY RA bằng ngưỡng, để servo thắng được ma sát tĩnh. + # Chỉ áp khi sai số yaw còn NGOÀI yaw_goal_tolerance; trong dung + # sai thì lệnh bằng 0, nếu không robot vẫn bị bảo quay tiếp sau + # khi đã tới nơi. + # Đặt rộng hơn nhiều so với yaw_goal_tolerance là gây vọt góc + + # ===== Lấy mẫu path toàn cục ===== + max_global_plan_lookahead_dist: 4.0 # [m] chỉ lấy phần path trong tầm này để bám. + # Ngắn = bám sát nhưng cua gấp; dài = mượt nhưng cắt cua + global_plan_viapoint_sep: 0.5 # [m] khoảng cách tối thiểu giữa hai điểm trung gian + # trích từ path. Lúc chạy lấy max(|v|, giá trị này) + global_plan_goal_sep: 0.05 # [m] lấy mẫu dày hơn ở đoạn sát goal + + # ===== Mô phỏng quỹ đạo của DWA ===== + predict_time: 1.5 # [s] DWA mô phỏng quỹ đạo ứng viên trước bao lâu + sim_period: 0.1 # [s] bước thời gian dùng khi dựng cửa sổ động + sim_time_samples: 10 # số bước mô phỏng trên mỗi quỹ đạo. Bước không gian + # xấp xỉ v * predict_time / sim_time_samples — ở v = 0.4 + # là 0.12 m, tức LỚN HƠN một ô costmap: quỹ đạo có thể + # bước qua vật cản mỏng. Tăng số này để bắt được vật mỏng, + # đổi lại tốn CPU tuyến tính + dwa_arrival_distance: 0.05 # [m] dưới cự ly này tới goal cục bộ, DWA thôi lấy mẫu + # quỹ đạo chạy và chuyển sang xoay tại chỗ + dwa_in_place_turn_angle: 3.1416 # [rad] lệch hướng phải VƯỢT ngưỡng này thì DWA mới dừng + # xoay tại chỗ trước khi đi. Đặt >= pi (giá trị hiện tại) + # là TẮT hẳn nhánh đó — đúng như hành vi cũ. Hạ xuống + # (ví dụ 0.8) nếu muốn robot xoay cho thẳng hướng rồi mới chạy + + # ===== Pure Pursuit (chỉ đánh lái) ===== + pp_weight_omega: 1.5 # hệ số nhân sai lệch hướng ra tốc độ quay. + # Tăng = bám cua gắt hơn nhưng dễ dao động quanh path + pp_min_steering_velocity: 0.05 # [m/s] dưới ngưỡng này Pure Pursuit KHÔNG được ghi đè omega. + # Luật lái của nó là omega = |v| * pp_weight_omega * sin(err) / lookahead, + # ở v = 0 nó suy biến (không tồn tại bán kính cong) và luôn trả 0, + # nuốt mất lệnh xoay tại chỗ của DWA -> robot tự khoá: không quay + # được vì không chạy, không chạy được vì không quay. + # Trong dải này quyền quay trả về cho DWA. + # Đặt 0 = tắt bảo vệ, quay lại hành vi cũ (dễ kẹt). + # Đặt quá cao = PP hiếm khi lái, robot bám path kém hơn + pp_reference_gain: 2.0 # trọng số của số hạng |omega_ứng_viên − omega_PurePursuit|, + # nhân thêm (1 − b). Pure Pursuit KHÔNG còn ghi đè lệnh; nó chỉ + # nêu ý kiến, DWA chấm điểm ứng viên theo độ gần với ý kiến đó. + # Nhờ vậy lệnh xuất ra luôn là một quỹ đạo ĐÃ được chấm điểm va + # chạm — bản cũ để omega của PP đi thẳng ra bánh, không qua kiểm. + # 0 = bỏ hẳn ảnh hưởng của PP. Tăng = bám path sát hơn khi đường + # trống, nhưng không bao giờ vượt được độ phân giải yawrate_samples + pp_min_lookahead: 0.3 # [m] SÀN cho cự ly nhìn trước khi dựng tham chiếu lái. + # Luật lái mang 1/L, nên khi điểm nhìn trước bị "ăn" hết lúc + # sát goal thì hệ số từ sai số hướng ra độ cong PHÂN KỲ. + # Đo thật: ở L = 0.06 m, sai số 0.9 độ cho ra 0.44 rad/s và + # tham chiếu ĐỔI DẤU theo nhiễu cảm biến — đó chính là hiện + # tượng đánh lái lắc qua lại ở 20 cm cuối + pp_reference_min_distance: 0.5 # [m] dưới cự ly này tới cuối chặng thì TẮT HẲN tham chiếu. + # Bám path không còn gì để nói ở đó — việc duy nhất còn lại là + # đi vào goal — và tham chiếu dựng từ một điểm nhìn trước đã + # nằm dưới bụng robot chỉ là nhiễu + + # ===== Trọng số hàm cost của DWA ===== + obs_cost_gain: 1.3 # phạt tiến gần vật cản + path_cost_gain: 2.5 # phạt lệch khỏi path toàn cục. Đây là khoá giữ robot + # trong lòng đường; giảm mạnh là robot cắt cua và men mép khe + to_goal_cost_gain: 0.8 # thưởng cho quỹ đạo tiến gần goal + speed_cost_gain: 0.5 # thưởng cho quỹ đạo chạy nhanh + + # ===== Cảm nhận vật cản ===== + obs_range: 2.5 # [m] bán kính quét vật cản quanh robot + + # ===== Ngưỡng hành vi ===== + segment_transition_threshold: 0.01 # [m] ngưỡng coi là đã tới hết một chặng path + use_obstacle_avoidance: true # false = tắt latch né vật cản, chỉ chạy Pure Pursuit bám path + # ===== Hoà trộn bám path <-> né vật cản (KHÔNG còn chế độ nhị phân) ===== + # Toàn bộ quyết định gói trong MỘT số: b = mức độ path phía trước bị chắn. + # b = 0 path thông -> path cost đủ trọng số, obs cost = 0, DWA bám sát omega của Pure Pursuit + # b = 1 path bị chắn -> path cost = 0, obs cost đủ trọng số, bỏ qua Pure Pursuit + # Hai đầu tái lập ĐÚNG hai chế độ cũ. Khác biệt là ở giữa giờ mới có gì đó. + # + # b tính lại mỗi chu kỳ từ costmap, KHÔNG lưu trạng thái — nên không còn latch, + # không còn hai bộ tham số phải luân phiên set. + blend_start_distance: 3.0 # [m] vật cản xa hơn ngưỡng này thì coi như không có (b = 0) + blend_end_distance: 3.0 # [m] vật cản gần hơn ngưỡng này thì coi như chắn hẳn (b = 1). + # ĐỂ BẰNG blend_start_distance là b thành bậc nhảy, tái lập + # CHÍNH XÁC hành vi latch cũ — đây là cấu hình dùng để chứng minh + # refactor không đổi kết quả. Hạ xuống (vd 1.0) để có vùng + # chuyển tiếp mượt: robot bắt đầu né sớm và nhẹ thay vì giật + use_avoidance_velocity_limit: false # true = khi path bị chắn thì hạ trần về avoidance_max_velocity + # (fleet set 1.0 nhưng đang né thì chạy 0.4) + # false = GIỮ NGUYÊN vận tốc fleet đang set, để một mình hàm cost + # lo việc né. Cost blend không đổi trong cả hai trường hợp — + # cờ này CHỈ quyết định có kẹp tốc độ hay không. + # Đặt false khi muốn né mà không mất thời gian, đổi lại quỹ đạo né + # ở tốc độ cao cần cửa sổ động rộng hơn mới lách được + creep_distance: 0.8 # [m] cự ly tới cuối chặng mà vùng bò chậm bắt đầu. + # Ngưỡng THỰC = max(giá trị này, quãng phanh + creep_margin), + # nên nó chỉ NỚI RA theo tốc độ, không bao giờ thu lại: dưới + # khoảng 0.9 m/s thì số cố định thắng và hành vi y như cũ, còn + # ở tốc độ cao nó cắn đủ sớm để phanh kịp. + # Thu nhỏ số này là mất luôn cái sàn giữ robot không chết đứng + # trước goal + creep_margin: 0.3 # [m] cộng thêm vào quãng phanh khi tính ngưỡng + creep_max_velocity: 0.4 # [m/s] trần trong vùng bò chậm (độ lớn, dùng cho cả hai chiều) + creep_min_velocity: 0.05 # [m/s] sàn trong vùng bò chậm khi tiến — giữ robot không đứng + # lại trước goal + creep_min_velocity_reverse: 0.01 # [m/s] sàn khi lùi (độ lớn). Nhỏ hơn chiều tiến, giữ đúng số cũ + curve_max_velocity: 0.3 # [m/s] trần vận tốc khi đang trong khúc cua + reject_collisions_always: false # false = chỉ loại quỹ đạo va chạm khi b > 0 (HÀNH VI CŨ). + # Lưu ý: nghĩa là khi bám path DWA KHÔNG loại quỹ đạo va chạm + # nào cả, chỉ dựa vào b để né. true = loại mọi lúc, an toàn hơn + # nhưng ĐỔI kết quả solve của chế độ bám path + velocity_samples: 10 # số mẫu vận tốc trong cửa sổ động. Cũ: 10 khi bám path thẳng, + # 7 khi cua và khi né. Cửa sổ rộng <= 0.06 m/s nên chênh lệch + # giữa 7 và 10 là ~5 mm/s, không đo được + yawrate_samples: 20 # số mẫu tốc độ quay cho mỗi mức vận tốc. Đây là thứ quyết định + # omega chọn được bám sát omega của Pure Pursuit đến đâu: + # sai lệch tối đa = bề rộng cửa sổ quay / yawrate_samples + # để robot vẫn xoay được khi đang bò chậm + turn_direction_th: 0.1 # [rad] ngưỡng lệch hướng tối thiểu để DWA coi là cần rẽ + + # ===== Bảo vệ TF plan -> global ===== + # Mỗi lần AMCL sửa vị trí, transform map->odom dịch vài cm. Robot đứng yên + # nhưng CẢ PATH bị dịch dưới chân nó, nên Pure Pursuit thấy error_angle nhảy + # bậc và DWA thấy path cost nhảy bậc — đó là hiện tượng lắc khi bám path. + # Đóng băng transform trong suốt một chặng làm mất cú dịch đó; robot bám hoàn + # toàn trong frame liên tục (odom). Kiểm va chạm KHÔNG bị ảnh hưởng vì local + # costmap vẫn nằm ở frame liên tục với dữ liệu cảm biến sống. + plan_tf_freeze: false # true = chốt transform cho cả chặng khi nó đã yên. + # Bật lên chỉ sau khi đã chạy thử — xem ghi chú + # freeze_settle_cycles bên dưới + freeze_settle_cycles: 30 # [chu kỳ] số chu kỳ YÊN liên tiếp trước khi chốt. + # PHẢI phủ >= 2 lần chu kỳ cập nhật định vị: AMCL 2 Hz + # với vòng điều khiển 20 Hz là >= 20 chu kỳ. Ngắn hơn thì + # cửa sổ rơi lọt giữa hai lần hiệu chỉnh — ở đó transform + # hằng số THEO ĐỊNH NGHĨA — và sẽ chốt ngay trước một + # hiệu chỉnh đang tới + freeze_settle_eps_xy: 0.005 # [m] bước dịch mỗi chu kỳ dưới ngưỡng này coi là yên + freeze_settle_eps_yaw: 0.005 # [rad] bước quay mỗi chu kỳ dưới ngưỡng này coi là yên + freeze_settle_timeout: 3.0 # [s] hết hạn mà chưa yên thì chốt luôn giá trị mới nhất, + # kèm cảnh báo. Bản đồ nhảy liên tục chính là điều kiện + # mà freeze sinh ra để trị; để sống tiếp là lắc cả chặng + tf_cache_max_age: 0.5 # [s] lookup lỗi thì lái tiếp trên transform đã cache tới + # ngần này rồi mới từ chối ra lệnh. Đặt 0 = dừng ngay khi + # trượt một nhịp TF, gây phanh nhấp khi publisher chập chờn + + # ===== Debug ===== + # Nhóm khoá bật log chẩn đoán [DBG-HYBRID-*]. Cùng quy ước với priest_local_planner: + # mức càng cao log càng dày, KHÔNG đổi hành vi điều khiển. + # 0 = tắt hẳn (mặc định, dùng khi chạy thật) + # 1 = chỉ log sự kiện đổi trạng thái (đổi hướng tiến/lùi, bật/tắt latch né vật cản, + # DWA trả lệnh 0, ô costmap nào chặn đường) + # 2 = mức 1 + log định kỳ 1 Hz cho từng chỗ ghi (không chỗ nào bị bỏ đói) + # 3 = in mọi chu kỳ điều khiển — chỉ dùng khi bắt lỗi ngắn, rất nặng I/O + debug_level: 0 + # Các khoá dưới bật/tắt từng nhóm log, chỉ có tác dụng khi debug_level >= 1. + debug_command: true # [DBG-HYBRID-CMD] pose, lệnh cuối (v, omega), tầng kẹp gia tốc, kẹp bò chậm + debug_dwa: true # [DBG-HYBRID-DWA] output thô của DWA, hồ sơ cost và số mẫu khi đổi chế độ + debug_purepursuit: true # [DBG-HYBRID-PP] error_angle, lookahead, và omega mà PP ghi đè lên DWA + debug_mode: true # [DBG-HYBRID-MODE] đổi hướng tiến/lùi, xong căn hướng đầu, đạt xy_goal + debug_collision: true # [DBG-HYBRID-OBS] swapPlan/checkObstacles: chặn ở pose nào, ô costmap nào, cost bao nhiêu + debug_goal: true # [DBG-HYBRID-GOAL] khoảng cách tới goal, sai lệch yaw, các cờ đã latch + debug_tf: true # [DBG-HYBRID-TF] chốt/nhả đóng băng, độ lệch transform, lái trên cache + debug_path: true # [DBG-HYBRID-PATH] bám path: cross-track có dấu (+ = robot lệch TRÁI so với + # chiều đi của path), sai lệch hướng so với tiếp tuyến path, cự ly còn lại + # tới cuối chặng, và ngưỡng chuyển chặng. Đây là dòng để trả lời "robot có + # bám path không" và "chuyển chặng có đúng ở cusp không". + +# ================================================================================================= +# HybridDockingLocalPlanner — CÙNG planner, instance RIÊNG cho chặng docking. +# +# move_base2 cache instance controller theo TÊN; tên truyền vào initialize() quyết định block YAML +# mà instance đó đọc. Các block YAML KHÔNG kế thừa nhau: khoá thiếu ở đây rơi về default C++, KHÔNG +# rơi về block HybridLocalPlanner. Vì vậy đây là BẢN SAO ĐẦY ĐỦ, chỉ khác ở các dòng ghi `[DOCK]`. +# +# Thêm khoá mới vào block HybridLocalPlanner thì PHẢI thêm cả vào đây, nếu không chặng docking sẽ +# âm thầm chạy default C++ cho khoá đó. +# +# Các giá trị `[DOCK]` dưới đây là ĐIỂM XUẤT PHÁT, chưa đo trên robot thật. +# ================================================================================================= +HybridDockingLocalPlanner: + library_path: libhybrid_local_planner + + # ===== Giới hạn vận tốc ===== + max_forward_velocity: 0.25 # [DOCK] vào dock chậm để sai số vị trí không tích luỹ + max_reverse_velocity: 0.2 # [DOCK] lùi ra khỏi dock chậm hơn nữa + avoidance_max_velocity: 0.2 # [DOCK] nếu có né thì phải rất chậm — nhưng xem use_obstacle_avoidance dưới + # max_forward_velocity để còn kịp phanh trong không gian hẹp + max_angular_velocity: 0.6 # [rad/s] trần tốc độ quay + min_velocity: 0.0 # [m/s] sàn của cửa sổ động DWA. Đặt khác 0 là ép robot + # không bao giờ được đứng yên — nguy hiểm + min_yawrate: 0.05 # [rad/s] độ lớn quay tối thiểu khi DWA đã quyết định quay. + # Dưới ngưỡng này servo không thắng nổi ma sát tĩnh + + # ===== Giới hạn gia tốc — CÓ HAI TẦNG, đừng nhầm ===== + # Tầng cửa sổ DWA (acc_lim_*, decel_lim_x): dựng dải vận tốc mà bộ lấy mẫu + # ĐƯỢC PHÉP cân nhắc. Đây là thứ quyết định DWA nghĩ tới những lệnh nào. + # Tầng kẹp đầu ra (output_acc_lim_*): kẹp lệnh cuối so với vận tốc đo từ odom, + # chạy ở cuối mỗi chu kỳ. Đây là thứ quyết định bánh xe bị yêu cầu đổi gấp đến đâu. + # Để tầng cửa sổ chặt hơn tầng đầu ra (như bản đang chạy) thì DWA tự giới hạn + # trước, tầng đầu ra gần như không cắn. Đặt ngược lại thì lệnh bị cắt SAU khi + # đã chấm điểm — DWA chọn một đằng, robot chạy một nẻo. Code sẽ cảnh báo nếu vậy. + acc_lim_x: 0.1 # [m/s^2] cửa sổ DWA, tăng tốc + decel_lim_x: 0.5 # [m/s^2] cửa sổ DWA, giảm tốc (độ lớn dương) + acc_lim_theta: 3.2 # [rad/s^2] cửa sổ DWA, gia tốc góc + output_acc_lim_x: 1.0 # [m/s^2] kẹp đầu ra, tịnh tiến + output_acc_lim_theta: 2.0 # [rad/s^2] kẹp đầu ra, quay. Ở 20 Hz, giá trị 2.0 + output_decel_lim_theta: 6.0 # [rad/s^2] kẹp đầu ra khi lệnh quay đi VỀ PHÍA 0. + # Cùng lý do với output_decel_lim_x, và cùng kiểu hỏng khi thiếu: + # gần goal planner đòi -0.222 rad/s trong khi robot đang quay + # +0.59, giới hạn đối xứng 2.0 xuất ra +0.490 — robot quay SAI + # CHIỀU suốt 8 chu kỳ và sai số yaw tăng gấp đôi trước khi gỡ được. + # Giảm |omega| luôn khả thi về vật lý (ma sát giúp), nên số này + # đặt cao hơn hẳn giới hạn tăng tốc được + output_decel_lim_x: 2.0 # [m/s^2] kẹp đầu ra khi lệnh đi VỀ PHÍA 0 (đang phanh). + # Tách riêng khỏi output_acc_lim_x có chủ đích: giới hạn tăng tốc + # là chuyện êm ái, giới hạn giảm tốc là chuyện robot có dừng được + # hay không. Một giới hạn đối xứng đã từng TỪ CHỐI lệnh phanh — + # creep clamp đòi 0.40 m/s, tầng kẹp xuất ra 1.37 m/s và robot + # vọt qua goal. Phải LỚN HƠN output_acc_lim_x, nhưng đừng đặt vô + # cùng lớn: lệnh nhảy từ tốc độ cao về 0 trong một chu kỳ làm + # xê dịch hàng đang chở + brake_margin: 0.15 # [m] biên trừ vào quãng đường còn lại trước khi tính trần phanh + # trong DWA. Bù thời gian phản ứng một chu kỳ và dung sai goal + # cho phép omega đổi 0.1 rad/s mỗi chu kỳ + + # ===== Quay tại chỗ ===== + max_in_place_angular_velocity: 0.6 # [rad/s] trần tốc độ quay tại chỗ + min_in_place_angular_velocity: 0.3 # [rad/s] sàn tốc độ quay tại chỗ. Phải <= trần, + # nếu lớn hơn thì validate() tự hạ xuống và cảnh báo + + # ===== Hình học robot và kiểm va chạm ===== + min_turn_radius: 0.0 # [m] bán kính cua nhỏ nhất. 0 = không ràng buộc (vi sai). + # Khác 0 sẽ kẹp omega theo |v| / min_turn_radius + robot_radius: 0.1 # [m] bán kính robot, CHỈ dùng khi use_footprint = false + footprint_padding: 0.07 # [m] nới footprint ra mọi phía để có biên an toàn. + # Tăng = an toàn hơn nhưng khe hẹp sẽ bị coi là chặn. + # Mỗi 0.01 ở đây là 0.02 bề rộng khe cần thêm + use_footprint: true # true = kiểm va chạm theo footprint đa giác; + # false = coi robot là hình tròn bán kính robot_radius + turn_around_priority: false # [DOCK] TẮT: dừng xoay giữa chặng làm gãy đường vào dock + # xoay cho đúng hướng trước, thay vì vừa đi vừa lượn + + # ===== Dung sai goal ===== + xy_goal_tolerance: 0.015 # [DOCK] dung sai vị trí chặt hơn nhiều so với chạy tự do + yaw_goal_tolerance: 0.03 # [DOCK] dung sai góc chặt hơn: lệch góc ở dock là lệch cả thân robot + goal_yaw_gain: 1.0 # [1/s] hệ số tỉ lệ của pha xoay cuối: omega = gain * sai_số_yaw. + # Trước đây ngầm định 1.0 và không chỉnh được từ config. Bộ P + # thuần nối vào một tầng giới hạn tốc độ thay đổi là công thức + # kinh điển của dao động — còn lắc thì HẠ số này trước tiên + goal_yaw_deadband: 0.05 # [rad/s] vùng chết của pha xoay cuối: lệnh nhỏ hơn ngưỡng này + # bị ĐẨY RA bằng ngưỡng, để servo thắng được ma sát tĩnh. + # Chỉ áp khi sai số yaw còn NGOÀI yaw_goal_tolerance; trong dung + # sai thì lệnh bằng 0, nếu không robot vẫn bị bảo quay tiếp sau + # khi đã tới nơi. + # Đặt rộng hơn nhiều so với yaw_goal_tolerance là gây vọt góc + + # ===== Lấy mẫu path toàn cục ===== + max_global_plan_lookahead_dist: 1.5 # [DOCK] đường vào dock ngắn; nhìn xa quá là cắt cua vào dock + # Ngắn = bám sát nhưng cua gấp; dài = mượt nhưng cắt cua + global_plan_viapoint_sep: 0.12 # [DOCK] [m] cự ly giữa các điểm ngắm lấy ra từ path — đây + # cũng chính là BỀ RỘNG CỬA SỔ LÀM MƯỢT của luật lái: mọi chỗ + # path đổi độ cong (khớp cung->thẳng) đều bị trung bình hoá trên + # đúng cự ly này, nên robot duỗi thẳng SỚM chừng đó khi ra cung. + # Đo 27/8 (sep 0.2): ra khớp nối mang herr -0.10 rad, lệch ngang + # phồng 3 -> 30 mm trên đoạn thẳng rồi hồi gần cả mét. + # Hạ 0.2 -> 0.12: khớp nối sắc hơn ~40%, gain hồi lệch tăng + # (mẫu số luật lái là cự ly RAW tới điểm ngắm — từ 27/8 không còn + # sàn 0.3 ghim nữa, khoá này mới thật sự điều khiển cửa sổ). + # + # LỊCH SỬ ĐO, đừng lặp lại: + # 26/8 sep 0.2 -> 0.3 khi mẫu số CÒN ghim 0.3: xấu đi ~50% + # (understeer thuần — 30cm cuối 31/23/17/13/10 -> 38/34/27/21/16 mm) + # ► Chỉnh: nhỏ hơn -> bám sát, phản ứng nhanh, dễ nhiễu khi + # localization rung; lớn hơn -> mượt, cắt góc ở khớp nối. + # Sàn cứng kCuspLegLookaheadFloor = 0.10 trong code chặn nổ 1/L. + # trích từ path. Lúc chạy lấy max(|v|, giá trị này) + global_plan_goal_sep: 0.05 # [m] lấy mẫu dày hơn ở đoạn sát goal + + # ===== Mô phỏng quỹ đạo của DWA ===== + predict_time: 1.0 # [DOCK] [s] DWA mô phỏng quỹ đạo ứng viên trước bao lâu. + # HẠ TỪ 3.0 ngày 27/8. Rollout giữ NGUYÊN (v, omega) suốt + # predict_time, nên ứng viên sửa lệch ngang (omega ~0.3 để + # về path) bị vẽ thành cung 0.9 rad văng xuyên qua path và + # path_cost phủ quyết — đo được: tham chiếu đòi omega +0.29 + # ...+0.42, DWA chỉ giao +0.09...+0.14, lệch 30 mm ở khớp + # cung->thẳng hồi gần cả mét. Ở tốc độ dock <=0.25 m/s, + # 3.0 s = chân trời 0.6-0.75 m trên chặng tổng 1.2 m. + # 1.0 s = 0.2 m: đủ thấy va chạm trước mặt, đủ ngắn để lệnh + # sửa lệch được chấm đúng bản chất tức thời của nó. + # ► Chỉnh: tăng nếu dock có vật cản động cần nhìn xa; + # giảm nữa thì cost nhìn quá gần, dễ dao động. + sim_period: 0.1 # [s] bước thời gian dùng khi dựng cửa sổ động + sim_time_samples: 10 # số bước mô phỏng trên mỗi quỹ đạo. Bước không gian + # xấp xỉ v * predict_time / sim_time_samples — ở v = 0.4 + # là 0.12 m, tức LỚN HƠN một ô costmap: quỹ đạo có thể + # bước qua vật cản mỏng. Tăng số này để bắt được vật mỏng, + # đổi lại tốn CPU tuyến tính + dwa_arrival_distance: 0.05 # [m] dưới cự ly này tới goal cục bộ, DWA thôi lấy mẫu + # quỹ đạo chạy và chuyển sang xoay tại chỗ + dwa_in_place_turn_angle: 3.1416 # [rad] lệch hướng phải VƯỢT ngưỡng này thì DWA mới dừng + # xoay tại chỗ trước khi đi. Đặt >= pi (giá trị hiện tại) + # là TẮT hẳn nhánh đó — đúng như hành vi cũ. Hạ xuống + # (ví dụ 0.8) nếu muốn robot xoay cho thẳng hướng rồi mới chạy + + # ===== Pure Pursuit (chỉ đánh lái) ===== + pp_weight_omega: 2.0 # hệ số nhân sai lệch hướng ra tốc độ quay. + # Tăng = bám cua gắt hơn nhưng dễ dao động quanh path + pp_min_steering_velocity: 0.05 # [m/s] dưới ngưỡng này Pure Pursuit KHÔNG được ghi đè omega. + # Luật lái của nó là omega = |v| * pp_weight_omega * sin(err) / lookahead, + # ở v = 0 nó suy biến (không tồn tại bán kính cong) và luôn trả 0, + # nuốt mất lệnh xoay tại chỗ của DWA -> robot tự khoá: không quay + # được vì không chạy, không chạy được vì không quay. + # Trong dải này quyền quay trả về cho DWA. + # Đặt 0 = tắt bảo vệ, quay lại hành vi cũ (dễ kẹt). + # Đặt quá cao = PP hiếm khi lái, robot bám path kém hơn + pp_reference_gain: 2.0 # trọng số của số hạng |omega_ứng_viên − omega_PurePursuit|, + # nhân thêm (1 − b). Pure Pursuit KHÔNG còn ghi đè lệnh; nó chỉ + # nêu ý kiến, DWA chấm điểm ứng viên theo độ gần với ý kiến đó. + # Nhờ vậy lệnh xuất ra luôn là một quỹ đạo ĐÃ được chấm điểm va + # chạm — bản cũ để omega của PP đi thẳng ra bánh, không qua kiểm. + # 0 = bỏ hẳn ảnh hưởng của PP. Tăng = bám path sát hơn khi đường + # trống, nhưng không bao giờ vượt được độ phân giải yawrate_samples + pp_min_lookahead: 0.3 # [m] SÀN cho cự ly nhìn trước khi dựng tham chiếu lái. + # Luật lái mang 1/L, nên khi điểm nhìn trước bị "ăn" hết lúc + # sát goal thì hệ số từ sai số hướng ra độ cong PHÂN KỲ. + # Đo thật: ở L = 0.06 m, sai số 0.9 độ cho ra 0.44 rad/s và + # tham chiếu ĐỔI DẤU theo nhiễu cảm biến — đó chính là hiện + # tượng đánh lái lắc qua lại ở 20 cm cuối + pp_reference_min_distance: 0.05 # [DOCK] [m] dưới cự ly này tới cuối chặng thì TẮT HẲN tham chiếu + # lái. Lý do tồn tại của khoá: điểm nhìn trước bị robot nuốt dần + # ở cuối chặng, mà luật lái mang 1/L nên khi L -> 0 thì gain nổ + # và dấu lật theo nhiễu cảm biến. + # + # ĐÃ HẠ TỪ 0.5 XUỐNG 0.05 ngày 26/8. Lý do: pp_min_lookahead + # (0.3 m) đã chặn đúng cái 1/L đó rồi, nên 0.5 không bảo vệ thêm + # gì — nó chỉ TẮT LÁI ở đúng đoạn cần lái nhất. Terminal vào dock + # dài 0.583 m, tức gần như toàn bộ đoạn chui vào dock chạy không + # có tham chiếu, chỉ còn path cost kéo về. Đo trong sim 26/8: + # lệch ngang 31 mm ngay lúc vào miệng dock, trong khi dock_calc + # dựng đường với padding = 0.000 m, tức không có biên nào để nuốt. + # + # ► Chỉnh: 0.05 m xấp xỉ MỘT pose (global_plan_goal_sep = 0.05), + # tức chỉ tắt khi thật sự không còn gì để bám. Thấy robot rung + # lái ở vài centimet cuối thì tăng dần lên 0.10–0.15, ĐỪNG quay + # lại 0.5. Cũng kiểm pp_min_lookahead trước khi đổ cho khoá này. + + # ===== Trọng số hàm cost của DWA ===== + obs_cost_gain: 1.3 # phạt tiến gần vật cản + path_cost_gain: 2.5 # phạt lệch khỏi path toàn cục. Đây là khoá giữ robot + # trong lòng đường; giảm mạnh là robot cắt cua và men mép khe + to_goal_cost_gain: 0.8 # thưởng cho quỹ đạo tiến gần goal + speed_cost_gain: 0.5 # thưởng cho quỹ đạo chạy nhanh + + # ===== Cảm nhận vật cản ===== + obs_range: 2.5 # [m] bán kính quét vật cản quanh robot + + # ===== Ngưỡng hành vi ===== + segment_transition_threshold: 0.01 # [m] ngưỡng coi là đã tới hết một chặng path + use_obstacle_avoidance: false # [DOCK] TẮT: latch né vật cản bỏ hẳn path cost, robot sẽ lệch khỏi đường vào dock + # ===== Hoà trộn bám path <-> né vật cản (KHÔNG còn chế độ nhị phân) ===== + # Toàn bộ quyết định gói trong MỘT số: b = mức độ path phía trước bị chắn. + # b = 0 path thông -> path cost đủ trọng số, obs cost = 0, DWA bám sát omega của Pure Pursuit + # b = 1 path bị chắn -> path cost = 0, obs cost đủ trọng số, bỏ qua Pure Pursuit + # Hai đầu tái lập ĐÚNG hai chế độ cũ. Khác biệt là ở giữa giờ mới có gì đó. + # + # b tính lại mỗi chu kỳ từ costmap, KHÔNG lưu trạng thái — nên không còn latch, + # không còn hai bộ tham số phải luân phiên set. + blend_start_distance: 3.0 # [m] vật cản xa hơn ngưỡng này thì coi như không có (b = 0) + blend_end_distance: 3.0 # [m] vật cản gần hơn ngưỡng này thì coi như chắn hẳn (b = 1). + # ĐỂ BẰNG blend_start_distance là b thành bậc nhảy, tái lập + # CHÍNH XÁC hành vi latch cũ — đây là cấu hình dùng để chứng minh + # refactor không đổi kết quả. Hạ xuống (vd 1.0) để có vùng + # chuyển tiếp mượt: robot bắt đầu né sớm và nhẹ thay vì giật + use_avoidance_velocity_limit: true # true = khi path bị chắn thì hạ trần về avoidance_max_velocity + # (fleet set 1.0 nhưng đang né thì chạy 0.4) + # false = GIỮ NGUYÊN vận tốc fleet đang set, để một mình hàm cost + # lo việc né. Cost blend không đổi trong cả hai trường hợp — + # cờ này CHỈ quyết định có kẹp tốc độ hay không. + # Đặt false khi muốn né mà không mất thời gian, đổi lại quỹ đạo né + # ở tốc độ cao cần cửa sổ động rộng hơn mới lách được + creep_distance: 0.8 # [m] cự ly tới cuối chặng mà vùng bò chậm bắt đầu. + # Ngưỡng THỰC = max(giá trị này, quãng phanh + creep_margin), + # nên nó chỉ NỚI RA theo tốc độ, không bao giờ thu lại: dưới + # khoảng 0.9 m/s thì số cố định thắng và hành vi y như cũ, còn + # ở tốc độ cao nó cắn đủ sớm để phanh kịp. + # Thu nhỏ số này là mất luôn cái sàn giữ robot không chết đứng + # trước goal + creep_margin: 0.3 # [m] cộng thêm vào quãng phanh khi tính ngưỡng + creep_max_velocity: 0.4 # [m/s] trần trong vùng bò chậm (độ lớn, dùng cho cả hai chiều) + creep_min_velocity: 0.05 # [m/s] sàn trong vùng bò chậm khi tiến — giữ robot không đứng + # lại trước goal + creep_min_velocity_reverse: 0.01 # [m/s] sàn khi lùi (độ lớn). Nhỏ hơn chiều tiến, giữ đúng số cũ + curve_max_velocity: 0.3 # [m/s] trần vận tốc khi đang trong khúc cua + reject_collisions_always: false # false = chỉ loại quỹ đạo va chạm khi b > 0 (HÀNH VI CŨ). + # Lưu ý: nghĩa là khi bám path DWA KHÔNG loại quỹ đạo va chạm + # nào cả, chỉ dựa vào b để né. true = loại mọi lúc, an toàn hơn + # nhưng ĐỔI kết quả solve của chế độ bám path + velocity_samples: 10 # số mẫu vận tốc trong cửa sổ động. Cũ: 10 khi bám path thẳng, + # 7 khi cua và khi né. Cửa sổ rộng <= 0.06 m/s nên chênh lệch + # giữa 7 và 10 là ~5 mm/s, không đo được + yawrate_samples: 20 # số mẫu tốc độ quay cho mỗi mức vận tốc. Đây là thứ quyết định + # omega chọn được bám sát omega của Pure Pursuit đến đâu: + # sai lệch tối đa = bề rộng cửa sổ quay / yawrate_samples + # để robot vẫn xoay được khi đang bò chậm + turn_direction_th: 0.1 # [rad] ngưỡng lệch hướng tối thiểu để DWA coi là cần rẽ + + # ===== Bảo vệ TF plan -> global ===== + # Mỗi lần AMCL sửa vị trí, transform map->odom dịch vài cm. Robot đứng yên + # nhưng CẢ PATH bị dịch dưới chân nó, nên Pure Pursuit thấy error_angle nhảy + # bậc và DWA thấy path cost nhảy bậc — đó là hiện tượng lắc khi bám path. + # Đóng băng transform trong suốt một chặng làm mất cú dịch đó; robot bám hoàn + # toàn trong frame liên tục (odom). Kiểm va chạm KHÔNG bị ảnh hưởng vì local + # costmap vẫn nằm ở frame liên tục với dữ liệu cảm biến sống. + plan_tf_freeze: true # [DOCK] BẬT: hiệu chỉnh định vị giữa chặng không được dịch đường vào dock dưới chân robot + # Bật lên chỉ sau khi đã chạy thử — xem ghi chú + # freeze_settle_cycles bên dưới + freeze_settle_cycles: 20 # [DOCK] chặng dock ngắn, không đủ thời gian chờ 30 chu kỳ; 20 vẫn phủ 2 chu kỳ AMCL ở 20 Hz + # PHẢI phủ >= 2 lần chu kỳ cập nhật định vị: AMCL 2 Hz + # với vòng điều khiển 20 Hz là >= 20 chu kỳ. Ngắn hơn thì + # cửa sổ rơi lọt giữa hai lần hiệu chỉnh — ở đó transform + # hằng số THEO ĐỊNH NGHĨA — và sẽ chốt ngay trước một + # hiệu chỉnh đang tới + freeze_settle_eps_xy: 0.005 # [m] bước dịch mỗi chu kỳ dưới ngưỡng này coi là yên + freeze_settle_eps_yaw: 0.005 # [rad] bước quay mỗi chu kỳ dưới ngưỡng này coi là yên + freeze_settle_timeout: 3.0 # [s] hết hạn mà chưa yên thì chốt luôn giá trị mới nhất, + # kèm cảnh báo. Bản đồ nhảy liên tục chính là điều kiện + # mà freeze sinh ra để trị; để sống tiếp là lắc cả chặng + tf_cache_max_age: 0.5 # [s] lookup lỗi thì lái tiếp trên transform đã cache tới + # ngần này rồi mới từ chối ra lệnh. Đặt 0 = dừng ngay khi + # trượt một nhịp TF, gây phanh nhấp khi publisher chập chờn + + # ===== Debug ===== + # Nhóm khoá bật log chẩn đoán [DBG-HYBRID-*]. Cùng quy ước với priest_local_planner: + # mức càng cao log càng dày, KHÔNG đổi hành vi điều khiển. + # 0 = tắt hẳn (mặc định, dùng khi chạy thật) + # 1 = chỉ log sự kiện đổi trạng thái (đổi hướng tiến/lùi, bật/tắt latch né vật cản, + # DWA trả lệnh 0, ô costmap nào chặn đường) + # 2 = mức 1 + log định kỳ 1 Hz cho từng chỗ ghi (không chỗ nào bị bỏ đói) + # 3 = in mọi chu kỳ điều khiển — chỉ dùng khi bắt lỗi ngắn, rất nặng I/O + debug_level: 0 + # Các khoá dưới bật/tắt từng nhóm log, chỉ có tác dụng khi debug_level >= 1. + debug_command: true # [DBG-HYBRID-CMD] pose, lệnh cuối (v, omega), tầng kẹp gia tốc, kẹp bò chậm + debug_dwa: true # [DBG-HYBRID-DWA] output thô của DWA, hồ sơ cost và số mẫu khi đổi chế độ + debug_purepursuit: true # [DBG-HYBRID-PP] error_angle, lookahead, và omega mà PP ghi đè lên DWA + debug_mode: true # [DBG-HYBRID-MODE] đổi hướng tiến/lùi, xong căn hướng đầu, đạt xy_goal + debug_collision: true # [DBG-HYBRID-OBS] swapPlan/checkObstacles: chặn ở pose nào, ô costmap nào, cost bao nhiêu + debug_goal: true # [DBG-HYBRID-GOAL] khoảng cách tới goal, sai lệch yaw, các cờ đã latch + debug_tf: true # [DBG-HYBRID-TF] chốt/nhả đóng băng, độ lệch transform, lái trên cache + debug_path: true # [DBG-HYBRID-PATH] bám path: cross-track có dấu (+ = robot lệch TRÁI so với + # chiều đi của path), sai lệch hướng so với tiếp tuyến path, cự ly còn lại + # tới cuối chặng, và ngưỡng chuyển chặng. Đây là dòng để trả lời "robot có + # bám path không" và "chuyển chặng có đúng ở cusp không". diff --git a/config/runtime/maker_sources.yaml b/config/runtime/maker_sources.yaml new file mode 100644 index 0000000..8e4b931 --- /dev/null +++ b/config/runtime/maker_sources.yaml @@ -0,0 +1,93 @@ +# ================================================================================================= +# move_base2 — danh sách marker docking hợp lệ và cặp planner riêng của từng marker. +# +# Quy ước comment: dòng mô tả = LÀ GÌ / vì sao; `► Chỉnh:` = sửa thế nào cho đúng. +# +# Danh sách cho phép, dùng cho `BaseNavigation::dockTo(marker, ...)`. +# +# move_base2 docking quy `goal_frame` thành pose TUYỆT ĐỐI rồi chạy DockPlanner + local planner +# docking. Nó KHÔNG đọc bộ tham số per-marker của PNKXDockingLocalPlanner cũ (plugins, +# maker_goal_frame, delay, timeout, velocity, tolerance, lookahead) — những khoá đó nếu còn sót lại +# ở đâu đó cũng không có tác dụng. +# ================================================================================================= + +# Marker mà host được phép gửi xuống. Đây là ALLOW-LIST: tên không có trong dòng này bị từ chối +# ngay tại `dockTo`, không đi tới planner. +# +# ► Chỉnh: chỉ thêm/bớt TÊN, cách nhau bằng khoảng trắng. Giữ danh sách tối thiểu — mỗi tên thừa là +# một đường vào chưa được kiểm chứng. Sẽ bỏ hẳn khi `dockTo` được chuyển sang dock_sequences khai +# báo trong compound_actions_params.yaml. +maker_sources: trolley charger dock_station pallet + +# Marker có entry ở đây dùng CẶP PLANNER RIÊNG. Marker rỗng, hoặc chỉ có trong `maker_sources` mà +# không nằm trong bảng này, sẽ dùng cặp `docking` mặc định của move_base_common_params.yaml. +# +# ► Chỉnh: chỉ khai marker nào THỰC SỰ cần planner khác mặc định. Tham số của planner nằm ở YAML +# riêng của plugin (dock_global_params.yaml, hybrid_local_planner_params.yaml), KHÔNG khai ở đây — +# trừ `footprint_dock` dưới đây. +# +# ── footprint_dock ──────────────────────────────────────────────────────────────────────────────── +# +# Đa giác của ĐỐI TƯỢNG DOCK (kệ / trạm sạc), [m], trong frame của goal pose. KHÔNG phải footprint +# robot: footprint robot khai ở costmap và dùng cho collision check, còn khoá này vào khoảng dừng +# của DockCalc — điểm robot bắt đầu đoạn căn thẳng trước dock: +# +# alignment_distance = + + padding +# +# Chỉ dùng khi `dock_anchor: center`. Khai thiếu = dock bị coi là một điểm, robot tiến sát hơn dự +# tính đúng extent tới mặt gần. +# +# ── dock_anchor ─────────────────────────────────────────────────────────────────────────────────── +# +# Goal pose của marker nằm ở đâu trên đối tượng dock: +# center — goal ở tâm footprint dock; DockPlanner cộng thêm extent từ tâm tới mặt tiếp cận +# (lấy từ footprint_dock). Mặc định khi không khai — giữ nguyên hành vi cũ. +# face — goal đã nằm ngay tâm MẶT tiếp cận; dock không đóng góp vào khoảng dừng, +# footprint_dock bị bỏ qua hoàn toàn (DockPlanner log info nếu vẫn khai). +# +# KHÔNG có khoá nào override chiều chạy của đoạn thẳng cuối. Chiều đó được SUY RA từ phía robot +# đứng so với goal, vì goal đã được offset sẵn từ tầng trên cho đúng manơ định làm — ép chiều bằng +# tham số sẽ mâu thuẫn với chính vị trí goal. +# Hai khoá này là các khoá DUY NHẤT trong bảng được rót xuống plugin: +# `PlannerRunner::bindDockingMarker()` chép chúng sang namespace của `global_planner` khai ngay bên +# trên, TRƯỚC khi instance được dựng, rồi dựng lại instance khi marker đổi. +# +# ⚠ Chỉ `DockPlanner` đọc hai khoá này. Marker nào khai `global_planner: TwoPointsPlanner` thì giá +# trị vẫn được chép sang namespace đó nhưng không ai đọc — không lỗi, không log, chỉ là không có +# tác dụng. +# +# ► Chỉnh: đo kích thước THẬT của từng loại kệ/trạm — chúng khác nhau, để trùng số là mất tác dụng +# của việc khai theo marker. Trục x là hướng robot tiến vào. Chọn `dock_anchor` theo cách teach +# goal của từng loại: goal teach ở mặt (pallet, charger) → face; goal teach ở tâm (trolley chui +# gầm) → center. +docking_marker_profiles: + # Mọi profile marker dùng HybridDockingLocalPlanner: CÙNG plugin hybrid nhưng là instance RIÊNG, + # đọc block `HybridDockingLocalPlanner` trong hybrid_local_planner_params.yaml (bản sao ĐẦY ĐỦ của + # block chạy tự do + override cho dock: bật plan_tf_freeze, tắt né vật cản, hạ vận tốc, siết dung + # sai goal). Khoá ở đây THẮNG `docking:` trong move_base_common_params.yaml. + trolley: + global_planner: DockPlanner + local_planner: HybridDockingLocalPlanner + # Goal ở trọng tâm xe trolley (robot chui gầm) → cộng extent tâm→mặt từ footprint_dock. + dock_anchor: center + footprint_dock: [[0.583,-0.48],[0.583,0.48],[-0.583,0.48],[-0.583,-0.48]] + + charger: + global_planner: DockPlanner + local_planner: HybridDockingLocalPlanner + # Goal teach ngay tâm mặt trạm sạc. Chỉ có tác dụng nếu đổi sang DockPlanner. + dock_anchor: face + footprint_dock: [[0.583,-0.48],[0.583,0.48],[-0.583,0.48],[-0.583,-0.48]] + + dock_station: + global_planner: DockPlanner + local_planner: HybridDockingLocalPlanner + dock_anchor: center + footprint_dock: [[0.583,-0.48],[0.583,0.48],[-0.583,0.48],[-0.583,-0.48]] + + pallet: + global_planner: DockPlanner + local_planner: HybridDockingLocalPlanner + # Goal teach ở tâm mặt pallet → dock không đóng góp khoảng dừng, footprint_dock bị bỏ qua. + dock_anchor: face + footprint_dock: [[0.5,-0.5],[0.5,0.5],[-0.5,0.5],[-0.5,-0.5]] diff --git a/config/runtime/mission_adapters_params.yaml b/config/runtime/mission_adapters_params.yaml new file mode 100644 index 0000000..7cea131 --- /dev/null +++ b/config/runtime/mission_adapters_params.yaml @@ -0,0 +1,104 @@ +# ================================================================================================= +# mission_adapters — tham số RUNTIME của mission layer. +# +# Quy ước comment: dòng mô tả = LÀ GÌ / vì sao; `► Chỉnh:` = tăng giảm theo triệu chứng nào. +# +# Mission layer đứng GIỮA nguồn nhiệm vụ (VDA5050 Order, goal trần) và navigation: nó cắt order +# thành từng CHẶNG tại mỗi node có action, chỉ chạy phần `released`, nối tiếp theo `orderUpdateId` +# thay vì chạy lại từ đầu, và giữ hàng đợi chặng. +# +# Đây là bản đang có hiệu lực. Bản trong `Test/mission_adapters/test/config/` chỉ phục vụ test và +# chỉ được đọc khi chạy kèm PNKX_NAV_CORE_CONFIG_DIR trỏ vào đúng thư mục đó. +# +# Bật/tắt cả tầng này bằng `mission_layer_enabled` trong `move_base_common_params.yaml`. +# ================================================================================================= + +mission_adapters: + # Nguồn mission. Thêm một loại nguồn mới = thêm một entry ở đây + một plugin .so, không phải sửa + # code của gói. + # name: tên instance, cũng là namespace param riêng của nó + # type: tên symbol export bằng BOOST_DLL_ALIAS, phải có khoá library_path tương ứng bên dưới + # + # goal_src : goal trần từ host (không có edge) — dùng khi test bằng RViz/sim. + # vda5050_src : Order VDA5050 đầy đủ (node + edge + action), đường chạy production. + # instant_src : một action lẻ ngoài order (VDA5050 `instantActions`). + # + # ► Chỉnh: bỏ bớt một nguồn = tắt đường vào tương ứng. Bỏ HẾT thì runtime tự quay về đường trực + # tiếp (như `mission_layer_enabled: false`) kèm log cảnh báo — thiếu plugin không được phép biến + # thành robot đứng im không rõ lý do. + # + # ⚠ Bỏ `instant_src` KHÔNG quay về hành vi cũ: `executeInstantAction` sẽ trả false và mọi + # instantAction (trừ cancelOrder/startPause/stopPause) bị báo FAILED `actionNotSupported`. + # Đường host tự chạy IO cho `PickUp`/`Load`/... đã bị gỡ, không còn chỗ nào nhận thay. + mission_sources: + - {name: goal_src, type: GoalSourceAdapter} + - {name: vda5050_src, type: VDA5050SourceAdapter} + - {name: instant_src, type: InstantActionSourceAdapter} + + # [s] Trần thời gian cho MỘT chặng (navigation + action), tính từ lúc chặng được giao. + # 0 = tắt. Quá hạn thì chặng bị đánh dấu thất bại VÀ navigation được bảo dừng — lưới cuối cho + # trường hợp navigation không bao giờ báo kết quả về. + # + # ► Chỉnh: đây là lưới an toàn CUỐI CÙNG, không phải cơ chế timeout chính (mỗi action handler đã + # tự timeout, và navigation có `planner_patience`/`controller_patience`). + # - Bật (vd 120–300 s) khi cần chắc chắn fleet luôn nhận được kết quả chặng. + # - Đặt phải LỚN HƠN chặng dài nhất cộng toàn bộ thời gian recovery có thể xảy ra, nếu không + # robot đang phục hồi bình thường sẽ bị cắt ngang và báo fail oan. + mission_timeout: 0.0 + + # Một chặng thất bại thì xử lý phần còn lại của hàng đợi thế nào. + # true = xoá sạch hàng đợi (mặc định, an toàn cho tuyến đường tuần tự kiểu VDA5050: không tới + # được node n thì chạy tiếp chặng n+1 là cắt ngang đoạn chưa được cho phép đi) + # false = chỉ bỏ chặng lỗi rồi chạy tiếp. + # + # ► Chỉnh: chỉ đặt false khi các mission trong hàng đợi ĐỘC LẬP với nhau, không phải các chặng của + # cùng một tuyến. Với compound action (charge/PickUp) thì BẮT BUỘC true: nó chính là thứ ngăn + # robot chạy bước `startCharging`/`LiftFork` khi bước dò hoặc bước tiến vào đã hỏng. + clear_queue_on_failure: true + +# ================================================================================================= +# Param riêng của từng instance nguồn mission, đặt theo `name` khai ở `mission_sources`. +# ================================================================================================= +vda5050_src: + # Frame gán cho goal/start sinh ra từ nodePosition của VDA5050. + # Lưu ý: `mapId` trong VDA5050 là danh tính bản đồ, KHÔNG phải frame TF, nên không dùng làm frame. + # + # ► Chỉnh: phải khớp `global_frame` của costmap global. Sai frame ở đây thì mọi goal lệch vị trí + # hoặc TF không quy đổi được, và lỗi hiện ra ở tận tầng planner nên rất khó truy. + global_frame: map + + # Bảng compound action (`charge`, `PickUp`, ...) KHÔNG khai ở đây mà ở + # `Test/move_base2/config/runtime/compound_actions_params.yaml` — file đó cũng dùng khoá + # `vda5050_src` và được `robot::NodeHandle` GỘP vào chung một cây. Tách file vì file này là + # symlink sang submodule `pnkx_nav_core`. + +# --- instant_src: một action lẻ ngoài order (VDA5050 `instantActions`) --------------------------- +instant_src: + # Namespace của nguồn khác để DÙNG CHUNG bảng `compound_actions` của nó. + # + # Đây là lý do adapter này tồn tại như một class con thay vì một plugin riêng: `charge` gửi dạng + # node action và `charge` gửi dạng instantAction phải nở ra CÙNG một chuỗi chặng. Khai một bảng + # thứ hai dưới khoá `instant_src` sẽ chạy được ngay hôm nay rồi trôi lệch dần — và triệu chứng là + # robot lùi vào trạm bằng toạ độ cũ vì một trong hai bảng thiếu bước dò. + # + # ► Chỉnh: gần như không bao giờ. Chỉ đổi khi thật sự cần hai bộ quy trình khác nhau cho cùng một + # actionType — và lúc đó phải cân nhắc lại vì fleet chỉ gửi một tên. + # Giá trị mặc định (khi không khai khoá này) cũng là `vda5050_src`; khai rõ ở đây để người đọc + # config thấy được sự phụ thuộc thay vì phải đọc code mới biết. + compound_actions_from: vda5050_src + +# Bảng symbol -> thư viện cho Boost.DLL. KHÔNG phải tham số tinh chỉnh. +# +# Thiếu khoá library_path là nguyên nhân phổ biến nhất của lỗi "plugin build xong nhưng runtime báo +# không tìm thấy". Tên không có đuôi .so được resolve qua PNKX_NAV_CORE_LIBRARY_PATH / devel/lib / +# LD_LIBRARY_PATH — tức phải `source devel/setup.bash` trước khi chạy. +GoalSourceAdapter: + library_path: libmission_adapters_goal_source + +VDA5050SourceAdapter: + library_path: libmission_adapters_vda5050_source + +# Cùng .so với VDA5050SourceAdapter, alias thứ hai. Không phải nhầm: hai adapter dùng chung bộ nở +# compound action nên chúng phải ở chung một đơn vị biên dịch, tránh hai bản logic trôi lệch nhau. +InstantActionSourceAdapter: + library_path: libmission_adapters_vda5050_source diff --git a/config/runtime/move_base_common_params.yaml b/config/runtime/move_base_common_params.yaml new file mode 100644 index 0000000..1e3a891 --- /dev/null +++ b/config/runtime/move_base_common_params.yaml @@ -0,0 +1,307 @@ +# ================================================================================================= +# move_base2 — tham số lõi của navigation runtime. +# +# Quy ước comment trong file này: +# • dòng mô tả = tham số đó LÀ GÌ và vì sao tồn tại +# • `► Chỉnh:` = tăng/giảm theo triệu chứng nào, miền giá trị, và tương tác với tham số khác +# +# Đọc file này cùng `recovery_behaviors_params.yaml` (recovery gen-2) và +# `mission_adapters_params.yaml` (mission layer) — ba file cùng mô tả một luồng chạy. +# +# `robot::NodeHandle` GỘP mọi file YAML trong thư mục config thành một cây. Trùng khoá giữa hai file +# là lỗi khó thấy nhất ở đây: file khớp trước thắng. Đặt tên khoá cho riêng biệt. +# ================================================================================================= + +# --- Cặp planner của từng kiểu chuyển động ------------------------------------------------------- +# +# move_base2 nạp trực tiếp `robot_nav_core2::LocalPlanner`; không dùng LocalPlannerAdapter (bridge +# chỉ dành cho move_base cũ). +# +# ► Chỉnh: đây là lựa chọn KIẾN TRÚC, không phải số tinh chỉnh. Đổi tên planner ở đây thì tham số +# của planner đó nằm ở YAML riêng của nó (symlink từ pnkx_nav_core/config/), và phải có khoá +# `library_path` tương ứng, nếu không runtime báo "không tìm thấy plugin". +position: + global_planner: CustomPlanner # vật chất hoá tuyến NURBS từ edge của VDA5050 Order. + # MÙ VẬT CẢN theo thiết kế — nó là route materializer, không + # phải search planner. Chỉ có bản makePlan(Order, ...). + local_planner: PriestLocalPlanner + +docking: + # goal_frame đã được ControlLoop quy thành pose tuyệt đối. DockPlanner dùng đúng contract + # makePlan(start, goal, plan), còn CustomPlanner chỉ xử lý makePlan(Order, start, goal, plan). + # đây là config default sẽ được dùng nếu config theo từng maker docking ở file maker_sources.yaml bị bỏ trống + global_planner: DockPlanner + local_planner: HybridDockingLocalPlanner # CÙNG plugin hybrid, instance RIÊNG: đọc block cùng tên + # trong hybrid_local_planner_params.yaml (bản sao ĐẦY ĐỦ + # + override). Chặng dock bật plan_tf_freeze và TẮT né + # vật cản, không đụng tới profile chạy tự do. + +go_straight: + global_planner: TwoPointsPlanner + local_planner: HybridDockingLocalPlanner # instance Stanley riêng, block cùng tên (path 2 điểm thẳng) + +rotate: + global_planner: TwoPointsPlanner + local_planner: HybridDockingLocalPlanner # instance Stanley riêng: XY đã trong tolerance -> Phase B xoay về yaw goal + +# Đường lùi chung cho mọi profile: planner chính trả false hoặc plan rỗng thì move_base2 đổi sang +# planner này đúng MỘT lần cho request hiện tại. Backup cũng fail thì mới chạy recovery; request mới +# luôn bắt đầu lại từ planner chính. Backup gọi makePlan(start, goal, plan), không mang VDA5050 +# Order, để SBPLLatticePlanner (chỉ có overload ba tham số) dùng được. +# +# ► Chỉnh: để rỗng = tắt đường lùi (mọi lỗi planner đi thẳng vào recovery). Giữ SBPL trừ khi có +# planner khác vừa chấp nhận contract 3 tham số vừa tránh được vật cản. +# ► Lưu ý vận hành: khi order KHÔNG có edge (goal trần), CustomPlanner fail và runtime luôn rơi về +# backup này. Tức trên sim goal-trần, plan thực tế do SBPL sinh chứ không phải NURBS — mật độ pose +# và hình học khác production. Đừng tinh chỉnh tham số tuyến chỉ dựa trên sim goal-trần. +backup_global_planner: SBPLLatticePlanner + +# Compound docking quy `goal_frame` thành pose tuyệt đối; HybridLocalPlanner không đọc maker_name. +# `true` chỉ dành cho PNKXDockingLocalPlanner legacy, vốn phải chọn marker trước initialize(). +# +# ► Chỉnh: giữ false cho move_base2. Đặt true chỉ khi quay lại dùng local planner docking legacy. +docking_requires_marker: false + +# Bảng `library_path` và tham số riêng của CustomPlanner, DockPlanner, TwoPointsPlanner cùng các +# local planner nằm trong các YAML runtime đồng hành (symlink từ pnkx_nav_core/config/). Không lặp +# lại chúng ở đây để tránh hai nguồn cấu hình cho cùng một plugin. + +# ================================================================================================= +# Nhịp điều khiển và các đồng hồ kiên nhẫn (contract 2026-08-04 — tách replan nền khỏi recovery) +# ================================================================================================= + +# [Hz] Nhịp control loop: đọc pose, chạy state machine, gọi controller, phát cmd_vel. +# ► Chỉnh: phải >= nhịp mà local planner giải xong một lần. Priest/Hybrid solve ~30 ms nên 30 Hz là +# sát trần — nếu log hiện nhiều dòng "solve took ... (limit ...)" thì HẠ xuống 20 Hz thay vì ép +# planner chạy nhanh hơn. Tăng lên >30 chỉ có nghĩa khi controller thật sự rẻ hơn 1/f giây. +controller_frequency: 30.0 + +# [s] Controller không ra lệnh (kể cả mất pose) thì robot DỪNG TẠI CHỖ và vẫn ở CONTROLLING; +# quá controller_patience mới vào RECOVERING(controlling_failed). Không còn nhánh "hỏng một cycle +# là nhảy về PLANNING" — replan trong lúc chạy là việc của planner_frequency bên dưới. +# +# ► Chỉnh: giá trị hiện tại = ĐÚNG MỘT chu kỳ 30 Hz, tức "mất lệnh một nhịp là leo thang ngay". +# - TĂNG (vd 0.5–1.0 s) nếu robot vào recovery quá nhạy ở khúc cua gắt hoặc lúc local planner +# thỉnh thoảng trượt một nhịp — đây là chỉnh thường gặp nhất. +# - GIẢM chỉ khi muốn phản ứng cực nhanh và chắc chắn controller không bao giờ trượt nhịp. +# - <= 0 = tắt hẳn, KHÔNG khuyến nghị: controller chết vĩnh viễn sẽ không ai phát hiện. +controller_patience: 0.033333333 + +# [s] Trần cho chuỗi cycle costmap STALE liên tục ở CONTROLLING (2026-08-05). Costmap quá hạn thì +# controller bị SKIP — data outage, không phải controller bất lực, nên controller_patience bị ĐÓNG +# BĂNG trong lúc đó (33 ms đo outage là đo sai thứ: sim ABORT sau một cycle stale trong khi costmap +# chỉ cần ~0.5 s để hồi). Stale liên tục quá trần này mới controlling_failed. 0 = tắt (hành vi cũ). +# +# ► Chỉnh: đặt >= vài lần chu kỳ cập nhật costmap chậm nhất. Costmap local 6 Hz + buffer sensor +# 0.5 s ⇒ 2.0 s là ~4 lần dư địa. +# - TĂNG nếu log hiện `controlling_failed` kèm "Sensor data is stale" mà sensor vẫn sống (mạng +# lag, CPU nghẽn). +# - GIẢM nếu muốn phát hiện mất sensor thật nhanh hơn — nhưng dưới 1.0 s sẽ bắt oan các nhịp +# miss lẻ tẻ. +sensor_patience: 2.0 + +# [Hz] Replan NỀN khi đang CONTROLLING: lập plan bất đồng bộ trên thread planner, plan mới về thì +# thay ngay mà không đổi state, không dừng robot. Replan nền thất bại thì giữ plan cũ, không kích +# backup planner, không vào recovery. 0 = tắt (chỉ lập plan khi state machine yêu cầu). +# +# ► Chỉnh: GIỮ 0 trong kiến trúc hiện tại. Ba lý do độc lập (xem TRAP_DETECTION_PLAN.md): +# 1. `CustomPlanner` là route materializer, lập lại cho ra ĐÚNG tuyến cũ — lưới nào cũng vậy; +# 2. tuyến cũ đang bị chắn nên luật plan-filter loại nó ⇒ kFailed lặp mỗi chu kỳ, tốn CPU vô ích; +# 3. SBPL full-mission đo được 0.09–0.29 s/lượt ⇒ 1 Hz ăn 9–29% một core liên tục. +# Chỉ bật (0.5–1.0) nếu sau này global planner vừa tránh được vật cản vừa đủ nhanh (~30 ms). +planner_frequency: 0.0 + +# [s] Ở PLANNING quá lâu mà chưa có plan -> recovery. Mất pose ngay trong PLANNING dùng ngân sách +# `controlling_failed` (xem recovery_behaviors_params.yaml). +# ► Chỉnh: đặt > thời gian lập plan xấu nhất của global planner. SBPL `allocated_time: 10.0` ở +# sbpl_global_params.yaml ⇒ 2.0 s là NGẮN HƠN trần của chính planner: nếu thấy leo thang trong khi +# planner vẫn đang chạy, tăng giá trị này lên trên trần đó. +planner_patience: 2.0 + +# Số lần lập plan HỎNG liên tiếp được phép trước khi leo thang. 0 = hỏng một lượt là leo thang ngay. +# ► Chỉnh: TĂNG (1–3) nếu planner thỉnh thoảng fail do costmap chưa kịp cập nhật lúc vừa nhận goal. +# < 0 = không giới hạn — chỉ an toàn khi `planner_patience > 0`, nếu không planner treo sẽ không +# ai phát hiện (config validate chặn ca tắt cả hai). +max_planning_retries: 0 + +# [s] Ở trong bán kính `oscillation_distance` quá lâu = coi là quẩn -> recovery `oscillation`. +# ► Chỉnh: <= 0 là TẮT (giá trị hiện tại). Bật (vd 10–20 s) khi thấy robot lắc qua lắc lại tại chỗ +# mà không trigger nào khác bắt được. Bật thì `oscillation_distance` bắt buộc phải > 0. +oscillation_timeout: -1 + +# [m] Đi được quá quãng này thì: hết bị coi là quẩn, VÀ mọi cursor route recovery được reset, VÀ +# trigger giám sát tuyến đang bị khoá được mở lại (contract 2026-08-05e). +# ► Chỉnh: đây là định nghĩa "có tiến độ thật". GIẢM (0.2–0.3) nếu robot ở khu chật ít khi đi nổi +# 0.5 m nên ngân sách recovery không bao giờ nạp lại. TĂNG nếu recovery được nạp lại quá dễ dãi +# và robot cứ thử vô hạn thay vì báo lỗi lên fleet. +oscillation_distance: 0.5 + +# ================================================================================================= +# Giới hạn vận tốc — hàng rào CUỐI trước khi Twist rời runtime (VelocityArbiter) +# +# Đây KHÔNG phải bộ điều khiển. Local planner đã có trần riêng trong YAML của nó; arbiter chỉ chặn +# lệnh vô lý từ BẤT KỲ nguồn nào, kể cả recovery behavior nạp từ plugin ngoài. Hệ quả bắt buộc: +# mọi trần ở đây phải NỚI HƠN trần tương ứng của planner một khoảng margin. Đặt sát hoặc chặt hơn +# sẽ tái sinh đúng hai lỗi đã đo: acc_lim_x chặt hơn `goal_decel_limit` làm mềm cú phanh (trượt +# đích), acc_lim_theta chặt hơn `max_steer_rate` tạo slew kép trên lệnh lái. +# +# Không khai các khoá này thì code rơi về default hard-code trong velocity_arbiter.h +# (twist / 0.5 / -0.2 / 1.0 / 1.0 / 2.0) — trần 1.0 đã từng cắt cụt lệnh pivot 1.5708 rad. +# ================================================================================================= + +# Twist đi qua arbiter mang NGHĨA gì. Quyết định ĐƠN VỊ của cả cụm trần bên dưới. +# twist : chuẩn ROS — linear.x = vận tốc base [m/s], angular.z = tốc độ quay [rad/s]. +# steering : robot lái một bánh (bicycle) — linear.x = vận tốc BÁNH STEER [m/s], +# angular.z = GÓC lái [rad]. Bật thì arbiter kiểm theo đơn vị góc và HÉT LÊN +# (log_error + đếm `steeringAngleClamps`) mỗi khi lệnh đánh lái bị cắt, đồng thời +# validate() chặn boot nếu `max_vel_theta > pi` (dấu hiệu chọn nhầm semantics). +# +# ► Chỉnh: đang để `twist` vì recovery behavior xoay tại chỗ phát angular.z theo rad/s — đổi sang +# `steering` là đổi nghĩa cho CẢ recovery, nên chỉ đổi khi robot thật sự là bicycle VÀ route +# recovery đã bỏ/thay hành vi xoay tại chỗ (bicycle không xoay tại chỗ được). +# Riêng việc chạy được bicycle thì `max_vel_theta` bên dưới đã đủ: 1.5708 không còn bị cắt. +command_semantics: twist + +# [m/s] Trần tốc độ tiến (semantics `steering`: tốc độ bánh steer). Phải > max_vel_x của local +# planner đang chạy — stanley 0.50, pnkx 1.2. +# ► Chỉnh: nới thêm ~20% so với planner nhanh nhất được phép chạy. Hạ xuống dưới trần planner là +# cắt cụt lệnh mỗi cycle mà planner không hề biết. +max_vel_x: 1.20 + +# [m/s] Trần tốc độ lùi, ÂM. 0 = cấm lùi hẳn. Stanley min_vel_x = -0.25. +# ► Chỉnh: giữ âm hơn trần lùi của planner. Đặt 0 khi robot không có cảm biến phía sau. +min_vel_x: -0.30 + +# semantics `twist` : [rad/s] trần tốc độ quay. +# semantics `steering`: [rad] giới hạn CƠ KHÍ của góc lái. +# 1.5708 rad = 90 deg = đúng `steer_limit_standstill` / `align_steer_angle` của stanley. Đây là +# con số quan trọng nhất của khối này: default cũ 1.0 kẹp lệnh pivot 1.5708 còn 57.3 deg, robot +# không bao giờ đạt góc align và kẹt vĩnh viễn ở pha xoay. +# ► Chỉnh: phải >= `align_steer_angle` của local planner. Ghi số thật, KHÔNG viết `M_PI / 2.0` — +# parser không evaluate biểu thức. +max_vel_theta: 1.5708 + +# [m/s^2] Trần biến thiên tốc độ dài, áp cho cả tăng lẫn giảm. +# ► Chỉnh: phải > `goal_decel_limit` của planner (stanley 0.40), nếu không arbiter làm mềm cú +# phanh về đích và robot trượt quá goal. +acc_lim_x: 1.0 + +# semantics `twist` : [rad/s^2] trần biến thiên tốc độ quay. +# semantics `steering`: [rad/s] trần TỐC ĐỘ đánh lái. +# ► Chỉnh: phải >= tốc độ servo thật VÀ >= `max_steer_rate` của planner (stanley 1.00, servo đo +# được đỉnh 1.08–1.35). 1.20 là mức nới tối thiểu; chặt hơn sẽ tạo slew kép chồng lên slew của +# chính planner, lệnh lái trễ pha và bám line xấu đi. +acc_lim_theta: 1.20 + +# ================================================================================================= +# Giám sát tuyến (contract 2026-08-04d) +# +# Hai phép đo chạy trong lúc robot bám plan, cùng một kết cục: robot DỪNG rồi chạy recovery của +# trigger tương ứng (`path_blocked` / `off_path` trong recovery_behaviors_params.yaml). +# - tuyến phía trước bị chắn -> khai hoả `path_blocked` +# - robot đã lệch khỏi plan -> khai hoả `off_path` +# +# MỖI phép đo có BA nút độc lập và phải đủ CẢ BA mới sống: +# (1) cờ riêng ở đây, (2) ngưỡng của nó > 0, (3) route tương ứng bên recovery khác rỗng. +# ================================================================================================= +path_monitor: + # Công tắc CHUNG; tắt cái này là tắt cả hai phép đo bên dưới. + # ► Chỉnh: false = đưa hành vi về đúng như trước 2026-08-04d (chỉ còn controller_patience lo). + # Dùng làm đường lùi nhanh khi nghi cơ chế giám sát gây vấn đề ngoài hiện trường. + enabled: false + + # Công tắc RIÊNG từng phép đo (2026-08-06). Trước đây chỉ tắt được bằng cách đặt ngưỡng về 0 — + # giá trị ma, lẫn với "quên khai". + # ► Chỉnh: hạ cờ để tắt mà VẪN GIỮ ngưỡng đã đo được — bật lại chỉ sửa một dòng. + path_blocked_enabled: true + off_path_enabled: false # tắt tường minh: max_cross_track chưa đo được nên chưa có ngưỡng thật + + # [s] Nhịp quét costmap. KHÔNG quét mỗi control cycle (30 Hz) — quá phí. + # ► Chỉnh: đặt ~= chu kỳ cập nhật costmap local (6 Hz ⇒ 0.17 s). Nhỏ hơn thế là quét lại cùng một + # dữ liệu. TĂNG nếu CPU căng; đổi lại phản ứng chậm đi đúng chừng đó. + check_period: 0.2 + + # [s] Điều kiện phải đúng LIÊN TỤC chừng này mới khai hoả (chống nhiễu một nhịp). + # ► Chỉnh: TĂNG (0.8–1.5) nếu người đi ngang qua làm robot dừng oan. GIẢM nếu robot phản ứng quá + # chậm với vật cản thật. Phải >= vài lần `check_period`, nếu không debounce vô nghĩa. + confirm_time: 0.5 + + # Profile được giám sát. docking/go_straight/rotate KHÔNG được detour: đường cong vào dock là một + # thể thống nhất, cắt ghép nó là phá chính hình học đó. + # ► Chỉnh: gần như luôn để `[position]`. Thêm profile khác chỉ khi profile đó dùng tuyến tự do. + profiles: [position] + + # -- Phép đo 1: tuyến phía trước bị chắn -------------------------------------------------------- + + # [m] Quãng tuyến phía trước cần quét. + # ► Chỉnh: phải <= nửa cửa sổ costmap local (8x8 m ⇒ ~4 m), ngoài đó không có dữ liệu. + # - TĂNG (tới ~3.5) để phát hiện sớm hơn, có nhiều chỗ hơn để lập đường vòng; + # - GIẢM (1.5–2.0) nếu robot dừng quá sớm trước vật cản mà local planner tự lách được. + horizon: 3.0 + + # [m] Vật cản gần hơn mức này thì KHÔNG khai hoả: detour từ sát nách hầu như không ra nghiệm, và + # ca đó đã có controller_patience lo. + # ► Chỉnh: đặt ~= bán kính ngoại tiếp footprint + dư địa (footprint 0.6x0.6 ⇒ ~0.42 m). TĂNG nếu + # thấy nhiều lượt detour `Solution not found` với vật cản rất gần. + min_detour_distance: 0.5 + + # -- Phép đo 2: robot lệch khỏi plan ------------------------------------------------------------ + + # [m] Lệch khỏi plan ĐANG CHẠY quá mức này thì khai hoả. Đo với plan đang chạy chứ không phải + # tuyến gốc — sau một lượt detour hợp lệ, plan đang chạy CHÍNH LÀ đường vòng nên không báo oan. + # (Ràng buộc "lệch bao nhiêu so với tuyến fleet" là việc của `max_deviation` bên detour.) + # ► Chỉnh: 0 = TẮT (hiện tại). Cách đặt đúng: chạy sim/robot qua các khúc cua gắt nhất của tuyến, + # ghi cross-track đỉnh, rồi đặt ~1.5–2 lần giá trị đó. Đặt số mò là robot dừng oan giữa đường + # cong. Bật thì nhớ bật cả `off_path_enabled`. + max_cross_track: 0.0 + + # [s] Bỏ qua phép đo lệch tuyến ngay sau khi nhận plan mới — lúc preempt/đổi chặng pose robot có + # thể lệch nhất thời so với plan vừa tới. + # ► Chỉnh: TĂNG nếu `off_path` khai hoả ngay sau mỗi lần đổi chặng hoặc sau mỗi detour. + grace_after_new_plan: 1.0 + +# ================================================================================================= +# Telemetry +# ================================================================================================= + +# [s] Chu kỳ in bảng thông số runtime ra terminal: CPU của từng thread đã đăng ký (control loop, +# thread lập plan, hai vòng cập nhật costmap), chi phí từng đoạn công việc (local planner, global +# planner, cachePlans), RSS và tốc độ tăng RSS. 0 = tắt hẳn, không đo gì. +# +# Dòng "(không đăng ký)" trong bảng là phần CPU KHÔNG thuộc navigation stack — nó thuộc host ROS +# (callback cảm biến, OPC-UA, VDA5050, TF bridge). Đọc con số đó trước khi kết luận move_base2 nặng. +# +# ► Chỉnh: đặt 2.0–5.0 khi đang truy CPU/rò bộ nhớ, rồi TRẢ VỀ 0. Đây là công cụ chẩn đoán, đừng để +# chạy thường trực trên robot thật. +runtime_stats_period: 0.0 + +# Bật/tắt toàn bộ recovery. Danh sách behavior và route nằm ở `recovery_behaviors_params.yaml`, +# namespace `recovery`. +# ► Chỉnh: false = mọi lỗi đi thẳng tới ABORTED, không thử phục hồi. Chỉ dùng khi cô lập lỗi lúc +# debug; trên hiện trường để true. +recovery_behavior_enabled: false + +# ================================================================================================= +# Mission layer +# ================================================================================================= + +# true (mặc định của move_base2): VDA5050 Order đi qua `mission_adapters` — order được cắt thành +# từng chặng tại mỗi node có action, chỉ phần `released` được chạy, `orderUpdateId` nối tiếp thay vì +# chạy lại từ đầu, và có `mission_timeout` làm lưới cuối. Nguồn mission và tham số của layer khai ở +# `mission_adapters_params.yaml`. +# +# false: order đi thẳng xuống navigation như MỘT goal duy nhất — hành vi của move_base gen-1, và +# cũng là hành vi đã chạy được trên sim trước 2026-07-31. Đây là đường lùi khi mission layer gây vấn +# đề trên hiện trường: đổi một khoá, không phải build lại. +# +# Bật mà không nạp được nguồn nào thì runtime TỰ quay về đường trực tiếp kèm log cảnh báo — thiếu +# plugin không được phép biến thành robot đứng im không rõ lý do. +# +# ► Chỉnh: tắt thì MẤT compound action (charge/PickUp), mất cắt chặng theo node, mất `mission_timeout`. +# Chỉ tắt để cô lập sự cố, và nhớ bật lại. +mission_layer_enabled: true + +# Bảng symbol -> thư viện cho Boost.DLL. Đây KHÔNG phải tham số tinh chỉnh — thiếu khoá này là +# nguyên nhân phổ biến nhất của lỗi "plugin build xong nhưng runtime báo không tìm thấy". +MoveBase: + library_path: libmove_base2 diff --git a/config/runtime/mppi_local_planner_params.yaml b/config/runtime/mppi_local_planner_params.yaml new file mode 100644 index 0000000..6494be9 --- /dev/null +++ b/config/runtime/mppi_local_planner_params.yaml @@ -0,0 +1,309 @@ +LocalPlannerAdapter: + library_path: liblocal_planner_adapter + yaw_goal_tolerance: 0.017 + xy_goal_tolerance: 0.03 + min_approach_linear_velocity: 0.06 + +MPPILocalPlanner: + library_path: libmppi_local_planner + + # ===== Giới hạn robot [m/s, rad/s] ===== + min_velocity: 0.0 + # Cao hon reference_velocity mot khoang dem (headroom). Neu de sat ref thi + # nua tren cua nhieu sampling bi clamp o max, keo van toc trung binh xuong + # (do duoc: ref0.45/max0.50 -> chi dat 0.33; max0.65 -> dat 0.41). Robot chay + # duoc >0.6 m/s nen dat 0.65. + max_velocity: 0.65 + max_angular_velocity: 1.0 + # [m] Bán kính hình tròn DỰ PHÒNG, chỉ dùng khi chưa có footprint hợp lệ (trước + # setPlan đầu tiên, hoặc footprint suy biến). Có footprint thì hình dạng thật được + # dùng thay và hai khoá này không còn ảnh hưởng tới kiểm va chạm. + robot_radius: 0.30 + # [m] Bán kính của MỘT ô costmap. Ô costmap không phải điểm toán học — bỏ qua bán + # kính này làm bán kính va chạm hiệu dụng thiếu đi đúng chừng ấy. + obstacle_point_radius: 0.08 + # Hệ số nở khung xe khi kiểm va chạm. Bản Python dùng 1.2, nhưng ở đây footprint + # lấy từ costmap ĐÃ được pad sẵn bằng "footprint_padding" của costmap, nên để 1.0 + # để không nở hai lần. Tăng lên nếu muốn thêm biên an toàn; 1.1 = nở 10% mọi chiều. + # Không nhận giá trị < 1.0 (thu nhỏ khung xe không bao giờ là thứ người dùng muốn). + collision_safety_margin_rate: 1.0 + footprint_padding: 0.05 + + # ===== Lõi MPPI ===== + # Horizon = model_dt * time_steps = 3.6 s ~ 1.8 m @0.5 m/s. + # Truoc day 1.4 s (0.7 m) qua ngan: robot chi "thay" vat can khi da sat, khong con + # cho de vong qua -> hoac ket hoac lang nhang. Do thuc te: 0.7m/1.2m khong toi dich; + # 1.8m toi dich voi quang duong chi dai hon 6% so voi duong thang. + # Khong tang dt qua 0.15: dt=0.20 lam dao dong tang gap 4 lan. + model_dt: 0.2 + time_steps: 20 + batch_size: 220 + # So thread OpenMP. De mac dinh (= 16 core) thi tranh chap voi gazebo/rviz/perception + # lam 1 chu ky solveMPPI cham tu 0.9 ms len ~25 ms. + num_threads: 4 + param_lambda: 100.0 + param_alpha: 0.98 + # Tỉ lệ mẫu lấy quanh nominal (ref_velocity, 0) thay vì quanh nghiệm chu kỳ trước. + # Đo trên đường thẳng-cung R=3 m, trung bình 12 lần chạy: 0.20 cho v nhanh hơn 8% + # nhưng sai lệch ngang xấu đi 25%; 1.00 thì robot văng khỏi đường (sai lệch 1.7 m). + # Giữ 0.05 như bản Python. + param_exploration: 0.05 + # [bước] Cửa sổ lọc trung bình trượt áp lên bước cập nhật control — cơ chế làm mượt + # chính của MPPI. Nhỏ quá thì lệnh giật (window=1: độ giật gấp 5 lần), lớn quá thì + # phản ứng chậm và bám đường xấu đi (window=20: sai lệch ngang 0.149 m so với 0.117). + # Tự kẹp vào [1, time_steps]. + control_filter_window: 10 + vx_std: 0.2 + wz_std: 0.25 + reference_velocity: 0.48 + + # ===== Path và goal ===== + # Phai lon hon horizon (1.8 m), neu khong terminal goal_weight se keo robot ve + # diem cat cua reference path va lam no giam toc moi chu ky. + max_global_plan_lookahead_dist: 3.0 + # [m] Vào trong ngưỡng này thì CHỐT lại: từ đó v = 0 tuyệt đối, robot chỉ còn xoay + # về yaw đích. Chốt là thứ chặn robot đi xuyên qua đích — nó không lùi lại được + # (min_velocity = 0). Chốt được nhả khi có plan mới. + xy_goal_tolerance: 0.10 + # [rad] Đạt cả hai ngưỡng thì báo tới đích lên move_base2. + yaw_goal_tolerance: 0.10 + # [m] Bán kính BẮT của cơ chế "đã đi qua đích" (theo hybrid_local_planner). + # Chốt theo xy_goal_tolerance một mình là không đủ: khi vật cản chắn lối vào đích, + # robot không bao giờ vào nổi trong 0.10 m. Đo trên sim: nó tới gần nhất 0.29 m rồi + # trôi ra 0.60 m và không bao giờ báo tới đích — vì min_velocity = 0 nên không lùi + # lại được. + # Trong bán kính này, controller bám khoảng cách NHỎ NHẤT từng đạt; khi khoảng cách + # bắt đầu tăng trở lại quá goal_overshoot_margin thì coi như đã qua điểm gần nhất + # với tới được -> dừng tịnh tiến và xoay về yaw đích. + # Chỉ áp dụng ở chặng CUỐI và sau khi đã đi quá nửa đường tham chiếu, nên đường vòng + # đi sát đích ở giữa chặng không làm chốt nhầm. + # Đặt quá lớn: chốt sớm, robot dừng xa đích. Quá nhỏ: không bắt được ca như trên. + goal_capture_radius: 0.6 + # [m] Phải xa hơn khoảng cách nhỏ nhất thêm ngần này mới coi là đã đi qua — chặn + # việc chốt nhầm vì nhiễu pose vài milimet. + goal_overshoot_margin: 0.05 + + # ===== Costmap và trọng số hàm chi phí ===== + obstacle_range: 2.5 + obstacle_cost_threshold: 150 + # Bước lấy mẫu costmap: 1 = mọi ô, 2 = cách một ô mỗi trục. + # Giữ 2. Đã đo bước 1: nó KÉM hơn (khoảng hở 0.958 so với 1.020 m) và đắt gấp 2.4 + # lần (3.50 so với 1.45 ms), vì cùng một max_obstacle_points thì mật độ gấp 4 làm + # số điểm gần nhất chỉ phủ được bán kính nhỏ hơn ~2 lần — cắt mất đúng dải 1-2 m + # mà obstacle_influence_radius = 2.0 cần tới. + # Đánh đổi còn lại của bước 2: một vật cản mảnh chiếm đúng MỘT ô lethal (cột, chân + # bàn) chỉ có ~25% cơ hội được lấy mẫu, nên nó có thể không được tính là va chạm + # CỨNG. Quầng inflation cost ~253 quanh nó vẫn vào trường mềm nên robot vẫn né, + # chỉ là không có rào 1e6. Muốn chắc chắn với vật cản mảnh thì đặt 1 VÀ nâng + # max_obstacle_points lên ~4000 (kiểm lại CPU: ~11% ngân sách). + # Độ lớn trường cost KHÔNG đổi khi chỉnh khoá này: core chuẩn hoá cost mềm theo + # diện tích ô (obstacle_sample_area), nên obstacle_weight giữ nguyên ý nghĩa. + obstacle_cell_step: 2 + # Trần số điểm vật cản đưa vào bộ giải, giữ lại các điểm GẦN NHẤT. + # Đây là van an toàn CPU, không phải tham số tinh chỉnh — đặt cao hơn số điểm thực + # tế để không cắt mất thông tin. Đo trong môi trường dày (hành lang + khối chặn): + # trần 180 cắt từ 281 điểm xuống 168 và làm khoảng hở tụt 1.020 -> 0.750 m; + # trần 400 cho kết quả y hệt không có trần. + # ĐANG ĐỂ 180 = giá trị cuối cùng ĐÃ VERIFY TRÊN SIM (xem obstacle_influence_radius). + # Nâng lên 1200 cùng lúc với influence 2.0 nằm trong cùng lần hỏng đó. + max_obstacle_points: 180 + # [m] Bán kính trường cost mềm, đo từ TÂM robot. + # + # GIỮ 1.0 — giá trị cuối cùng ĐÃ VERIFY TRÊN SIM (lần chạy 17:22: tới đích 3 lần, + # v trung vị 0.431). Đã thử 1.5 và HỎNG: 4 lượt chạy liên tiếp sau đó KHÔNG tới đích + # lần nào, robot lượn vòng kín quanh vật cản giữa đường (chu kỳ ~31 s, lặp 5 vòng, + # khoảng cách tới đích không bao giờ xuống dưới 3.1 m). + # + # Về lý thuyết nới R chỉ làm trường VƯƠN XA hơn chứ không MẠNH hơn (core đã chia cho + # (R/1.0)^2, xem influence_scale trong mppi_core.cpp) — nhưng thực tế trên sim vẫn + # hỏng, nên đừng nới lại nếu chưa hiểu tại sao. Bench KHÔNG tái hiện được ca này. + obstacle_influence_radius: 1.0 + # Cost vat can gio CONG DON tren tung cell (truoc day lay max), nen thang nay phai + # nho hon nhieu. Giu 85 voi che do sum lam cost vot len ~180x85, ap dao moi thanh + # phan khac -> dao dong manh va di vong xa 45%. Do thuc te tai T=24/dt=0.15: + # weight=10 cho dao dong thap nhat va khoang ho 0.48 m (du 13 cm). + obstacle_cost_use_sum: true + obstacle_weight: 10.0 + collision_cost: 1000000.0 + # progress_weight / terminal_progress_weight / goal_weight ĐÃ BỊ BỎ ở Phase 3. + # - progress_weight tồn tại để bù cho một phép chiếu có thể trượt lùi; cửa sổ chiếu + # TIẾN (path_search_arclength) đã giải quyết bằng cấu trúc, và (v - ref_v)^2 mới + # là thứ đẩy robot đi tới. + # - goal_weight neo vào pose cuối của đường tham chiếu, mà đó là điểm TRƯỢT (cuối + # segment / cuối cửa sổ), không phải đích nhiệm vụ. Việc dừng ở đích do chốt + # xy_goal_tolerance lo. + # Phat v^2: gan 0 vi no truc tiep keo van toc xuong (phan truc giac voi robot + # muon chay nhanh). Giu nho de van co chut smoothing. + # Phạt |v|^2 và |omega|^2 thuần tuý. Bản Python KHÔNG có hai khoá này; chúng chống + # trực tiếp với mục tiêu vận tốc nên để 0. + linear_control_weight: 0.0 + angular_control_weight: 0.0 + # Phạt ĐỔI control giữa hai bước. Đây là chỗ CỐ Ý KHÁC bản Python: ở đó control là + # (steer, accel) nên giới hạn gia tốc có sẵn trong mô hình, còn ở đây control là + # (v, omega) trực tiếp — không có gì chặn lệnh nhảy từ 0 lên 0.65 trong một chu kỳ. + # Giữ lại làm giới hạn gia tốc. Giảm về 0 thì lệnh giật, tăng thì robot ì. + control_change_weight: 1.0 + # Giam toc khi lech huong: ha tu 0.8 xuong 0.3. Truoc day khi ne vat can + # (yaw error lon) robot bo <0.1 m/s. 0.3 van giam toc vao cua nhung khong bo. + # 0 = bám đúng reference_velocity bất kể sai lệch yaw, giống bản Python. Sai lệch + # yaw lớn đã do pha căn hướng đầu chặng (align_at_path_start) xử lý trước khi MPPI + # chạy, nên không cần giảm tốc theo yaw nữa. + yaw_error_slowdown: 0.0 + min_tracking_velocity: 0.08 + + # Phat hien ket: MPPI co the tra lenh hop le nhung ~0 mai o cuc tieu dia phuong. + # Qua nguong nay controller bao that bai -> move_base PLANNING roi CLEARING. + stuck_velocity_threshold: 0.03 + stuck_omega_threshold: 0.05 + stuck_patience_cycles: 40 + + # ===== Covariance thích nghi (giai đoạn 2) ===== + # Moi chu ky fit lai do rong nhieu cho TUNG buoc thoi gian tu chinh batch. + # vx_std/wz_std o tren chi con la gia tri khoi tao va gia tri sau reset. + adaptive_covariance: true + # Nhiệt độ softmax dùng RIÊNG cho phép fit Gaussian ước lượng sigma thích nghi. + # Phải nhỏ hơn param_lambda (100), nhưng KHÔNG được nhỏ quá so với độ trải cost: + # exp(-dS/lambda) với lambda quá nhỏ dồn hết trọng số vào một mẫu, Gaussian fit ra + # cực hẹp và sigma rơi xuống SÀN. + # Giá trị 5.0 được tune khi stage_speed_weight còn 20; nâng lên 400 làm độ trải cost + # lớn hơn ~20 lần và phá vỡ nhiệt độ này. Log robot thật: vx_std nằm ở sàn 0.080 + # trong 28/38 chu kỳ, KỂ CẢ khi không có mẫu nào va chạm — mẫu vận tốc chỉ trải + # ±0.16 nên lệnh không leo nổi lên ref_v. + # Đo trên đường thẳng-cung R=3 m, trung bình 12 lần chạy: + # 5 -> v 0.390, sai lệch ngang 0.1272, 81% chu kỳ vx_std ở sàn + # 15 -> v 0.413, sai lệch ngang 0.0340 <- bám đường tốt hơn 3.7 lần + # 30 -> v 0.428, sai lệch ngang 0.0370, độ giật +40% + # 60 -> v 0.434, sai lệch ngang 0.0349, độ giật +170% + # Chỉnh lại nếu đổi mạnh các trọng số cost: giữ tỉ lệ với độ trải cost. + gaussian_fitting_lambda: 15.0 + # [m/s] SÀN của độ lệch chuẩn lấy mẫu vận tốc. + # + # GIỮ 0.08 — giá trị đã verify trên sim. Đã thử 0.15 (bench báo tốt hơn trên mọi + # trục: v 0.413 -> 0.430, hồi phục sau vật cản 3.08 s -> 0.16 s) nhưng trên robot + # thật thì TỆ HƠN HẲN: v trung vị 0.431 -> 0.199 (-54%). Nguyên nhân: sàn 0.15 làm + # sigma bị ghim ở sàn Ở MỌI CHU KỲ (trung vị = min = 0.150), mất hẳn tính thích + # nghi, và nhiễu lấy mẫu rộng làm nhiều mẫu va chạm hơn nên trung bình có trọng số + # bị kéo xuống. + # Đừng chỉnh khoá này dựa trên bench — bench không tái hiện được môi trường thật. + min_vx_std: 0.08 + max_vx_std: 0.35 + min_wz_std: 0.10 + max_wz_std: 0.60 + # Khi bi ket, nở rộng sigma dần qua từng chu kỳ để thoát cực tiểu địa phương. + stuck_sigma_inflation: 1.6 + # Tỉ lệ mẫu va chạm mà từ đó coi batch là KHÔNG MANG THÔNG TIN -> nở sigma thay vì + # fit lại. Trước đây van này chỉ mở khi emergency_stop, tức 100% mẫu va chạm. + # Log robot thật cho thấy đó là quá muộn: suốt đoạn lết, số mẫu va chạm là + # 192-217/220 nên emergency_stop không bao giờ bật; adaptive covariance vẫn fit vào + # vài mẫu sống sót (đều là loại "gần đứng yên") và bóp sigma xuống SÀN — + # wz_std = 0.100 = min_wz_std, trong khi cú lách để thoát cần omega = -0.66, xa 6 + # sigma. Càng kẹt càng hẹp, càng hẹp càng kẹt. Chỉ khi chạm đúng 220/220 van mới mở + # và robot thoát ngay chu kỳ sau. + # Đặt quá thấp (< ~0.5): sigma nở khi robot vẫn đang bám đường tốt -> lệnh giật. + # Đặt 1.0 = quay lại hành vi cũ (chỉ mở ở 100%). + # 0.65 chứ không phải 0.8: log robot thật cho thấy vùng KẸT nằm ở 67-77% mẫu va + # chạm (t=1..4: 75/72/77/73%), tức ngay DƯỚI ngưỡng 0.8 nên van không mở và wz_std + # nằm ở sàn. Van chỉ mở đúng một lần ở 83% và robot thoát ngay chu kỳ sau. + # Chu kỳ chạy bình thường ở 0-24%, chuyển tiếp 38-61%, nên 0.65 vẫn nằm trên dải + # bình thường và không nở sigma khi robot đang bám đường tốt. + sigma_inflation_collision_ratio: 0.65 + hard_obstacle_cost_threshold: 254 + stage_xy_weight: 50.0 + stage_yaw_weight: 1.0 + # Trọng số bám vận tốc. KHÔNG chép được từ bản Python: số hạng này là + # weight * (v - ref_v)^2 nên đóng góp của nó tỉ lệ với ref_v^2. + # Cán cân quyết định "đứng chờ" hay "đi vòng" là: + # đứng yên tốn speed_weight * ref_v^2 + # đi vòng tốn xy_weight * (độ lệch ngang)^2 + # Python: xe ~10 m/s, vòng 4 m -> 20*100 = 2000 so với 50*16 = 800, đứng yên đắt + # gấp 2.5 -> xe chọn đi vòng. + # AMR : 0.48 m/s, vòng 1.1 m -> 20*0.23 = 4.6 so với 50*1.21 = 58, đi vòng đắt + # gấp 12 -> robot chọn đứng chờ. Cán cân bị lật ngược. + # Đo trên kịch bản khối chặn nửa lối đi: weight 20 -> 0% qua được; 400 -> 100%. + # Trên đường sạch: 20 -> v 0.316; 400 -> v 0.392 và sai lệch ngang tốt hơn. + # Chỉnh lại nếu đổi reference_velocity nhiều: giữ speed_weight * ref_v^2 không đổi. + stage_speed_weight: 400.0 + terminal_xy_weight: 50.0 + terminal_yaw_weight: 1.0 + terminal_speed_weight: 400.0 + + # ===== Cửa sổ chiếu tiến (port từ python_simple_mppi) ===== + # Điểm tham chiếu chỉ được tìm về PHÍA TRƯỚC, không bao giờ lùi. Không có nó, + # rollout có thể chiếu lên đoạn đường robot đã đi qua — tức là được thưởng cho + # việc quay đầu lại. + # [m] Cửa sổ tìm kiếm tính theo chiều dài đường, không theo số điểm, để không phụ + # thuộc mật độ điểm của global planner. Phải phủ được quãng rollout đi xa nhất + # (time_steps * model_dt * max_velocity = 20 * 0.2 * 0.65 = 2.6 m); đặt nhỏ hơn thì + # trạng thái cuối horizon chiếu nhầm vào waypoint chưa tới. Tự nâng lên nếu quá nhỏ. + path_search_arclength: 4.0 + # [m] Ngưỡng nhả khoá. Cửa sổ chỉ tiến nên bám nhầm một lần là bám nhầm mãi; nếu + # điểm gần nhất trong cửa sổ vẫn xa hơn ngưỡng này thì coi như robot đã rời đường + # (recovery đẩy ra, bị đẩy tay, localization nhảy) và quét lại toàn bộ để đặt lại. + # Đặt quá nhỏ: chỉ số bị đặt lại liên tục, mất tính đơn điệu. Quá lớn: robot bám + # theo một điểm tham chiếu nó không còn với tới được. + path_release_distance: 1.5 + + # ===== Căn hướng đầu chặng ===== + # Xoay tại chỗ cho thẳng hướng đường trước khi giao quyền cho MPPI. + # Vì sao cần: sai lệch yaw chỉ vào cost qua stage_yaw_weight, mà trọng số đó rất + # nhỏ so với stage_xy_weight, nên khi lệch hướng ~180 độ nghiệm tối ưu của MPPI là + # "bò thật chậm và quét một cung rộng". Đo trên sim: 19-22 s mỗi chặng, cung rộng + # 0.75 m — trong lối đi hẹp là va chạm. + # Chạy lại mỗi khi có plan mới HOẶC chuyển sang segment kế tiếp. + align_at_path_start: true + # [rad] Sai lệch còn lại thì coi là căn xong. Nhỏ quá thì robot lắc quanh ngưỡng + # và không bao giờ chuyển sang MPPI; lớn quá thì bàn giao khi còn lệch nhiều. + align_yaw_tolerance: 0.15 + # [rad/s] Trần tốc độ xoay khi căn hướng. Tự kẹp xuống max_angular_velocity. + # BA khoá align_max/min/gain còn dùng lại cho pha XOAY CUỐI ở đích (xem + # xy_goal_tolerance bên dưới) — cùng một động tác vật lý là xoay tại chỗ. + align_max_angular_velocity: 0.8 + # [rad/s] Sàn tốc độ xoay. Dưới sàn thì bánh không thắng nổi ma sát tĩnh, robot + # đứng im trong khi bộ đếm timeout vẫn chạy. Đặt 0.0 để tắt sàn. + # Sàn KHÔNG được áp khi đã nằm trong tolerance — nếu áp, lệnh cuối cùng robot nhận + # là quay vượt qua đúng cái mục tiêu nó vừa chạm. + align_min_angular_velocity: 0.15 + # [1/s] Hệ số P: omega = gain * sai_lệch_yaw. Tăng thì xoay dứt khoát hơn nhưng + # dễ vọt qua ngưỡng và lắc. + align_angular_gain: 1.2 + # [m] Chiều dài dây cung dùng để đo hướng của đường. Ngắn quá thì nhiễu yaw từng + # điểm của global planner lọt thẳng vào hướng mục tiêu. + align_lookahead: 0.5 + # [chu kỳ] Hết số chu kỳ này mà chưa căn xong thì BỎ QUA và đi tiếp bằng MPPI. + # 200 chu kỳ = 10 s @20 Hz. Không để vô hạn: xoay tại chỗ mãi thì không bao giờ + # tới đích, và nếu servo hỏng thật thì đứng im vĩnh viễn sẽ giấu mất lỗi đó. + align_timeout_cycles: 200 + + # ================================================================================================= + # Log chẩn đoán [DBG-MPPI-*] + # ================================================================================================= + # Người đọc: người vận hành / kỹ sư đang debug tại chỗ. Log đi ra console của + # `amr_node`, cùng chỗ với log của các planner khác. + # + # debug_level điều khiển TẦN SUẤT, các khoá debug_* bên dưới điều khiển NHÓM nào + # được in. Cùng ngữ nghĩa với hybrid_local_planner: + # 0 = tắt hoàn toàn (mặc định khi chạy thật) + # 1 = chỉ sự kiện đổi trạng thái (plan mới, cắt segment, tới đích, lỗi TF) + # 2 = thêm các dòng định kỳ, throttle 1 Hz theo TỪNG dòng log + # 3 = in mọi chu kỳ điều khiển — CHỈ dùng khi soi một đoạn ngắn, mức này + # sinh ~20 dòng/giây và làm chậm vòng điều khiển + # Bật nhiều nhóm cùng lúc không nhóm nào bị bỏ đói: mỗi dòng có bộ đếm throttle + # riêng. + # Cây này là cấu hình chạy thử trên máy dev (sim/Gazebo) nên để mức 2: có sự kiện + # và có dòng định kỳ 1 Hz. Cây `cfg/` (robot thật) và `pnkx_nav_core/config` giữ 0. + debug_level: 2 + # Các khoá dưới chỉ có tác dụng khi debug_level >= 1. + debug_command: true # [DBG-MPPI-CMD] lệnh cuối (v, omega), số mẫu va chạm, số điểm vật cản + debug_plan: true # [DBG-MPPI-PLAN] cắt segment, plan sau transform, lookahead, plan rỗng + debug_goal: true # [DBG-MPPI-GOAL] khoảng cách tới đích, sai lệch yaw so với tolerance + debug_obstacle: true # [DBG-MPPI-OBS] số điểm vật cản, điểm gần nhất, cửa sổ quét costmap + debug_tf: true # [DBG-MPPI-TF] lookup transform thất bại (frame nào sang frame nào) + debug_stuck: true # [DBG-MPPI-STUCK] bộ đếm kẹt so với stuck_patience_cycles + # Sigma thích nghi in mỗi chu kỳ 1 dòng; chỉ bật khi đang tune adaptive_covariance. + debug_sigma: true # [DBG-MPPI-SIG] độ lệch chuẩn đã thích nghi ở bước đầu và bước cuối + + # [DBG-MPPI-TIME] đo thời gian từng giai đoạn, ĐỘC LẬP với debug_level ở trên. + # Đơn vị là số chu kỳ: 0 = tắt, 1 = in mỗi chu kỳ, 20 = in mỗi 20 chu kỳ (~1 s @20 Hz). + # Giữ ở mức thưa khi chạy thật — toàn bộ computeVelocityCommands chạy trong lúc + # move_base2 đang giữ costmap, nên log dày ở đây làm chậm cả vòng cập nhật costmap. + timing_log_period: 20 diff --git a/config/runtime/mprim/base_local_planner_params.yaml b/config/runtime/mprim/base_local_planner_params.yaml new file mode 100644 index 0000000..853cace --- /dev/null +++ b/config/runtime/mprim/base_local_planner_params.yaml @@ -0,0 +1,48 @@ +#For full documentation of the parameters in this file, and a list of all the +#parameters available for TrajectoryPlannerROS, please see +#http://www.ros.org/wiki/base_local_planner +TrajectoryPlannerROS: + #Set the acceleration limits of the robot + acc_lim_th: 3.2 + acc_lim_x: 0.5 + acc_lim_y: 0.5 + + #Set the velocity limits of the robot + max_vel_x: 0.4 + min_vel_x: 0.1 + max_rotational_vel: 1.0 + min_in_place_rotational_vel: 0.4 + + #The velocity the robot will command when trying to escape from a stuck situation + escape_vel: -0.2 + + #For this example, we'll use a holonomic robot + holonomic_robot: false + + #Since we're using a holonomic robot, we'll set the set of y velocities it will sample + y_vels: [-0.3, -0.1, 0.1, 0.3] + + #Set the tolerance on achieving a goal + xy_goal_tolerance: 0.1 + yaw_goal_tolerance: 0.05 + + #We'll configure how long and with what granularity we'll forward simulate trajectories + sim_time: 3.0 + sim_granularity: 0.025 + vx_samples: 5 + vtheta_samples: 20 + + #Parameters for scoring trajectories + goal_distance_bias: 0.4 + path_distance_bias: 0.7 + occdist_scale: 0.3 + heading_lookahead: 0.325 + + #We'll use the Dynamic Window Approach to control instead of Trajectory Rollout for this example + dwa: false + + #How far the robot must travel before oscillation flags are reset + oscillation_reset_dist: 0.01 + + #Eat up the plan as the robot moves along it + prune_plan: false \ No newline at end of file diff --git a/config/runtime/mprim/dwa_local_planner_params.yaml b/config/runtime/mprim/dwa_local_planner_params.yaml new file mode 100755 index 0000000..b8d766a --- /dev/null +++ b/config/runtime/mprim/dwa_local_planner_params.yaml @@ -0,0 +1,55 @@ +base_local_planner: dwa_local_planner/DWAPlannerROS +DWAPlannerROS: + # Robot configuration + max_vel_x: 0.8 + min_vel_x: -0.2 + + max_vel_y: 0.0 # diff drive robot + min_vel_y: 0.0 # diff drive robot + + max_trans_vel: 0.8 # choose slightly less than the base's capability + min_trans_vel: 0.1 # this is the min trans velocity when there is negligible rotational velocity + trans_stopped_vel: 0.03 + + # Warning! + # do not set min_trans_vel to 0.0 otherwise dwa will always think translational velocities + # are non-negligible and small in place rotational velocities will be created. + + max_rot_vel: 1.0 # choose slightly less than the base's capability + min_rot_vel: 0.1 # this is the min angular velocity when there is negligible translational velocity + rot_stopped_vel: 0.1 + + acc_lim_x: 1.5 + acc_lim_y: 0.0 # diff drive robot + acc_limit_trans: 1.5 + acc_lim_theta: 2.0 + + # Goal tolerance + yaw_goal_tolerance: 0.03 # yaw_goal_tolerance > (sim_time * min_rot_vel) / 2 (from Navigation Tuning Guide) + xy_goal_tolerance: 0.08 # xy_goal_tolerance > (sim_time * min_vel_x) / 2 + latch_xy_goal_tolerance: true + + # Forward simulation + sim_time: 1.2 + vx_samples: 15 + vy_samples: 1 # diff drive robot, there is only one sample + vtheta_samples: 20 + + # Trajectory scoring + path_distance_bias: 64.0 # default: 32.0 mir: 32.0 - weighting for how much it should stick to the global path plan + goal_distance_bias: 12.0 # default: 24.0 mir: 48.0 - weighting for how much it should attempt to reach its goal + occdist_scale: 0.5 # default: 0.01 mir: 0.01 - weighting for how much the controller should avoid obstacles + forward_point_distance: 0.325 # default: 0.325 mir: 0.325 - how far along to place an additional scoring point + stop_time_buffer: 0.2 # default: 0.2 mir: 0.2 - amount of time a robot must stop before colliding for a valid traj. + scaling_speed: 0.25 # default: 0.25 mir: 0.25 - absolute velocity at which to start scaling the robot's footprint + max_scaling_factor: 0.2 # default: 0.2 mir: 0.2 - how much to scale the robot's footprint when at speed. + prune_plan: true + + # Oscillation prevention + oscillation_reset_dist: 0.05 # 0.05 - how far to travel before resetting oscillation flags, in m + oscillation_reset_angle: 0.2 # 0.2 - the angle the robot must turn before resetting Oscillation flags, in rad + + # Debugging + publish_traj_pc : true + publish_cost_grid_pc: true + global_frame_id: /odom # or /odom diff --git a/config/runtime/mprim/ekf.yaml b/config/runtime/mprim/ekf.yaml new file mode 100755 index 0000000..ff05f12 --- /dev/null +++ b/config/runtime/mprim/ekf.yaml @@ -0,0 +1,217 @@ +# The frequency, in Hz, at which the filter will output a position estimate. Note that the filter will not begin +# computation until it receives at least one message from one of the inputs. It will then run continuously at the +# frequency specified here, regardless of whether it receives more measurements. Defaults to 30 if unspecified. +frequency: 50 + +# The period, in seconds, after which we consider a sensor to have timed out. In this event, we carry out a predict +# cycle on the EKF without correcting it. This parameter can be thought of as the minimum frequency with which the +# filter will generate new output. Defaults to 1 / frequency if not specified. +sensor_timeout: 0.1 + +# ekf_localization_node and ukf_localization_node both use a 3D omnidirectional motion model. If this parameter is +# set to true, no 3D information will be used in your state estimate. Use this if you are operating in a planar +# environment and want to ignore the effect of small variations in the ground plane that might otherwise be detected +# by, for example, an IMU. Defaults to false if unspecified. +two_d_mode: true + +# Use this parameter to provide an offset to the transform generated by ekf_localization_node. This can be used for +# future dating the transform, which is required for interaction with some other packages. Defaults to 0.0 if +# unspecified. +transform_time_offset: 0.0 + +# Use this parameter to specify how long the tf listener should wait for a transform to become available. +# Defaults to 0.0 if unspecified. +transform_timeout: 0.0 + +# If you're having trouble, try setting this to true, and then echo the /diagnostics_agg topic to see if the node is +# unhappy with any settings or data. +print_diagnostics: true + +# Debug settings. Not for the faint of heart. Outputs a ludicrous amount of information to the file specified by +# debug_out_file. I hope you like matrices! Please note that setting this to true will have strongly deleterious +# effects on the performance of the node. Defaults to false if unspecified. +debug: false + +# Defaults to "robot_localization_debug.txt" if unspecified. Please specify the full path. +debug_out_file: /path/to/debug/file.txt + +# Whether to broadcast the transformation over the /tf topic. Defaults to true if unspecified. +publish_tf: true + +# Whether to publish the acceleration state. Defaults to false if unspecified. +publish_acceleration: false + +# REP-105 (http://www.ros.org/reps/rep-0105.html) specifies four principal coordinate frames: base_link, odom, map, and +# earth. base_link is the coordinate frame that is affixed to the robot. Both odom and map are world-fixed frames. +# The robot's position in the odom frame will drift over time, but is accurate in the short term and should be +# continuous. The odom frame is therefore the best frame for executing local motion plans. The map frame, like the odom +# frame, is a world-fixed coordinate frame, and while it contains the most globally accurate position estimate for your +# robot, it is subject to discrete jumps, e.g., due to the fusion of GPS data or a correction from a map-based +# localization node. The earth frame is used to relate multiple map frames by giving them a common reference frame. +# ekf_localization_node and ukf_localization_node are not concerned with the earth frame. +# Here is how to use the following settings: +# 1. Set the map_frame, odom_frame, and base_link frames to the appropriate frame names for your system. +# 1a. If your system does not have a map_frame, just remove it, and make sure "world_frame" is set to the value of +# odom_frame. +# 2. If you are fusing continuous position data such as wheel encoder odometry, visual odometry, or IMU data, set +# "world_frame" to your odom_frame value. This is the default behavior for robot_localization's state estimation nodes. +# 3. If you are fusing global absolute position data that is subject to discrete jumps (e.g., GPS or position updates +# from landmark observations) then: +# 3a. Set your "world_frame" to your map_frame value +# 3b. MAKE SURE something else is generating the odom->base_link transform. Note that this can even be another state +# estimation node from robot_localization! However, that instance should *not* fuse the global data. +map_frame: map # Defaults to "map" if unspecified +odom_frame: $(arg tf_prefix)odom # Defaults to "odom" if unspecified +base_link_frame: $(arg tf_prefix)base_link # Defaults to "base_link" if unspecified +world_frame: $(arg tf_prefix)odom # Defaults to the value of odom_frame if unspecified + +# The filter accepts an arbitrary number of inputs from each input message type (robot_nav_msgs/Odometry, +# geometry_msgs/PoseWithCovarianceStamped, geometry_msgs/TwistWithCovarianceStamped, +# robot_sensor_msgs/Imu). To add an input, simply append the next number in the sequence to its "base" name, e.g., odom0, +# odom1, twist0, twist1, imu0, imu1, imu2, etc. The value should be the topic name. These parameters obviously have no +# default values, and must be specified. +odom0: odom + +# Each sensor reading updates some or all of the filter's state. These options give you greater control over which +# values from each measurement are fed to the filter. For example, if you have an odometry message as input, but only +# want to use its Z position value, then set the entire vector to false, except for the third entry. The order of the +# values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Note that not some message types +# do not provide some of the state variables estimated by the filter. For example, a TwistWithCovarianceStamped message +# has no pose information, so the first six values would be meaningless in that case. Each vector defaults to all false +# if unspecified, effectively making this parameter required for each sensor. +# see http://docs.ros.org/melodic/api/robot_localization/html/configuring_robot_localization.html +odom0_config: [false, false, false, # x y z + false, false, false, # roll pitch yaw + true, true, false, # vx vy vz + false, false, true, # vroll vpitch vyaw + false, false, false] # ax ay az + +# If you have high-frequency data or are running with a low frequency parameter value, then you may want to increase +# the size of the subscription queue so that more measurements are fused. +odom0_queue_size: 10 + +# [ADVANCED] Large messages in ROS can exhibit strange behavior when they arrive at a high frequency. This is a result +# of Nagle's algorithm. This option tells the ROS subscriber to use the tcpNoDelay option, which disables Nagle's +# algorithm. +odom0_nodelay: false + +# [ADVANCED] When measuring one pose variable with two sensors, a situation can arise in which both sensors under- +# report their covariances. This can lead to the filter rapidly jumping back and forth between each measurement as they +# arrive. In these cases, it often makes sense to (a) correct the measurement covariances, or (b) if velocity is also +# measured by one of the sensors, let one sensor measure pose, and the other velocity. However, doing (a) or (b) isn't +# always feasible, and so we expose the differential parameter. When differential mode is enabled, all absolute pose +# data is converted to velocity data by differentiating the absolute pose measurements. These velocities are then +# integrated as usual. NOTE: this only applies to sensors that provide pose measurements; setting differential to true +# for twist measurements has no effect. +odom0_differential: false + +# [ADVANCED] When the node starts, if this parameter is true, then the first measurement is treated as a "zero point" +# for all future measurements. While you can achieve the same effect with the differential paremeter, the key +# difference is that the relative parameter doesn't cause the measurement to be converted to a velocity before +# integrating it. If you simply want your measurements to start at 0 for a given sensor, set this to true. +odom0_relative: false + +# [ADVANCED] If your data is subject to outliers, use these threshold settings, expressed as Mahalanobis distances, to +# control how far away from the current vehicle state a sensor measurement is permitted to be. Each defaults to +# numeric_limits::max() if unspecified. It is strongly recommended that these parameters be removed if not +# required. Data is specified at the level of pose and twist variables, rather than for each variable in isolation. +# For messages that have both pose and twist data, the parameter specifies to which part of the message we are applying +# the thresholds. +#odom0_pose_rejection_threshold: 5 +#odom0_twist_rejection_threshold: 1 + +# Further input parameter examples +# see http://docs.ros.org/melodic/api/robot_localization/html/configuring_robot_localization.html +imu0: imu_data +imu0_config: [false, false, false, # x y z + false, false, true, # roll pitch yaw + false, false, false, # vx vy vz + false, false, true, # vroll vpitch vyaw + true, false, false] # ax ay az +imu0_nodelay: false +imu0_differential: false +imu0_relative: true +imu0_queue_size: 10 +#imu0_pose_rejection_threshold: 0.8 # Note the difference in parameter names +#imu0_twist_rejection_threshold: 0.8 # +#imu0_linear_acceleration_rejection_threshold: 0.8 # + +# [ADVANCED] Some IMUs automatically remove acceleration due to gravity, and others don't. If yours doesn't, please set +# this to true, and *make sure* your data conforms to REP-103, specifically, that the data is in ENU frame. +imu0_remove_gravitational_acceleration: false + +# [ADVANCED] The EKF and UKF models follow a standard predict/correct cycle. During prediction, if there is no +# acceleration reference, the velocity at time t+1 is simply predicted to be the same as the velocity at time t. During +# correction, this predicted value is fused with the measured value to produce the new velocity estimate. This can be +# problematic, as the final velocity will effectively be a weighted average of the old velocity and the new one. When +# this velocity is the integrated into a new pose, the result can be sluggish covergence. This effect is especially +# noticeable with LIDAR data during rotations. To get around it, users can try inflating the process_noise_covariance +# for the velocity variable in question, or decrease the variance of the variable in question in the measurement +# itself. In addition, users can also take advantage of the control command being issued to the robot at the time we +# make the prediction. If control is used, it will get converted into an acceleration term, which will be used during +# predicition. Note that if an acceleration measurement for the variable in question is available from one of the +# inputs, the control term will be ignored. +# Whether or not we use the control input during predicition. Defaults to false. +use_control: false +# Whether the input (assumed to be cmd_vel) is a geometry_msgs/Twist or geometry_msgs/TwistStamped message. Defaults to +# false. +stamped_control: false +# The last issued control command will be used in prediction for this period. Defaults to 0.2. +control_timeout: 0.2 +# Which velocities are being controlled. Order is vx, vy, vz, vroll, vpitch, vyaw. +control_config: [true, false, false, false, false, true] +# Places limits on how large the acceleration term will be. Should match your robot's kinematics. +acceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 3.4] +# Acceleration and deceleration limits are not always the same for robots. +deceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 4.5] +# If your robot cannot instantaneously reach its acceleration limit, the permitted change can be controlled with these +# gains +acceleration_gains: [0.8, 0.0, 0.0, 0.0, 0.0, 0.9] +# If your robot cannot instantaneously reach its deceleration limit, the permitted change can be controlled with these +# gains +deceleration_gains: [1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + +# [ADVANCED] The process noise covariance matrix can be difficult to tune, and can vary for each application, so it is +# exposed as a configuration parameter. This matrix represents the noise we add to the total error after each +# prediction step. The better the omnidirectional motion model matches your system, the smaller these values can be. +# However, if users find that a given variable is slow to converge, one approach is to increase the +# process_noise_covariance diagonal value for the variable in question, which will cause the filter's predicted error +# to be larger, which will cause the filter to trust the incoming measurement more during correction. The values are +# ordered as x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if +# unspecified. +process_noise_covariance: [0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0.06, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0.03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0.03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0.06, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0.025, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0.025, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0.04, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.015] + +# [ADVANCED] This represents the initial value for the state estimate error covariance matrix. Setting a diagonal +# value (variance) to a large value will result in rapid convergence for initial measurements of the variable in +# question. Users should take care not to use large values for variables that will not be measured directly. The values +# are ordered as x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below +#if unspecified. +initial_estimate_covariance: [100.0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 100.0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10.0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10.0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9] diff --git a/config/runtime/mprim/genmprim_unicycle_highcost_5cm.m b/config/runtime/mprim/genmprim_unicycle_highcost_5cm.m new file mode 100755 index 0000000..2810593 --- /dev/null +++ b/config/runtime/mprim/genmprim_unicycle_highcost_5cm.m @@ -0,0 +1,280 @@ +% /* +% * Copyright (c) 2008, Maxim Likhachev +% * All rights reserved. +% * +% * Redistribution and use in source and binary forms, with or without +% * modification, are permitted provided that the following conditions are met: +% * +% * * Redistributions of source code must retain the above copyright +% * notice, this list of conditions and the following disclaimer. +% * * Redistributions in binary form must reproduce the above copyright +% * notice, this list of conditions and the following disclaimer in the +% * documentation and/or other materials provided with the distribution. +% * * Neither the name of the Carnegie Mellon University nor the names of its +% * contributors may be used to endorse or promote products derived from +% * this software without specific prior written permission. +% * +% * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +% * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +% * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +% * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +% * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +% * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +% * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +% * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +% * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +% * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +% * POSSIBILITY OF SUCH DAMAGE. +% */ + +function[] = genmprim_unicycle_highcost_5cm(outfilename) + +% +%generates motion primitives and saves them into file +% +%written by Maxim Likhachev +%--------------------------------------------------- +% + +%defines + +UNICYCLE_MPRIM_16DEGS = 1; + + +if UNICYCLE_MPRIM_16DEGS == 1 + resolution = 0.05; + numberofangles = 16; %preferably a power of 2, definitely multiple of 8 + numberofprimsperangle = 7; + + %multipliers (multiplier is used as costmult*cost) + forwardcostmult = 1; + backwardcostmult = 40; + forwardandturncostmult = 2; + sidestepcostmult = 10; + turninplacecostmult = 20; + + %note, what is shown x,y,theta changes (not absolute numbers) + + %0 degreees + basemprimendpts0_c = zeros(numberofprimsperangle, 4); %x,y,theta,costmult + %x aligned with the heading of the robot, angles are positive + %counterclockwise + %0 theta change + basemprimendpts0_c(1,:) = [1 0 0 forwardcostmult]; + basemprimendpts0_c(2,:) = [8 0 0 forwardcostmult]; + basemprimendpts0_c(3,:) = [-1 0 0 backwardcostmult]; + %1/16 theta change + basemprimendpts0_c(4,:) = [8 1 1 forwardandturncostmult]; + basemprimendpts0_c(5,:) = [8 -1 -1 forwardandturncostmult]; + %turn in place + basemprimendpts0_c(6,:) = [0 0 1 turninplacecostmult]; + basemprimendpts0_c(7,:) = [0 0 -1 turninplacecostmult]; + + %45 degrees + basemprimendpts45_c = zeros(numberofprimsperangle, 4); %x,y,theta,costmult (multiplier is used as costmult*cost) + %x aligned with the heading of the robot, angles are positive + %counterclockwise + %0 theta change + basemprimendpts45_c(1,:) = [1 1 0 forwardcostmult]; + basemprimendpts45_c(2,:) = [6 6 0 forwardcostmult]; + basemprimendpts45_c(3,:) = [-1 -1 0 backwardcostmult]; + %1/16 theta change + basemprimendpts45_c(4,:) = [5 7 1 forwardandturncostmult]; + basemprimendpts45_c(5,:) = [7 5 -1 forwardandturncostmult]; + %turn in place + basemprimendpts45_c(6,:) = [0 0 1 turninplacecostmult]; + basemprimendpts45_c(7,:) = [0 0 -1 turninplacecostmult]; + + %22.5 degrees + basemprimendpts22p5_c = zeros(numberofprimsperangle, 4); %x,y,theta,costmult (multiplier is used as costmult*cost) + %x aligned with the heading of the robot, angles are positive + %counterclockwise + %0 theta change + basemprimendpts22p5_c(1,:) = [2 1 0 forwardcostmult]; + basemprimendpts22p5_c(2,:) = [6 3 0 forwardcostmult]; + basemprimendpts22p5_c(3,:) = [-2 -1 0 backwardcostmult]; + %1/16 theta change + basemprimendpts22p5_c(4,:) = [5 4 1 forwardandturncostmult]; + basemprimendpts22p5_c(5,:) = [7 2 -1 forwardandturncostmult]; + %turn in place + basemprimendpts22p5_c(6,:) = [0 0 1 turninplacecostmult]; + basemprimendpts22p5_c(7,:) = [0 0 -1 turninplacecostmult]; + +else + fprintf(1, 'ERROR: undefined mprims type\n'); + return; +end; + + +fout = fopen(outfilename, 'w'); + + +%write the header +fprintf(fout, 'resolution_m: %f\n', resolution); +fprintf(fout, 'numberofangles: %d\n', numberofangles); +fprintf(fout, 'totalnumberofprimitives: %d\n', numberofprimsperangle*numberofangles); + +%iterate over angles +for angleind = 1:numberofangles + + figure(1); + hold off; + + text(0, 0, int2str(angleind)); + + %iterate over primitives + for primind = 1:numberofprimsperangle + fprintf(fout, 'primID: %d\n', primind-1); + fprintf(fout, 'startangle_c: %d\n', angleind-1); + + %current angle + currentangle = (angleind-1)*2*pi/numberofangles; + currentangle_36000int = round((angleind-1)*36000/numberofangles); + + %compute which template to use + if (rem(currentangle_36000int, 9000) == 0) + basemprimendpts_c = basemprimendpts0_c(primind,:); + angle = currentangle; + elseif (rem(currentangle_36000int, 4500) == 0) + basemprimendpts_c = basemprimendpts45_c(primind,:); + angle = currentangle - 45*pi/180; + elseif (rem(currentangle_36000int-7875, 9000) == 0) + basemprimendpts_c = basemprimendpts33p75_c(primind,:); + basemprimendpts_c(1) = basemprimendpts33p75_c(primind, 2); %reverse x and y + basemprimendpts_c(2) = basemprimendpts33p75_c(primind, 1); + basemprimendpts_c(3) = -basemprimendpts33p75_c(primind, 3); %reverse the angle as well + angle = currentangle - 78.75*pi/180; + fprintf(1, '78p75\n'); + elseif (rem(currentangle_36000int-6750, 9000) == 0) + basemprimendpts_c = basemprimendpts22p5_c(primind,:); + basemprimendpts_c(1) = basemprimendpts22p5_c(primind, 2); %reverse x and y + basemprimendpts_c(2) = basemprimendpts22p5_c(primind, 1); + basemprimendpts_c(3) = -basemprimendpts22p5_c(primind, 3); %reverse the angle as well + %fprintf(1, '%d %d %d onto %d %d %d\n', basemprimendpts22p5_c(1), basemprimendpts22p5_c(2), basemprimendpts22p5_c(3), ... + % basemprimendpts_c(1), basemprimendpts_c(2), basemprimendpts_c(3)); + angle = currentangle - 67.5*pi/180; + fprintf(1, '67p5\n'); + elseif (rem(currentangle_36000int-5625, 9000) == 0) + basemprimendpts_c = basemprimendpts11p25_c(primind,:); + basemprimendpts_c(1) = basemprimendpts11p25_c(primind, 2); %reverse x and y + basemprimendpts_c(2) = basemprimendpts11p25_c(primind, 1); + basemprimendpts_c(3) = -basemprimendpts11p25_c(primind, 3); %reverse the angle as well + angle = currentangle - 56.25*pi/180; + fprintf(1, '56p25\n'); + elseif (rem(currentangle_36000int-3375, 9000) == 0) + basemprimendpts_c = basemprimendpts33p75_c(primind,:); + angle = currentangle - 33.75*pi/180; + fprintf(1, '33p75\n'); + elseif (rem(currentangle_36000int-2250, 9000) == 0) + basemprimendpts_c = basemprimendpts22p5_c(primind,:); + angle = currentangle - 22.5*pi/180; + fprintf(1, '22p5\n'); + elseif (rem(currentangle_36000int-1125, 9000) == 0) + basemprimendpts_c = basemprimendpts11p25_c(primind,:); + angle = currentangle - 11.25*pi/180; + fprintf(1, '11p25\n'); + else + fprintf(1, 'ERROR: invalid angular resolution. angle = %d\n', currentangle_36000int); + return; + end; + + %now figure out what action will be + baseendpose_c = basemprimendpts_c(1:3); + additionalactioncostmult = basemprimendpts_c(4); + endx_c = round(baseendpose_c(1)*cos(angle) - baseendpose_c(2)*sin(angle)); + endy_c = round(baseendpose_c(1)*sin(angle) + baseendpose_c(2)*cos(angle)); + endtheta_c = rem(angleind - 1 + baseendpose_c(3), numberofangles); + endpose_c = [endx_c endy_c endtheta_c]; + + fprintf(1, 'rotation angle=%f\n', angle*180/pi); + + if baseendpose_c(2) == 0 & baseendpose_c(3) == 0 + %fprintf(1, 'endpose=%d %d %d\n', endpose_c(1), endpose_c(2), endpose_c(3)); + end; + + %generate intermediate poses (remember they are w.r.t 0,0 (and not + %centers of the cells) + numofsamples = 10; + intermcells_m = zeros(numofsamples,3); + if UNICYCLE_MPRIM_16DEGS == 1 + startpt = [0 0 currentangle]; + endpt = [endpose_c(1)*resolution endpose_c(2)*resolution ... + rem(angleind - 1 + baseendpose_c(3), numberofangles)*2*pi/numberofangles]; + intermcells_m = zeros(numofsamples,3); + if ((endx_c == 0 & endy_c == 0) | baseendpose_c(3) == 0) %turn in place or move forward + for iind = 1:numofsamples + intermcells_m(iind,:) = [startpt(1) + (endpt(1) - startpt(1))*(iind-1)/(numofsamples-1) ... + startpt(2) + (endpt(2) - startpt(2))*(iind-1)/(numofsamples-1) ... + 0]; + rotation_angle = (baseendpose_c(3) ) * (2*pi/numberofangles); + intermcells_m(iind,3) = rem(startpt(3) + (rotation_angle)*(iind-1)/(numofsamples-1), 2*pi); + + end; + else %unicycle-based move forward or backward + R = [cos(startpt(3)) sin(endpt(3)) - sin(startpt(3)); + sin(startpt(3)) -(cos(endpt(3)) - cos(startpt(3)))]; + S = pinv(R)*[endpt(1) - startpt(1); endpt(2) - startpt(2)]; + l = S(1); + tvoverrv = S(2); + rv = (baseendpose_c(3)*2*pi/numberofangles + l/tvoverrv); + tv = tvoverrv*rv; + + if l < 0 + fprintf(1, 'WARNING: l = %d < 0 -> bad action start/end points\n', l); + l = 0; + end; + %compute rv + %rv = baseendpose_c(3)*2*pi/numberofangles; + %compute tv + %tvx = (endpt(1) - startpt(1))*rv/(sin(endpt(3)) - sin(startpt(3))) + %tvy = -(endpt(2) - startpt(2))*rv/(cos(endpt(3)) - cos(startpt(3))) + %tv = (tvx + tvy)/2.0; + %generate samples + for iind = 1:numofsamples + dt = (iind-1)/(numofsamples-1); + + %dtheta = rv*dt + startpt(3); + %intermcells_m(iind,:) = [startpt(1) + tv/rv*(sin(dtheta) - sin(startpt(3))) ... + % startpt(2) - tv/rv*(cos(dtheta) - cos(startpt(3))) ... + % dtheta]; + + if(dt*tv < l) + intermcells_m(iind,:) = [startpt(1) + dt*tv*cos(startpt(3)) ... + startpt(2) + dt*tv*sin(startpt(3)) ... + startpt(3)]; + else + dtheta = rv*(dt - l/tv) + startpt(3); + intermcells_m(iind,:) = [startpt(1) + l*cos(startpt(3)) + tvoverrv*(sin(dtheta) - sin(startpt(3))) ... + startpt(2) + l*sin(startpt(3)) - tvoverrv*(cos(dtheta) - cos(startpt(3))) ... + dtheta]; + end; + end; + %correct + errorxy = [endpt(1) - intermcells_m(numofsamples,1) ... + endpt(2) - intermcells_m(numofsamples,2)]; + fprintf(1, 'l=%f errx=%f erry=%f\n', l, errorxy(1), errorxy(2)); + interpfactor = [0:1/(numofsamples-1):1]; + intermcells_m(:,1) = intermcells_m(:,1) + errorxy(1)*interpfactor'; + intermcells_m(:,2) = intermcells_m(:,2) + errorxy(2)*interpfactor'; + end; + end; + + %write out + fprintf(fout, 'endpose_c: %d %d %d\n', endpose_c(1), endpose_c(2), endpose_c(3)); + fprintf(fout, 'additionalactioncostmult: %d\n', additionalactioncostmult); + fprintf(fout, 'intermediateposes: %d\n', size(intermcells_m,1)); + for interind = 1:size(intermcells_m, 1) + fprintf(fout, '%.4f %.4f %.4f\n', intermcells_m(interind,1), intermcells_m(interind,2), intermcells_m(interind,3)); + end; + + plot(intermcells_m(:,1), intermcells_m(:,2)); + axis([-0.3 0.3 -0.3 0.3]); + text(intermcells_m(numofsamples,1), intermcells_m(numofsamples,2), int2str(endpose_c(3))); + hold on; + + end; + grid; + pause; +end; + +fclose('all'); diff --git a/config/runtime/mprim/genmprim_unicycle_highcost_5cm.py b/config/runtime/mprim/genmprim_unicycle_highcost_5cm.py new file mode 100755 index 0000000..c8801c0 --- /dev/null +++ b/config/runtime/mprim/genmprim_unicycle_highcost_5cm.py @@ -0,0 +1,416 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2016, David Conner (Christopher Newport University) +# Based on genmprim_unicycle.m +# Copyright (c) 2008, Maxim Likhachev +# All rights reserved. +# converted by libermate utility (https://github.com/awesomebytes/libermate) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the Carnegie Mellon University nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import numpy as np +import rospkg + +# if available import pylab (from matlibplot) +matplotlib_found = False +try: + import matplotlib.pylab as plt + + matplotlib_found = True +except ImportError: + pass + + +def matrix_size(mat, elem=None): + if not elem: + return mat.shape + else: + return mat.shape[int(elem) - 1] + + +def genmprim_unicycle(outfilename, visualize=False, separate_plots=False): + visualize = matplotlib_found and visualize # Plot the primitives + + # Local Variables: basemprimendpts22p5_c, endtheta_c, endx_c, + # baseendpose_c, additionalactioncostmult, fout, numofsamples, + # basemprimendpts45_c, primind, basemprimendpts0_c, rv, angle, outfilename, + # numberofangles, startpt, UNICYCLE_MPRIM_16DEGS, sidestepcostmult, + # rotation_angle, basemprimendpts_c, forwardandturncostmult, + # forwardcostmult, turninplacecostmult, endpose_c, backwardcostmult, + # interpfactor, S, R, tvoverrv, dtheta, intermcells_m, tv, dt, + # currentangle, numberofprimsperangle, resolution, currentangle_36000int, + # l, iind, errorxy, interind, endy_c, angleind, endpt + # Function calls: plot, cos, pi, grid, figure, genmprim_unicycle, text, + # int2str, pause, axis, sin, pinv, fprintf, fclose, rem, zeros, fopen, + # round, size + # % + # %generates motion primitives and saves them into file + # % + # %written by Maxim Likhachev + # %--------------------------------------------------- + # % + # %defines + UNICYCLE_MPRIM_16DEGS = 1.0 + if UNICYCLE_MPRIM_16DEGS == 1.0: + resolution = 0.05 + numberofangles = 16 + # %preferably a power of 2, definitely multiple of 8 + numberofprimsperangle = 7 + # %multipliers (multiplier is used as costmult*cost) + forwardcostmult = 1.0 + backwardcostmult = 40.0 + forwardandturncostmult = 2.0 + # sidestepcostmult = 10.0 + turninplacecostmult = 20.0 + # %note, what is shown x,y,theta changes (not absolute numbers) + # %0 degreees + basemprimendpts0_c = np.zeros((numberofprimsperangle, 4)) + # %x,y,theta,costmult + # %x aligned with the heading of the robot, angles are positive + # %counterclockwise + # %0 theta change + basemprimendpts0_c[0, :] = np.array(np.hstack((1.0, 0.0, 0.0, forwardcostmult))) + basemprimendpts0_c[1, :] = np.array(np.hstack((8.0, 0.0, 0.0, forwardcostmult))) + basemprimendpts0_c[2, :] = np.array(np.hstack((-1.0, 0.0, 0.0, backwardcostmult))) + # %1/16 theta change + basemprimendpts0_c[3, :] = np.array(np.hstack((8.0, 1.0, 1.0, forwardandturncostmult))) + basemprimendpts0_c[4, :] = np.array(np.hstack((8.0, -1.0, -1.0, forwardandturncostmult))) + # %turn in place + basemprimendpts0_c[5, :] = np.array(np.hstack((0.0, 0.0, 1.0, turninplacecostmult))) + basemprimendpts0_c[6, :] = np.array(np.hstack((0.0, 0.0, -1.0, turninplacecostmult))) + # %45 degrees + basemprimendpts45_c = np.zeros((numberofprimsperangle, 4)) + # %x,y,theta,costmult (multiplier is used as costmult*cost) + # %x aligned with the heading of the robot, angles are positive + # %counterclockwise + # %0 theta change + basemprimendpts45_c[0, :] = np.array(np.hstack((1.0, 1.0, 0.0, forwardcostmult))) + basemprimendpts45_c[1, :] = np.array(np.hstack((6.0, 6.0, 0.0, forwardcostmult))) + basemprimendpts45_c[2, :] = np.array(np.hstack((-1.0, -1.0, 0.0, backwardcostmult))) + # %1/16 theta change + basemprimendpts45_c[3, :] = np.array(np.hstack((5.0, 7.0, 1.0, forwardandturncostmult))) + basemprimendpts45_c[4, :] = np.array(np.hstack((7.0, 5.0, -1.0, forwardandturncostmult))) + # %turn in place + basemprimendpts45_c[5, :] = np.array(np.hstack((0.0, 0.0, 1.0, turninplacecostmult))) + basemprimendpts45_c[6, :] = np.array(np.hstack((0.0, 0.0, -1.0, turninplacecostmult))) + # %22.5 degrees + basemprimendpts22p5_c = np.zeros((numberofprimsperangle, 4)) + # %x,y,theta,costmult (multiplier is used as costmult*cost) + # %x aligned with the heading of the robot, angles are positive + # %counterclockwise + # %0 theta change + basemprimendpts22p5_c[0, :] = np.array(np.hstack((2.0, 1.0, 0.0, forwardcostmult))) + basemprimendpts22p5_c[1, :] = np.array(np.hstack((6.0, 3.0, 0.0, forwardcostmult))) + basemprimendpts22p5_c[2, :] = np.array(np.hstack((-2.0, -1.0, 0.0, backwardcostmult))) + # %1/16 theta change + basemprimendpts22p5_c[3, :] = np.array(np.hstack((5.0, 4.0, 1.0, forwardandturncostmult))) + basemprimendpts22p5_c[4, :] = np.array(np.hstack((7.0, 2.0, -1.0, forwardandturncostmult))) + # %turn in place + basemprimendpts22p5_c[5, :] = np.array(np.hstack((0.0, 0.0, 1.0, turninplacecostmult))) + basemprimendpts22p5_c[6, :] = np.array(np.hstack((0.0, 0.0, -1.0, turninplacecostmult))) + else: + print('ERROR: undefined mprims type\n') + return [] + + fout = open(outfilename, 'w') + # %write the header + fout.write('resolution_m: %f\n' % (resolution)) + fout.write('numberofangles: %d\n' % (numberofangles)) + fout.write('totalnumberofprimitives: %d\n' % (numberofprimsperangle * numberofangles)) + # %iterate over angles + for angleind in np.arange(1.0, (numberofangles) + 1): + currentangle = ((angleind - 1) * 2.0 * np.pi) / numberofangles + currentangle_36000int = np.round((angleind - 1) * 36000.0 / numberofangles) + if visualize: + if separate_plots: + fig = plt.figure(angleind) + plt.title('angle {:2.0f} (= {:3.1f} degrees)'.format(angleind - 1, currentangle_36000int / 100.0)) + else: + fig = plt.figure(1) + + plt.axis('equal') + plt.axis([-10 * resolution, 10 * resolution, -10 * resolution, 10 * resolution]) + ax = fig.add_subplot(1, 1, 1) + major_ticks = np.arange(-8 * resolution, 9 * resolution, 4 * resolution) + minor_ticks = np.arange(-8 * resolution, 9 * resolution, resolution) + ax.set_xticks(major_ticks) + ax.set_xticks(minor_ticks, minor=True) + ax.set_yticks(major_ticks) + ax.set_yticks(minor_ticks, minor=True) + ax.grid(which='minor', alpha=0.5) + ax.grid(which='major', alpha=0.9) + + # %iterate over primitives + for primind in np.arange(1.0, (numberofprimsperangle) + 1): + fout.write('primID: %d\n' % (primind - 1)) + fout.write('startangle_c: %d\n' % (angleind - 1)) + # %current angle + # %compute which template to use + if (currentangle_36000int % 9000) == 0: + basemprimendpts_c = basemprimendpts0_c[int(primind) - 1, :] + angle = currentangle + elif (currentangle_36000int % 4500) == 0: + basemprimendpts_c = basemprimendpts45_c[int(primind) - 1, :] + angle = currentangle - 45.0 * np.pi / 180.0 + + # commented out because basemprimendpts33p75_c is undefined + # elif ((currentangle_36000int - 7875) % 9000) == 0: + # basemprimendpts_c = ( + # 1 * basemprimendpts33p75_c[primind, :] + # ) # 1* to force deep copy to avoid reference update below + # basemprimendpts_c[0] = basemprimendpts33p75_c[primind, 1] + # # %reverse x and y + # basemprimendpts_c[1] = basemprimendpts33p75_c[primind, 0] + # basemprimendpts_c[2] = -basemprimendpts33p75_c[primind, 2] + # # %reverse the angle as well + # angle = currentangle - (78.75 * np.pi) / 180.0 + # print('78p75\n') + + elif ((currentangle_36000int - 6750) % 9000) == 0: + basemprimendpts_c = ( + 1 * basemprimendpts22p5_c[int(primind) - 1, :] + ) # 1* to force deep copy to avoid reference update below + basemprimendpts_c[0] = basemprimendpts22p5_c[int(primind) - 1, 1] + # %reverse x and y + basemprimendpts_c[1] = basemprimendpts22p5_c[int(primind) - 1, 0] + basemprimendpts_c[2] = -basemprimendpts22p5_c[int(primind) - 1, 2] + # %reverse the angle as well + # print( + # '%d : %d %d %d onto %d %d %d\n' + # % ( + # primind - 1, + # basemprimendpts22p5_c[int(primind) - 1, 0], + # basemprimendpts22p5_c[int(primind) - 1, 1], + # basemprimendpts22p5_c[int(primind) - 1, 2], + # basemprimendpts_c[0], + # basemprimendpts_c[1], + # basemprimendpts_c[2], + # ) + # ) + angle = currentangle - (67.5 * np.pi) / 180.0 + print('67p5\n') + + # commented out because basemprimendpts11p25_c is undefined + # elif ((currentangle_36000int - 5625) % 9000) == 0: + # basemprimendpts_c = ( + # 1 * basemprimendpts11p25_c[primind, :] + # ) # 1* to force deep copy to avoid reference update below + # basemprimendpts_c[0] = basemprimendpts11p25_c[primind, 1] + # # %reverse x and y + # basemprimendpts_c[1] = basemprimendpts11p25_c[primind, 0] + # basemprimendpts_c[2] = -basemprimendpts11p25_c[primind, 2] + # # %reverse the angle as well + # angle = currentangle - (56.25 * np.pi) / 180.0 + # print('56p25\n') + + # commented out because basemprimendpts33p75_c is undefined + # elif ((currentangle_36000int - 3375) % 9000) == 0: + # basemprimendpts_c = basemprimendpts33p75_c[int(primind), :] + # angle = currentangle - (33.75 * np.pi) / 180.0 + # print('33p75\n') + + elif ((currentangle_36000int - 2250) % 9000) == 0: + basemprimendpts_c = basemprimendpts22p5_c[int(primind) - 1, :] + angle = currentangle - (22.5 * np.pi) / 180.0 + print('22p5\n') + + # commented out because basemprimendpts11p25_c is undefined + # elif ((currentangle_36000int - 1125) % 9000) == 0: + # basemprimendpts_c = basemprimendpts11p25_c[int(primind), :] + # angle = currentangle - (11.25 * np.pi) / 180.0 + # print('11p25\n') + + else: + print('ERROR: invalid angular resolution. angle = %d\n' % currentangle_36000int) + return [] + + # %now figure out what action will be + baseendpose_c = basemprimendpts_c[0:3] + additionalactioncostmult = basemprimendpts_c[3] + endx_c = np.round((baseendpose_c[0] * np.cos(angle)) - (baseendpose_c[1] * np.sin(angle))) + endy_c = np.round((baseendpose_c[0] * np.sin(angle)) + (baseendpose_c[1] * np.cos(angle))) + endtheta_c = np.fmod(angleind - 1 + baseendpose_c[2], numberofangles) + endpose_c = np.array(np.hstack((endx_c, endy_c, endtheta_c))) + print("endpose_c=", endpose_c) + print(('rotation angle=%f\n' % (angle * 180.0 / np.pi))) + # if np.logical_and(baseendpose_c[1] == 0., baseendpose_c[2] == 0.): + # %fprintf(1, 'endpose=%d %d %d\n', endpose_c(1), endpose_c(2), endpose_c(3)); + + # %generate intermediate poses (remember they are w.r.t 0,0 (and not + # %centers of the cells) + numofsamples = 10 + intermcells_m = np.zeros((numofsamples, 3)) + if UNICYCLE_MPRIM_16DEGS == 1.0: + startpt = np.array(np.hstack((0.0, 0.0, currentangle))) + endpt = np.array( + np.hstack( + ( + (endpose_c[0] * resolution), + (endpose_c[1] * resolution), + ( + ((np.fmod(angleind - 1 + baseendpose_c[2], numberofangles)) * 2.0 * np.pi) + / numberofangles + ), + ) + ) + ) + + print("startpt =", startpt) + print("endpt =", endpt) + intermcells_m = np.zeros((numofsamples, 3)) + if np.logical_or(np.logical_and(endx_c == 0.0, endy_c == 0.0), baseendpose_c[2] == 0.0): + # %turn in place or move forward + for iind in np.arange(1.0, (numofsamples) + 1): + fraction = float(iind - 1) / (numofsamples - 1) + intermcells_m[int(iind) - 1, :] = np.array( + ( + startpt[0] + (endpt[0] - startpt[0]) * fraction, + startpt[1] + (endpt[1] - startpt[1]) * fraction, + 0, + ) + ) + rotation_angle = baseendpose_c[2] * (2.0 * np.pi / numberofangles) + intermcells_m[int(iind) - 1, 2] = np.fmod(startpt[2] + rotation_angle * fraction, (2.0 * np.pi)) + # print " ",iind," of ",numofsamples," fraction=",fraction," rotation=",rotation_angle + + else: + # %unicycle-based move forward or backward (http://sbpl.net/node/53) + R = np.array( + np.vstack( + ( + np.hstack((np.cos(startpt[2]), np.sin(endpt[2]) - np.sin(startpt[2]))), + np.hstack((np.sin(startpt[2]), -np.cos(endpt[2]) + np.cos(startpt[2]))), + ) + ) + ) + + S = np.dot(np.linalg.pinv(R), np.array(np.vstack((endpt[0] - startpt[0], endpt[1] - startpt[1])))) + l = S[0] + tvoverrv = S[1] + rv = (baseendpose_c[2] * 2.0 * np.pi / numberofangles) + l / tvoverrv + tv = tvoverrv * rv + + # print "R=\n",R + # print "Rpi=\n",np.linalg.pinv(R) + # print "S=\n",S + # print "l=",l + # print "tvoverrv=",tvoverrv + # print "rv=",rv + # print "tv=",tv + + if l < 0.0: + print(('WARNING: l = %f < 0 -> bad action start/end points\n' % (l))) + l = 0.0 + + # %compute rv + # %rv = baseendpose_c(3)*2*pi/numberofangles; + # %compute tv + # %tvx = (endpt(1) - startpt(1))*rv/(sin(endpt(3)) - sin(startpt(3))) + # %tvy = -(endpt(2) - startpt(2))*rv/(cos(endpt(3)) - cos(startpt(3))) + # %tv = (tvx + tvy)/2.0; + # %generate samples + for iind in np.arange(1, numofsamples + 1): + dt = (iind - 1) / (numofsamples - 1) + # %dtheta = rv*dt + startpt(3); + # %intermcells_m(iind,:) = [startpt(1) + tv/rv*(sin(dtheta) - sin(startpt(3))) ... + # % startpt(2) - tv/rv*(cos(dtheta) - cos(startpt(3))) ... + # % dtheta]; + if (dt * tv) < l: + intermcells_m[int(iind) - 1, :] = np.array( + np.hstack( + ( + startpt[0] + dt * tv * np.cos(startpt[2]), + startpt[1] + dt * tv * np.sin(startpt[2]), + startpt[2], + ) + ) + ) + else: + dtheta = rv * (dt - l / tv) + startpt[2] + intermcells_m[int(iind) - 1, :] = np.array( + np.hstack( + ( + startpt[0] + + l * np.cos(startpt[2]) + + tvoverrv * (np.sin(dtheta) - np.sin(startpt[2])), + startpt[1] + + l * np.sin(startpt[2]) + - tvoverrv * (np.cos(dtheta) - np.cos(startpt[2])), + dtheta, + ) + ) + ) + + # %correct + errorxy = np.array( + np.hstack( + ( + endpt[0] - intermcells_m[int(numofsamples) - 1, 0], + endpt[1] - intermcells_m[int(numofsamples) - 1, 1], + ) + ) + ) + # print('l=%f errx=%f erry=%f\n'%(l, errorxy[0], errorxy[1])) + interpfactor = np.array( + np.hstack((np.arange(0.0, 1.0 + (1.0 / (numofsamples)), 1.0 / (numofsamples - 1)))) + ) + + # print "intermcells_m=",intermcells_m + # print "interp'=",interpfactor.conj().T + + intermcells_m[:, 0] = intermcells_m[:, 0] + errorxy[0] * interpfactor.conj().T + intermcells_m[:, 1] = intermcells_m[:, 1] + errorxy[1] * interpfactor.conj().T + + # %write out + fout.write('endpose_c: %d %d %d\n' % (endpose_c[0], endpose_c[1], endpose_c[2])) + fout.write('additionalactioncostmult: %d\n' % (additionalactioncostmult)) + fout.write('intermediateposes: %d\n' % (matrix_size(intermcells_m, 1.0))) + for interind in np.arange(1.0, (matrix_size(intermcells_m, 1.0)) + 1): + fout.write( + '%.4f %.4f %.4f\n' + % ( + intermcells_m[int(interind) - 1, 0], + intermcells_m[int(interind) - 1, 1], + intermcells_m[int(interind) - 1, 2], + ) + ) + + if visualize: + plt.plot(intermcells_m[:, 0], intermcells_m[:, 1], linestyle="-", marker="o") + plt.text(endpt[0], endpt[1], '{:2.0f}'.format(endpose_c[2])) + # if (visualize): + # plt.waitforbuttonpress() # uncomment to plot each primitive set one at a time + + fout.close() + if visualize: + # plt.waitforbuttonpress() # hold until buttom pressed + plt.show() # Keep windows open until the program is terminated + return [] + + +if __name__ == "__main__": + rospack = rospkg.RosPack() + outfilename = rospack.get_path('mir_navigation') + '/mprim/unicycle_highcost_5cm.mprim' + genmprim_unicycle(outfilename, visualize=True) diff --git a/config/runtime/mprim/localization.yaml b/config/runtime/mprim/localization.yaml new file mode 100644 index 0000000..2ed52b8 --- /dev/null +++ b/config/runtime/mprim/localization.yaml @@ -0,0 +1,36 @@ +Amcl: + use_map_topic: true + odom_model_type: "diff-corrected" + gui_publish_rate: 5.0 + save_pose_rate: 0.5 + laser_max_beams: 300 + laser_min_range: -1.0 + laser_max_range: -1.0 + min_particles: 1000 + max_particles: 3000 + kld_err: 0.05 + kld_z: 0.99 + odom_alpha1: 0.02 + odom_alpha2: 0.01 + odom_alpha3: 0.01 + odom_alpha4: 0.02 + laser_z_hit: 0.5 + laser_z_short: 0.05 + laser_z_max: 0.05 + laser_z_rand: 0.5 + laser_sigma_hit: 0.2 + laser_lambda_short: 0.1 + laser_model_type: "likelihood_field" + laser_likelihood_max_dist: 1.0 + update_min_d: 0.05 + update_min_a: 0.05 + odom_frame_id: odom + base_frame_id: base_link + global_frame_id: map + resample_interval: 1 + transform_tolerance: 0.2 + recovery_alpha_slow: 0.001 + recovery_alpha_fast: 0.001 + initial_pose_x: 0.0 + initial_pose_y: 0.0 + initial_pose_a: 0.0 diff --git a/config/runtime/mprim/mapping.yaml b/config/runtime/mprim/mapping.yaml new file mode 100644 index 0000000..e58fce3 --- /dev/null +++ b/config/runtime/mprim/mapping.yaml @@ -0,0 +1,63 @@ +SlamToolBox: + # Plugin params + solver_plugin: solver_plugins::CeresSolver + ceres_linear_solver: SPARSE_NORMAL_CHOLESKY + ceres_preconditioner: SCHUR_JACOBI + ceres_trust_strategy: LEVENBERG_MARQUARDT + ceres_dogleg_type: TRADITIONAL_DOGLEG + ceres_loss_function: None + + # ROS Parameters + odom_frame: odom + map_frame: map + base_frame: base_link + scan_topic: /scan + mode: mapping #localization + debug_logging: false + throttle_scans: 1 + transform_publish_period: 0.02 #if 0 never publishes odometry + map_update_interval: 10.0 + resolution: 0.05 + max_laser_range: 20.0 #for rastering images + minimum_time_interval: 0.5 + transform_timeout: 0.2 + tf_buffer_duration: 14400. + stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps + enable_interactive_mode: true + + # General Parameters + use_scan_matching: true + use_scan_barycenter: true + minimum_travel_distance: 0.5 + minimum_travel_heading: 0.5 + scan_buffer_size: 10 + scan_buffer_maximum_scan_distance: 10 + link_match_minimum_response_fine: 0.1 + link_scan_maximum_distance: 1.5 + loop_search_maximum_distance: 3.0 + do_loop_closing: true + loop_match_minimum_chain_size: 10 + loop_match_maximum_variance_coarse: 3.0 + loop_match_minimum_response_coarse: 0.35 + loop_match_minimum_response_fine: 0.45 + + # Correlation Parameters - Correlation Parameters + correlation_search_space_dimension: 0.5 + correlation_search_space_resolution: 0.01 + correlation_search_space_smear_deviation: 0.1 + + # Correlation Parameters - Loop Closure Parameters + loop_search_space_dimension: 8.0 + loop_search_space_resolution: 0.05 + loop_search_space_smear_deviation: 0.03 + + # Scan Matcher Parameters + distance_variance_penalty: 0.5 + angle_variance_penalty: 1.0 + + fine_search_angle_offset: 0.00349 + coarse_search_angle_offset: 0.349 + coarse_angle_resolution: 0.0349 + minimum_angle_penalty: 0.9 + minimum_distance_penalty: 0.5 + use_response_expansion: true diff --git a/config/runtime/mprim/mpc_local_planner_params.yaml b/config/runtime/mprim/mpc_local_planner_params.yaml new file mode 100755 index 0000000..aa6a592 --- /dev/null +++ b/config/runtime/mprim/mpc_local_planner_params.yaml @@ -0,0 +1,106 @@ +base_local_planner: mpc_local_planner/MpcLocalPlannerROS +MpcLocalPlannerROS: + + odom_topic: odom + + ## Robot settings + robot: + type: "unicycle" + unicycle: + max_vel_x: 0.5 + max_vel_x_backwards: 0.3 + max_vel_theta: 0.3 + acc_lim_x: 0.4 # deactive bounds with zero + dec_lim_x: 0.4 # deactive bounds with zero + acc_lim_theta: 0.6 # deactivate bounds with zero + + ## Footprint model for collision avoidance + footprint_model: + type: "point" + is_footprint_dynamic: False + + ## Collision avoidance + collision_avoidance: + min_obstacle_dist: 0.5 # Note, this parameter must be chosen w.r.t. the footprint_model + enable_dynamic_obstacles: False + force_inclusion_dist: 0.5 + cutoff_dist: 2.0 + include_costmap_obstacles: True + costmap_obstacles_behind_robot_dist: 1.5 + collision_check_no_poses: 5 + + ## Planning grid + grid: + type: "fd_grid" + grid_size_ref: 20 # Set horizon length here (T = (grid_size_ref-1) * dt_ref); Note, also check max_global_plan_lookahead_dist + dt_ref: 0.3 # and here the corresponding temporal resolution + xf_fixed: [False, False, False] # Unfix final state -> we use terminal cost below + warm_start: True + collocation_method: "forward_differences" + cost_integration_method: "left_sum" + variable_grid: + enable: False # We want a fixed grid + min_dt: 0.0; + max_dt: 10.0; + grid_adaptation: + enable: True + dt_hyst_ratio: 0.1 + min_grid_size: 2 + max_grid_size: 50 + + ## Planning options + planning: + objective: + type: "quadratic_form" # minimum_time requires grid/variable_grid/enable=True and grid/xf_fixed set properly + quadratic_form: + state_weights: [2.0, 2.0, 0.25] + control_weights: [0.1, 0.05] + integral_form: False + terminal_cost: + type: "quadratic" # can be "none" + quadratic: + final_state_weights: [10.0, 10.0, 0.5] + terminal_constraint: + type: "none" # can be "none" + l2_ball: + weight_matrix: [1.0, 1.0, 1.0] + radius: 5 + + ## Controller options + controller: + outer_ocp_iterations: 1 + xy_goal_tolerance: 0.05 + yaw_goal_tolerance: 0.04 + global_plan_overwrite_orientation: False + global_plan_prune_distance: 1.5 + allow_init_with_backward_motion: True + max_global_plan_lookahead_dist: 1.0 # Check horizon length + force_reinit_new_goal_dist: 1.0 + force_reinit_new_goal_angular: 1.57 + force_reinit_num_steps: 0 + prefer_x_feedback: False + publish_ocp_results: True + + ## Solver settings + solver: + type: "ipopt" + ipopt: + iterations: 100 + max_cpu_time: -1.0 + ipopt_numeric_options: + tol: 1e-3 + ipopt_string_options: + linear_solver: "mumps" + hessian_approximation: "exact" # exact or limited-memory + lsq_lm: + iterations: 10 + weight_init_eq: 2 + weight_init_ineq: 2 + weight_init_bounds: 2 + weight_adapt_factor_eq: 1.5 + weight_adapt_factor_ineq: 1.5 + weight_adapt_factor_bounds: 1.5 + weight_adapt_max_eq: 500 + weight_adapt_max_ineq: 500 + weight_adapt_max_bounds: 500 + diff --git a/config/runtime/mprim/mqtt_general.yaml b/config/runtime/mprim/mqtt_general.yaml new file mode 100644 index 0000000..bc22191 --- /dev/null +++ b/config/runtime/mprim/mqtt_general.yaml @@ -0,0 +1,8 @@ +# MQTT: +# Name: T800 +# Host: 172.20.235.170 +# Port: 1885 +# Client_ID: T800 +# Username: robotics +# Password: robotics +# Keep_Alive: 60 \ No newline at end of file diff --git a/config/runtime/mprim/ros_diff_drive_controller.yaml b/config/runtime/mprim/ros_diff_drive_controller.yaml new file mode 100755 index 0000000..90b2db6 --- /dev/null +++ b/config/runtime/mprim/ros_diff_drive_controller.yaml @@ -0,0 +1,71 @@ +# ----------------------------------- +left_wheel : 'left_wheel_joint' +right_wheel : 'right_wheel_joint' +publish_rate: 50 # this is what the real MiR platform publishes (default: 50) +# These covariances are exactly what the real MiR platform publishes +pose_covariance_diagonal : [0.00001, 0.00001, 1000000.0, 1000000.0, 1000000.0, 1000.0] +twist_covariance_diagonal: [0.1, 0.1, 1000000.0, 1000000.0, 1000000.0, 1000.0] +enable_odom_tf: true +enable_wheel_tf: true +allow_multiple_cmd_vel_publishers: true +# open_loop: false +# Wheel separation and diameter. These are both optional. +# diff_drive_controller will attempt to read either one or both from the +# URDF if not specified as a parameter. +# We don't set the value here because it's different for each MiR type (100, 250, ...), and +# the plugin figures out the correct values. +wheel_separation : 0.5106 +wheel_radius : 0.1 + +# Wheel separation and radius multipliers +wheel_separation_multiplier: 1.0 # default: 1.0 +wheel_radius_multiplier : 1.0 # default: 1.0 + +# Velocity commands timeout [s], default 0.5 +cmd_vel_timeout: 1.0 + +# frame_ids (same as real MiR platform) +base_frame_id: base_link # default: base_link base_link +odom_frame_id: odom # default: odom + +# Velocity and acceleration limits +# Whenever a min_* is unspecified, default to -max_* +linear: + x: + has_velocity_limits : true + max_velocity : 1.5 # m/s; move_base max_vel_x: 0.8 + min_velocity : -1.5 # m/s + has_acceleration_limits: true + max_acceleration : 0.5 # m/s^2; move_base acc_lim_x: 1.5 + min_acceleration : -0.5 # m/s^2 + has_jerk_limits : true + max_jerk : 3.0 # m/s^3 +angular: + z: + has_velocity_limits : true + max_velocity : 1.0 # rad/s; move_base max_rot_vel: 1.0 + min_velocity : -1.0 + has_acceleration_limits: true + max_acceleration : 3.0 # rad/s^2; move_base acc_lim_th: 2.0 + has_jerk_limits : true + max_jerk : 2.5 # rad/s^3 + +left_wheel_joint: + lookup_name: WheelPlugin + max_publish_rate: 50 + mesurement_topic: left_encoder + frame_id: left_wheel_link + wheel_topic: /left_wheel + subscribe_queue_size: 1 + command_timeout: 5.0 + origin : [0.0, 0.255, 0.075, 0.0, 0.0, 0.0] # origin from base_frame_id + +right_wheel_joint: + lookup_name: WheelPlugin + max_publish_rate: 50 + mesurement_topic: right_encoder + frame_id: right_wheel_link + wheel_topic: /right_wheel + subscribe_queue_size: 1 + command_timeout: 5.0 + origin : [0.0, -0.255, 0.075, 0.0, 0.0, 0.0] # origin from base_frame_id diff --git a/config/runtime/mprim/sbpl_global_params.yaml b/config/runtime/mprim/sbpl_global_params.yaml new file mode 100755 index 0000000..ec2ac75 --- /dev/null +++ b/config/runtime/mprim/sbpl_global_params.yaml @@ -0,0 +1,10 @@ +base_global_planner: SBPLLatticePlanner +SBPLLatticePlanner: + environment_type: XYThetaLattice + planner_type: ARAPlanner + allocated_time: 10.0 + initial_epsilon: 1.0 + force_scratch_limit: 10000 + forward_search: true + nominalvel_mpersecs: 0.2 + timetoturn45degsinplace_secs: 0.6 # = 0.6 rad/s diff --git a/config/runtime/mprim/sick_line_guidance_mls.yaml b/config/runtime/mprim/sick_line_guidance_mls.yaml new file mode 100644 index 0000000..959a137 --- /dev/null +++ b/config/runtime/mprim/sick_line_guidance_mls.yaml @@ -0,0 +1,61 @@ +bus: + device: can0 + driver_plugin: can::SocketCANInterface + master_allocator: canopen::SimpleMaster::Allocator +sync: + interval_ms: 10 + overflow: 0 +# +# heartbeat: # simple heartbeat producer (optional, not supported by OLS or MLS, do not enable heartbeats) +# rate: 100 # heartbeat rate (1/rate in seconds) +# msg: "77f#05" # message to send, cansend format: heartbeat of node 127 with status 5=Started +nodes: + f_mlse: + id: 0x01 # CAN-Node-ID of can device, default: Node-ID 10=0x0A for OLS and MLS + eds_pkg: sick_line_guidance # package name for relative path + eds_file: mls/SICK-MLS.eds # path to EDS/DCF file + publish: ["1001","1018sub1","1018sub4","2021sub1!","2021sub2!","2021sub3!","2021sub4!","2022!"] + # MLS: 1001 = error register, 1018sub1 = VendorID, 1018sub4 = SerialNumber, TPDO1 = 0x2021sub1 to 0x2021sub4 and 0x2022 + + # sick_line_guidance configuration of this node: + sick_device_family: "MLS" # can devices of OLS10, OLS20 or MLS family currently supported + sick_topic: "f_mlse" # MLS_Measurement messages are published in topic "/mls" + subscribe_queue_size: 1 + sick_frame_id: "f_mlse" # MLS_Measurement messages are published frame_id "mls_measurement_frame" + + # device configuration of writable parameter by dcf_overlay: "objectindex": "parametervalue" + # example: "2027": "0x01" # Object 2027 (sensorFlipped, defaultvalue 0x00) will be configured with value 0x01 + # dcf_overlay: + # "2028sub1": "0x01" # UseMarkers (0 = disable marker detection, 1 = enable marker detection), UINT8, DataType=0x0005, defaultvalue=0 + # "2028sub2": "0x02" # MarkerStyle (0 = disable marker detection, 1 = standard mode, 2 = extended mode), UINT8, DataType=0x0005, defaultvalue=0 + # "2028sub3": "0x01" # FailSafeMode (0 = disabled, 1 = enabled), UINT8, DataType=0x0005, defaultvalue=0 + # "2025": "1000" # Min.Level, UINT16, DataType=0x0006, defaultvalue=600 + # "2026": "1" # Offset [mm] Nullpunkt, INT16, DataType=0x0003, defaultvalue=0 + # "2027": "0x01" # sensorFlipped, UINT8, DataType=0x0005, defaultvalue=0 + # "2029": "0x01" # LockTeach, UINT8, DataType=0x0005, defaultvalue=0 + # + + b_mlse: + id: 0x02 # CAN-Node-ID of can device, default: Node-ID 10=0x0A for OLS and MLS + eds_pkg: sick_line_guidance # package name for relative path + eds_file: mls/SICK-MLS.eds # path to EDS/DCF file + publish: ["1001","1018sub1","1018sub4","2021sub1!","2021sub2!","2021sub3!","2021sub4!","2022!"] + # MLS: 1001 = error register, 1018sub1 = VendorID, 1018sub4 = SerialNumber, TPDO1 = 0x2021sub1 to 0x2021sub4 and 0x2022 + + # sick_line_guidance configuration of this node: + sick_device_family: "MLS" # can devices of OLS10, OLS20 or MLS family currently supported + sick_topic: "b_mlse" # MLS_Measurement messages are published in topic "/mls" + subscribe_queue_size: 1 + sick_frame_id: "b_mlse" # MLS_Measurement messages are published frame_id "mls_measurement_frame" + + # device configuration of writable parameter by dcf_overlay: "objectindex": "parametervalue" + # example: "2027": "0x01" # Object 2027 (sensorFlipped, defaultvalue 0x00) will be configured with value 0x01 + # dcf_overlay: + # "2028sub1": "0x01" # UseMarkers (0 = disable marker detection, 1 = enable marker detection), UINT8, DataType=0x0005, defaultvalue=0 + # "2028sub2": "0x02" # MarkerStyle (0 = disable marker detection, 1 = standard mode, 2 = extended mode), UINT8, DataType=0x0005, defaultvalue=0 + # "2028sub3": "0x01" # FailSafeMode (0 = disabled, 1 = enabled), UINT8, DataType=0x0005, defaultvalue=0 + # "2025": "1000" # Min.Level, UINT16, DataType=0x0006, defaultvalue=600 + # "2026": "1" # Offset [mm] Nullpunkt, INT16, DataType=0x0003, defaultvalue=0 + # "2027": "0x01" # sensorFlipped, UINT8, DataType=0x0005, defaultvalue=0 + # "2029": "0x01" # LockTeach, UINT8, DataType=0x0005, defaultvalue=0 + # \ No newline at end of file diff --git a/config/runtime/mprim/unicycle_5cm.mprim b/config/runtime/mprim/unicycle_5cm.mprim new file mode 100755 index 0000000..cb56cd0 --- /dev/null +++ b/config/runtime/mprim/unicycle_5cm.mprim @@ -0,0 +1,1203 @@ +resolution_m: 0.050000 +numberofangles: 16 +totalnumberofprimitives: 80 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0056 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0167 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0278 0.0000 0.0000 +0.0333 0.0000 0.0000 +0.0389 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0500 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 8 0 0 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2222 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3111 0.0000 0.0000 +0.3556 0.0000 0.0000 +0.4000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0056 0.0000 0.0000 +-0.0111 0.0000 0.0000 +-0.0167 0.0000 0.0000 +-0.0222 0.0000 0.0000 +-0.0278 0.0000 0.0000 +-0.0333 0.0000 0.0000 +-0.0389 0.0000 0.0000 +-0.0444 0.0000 0.0000 +-0.0500 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 8 1 1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 -0.0000 0.0000 +0.0904 -0.0000 0.0000 +0.1355 -0.0000 0.0000 +0.1807 0.0008 0.0488 +0.2257 0.0045 0.1176 +0.2703 0.0114 0.1864 +0.3144 0.0213 0.2551 +0.3577 0.0342 0.3239 +0.4000 0.0500 0.3927 +primID: 4 +startangle_c: 0 +endpose_c: 8 -1 -1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 0.0000 0.0000 +0.0904 0.0000 0.0000 +0.1355 0.0000 0.0000 +0.1807 -0.0008 -0.0488 +0.2257 -0.0045 -0.1176 +0.2703 -0.0114 -0.1864 +0.3144 -0.0213 -0.2551 +0.3577 -0.0342 -0.3239 +0.4000 -0.0500 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0111 0.0056 0.3927 +0.0222 0.0111 0.3927 +0.0333 0.0167 0.3927 +0.0444 0.0222 0.3927 +0.0556 0.0278 0.3927 +0.0667 0.0333 0.3927 +0.0778 0.0389 0.3927 +0.0889 0.0444 0.3927 +0.1000 0.0500 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 6 3 1 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0333 0.0167 0.3927 +0.0667 0.0333 0.3927 +0.1000 0.0500 0.3927 +0.1333 0.0667 0.3927 +0.1667 0.0833 0.3927 +0.2000 0.1000 0.3927 +0.2333 0.1167 0.3927 +0.2667 0.1333 0.3927 +0.3000 0.1500 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0111 -0.0056 0.3927 +-0.0222 -0.0111 0.3927 +-0.0333 -0.0167 0.3927 +-0.0444 -0.0222 0.3927 +-0.0556 -0.0278 0.3927 +-0.0667 -0.0333 0.3927 +-0.0778 -0.0389 0.3927 +-0.0889 -0.0444 0.3927 +-0.1000 -0.0500 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 5 4 2 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0298 0.0184 0.4230 +0.0592 0.0379 0.4533 +0.0881 0.0583 0.4836 +0.1165 0.0796 0.5139 +0.1444 0.1019 0.5442 +0.1717 0.1251 0.5745 +0.1984 0.1492 0.6048 +0.2245 0.1742 0.6351 +0.2500 0.2000 0.6654 +primID: 4 +startangle_c: 1 +endpose_c: 7 2 0 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0377 0.0156 0.3927 +0.0754 0.0312 0.3927 +0.1131 0.0468 0.3927 +0.1508 0.0623 0.3736 +0.1893 0.0758 0.2989 +0.2287 0.0863 0.2242 +0.2687 0.0939 0.1494 +0.3092 0.0985 0.0747 +0.3500 0.1000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0056 0.0056 0.7854 +0.0111 0.0111 0.7854 +0.0167 0.0167 0.7854 +0.0222 0.0222 0.7854 +0.0278 0.0278 0.7854 +0.0333 0.0333 0.7854 +0.0389 0.0389 0.7854 +0.0444 0.0444 0.7854 +0.0500 0.0500 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 6 6 2 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0056 -0.0056 0.7854 +-0.0111 -0.0111 0.7854 +-0.0167 -0.0167 0.7854 +-0.0222 -0.0222 0.7854 +-0.0278 -0.0278 0.7854 +-0.0333 -0.0333 0.7854 +-0.0389 -0.0389 0.7854 +-0.0444 -0.0444 0.7854 +-0.0500 -0.0500 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 5 7 3 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0678 0.0684 0.8151 +0.1000 0.1043 0.8669 +0.1302 0.1418 0.9188 +0.1584 0.1809 0.9707 +0.1846 0.2213 1.0225 +0.2086 0.2631 1.0744 +0.2304 0.3060 1.1262 +0.2500 0.3500 1.1781 +primID: 4 +startangle_c: 2 +endpose_c: 7 5 1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0684 0.0678 0.7557 +0.1043 0.1000 0.7039 +0.1418 0.1302 0.6520 +0.1809 0.1584 0.6001 +0.2213 0.1846 0.5483 +0.2631 0.2086 0.4964 +0.3060 0.2304 0.4446 +0.3500 0.2500 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0056 0.0111 1.1781 +0.0111 0.0222 1.1781 +0.0167 0.0333 1.1781 +0.0222 0.0444 1.1781 +0.0278 0.0556 1.1781 +0.0333 0.0667 1.1781 +0.0389 0.0778 1.1781 +0.0444 0.0889 1.1781 +0.0500 0.1000 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 3 6 3 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0167 0.0333 1.1781 +0.0333 0.0667 1.1781 +0.0500 0.1000 1.1781 +0.0667 0.1333 1.1781 +0.0833 0.1667 1.1781 +0.1000 0.2000 1.1781 +0.1167 0.2333 1.1781 +0.1333 0.2667 1.1781 +0.1500 0.3000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0056 -0.0111 1.1781 +-0.0111 -0.0222 1.1781 +-0.0167 -0.0333 1.1781 +-0.0222 -0.0444 1.1781 +-0.0278 -0.0556 1.1781 +-0.0333 -0.0667 1.1781 +-0.0389 -0.0778 1.1781 +-0.0444 -0.0889 1.1781 +-0.0500 -0.1000 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 4 5 2 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0184 0.0298 1.1478 +0.0379 0.0592 1.1175 +0.0583 0.0881 1.0872 +0.0796 0.1165 1.0569 +0.1019 0.1444 1.0266 +0.1251 0.1717 0.9963 +0.1492 0.1984 0.9660 +0.1742 0.2245 0.9357 +0.2000 0.2500 0.9054 +primID: 4 +startangle_c: 3 +endpose_c: 2 7 4 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0156 0.0377 1.1781 +0.0312 0.0754 1.1781 +0.0468 0.1131 1.1781 +0.0623 0.1508 1.1972 +0.0758 0.1893 1.2719 +0.0863 0.2287 1.3466 +0.0939 0.2687 1.4214 +0.0985 0.3092 1.4961 +0.1000 0.3500 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0056 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0167 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0278 1.5708 +0.0000 0.0333 1.5708 +0.0000 0.0389 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0500 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 8 4 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2222 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3111 1.5708 +0.0000 0.3556 1.5708 +0.0000 0.4000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0056 1.5708 +0.0000 -0.0111 1.5708 +0.0000 -0.0167 1.5708 +0.0000 -0.0222 1.5708 +0.0000 -0.0278 1.5708 +0.0000 -0.0333 1.5708 +0.0000 -0.0389 1.5708 +0.0000 -0.0444 1.5708 +0.0000 -0.0500 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -1 8 5 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +-0.0008 0.1807 1.6196 +-0.0045 0.2257 1.6884 +-0.0114 0.2703 1.7572 +-0.0213 0.3144 1.8259 +-0.0342 0.3577 1.8947 +-0.0500 0.4000 1.9635 +primID: 4 +startangle_c: 4 +endpose_c: 1 8 3 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.5708 +-0.0000 0.0452 1.5708 +-0.0000 0.0904 1.5708 +-0.0000 0.1355 1.5708 +0.0008 0.1807 1.5220 +0.0045 0.2257 1.4532 +0.0114 0.2703 1.3844 +0.0213 0.3144 1.3156 +0.0342 0.3577 1.2469 +0.0500 0.4000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0056 0.0111 1.9635 +-0.0111 0.0222 1.9635 +-0.0167 0.0333 1.9635 +-0.0222 0.0444 1.9635 +-0.0278 0.0556 1.9635 +-0.0333 0.0667 1.9635 +-0.0389 0.0778 1.9635 +-0.0444 0.0889 1.9635 +-0.0500 0.1000 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -3 6 5 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0167 0.0333 1.9635 +-0.0333 0.0667 1.9635 +-0.0500 0.1000 1.9635 +-0.0667 0.1333 1.9635 +-0.0833 0.1667 1.9635 +-0.1000 0.2000 1.9635 +-0.1167 0.2333 1.9635 +-0.1333 0.2667 1.9635 +-0.1500 0.3000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0056 -0.0111 1.9635 +0.0111 -0.0222 1.9635 +0.0167 -0.0333 1.9635 +0.0222 -0.0444 1.9635 +0.0278 -0.0556 1.9635 +0.0333 -0.0667 1.9635 +0.0389 -0.0778 1.9635 +0.0444 -0.0889 1.9635 +0.0500 -0.1000 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -4 5 6 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0184 0.0298 1.9938 +-0.0379 0.0592 2.0241 +-0.0583 0.0881 2.0544 +-0.0796 0.1165 2.0847 +-0.1019 0.1444 2.1150 +-0.1251 0.1717 2.1453 +-0.1492 0.1984 2.1756 +-0.1742 0.2245 2.2059 +-0.2000 0.2500 2.2362 +primID: 4 +startangle_c: 5 +endpose_c: -2 7 4 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0156 0.0377 1.9635 +-0.0312 0.0754 1.9635 +-0.0468 0.1131 1.9635 +-0.0623 0.1508 1.9444 +-0.0758 0.1893 1.8697 +-0.0863 0.2287 1.7950 +-0.0939 0.2687 1.7202 +-0.0985 0.3092 1.6455 +-0.1000 0.3500 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0056 0.0056 2.3562 +-0.0111 0.0111 2.3562 +-0.0167 0.0167 2.3562 +-0.0222 0.0222 2.3562 +-0.0278 0.0278 2.3562 +-0.0333 0.0333 2.3562 +-0.0389 0.0389 2.3562 +-0.0444 0.0444 2.3562 +-0.0500 0.0500 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -6 6 6 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0056 -0.0056 2.3562 +0.0111 -0.0111 2.3562 +0.0167 -0.0167 2.3562 +0.0222 -0.0222 2.3562 +0.0278 -0.0278 2.3562 +0.0333 -0.0333 2.3562 +0.0389 -0.0389 2.3562 +0.0444 -0.0444 2.3562 +0.0500 -0.0500 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -7 5 7 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0684 0.0678 2.3859 +-0.1043 0.1000 2.4377 +-0.1418 0.1302 2.4896 +-0.1809 0.1584 2.5415 +-0.2213 0.1846 2.5933 +-0.2631 0.2086 2.6452 +-0.3060 0.2304 2.6970 +-0.3500 0.2500 2.7489 +primID: 4 +startangle_c: 6 +endpose_c: -5 7 5 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0678 0.0684 2.3265 +-0.1000 0.1043 2.2747 +-0.1302 0.1418 2.2228 +-0.1584 0.1809 2.1709 +-0.1846 0.2213 2.1191 +-0.2086 0.2631 2.0672 +-0.2304 0.3060 2.0154 +-0.2500 0.3500 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0111 0.0056 2.7489 +-0.0222 0.0111 2.7489 +-0.0333 0.0167 2.7489 +-0.0444 0.0222 2.7489 +-0.0556 0.0278 2.7489 +-0.0667 0.0333 2.7489 +-0.0778 0.0389 2.7489 +-0.0889 0.0444 2.7489 +-0.1000 0.0500 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -6 3 7 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0333 0.0167 2.7489 +-0.0667 0.0333 2.7489 +-0.1000 0.0500 2.7489 +-0.1333 0.0667 2.7489 +-0.1667 0.0833 2.7489 +-0.2000 0.1000 2.7489 +-0.2333 0.1167 2.7489 +-0.2667 0.1333 2.7489 +-0.3000 0.1500 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0111 -0.0056 2.7489 +0.0222 -0.0111 2.7489 +0.0333 -0.0167 2.7489 +0.0444 -0.0222 2.7489 +0.0556 -0.0278 2.7489 +0.0667 -0.0333 2.7489 +0.0778 -0.0389 2.7489 +0.0889 -0.0444 2.7489 +0.1000 -0.0500 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -5 4 6 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0298 0.0184 2.7186 +-0.0592 0.0379 2.6883 +-0.0881 0.0583 2.6580 +-0.1165 0.0796 2.6277 +-0.1444 0.1019 2.5974 +-0.1717 0.1251 2.5671 +-0.1984 0.1492 2.5368 +-0.2245 0.1742 2.5065 +-0.2500 0.2000 2.4762 +primID: 4 +startangle_c: 7 +endpose_c: -7 2 8 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0377 0.0156 2.7489 +-0.0754 0.0312 2.7489 +-0.1131 0.0468 2.7489 +-0.1508 0.0623 2.7680 +-0.1893 0.0758 2.8427 +-0.2287 0.0863 2.9174 +-0.2687 0.0939 2.9921 +-0.3092 0.0985 3.0669 +-0.3500 0.1000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0056 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0167 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0278 0.0000 3.1416 +-0.0333 0.0000 3.1416 +-0.0389 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0500 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -8 0 8 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2222 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3111 0.0000 3.1416 +-0.3556 0.0000 3.1416 +-0.4000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0056 0.0000 3.1416 +0.0111 0.0000 3.1416 +0.0167 0.0000 3.1416 +0.0222 0.0000 3.1416 +0.0278 0.0000 3.1416 +0.0333 0.0000 3.1416 +0.0389 0.0000 3.1416 +0.0444 0.0000 3.1416 +0.0500 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -8 -1 9 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 -0.0008 3.1904 +-0.2257 -0.0045 3.2592 +-0.2703 -0.0114 3.3280 +-0.3144 -0.0213 3.3967 +-0.3577 -0.0342 3.4655 +-0.4000 -0.0500 3.5343 +primID: 4 +startangle_c: 8 +endpose_c: -8 1 7 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 0.0008 3.0928 +-0.2257 0.0045 3.0240 +-0.2703 0.0114 2.9552 +-0.3144 0.0213 2.8864 +-0.3577 0.0342 2.8177 +-0.4000 0.0500 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0111 -0.0056 3.5343 +-0.0222 -0.0111 3.5343 +-0.0333 -0.0167 3.5343 +-0.0444 -0.0222 3.5343 +-0.0556 -0.0278 3.5343 +-0.0667 -0.0333 3.5343 +-0.0778 -0.0389 3.5343 +-0.0889 -0.0444 3.5343 +-0.1000 -0.0500 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -6 -3 9 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0333 -0.0167 3.5343 +-0.0667 -0.0333 3.5343 +-0.1000 -0.0500 3.5343 +-0.1333 -0.0667 3.5343 +-0.1667 -0.0833 3.5343 +-0.2000 -0.1000 3.5343 +-0.2333 -0.1167 3.5343 +-0.2667 -0.1333 3.5343 +-0.3000 -0.1500 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0111 0.0056 3.5343 +0.0222 0.0111 3.5343 +0.0333 0.0167 3.5343 +0.0444 0.0222 3.5343 +0.0556 0.0278 3.5343 +0.0667 0.0333 3.5343 +0.0778 0.0389 3.5343 +0.0889 0.0444 3.5343 +0.1000 0.0500 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -5 -4 10 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0298 -0.0184 3.5646 +-0.0592 -0.0379 3.5949 +-0.0881 -0.0583 3.6252 +-0.1165 -0.0796 3.6555 +-0.1444 -0.1019 3.6858 +-0.1717 -0.1251 3.7161 +-0.1984 -0.1492 3.7464 +-0.2245 -0.1742 3.7767 +-0.2500 -0.2000 3.8070 +primID: 4 +startangle_c: 9 +endpose_c: -7 -2 8 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0377 -0.0156 3.5343 +-0.0754 -0.0312 3.5343 +-0.1131 -0.0468 3.5343 +-0.1508 -0.0623 3.5152 +-0.1893 -0.0758 3.4405 +-0.2287 -0.0863 3.3658 +-0.2687 -0.0939 3.2910 +-0.3092 -0.0985 3.2163 +-0.3500 -0.1000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0056 -0.0056 3.9270 +-0.0111 -0.0111 3.9270 +-0.0167 -0.0167 3.9270 +-0.0222 -0.0222 3.9270 +-0.0278 -0.0278 3.9270 +-0.0333 -0.0333 3.9270 +-0.0389 -0.0389 3.9270 +-0.0444 -0.0444 3.9270 +-0.0500 -0.0500 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -6 -6 10 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0056 0.0056 3.9270 +0.0111 0.0111 3.9270 +0.0167 0.0167 3.9270 +0.0222 0.0222 3.9270 +0.0278 0.0278 3.9270 +0.0333 0.0333 3.9270 +0.0389 0.0389 3.9270 +0.0444 0.0444 3.9270 +0.0500 0.0500 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -5 -7 11 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0678 -0.0684 3.9567 +-0.1000 -0.1043 4.0085 +-0.1302 -0.1418 4.0604 +-0.1584 -0.1809 4.1123 +-0.1846 -0.2213 4.1641 +-0.2086 -0.2631 4.2160 +-0.2304 -0.3060 4.2678 +-0.2500 -0.3500 4.3197 +primID: 4 +startangle_c: 10 +endpose_c: -7 -5 9 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0684 -0.0678 3.8973 +-0.1043 -0.1000 3.8455 +-0.1418 -0.1302 3.7936 +-0.1809 -0.1584 3.7417 +-0.2213 -0.1846 3.6899 +-0.2631 -0.2086 3.6380 +-0.3060 -0.2304 3.5862 +-0.3500 -0.2500 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0056 -0.0111 4.3197 +-0.0111 -0.0222 4.3197 +-0.0167 -0.0333 4.3197 +-0.0222 -0.0444 4.3197 +-0.0278 -0.0556 4.3197 +-0.0333 -0.0667 4.3197 +-0.0389 -0.0778 4.3197 +-0.0444 -0.0889 4.3197 +-0.0500 -0.1000 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -3 -6 11 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0167 -0.0333 4.3197 +-0.0333 -0.0667 4.3197 +-0.0500 -0.1000 4.3197 +-0.0667 -0.1333 4.3197 +-0.0833 -0.1667 4.3197 +-0.1000 -0.2000 4.3197 +-0.1167 -0.2333 4.3197 +-0.1333 -0.2667 4.3197 +-0.1500 -0.3000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0056 0.0111 4.3197 +0.0111 0.0222 4.3197 +0.0167 0.0333 4.3197 +0.0222 0.0444 4.3197 +0.0278 0.0556 4.3197 +0.0333 0.0667 4.3197 +0.0389 0.0778 4.3197 +0.0444 0.0889 4.3197 +0.0500 0.1000 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -4 -5 10 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0184 -0.0298 4.2894 +-0.0379 -0.0592 4.2591 +-0.0583 -0.0881 4.2288 +-0.0796 -0.1165 4.1985 +-0.1019 -0.1444 4.1682 +-0.1251 -0.1717 4.1379 +-0.1492 -0.1984 4.1076 +-0.1742 -0.2245 4.0773 +-0.2000 -0.2500 4.0470 +primID: 4 +startangle_c: 11 +endpose_c: -2 -7 12 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0156 -0.0377 4.3197 +-0.0312 -0.0754 4.3197 +-0.0468 -0.1131 4.3197 +-0.0623 -0.1508 4.3388 +-0.0758 -0.1893 4.4135 +-0.0863 -0.2287 4.4882 +-0.0939 -0.2687 4.5629 +-0.0985 -0.3092 4.6377 +-0.1000 -0.3500 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0056 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0167 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0278 4.7124 +0.0000 -0.0333 4.7124 +0.0000 -0.0389 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0500 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -8 12 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2222 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3111 4.7124 +0.0000 -0.3556 4.7124 +0.0000 -0.4000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0056 4.7124 +0.0000 0.0111 4.7124 +0.0000 0.0167 4.7124 +0.0000 0.0222 4.7124 +0.0000 0.0278 4.7124 +0.0000 0.0333 4.7124 +0.0000 0.0389 4.7124 +0.0000 0.0444 4.7124 +0.0000 0.0500 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 1 -8 13 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0000 -0.0452 4.7124 +-0.0000 -0.0904 4.7124 +-0.0000 -0.1355 4.7124 +0.0008 -0.1807 4.7612 +0.0045 -0.2257 4.8300 +0.0114 -0.2703 4.8988 +0.0213 -0.3144 4.9675 +0.0342 -0.3577 5.0363 +0.0500 -0.4000 5.1051 +primID: 4 +startangle_c: 12 +endpose_c: -1 -8 11 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0000 -0.0452 4.7124 +-0.0000 -0.0904 4.7124 +-0.0000 -0.1355 4.7124 +-0.0008 -0.1807 4.6636 +-0.0045 -0.2257 4.5948 +-0.0114 -0.2703 4.5260 +-0.0213 -0.3144 4.4572 +-0.0342 -0.3577 4.3885 +-0.0500 -0.4000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0056 -0.0111 5.1051 +0.0111 -0.0222 5.1051 +0.0167 -0.0333 5.1051 +0.0222 -0.0444 5.1051 +0.0278 -0.0556 5.1051 +0.0333 -0.0667 5.1051 +0.0389 -0.0778 5.1051 +0.0444 -0.0889 5.1051 +0.0500 -0.1000 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 3 -6 13 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0167 -0.0333 5.1051 +0.0333 -0.0667 5.1051 +0.0500 -0.1000 5.1051 +0.0667 -0.1333 5.1051 +0.0833 -0.1667 5.1051 +0.1000 -0.2000 5.1051 +0.1167 -0.2333 5.1051 +0.1333 -0.2667 5.1051 +0.1500 -0.3000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0056 0.0111 5.1051 +-0.0111 0.0222 5.1051 +-0.0167 0.0333 5.1051 +-0.0222 0.0444 5.1051 +-0.0278 0.0556 5.1051 +-0.0333 0.0667 5.1051 +-0.0389 0.0778 5.1051 +-0.0444 0.0889 5.1051 +-0.0500 0.1000 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 4 -5 14 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0184 -0.0298 5.1354 +0.0379 -0.0592 5.1657 +0.0583 -0.0881 5.1960 +0.0796 -0.1165 5.2263 +0.1019 -0.1444 5.2566 +0.1251 -0.1717 5.2869 +0.1492 -0.1984 5.3172 +0.1742 -0.2245 5.3475 +0.2000 -0.2500 5.3778 +primID: 4 +startangle_c: 13 +endpose_c: 2 -7 12 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0156 -0.0377 5.1051 +0.0312 -0.0754 5.1051 +0.0468 -0.1131 5.1051 +0.0623 -0.1508 5.0860 +0.0758 -0.1893 5.0113 +0.0863 -0.2287 4.9366 +0.0939 -0.2687 4.8618 +0.0985 -0.3092 4.7871 +0.1000 -0.3500 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0056 -0.0056 5.4978 +0.0111 -0.0111 5.4978 +0.0167 -0.0167 5.4978 +0.0222 -0.0222 5.4978 +0.0278 -0.0278 5.4978 +0.0333 -0.0333 5.4978 +0.0389 -0.0389 5.4978 +0.0444 -0.0444 5.4978 +0.0500 -0.0500 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 6 -6 14 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0056 0.0056 5.4978 +-0.0111 0.0111 5.4978 +-0.0167 0.0167 5.4978 +-0.0222 0.0222 5.4978 +-0.0278 0.0278 5.4978 +-0.0333 0.0333 5.4978 +-0.0389 0.0389 5.4978 +-0.0444 0.0444 5.4978 +-0.0500 0.0500 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 7 -5 15 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0684 -0.0678 5.5275 +0.1043 -0.1000 5.5793 +0.1418 -0.1302 5.6312 +0.1809 -0.1584 5.6830 +0.2213 -0.1846 5.7349 +0.2631 -0.2086 5.7868 +0.3060 -0.2304 5.8386 +0.3500 -0.2500 5.8905 +primID: 4 +startangle_c: 14 +endpose_c: 5 -7 13 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0678 -0.0684 5.4681 +0.1000 -0.1043 5.4162 +0.1302 -0.1418 5.3644 +0.1584 -0.1809 5.3125 +0.1846 -0.2213 5.2607 +0.2086 -0.2631 5.2088 +0.2304 -0.3060 5.1569 +0.2500 -0.3500 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0111 -0.0056 5.8905 +0.0222 -0.0111 5.8905 +0.0333 -0.0167 5.8905 +0.0444 -0.0222 5.8905 +0.0556 -0.0278 5.8905 +0.0667 -0.0333 5.8905 +0.0778 -0.0389 5.8905 +0.0889 -0.0444 5.8905 +0.1000 -0.0500 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 6 -3 15 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0333 -0.0167 5.8905 +0.0667 -0.0333 5.8905 +0.1000 -0.0500 5.8905 +0.1333 -0.0667 5.8905 +0.1667 -0.0833 5.8905 +0.2000 -0.1000 5.8905 +0.2333 -0.1167 5.8905 +0.2667 -0.1333 5.8905 +0.3000 -0.1500 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0111 0.0056 5.8905 +-0.0222 0.0111 5.8905 +-0.0333 0.0167 5.8905 +-0.0444 0.0222 5.8905 +-0.0556 0.0278 5.8905 +-0.0667 0.0333 5.8905 +-0.0778 0.0389 5.8905 +-0.0889 0.0444 5.8905 +-0.1000 0.0500 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 5 -4 14 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0298 -0.0184 5.8602 +0.0592 -0.0379 5.8299 +0.0881 -0.0583 5.7996 +0.1165 -0.0796 5.7693 +0.1444 -0.1019 5.7390 +0.1717 -0.1251 5.7087 +0.1984 -0.1492 5.6784 +0.2245 -0.1742 5.6481 +0.2500 -0.2000 5.6178 +primID: 4 +startangle_c: 15 +endpose_c: 7 -2 0 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0377 -0.0156 5.8905 +0.0754 -0.0312 5.8905 +0.1131 -0.0468 5.8905 +0.1508 -0.0623 5.9096 +0.1893 -0.0758 5.9843 +0.2287 -0.0863 6.0590 +0.2687 -0.0939 6.1337 +0.3092 -0.0985 6.2085 +0.3500 -0.1000 6.2832 diff --git a/config/runtime/mprim/unicycle_5cm_expensive_turn_in_place.mprim b/config/runtime/mprim/unicycle_5cm_expensive_turn_in_place.mprim new file mode 100755 index 0000000..f27907b --- /dev/null +++ b/config/runtime/mprim/unicycle_5cm_expensive_turn_in_place.mprim @@ -0,0 +1,1683 @@ +resolution_m: 0.050000 +numberofangles: 16 +totalnumberofprimitives: 112 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0056 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0167 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0278 0.0000 0.0000 +0.0333 0.0000 0.0000 +0.0389 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0500 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 8 0 0 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2222 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3111 0.0000 0.0000 +0.3556 0.0000 0.0000 +0.4000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0056 0.0000 0.0000 +-0.0111 0.0000 0.0000 +-0.0167 0.0000 0.0000 +-0.0222 0.0000 0.0000 +-0.0278 0.0000 0.0000 +-0.0333 0.0000 0.0000 +-0.0389 0.0000 0.0000 +-0.0444 0.0000 0.0000 +-0.0500 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 8 1 1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 -0.0000 0.0000 +0.0904 -0.0000 0.0000 +0.1355 -0.0000 0.0000 +0.1807 0.0008 0.0488 +0.2257 0.0045 0.1176 +0.2703 0.0114 0.1864 +0.3144 0.0213 0.2551 +0.3577 0.0342 0.3239 +0.4000 0.0500 0.3927 +primID: 4 +startangle_c: 0 +endpose_c: 8 -1 -1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 0.0000 0.0000 +0.0904 0.0000 0.0000 +0.1355 0.0000 0.0000 +0.1807 -0.0008 -0.0488 +0.2257 -0.0045 -0.1176 +0.2703 -0.0114 -0.1864 +0.3144 -0.0213 -0.2551 +0.3577 -0.0342 -0.3239 +0.4000 -0.0500 -0.3927 +primID: 5 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0111 0.0056 0.3927 +0.0222 0.0111 0.3927 +0.0333 0.0167 0.3927 +0.0444 0.0222 0.3927 +0.0556 0.0278 0.3927 +0.0667 0.0333 0.3927 +0.0778 0.0389 0.3927 +0.0889 0.0444 0.3927 +0.1000 0.0500 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 6 3 1 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0333 0.0167 0.3927 +0.0667 0.0333 0.3927 +0.1000 0.0500 0.3927 +0.1333 0.0667 0.3927 +0.1667 0.0833 0.3927 +0.2000 0.1000 0.3927 +0.2333 0.1167 0.3927 +0.2667 0.1333 0.3927 +0.3000 0.1500 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0111 -0.0056 0.3927 +-0.0222 -0.0111 0.3927 +-0.0333 -0.0167 0.3927 +-0.0444 -0.0222 0.3927 +-0.0556 -0.0278 0.3927 +-0.0667 -0.0333 0.3927 +-0.0778 -0.0389 0.3927 +-0.0889 -0.0444 0.3927 +-0.1000 -0.0500 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 5 4 2 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0298 0.0184 0.4230 +0.0592 0.0379 0.4533 +0.0881 0.0583 0.4836 +0.1165 0.0796 0.5139 +0.1444 0.1019 0.5442 +0.1717 0.1251 0.5745 +0.1984 0.1492 0.6048 +0.2245 0.1742 0.6351 +0.2500 0.2000 0.6654 +primID: 4 +startangle_c: 1 +endpose_c: 7 2 0 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0377 0.0156 0.3927 +0.0754 0.0312 0.3927 +0.1131 0.0468 0.3927 +0.1508 0.0623 0.3736 +0.1893 0.0758 0.2989 +0.2287 0.0863 0.2242 +0.2687 0.0939 0.1494 +0.3092 0.0985 0.0747 +0.3500 0.1000 -0.0000 +primID: 5 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0056 0.0056 0.7854 +0.0111 0.0111 0.7854 +0.0167 0.0167 0.7854 +0.0222 0.0222 0.7854 +0.0278 0.0278 0.7854 +0.0333 0.0333 0.7854 +0.0389 0.0389 0.7854 +0.0444 0.0444 0.7854 +0.0500 0.0500 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 6 6 2 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0056 -0.0056 0.7854 +-0.0111 -0.0111 0.7854 +-0.0167 -0.0167 0.7854 +-0.0222 -0.0222 0.7854 +-0.0278 -0.0278 0.7854 +-0.0333 -0.0333 0.7854 +-0.0389 -0.0389 0.7854 +-0.0444 -0.0444 0.7854 +-0.0500 -0.0500 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 5 7 3 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0678 0.0684 0.8151 +0.1000 0.1043 0.8669 +0.1302 0.1418 0.9188 +0.1584 0.1809 0.9707 +0.1846 0.2213 1.0225 +0.2086 0.2631 1.0744 +0.2304 0.3060 1.1262 +0.2500 0.3500 1.1781 +primID: 4 +startangle_c: 2 +endpose_c: 7 5 1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0684 0.0678 0.7557 +0.1043 0.1000 0.7039 +0.1418 0.1302 0.6520 +0.1809 0.1584 0.6001 +0.2213 0.1846 0.5483 +0.2631 0.2086 0.4964 +0.3060 0.2304 0.4446 +0.3500 0.2500 0.3927 +primID: 5 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0056 0.0111 1.1781 +0.0111 0.0222 1.1781 +0.0167 0.0333 1.1781 +0.0222 0.0444 1.1781 +0.0278 0.0556 1.1781 +0.0333 0.0667 1.1781 +0.0389 0.0778 1.1781 +0.0444 0.0889 1.1781 +0.0500 0.1000 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 3 6 3 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0167 0.0333 1.1781 +0.0333 0.0667 1.1781 +0.0500 0.1000 1.1781 +0.0667 0.1333 1.1781 +0.0833 0.1667 1.1781 +0.1000 0.2000 1.1781 +0.1167 0.2333 1.1781 +0.1333 0.2667 1.1781 +0.1500 0.3000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0056 -0.0111 1.1781 +-0.0111 -0.0222 1.1781 +-0.0167 -0.0333 1.1781 +-0.0222 -0.0444 1.1781 +-0.0278 -0.0556 1.1781 +-0.0333 -0.0667 1.1781 +-0.0389 -0.0778 1.1781 +-0.0444 -0.0889 1.1781 +-0.0500 -0.1000 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 4 5 2 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0184 0.0298 1.1478 +0.0379 0.0592 1.1175 +0.0583 0.0881 1.0872 +0.0796 0.1165 1.0569 +0.1019 0.1444 1.0266 +0.1251 0.1717 0.9963 +0.1492 0.1984 0.9660 +0.1742 0.2245 0.9357 +0.2000 0.2500 0.9054 +primID: 4 +startangle_c: 3 +endpose_c: 2 7 4 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0156 0.0377 1.1781 +0.0312 0.0754 1.1781 +0.0468 0.1131 1.1781 +0.0623 0.1508 1.1972 +0.0758 0.1893 1.2719 +0.0863 0.2287 1.3466 +0.0939 0.2687 1.4214 +0.0985 0.3092 1.4961 +0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0056 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0167 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0278 1.5708 +0.0000 0.0333 1.5708 +0.0000 0.0389 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0500 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 8 4 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2222 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3111 1.5708 +0.0000 0.3556 1.5708 +0.0000 0.4000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0056 1.5708 +0.0000 -0.0111 1.5708 +0.0000 -0.0167 1.5708 +0.0000 -0.0222 1.5708 +0.0000 -0.0278 1.5708 +0.0000 -0.0333 1.5708 +0.0000 -0.0389 1.5708 +0.0000 -0.0444 1.5708 +0.0000 -0.0500 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -1 8 5 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +-0.0008 0.1807 1.6196 +-0.0045 0.2257 1.6884 +-0.0114 0.2703 1.7572 +-0.0213 0.3144 1.8259 +-0.0342 0.3577 1.8947 +-0.0500 0.4000 1.9635 +primID: 4 +startangle_c: 4 +endpose_c: 1 8 3 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +0.0008 0.1807 1.5220 +0.0045 0.2257 1.4532 +0.0114 0.2703 1.3844 +0.0213 0.3144 1.3156 +0.0342 0.3577 1.2469 +0.0500 0.4000 1.1781 +primID: 5 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0056 0.0111 1.9635 +-0.0111 0.0222 1.9635 +-0.0167 0.0333 1.9635 +-0.0222 0.0444 1.9635 +-0.0278 0.0556 1.9635 +-0.0333 0.0667 1.9635 +-0.0389 0.0778 1.9635 +-0.0444 0.0889 1.9635 +-0.0500 0.1000 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -3 6 5 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0167 0.0333 1.9635 +-0.0333 0.0667 1.9635 +-0.0500 0.1000 1.9635 +-0.0667 0.1333 1.9635 +-0.0833 0.1667 1.9635 +-0.1000 0.2000 1.9635 +-0.1167 0.2333 1.9635 +-0.1333 0.2667 1.9635 +-0.1500 0.3000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0056 -0.0111 1.9635 +0.0111 -0.0222 1.9635 +0.0167 -0.0333 1.9635 +0.0222 -0.0444 1.9635 +0.0278 -0.0556 1.9635 +0.0333 -0.0667 1.9635 +0.0389 -0.0778 1.9635 +0.0444 -0.0889 1.9635 +0.0500 -0.1000 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -4 5 6 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0184 0.0298 1.9938 +-0.0379 0.0592 2.0241 +-0.0583 0.0881 2.0544 +-0.0796 0.1165 2.0847 +-0.1019 0.1444 2.1150 +-0.1251 0.1717 2.1453 +-0.1492 0.1984 2.1756 +-0.1742 0.2245 2.2059 +-0.2000 0.2500 2.2362 +primID: 4 +startangle_c: 5 +endpose_c: -2 7 4 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0156 0.0377 1.9635 +-0.0312 0.0754 1.9635 +-0.0468 0.1131 1.9635 +-0.0623 0.1508 1.9444 +-0.0758 0.1893 1.8697 +-0.0863 0.2287 1.7950 +-0.0939 0.2687 1.7202 +-0.0985 0.3092 1.6455 +-0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0056 0.0056 2.3562 +-0.0111 0.0111 2.3562 +-0.0167 0.0167 2.3562 +-0.0222 0.0222 2.3562 +-0.0278 0.0278 2.3562 +-0.0333 0.0333 2.3562 +-0.0389 0.0389 2.3562 +-0.0444 0.0444 2.3562 +-0.0500 0.0500 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -6 6 6 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0056 -0.0056 2.3562 +0.0111 -0.0111 2.3562 +0.0167 -0.0167 2.3562 +0.0222 -0.0222 2.3562 +0.0278 -0.0278 2.3562 +0.0333 -0.0333 2.3562 +0.0389 -0.0389 2.3562 +0.0444 -0.0444 2.3562 +0.0500 -0.0500 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -7 5 7 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0684 0.0678 2.3859 +-0.1043 0.1000 2.4377 +-0.1418 0.1302 2.4896 +-0.1809 0.1584 2.5415 +-0.2213 0.1846 2.5933 +-0.2631 0.2086 2.6452 +-0.3060 0.2304 2.6970 +-0.3500 0.2500 2.7489 +primID: 4 +startangle_c: 6 +endpose_c: -5 7 5 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0678 0.0684 2.3265 +-0.1000 0.1043 2.2747 +-0.1302 0.1418 2.2228 +-0.1584 0.1809 2.1709 +-0.1846 0.2213 2.1191 +-0.2086 0.2631 2.0672 +-0.2304 0.3060 2.0154 +-0.2500 0.3500 1.9635 +primID: 5 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0111 0.0056 2.7489 +-0.0222 0.0111 2.7489 +-0.0333 0.0167 2.7489 +-0.0444 0.0222 2.7489 +-0.0556 0.0278 2.7489 +-0.0667 0.0333 2.7489 +-0.0778 0.0389 2.7489 +-0.0889 0.0444 2.7489 +-0.1000 0.0500 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -6 3 7 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0333 0.0167 2.7489 +-0.0667 0.0333 2.7489 +-0.1000 0.0500 2.7489 +-0.1333 0.0667 2.7489 +-0.1667 0.0833 2.7489 +-0.2000 0.1000 2.7489 +-0.2333 0.1167 2.7489 +-0.2667 0.1333 2.7489 +-0.3000 0.1500 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0111 -0.0056 2.7489 +0.0222 -0.0111 2.7489 +0.0333 -0.0167 2.7489 +0.0444 -0.0222 2.7489 +0.0556 -0.0278 2.7489 +0.0667 -0.0333 2.7489 +0.0778 -0.0389 2.7489 +0.0889 -0.0444 2.7489 +0.1000 -0.0500 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -5 4 6 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0298 0.0184 2.7186 +-0.0592 0.0379 2.6883 +-0.0881 0.0583 2.6580 +-0.1165 0.0796 2.6277 +-0.1444 0.1019 2.5974 +-0.1717 0.1251 2.5671 +-0.1984 0.1492 2.5368 +-0.2245 0.1742 2.5065 +-0.2500 0.2000 2.4762 +primID: 4 +startangle_c: 7 +endpose_c: -7 2 8 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0377 0.0156 2.7489 +-0.0754 0.0312 2.7489 +-0.1131 0.0468 2.7489 +-0.1508 0.0623 2.7680 +-0.1893 0.0758 2.8427 +-0.2287 0.0863 2.9174 +-0.2687 0.0939 2.9921 +-0.3092 0.0985 3.0669 +-0.3500 0.1000 3.1416 +primID: 5 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0056 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0167 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0278 0.0000 3.1416 +-0.0333 0.0000 3.1416 +-0.0389 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0500 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -8 0 8 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2222 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3111 0.0000 3.1416 +-0.3556 0.0000 3.1416 +-0.4000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0056 0.0000 3.1416 +0.0111 0.0000 3.1416 +0.0167 0.0000 3.1416 +0.0222 0.0000 3.1416 +0.0278 0.0000 3.1416 +0.0333 0.0000 3.1416 +0.0389 0.0000 3.1416 +0.0444 0.0000 3.1416 +0.0500 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -8 -1 9 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 -0.0008 3.1904 +-0.2257 -0.0045 3.2592 +-0.2703 -0.0114 3.3280 +-0.3144 -0.0213 3.3967 +-0.3577 -0.0342 3.4655 +-0.4000 -0.0500 3.5343 +primID: 4 +startangle_c: 8 +endpose_c: -8 1 7 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 0.0008 3.0928 +-0.2257 0.0045 3.0240 +-0.2703 0.0114 2.9552 +-0.3144 0.0213 2.8864 +-0.3577 0.0342 2.8177 +-0.4000 0.0500 2.7489 +primID: 5 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0111 -0.0056 3.5343 +-0.0222 -0.0111 3.5343 +-0.0333 -0.0167 3.5343 +-0.0444 -0.0222 3.5343 +-0.0556 -0.0278 3.5343 +-0.0667 -0.0333 3.5343 +-0.0778 -0.0389 3.5343 +-0.0889 -0.0444 3.5343 +-0.1000 -0.0500 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -6 -3 9 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0333 -0.0167 3.5343 +-0.0667 -0.0333 3.5343 +-0.1000 -0.0500 3.5343 +-0.1333 -0.0667 3.5343 +-0.1667 -0.0833 3.5343 +-0.2000 -0.1000 3.5343 +-0.2333 -0.1167 3.5343 +-0.2667 -0.1333 3.5343 +-0.3000 -0.1500 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0111 0.0056 3.5343 +0.0222 0.0111 3.5343 +0.0333 0.0167 3.5343 +0.0444 0.0222 3.5343 +0.0556 0.0278 3.5343 +0.0667 0.0333 3.5343 +0.0778 0.0389 3.5343 +0.0889 0.0444 3.5343 +0.1000 0.0500 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -5 -4 10 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0298 -0.0184 3.5646 +-0.0592 -0.0379 3.5949 +-0.0881 -0.0583 3.6252 +-0.1165 -0.0796 3.6555 +-0.1444 -0.1019 3.6858 +-0.1717 -0.1251 3.7161 +-0.1984 -0.1492 3.7464 +-0.2245 -0.1742 3.7767 +-0.2500 -0.2000 3.8070 +primID: 4 +startangle_c: 9 +endpose_c: -7 -2 8 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0377 -0.0156 3.5343 +-0.0754 -0.0312 3.5343 +-0.1131 -0.0468 3.5343 +-0.1508 -0.0623 3.5152 +-0.1893 -0.0758 3.4405 +-0.2287 -0.0863 3.3658 +-0.2687 -0.0939 3.2910 +-0.3092 -0.0985 3.2163 +-0.3500 -0.1000 3.1416 +primID: 5 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0056 -0.0056 3.9270 +-0.0111 -0.0111 3.9270 +-0.0167 -0.0167 3.9270 +-0.0222 -0.0222 3.9270 +-0.0278 -0.0278 3.9270 +-0.0333 -0.0333 3.9270 +-0.0389 -0.0389 3.9270 +-0.0444 -0.0444 3.9270 +-0.0500 -0.0500 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -6 -6 10 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0056 0.0056 3.9270 +0.0111 0.0111 3.9270 +0.0167 0.0167 3.9270 +0.0222 0.0222 3.9270 +0.0278 0.0278 3.9270 +0.0333 0.0333 3.9270 +0.0389 0.0389 3.9270 +0.0444 0.0444 3.9270 +0.0500 0.0500 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -5 -7 11 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0678 -0.0684 3.9567 +-0.1000 -0.1043 4.0085 +-0.1302 -0.1418 4.0604 +-0.1584 -0.1809 4.1123 +-0.1846 -0.2213 4.1641 +-0.2086 -0.2631 4.2160 +-0.2304 -0.3060 4.2678 +-0.2500 -0.3500 4.3197 +primID: 4 +startangle_c: 10 +endpose_c: -7 -5 9 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0684 -0.0678 3.8973 +-0.1043 -0.1000 3.8455 +-0.1418 -0.1302 3.7936 +-0.1809 -0.1584 3.7417 +-0.2213 -0.1846 3.6899 +-0.2631 -0.2086 3.6380 +-0.3060 -0.2304 3.5862 +-0.3500 -0.2500 3.5343 +primID: 5 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0056 -0.0111 4.3197 +-0.0111 -0.0222 4.3197 +-0.0167 -0.0333 4.3197 +-0.0222 -0.0444 4.3197 +-0.0278 -0.0556 4.3197 +-0.0333 -0.0667 4.3197 +-0.0389 -0.0778 4.3197 +-0.0444 -0.0889 4.3197 +-0.0500 -0.1000 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -3 -6 11 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0167 -0.0333 4.3197 +-0.0333 -0.0667 4.3197 +-0.0500 -0.1000 4.3197 +-0.0667 -0.1333 4.3197 +-0.0833 -0.1667 4.3197 +-0.1000 -0.2000 4.3197 +-0.1167 -0.2333 4.3197 +-0.1333 -0.2667 4.3197 +-0.1500 -0.3000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0056 0.0111 4.3197 +0.0111 0.0222 4.3197 +0.0167 0.0333 4.3197 +0.0222 0.0444 4.3197 +0.0278 0.0556 4.3197 +0.0333 0.0667 4.3197 +0.0389 0.0778 4.3197 +0.0444 0.0889 4.3197 +0.0500 0.1000 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -4 -5 10 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0184 -0.0298 4.2894 +-0.0379 -0.0592 4.2591 +-0.0583 -0.0881 4.2288 +-0.0796 -0.1165 4.1985 +-0.1019 -0.1444 4.1682 +-0.1251 -0.1717 4.1379 +-0.1492 -0.1984 4.1076 +-0.1742 -0.2245 4.0773 +-0.2000 -0.2500 4.0470 +primID: 4 +startangle_c: 11 +endpose_c: -2 -7 12 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0156 -0.0377 4.3197 +-0.0312 -0.0754 4.3197 +-0.0468 -0.1131 4.3197 +-0.0623 -0.1508 4.3388 +-0.0758 -0.1893 4.4135 +-0.0863 -0.2287 4.4882 +-0.0939 -0.2687 4.5629 +-0.0985 -0.3092 4.6377 +-0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0056 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0167 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0278 4.7124 +0.0000 -0.0333 4.7124 +0.0000 -0.0389 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0500 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -8 12 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2222 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3111 4.7124 +0.0000 -0.3556 4.7124 +0.0000 -0.4000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0056 4.7124 +0.0000 0.0111 4.7124 +0.0000 0.0167 4.7124 +0.0000 0.0222 4.7124 +0.0000 0.0278 4.7124 +0.0000 0.0333 4.7124 +0.0000 0.0389 4.7124 +0.0000 0.0444 4.7124 +0.0000 0.0500 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 1 -8 13 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0452 4.7124 +0.0000 -0.0904 4.7124 +0.0000 -0.1355 4.7124 +0.0008 -0.1807 4.7612 +0.0045 -0.2257 4.8300 +0.0114 -0.2703 4.8988 +0.0213 -0.3144 4.9675 +0.0342 -0.3577 5.0363 +0.0500 -0.4000 5.1051 +primID: 4 +startangle_c: 12 +endpose_c: -1 -8 11 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0000 -0.0452 4.7124 +-0.0000 -0.0904 4.7124 +-0.0000 -0.1355 4.7124 +-0.0008 -0.1807 4.6636 +-0.0045 -0.2257 4.5948 +-0.0114 -0.2703 4.5260 +-0.0213 -0.3144 4.4572 +-0.0342 -0.3577 4.3885 +-0.0500 -0.4000 4.3197 +primID: 5 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0056 -0.0111 5.1051 +0.0111 -0.0222 5.1051 +0.0167 -0.0333 5.1051 +0.0222 -0.0444 5.1051 +0.0278 -0.0556 5.1051 +0.0333 -0.0667 5.1051 +0.0389 -0.0778 5.1051 +0.0444 -0.0889 5.1051 +0.0500 -0.1000 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 3 -6 13 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0167 -0.0333 5.1051 +0.0333 -0.0667 5.1051 +0.0500 -0.1000 5.1051 +0.0667 -0.1333 5.1051 +0.0833 -0.1667 5.1051 +0.1000 -0.2000 5.1051 +0.1167 -0.2333 5.1051 +0.1333 -0.2667 5.1051 +0.1500 -0.3000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0056 0.0111 5.1051 +-0.0111 0.0222 5.1051 +-0.0167 0.0333 5.1051 +-0.0222 0.0444 5.1051 +-0.0278 0.0556 5.1051 +-0.0333 0.0667 5.1051 +-0.0389 0.0778 5.1051 +-0.0444 0.0889 5.1051 +-0.0500 0.1000 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 4 -5 14 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0184 -0.0298 5.1354 +0.0379 -0.0592 5.1657 +0.0583 -0.0881 5.1960 +0.0796 -0.1165 5.2263 +0.1019 -0.1444 5.2566 +0.1251 -0.1717 5.2869 +0.1492 -0.1984 5.3172 +0.1742 -0.2245 5.3475 +0.2000 -0.2500 5.3778 +primID: 4 +startangle_c: 13 +endpose_c: 2 -7 12 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0156 -0.0377 5.1051 +0.0312 -0.0754 5.1051 +0.0468 -0.1131 5.1051 +0.0623 -0.1508 5.0860 +0.0758 -0.1893 5.0113 +0.0863 -0.2287 4.9366 +0.0939 -0.2687 4.8618 +0.0985 -0.3092 4.7871 +0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0056 -0.0056 5.4978 +0.0111 -0.0111 5.4978 +0.0167 -0.0167 5.4978 +0.0222 -0.0222 5.4978 +0.0278 -0.0278 5.4978 +0.0333 -0.0333 5.4978 +0.0389 -0.0389 5.4978 +0.0444 -0.0444 5.4978 +0.0500 -0.0500 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 6 -6 14 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0056 0.0056 5.4978 +-0.0111 0.0111 5.4978 +-0.0167 0.0167 5.4978 +-0.0222 0.0222 5.4978 +-0.0278 0.0278 5.4978 +-0.0333 0.0333 5.4978 +-0.0389 0.0389 5.4978 +-0.0444 0.0444 5.4978 +-0.0500 0.0500 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 7 -5 15 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0684 -0.0678 5.5275 +0.1043 -0.1000 5.5793 +0.1418 -0.1302 5.6312 +0.1809 -0.1584 5.6830 +0.2213 -0.1846 5.7349 +0.2631 -0.2086 5.7868 +0.3060 -0.2304 5.8386 +0.3500 -0.2500 5.8905 +primID: 4 +startangle_c: 14 +endpose_c: 5 -7 13 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0678 -0.0684 5.4681 +0.1000 -0.1043 5.4162 +0.1302 -0.1418 5.3644 +0.1584 -0.1809 5.3125 +0.1846 -0.2213 5.2607 +0.2086 -0.2631 5.2088 +0.2304 -0.3060 5.1569 +0.2500 -0.3500 5.1051 +primID: 5 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0111 -0.0056 5.8905 +0.0222 -0.0111 5.8905 +0.0333 -0.0167 5.8905 +0.0444 -0.0222 5.8905 +0.0556 -0.0278 5.8905 +0.0667 -0.0333 5.8905 +0.0778 -0.0389 5.8905 +0.0889 -0.0444 5.8905 +0.1000 -0.0500 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 6 -3 15 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0333 -0.0167 5.8905 +0.0667 -0.0333 5.8905 +0.1000 -0.0500 5.8905 +0.1333 -0.0667 5.8905 +0.1667 -0.0833 5.8905 +0.2000 -0.1000 5.8905 +0.2333 -0.1167 5.8905 +0.2667 -0.1333 5.8905 +0.3000 -0.1500 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 5 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0111 0.0056 5.8905 +-0.0222 0.0111 5.8905 +-0.0333 0.0167 5.8905 +-0.0444 0.0222 5.8905 +-0.0556 0.0278 5.8905 +-0.0667 0.0333 5.8905 +-0.0778 0.0389 5.8905 +-0.0889 0.0444 5.8905 +-0.1000 0.0500 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 5 -4 14 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0298 -0.0184 5.8602 +0.0592 -0.0379 5.8299 +0.0881 -0.0583 5.7996 +0.1165 -0.0796 5.7693 +0.1444 -0.1019 5.7390 +0.1717 -0.1251 5.7087 +0.1984 -0.1492 5.6784 +0.2245 -0.1742 5.6481 +0.2500 -0.2000 5.6178 +primID: 4 +startangle_c: 15 +endpose_c: 7 -2 0 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0377 -0.0156 5.8905 +0.0754 -0.0312 5.8905 +0.1131 -0.0468 5.8905 +0.1508 -0.0623 5.9096 +0.1893 -0.0758 5.9843 +0.2287 -0.0863 6.0590 +0.2687 -0.0939 6.1337 +0.3092 -0.0985 6.2085 +0.3500 -0.1000 6.2832 +primID: 5 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.2360 +0.0000 0.0000 4.5815 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.2725 +0.0000 0.0000 2.6180 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.3090 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.0000 diff --git a/config/runtime/mprim/unicycle_5cm_expensive_turn_in_place_highcost.mprim b/config/runtime/mprim/unicycle_5cm_expensive_turn_in_place_highcost.mprim new file mode 100755 index 0000000..0f11e5d --- /dev/null +++ b/config/runtime/mprim/unicycle_5cm_expensive_turn_in_place_highcost.mprim @@ -0,0 +1,1683 @@ +resolution_m: 0.050000 +numberofangles: 16 +totalnumberofprimitives: 112 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0056 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0167 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0278 0.0000 0.0000 +0.0333 0.0000 0.0000 +0.0389 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0500 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 8 0 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2222 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3111 0.0000 0.0000 +0.3556 0.0000 0.0000 +0.4000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0056 0.0000 0.0000 +-0.0111 0.0000 0.0000 +-0.0167 0.0000 0.0000 +-0.0222 0.0000 0.0000 +-0.0278 0.0000 0.0000 +-0.0333 0.0000 0.0000 +-0.0389 0.0000 0.0000 +-0.0444 0.0000 0.0000 +-0.0500 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 8 1 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 -0.0000 0.0000 +0.0904 -0.0000 0.0000 +0.1355 -0.0000 0.0000 +0.1807 0.0008 0.0488 +0.2257 0.0045 0.1176 +0.2703 0.0114 0.1864 +0.3144 0.0213 0.2551 +0.3577 0.0342 0.3239 +0.4000 0.0500 0.3927 +primID: 4 +startangle_c: 0 +endpose_c: 8 -1 -1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 0.0000 0.0000 +0.0904 0.0000 0.0000 +0.1355 0.0000 0.0000 +0.1807 -0.0008 -0.0488 +0.2257 -0.0045 -0.1176 +0.2703 -0.0114 -0.1864 +0.3144 -0.0213 -0.2551 +0.3577 -0.0342 -0.3239 +0.4000 -0.0500 -0.3927 +primID: 5 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0111 0.0056 0.3927 +0.0222 0.0111 0.3927 +0.0333 0.0167 0.3927 +0.0444 0.0222 0.3927 +0.0556 0.0278 0.3927 +0.0667 0.0333 0.3927 +0.0778 0.0389 0.3927 +0.0889 0.0444 0.3927 +0.1000 0.0500 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 6 3 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0333 0.0167 0.3927 +0.0667 0.0333 0.3927 +0.1000 0.0500 0.3927 +0.1333 0.0667 0.3927 +0.1667 0.0833 0.3927 +0.2000 0.1000 0.3927 +0.2333 0.1167 0.3927 +0.2667 0.1333 0.3927 +0.3000 0.1500 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0111 -0.0056 0.3927 +-0.0222 -0.0111 0.3927 +-0.0333 -0.0167 0.3927 +-0.0444 -0.0222 0.3927 +-0.0556 -0.0278 0.3927 +-0.0667 -0.0333 0.3927 +-0.0778 -0.0389 0.3927 +-0.0889 -0.0444 0.3927 +-0.1000 -0.0500 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 5 4 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0298 0.0184 0.4230 +0.0592 0.0379 0.4533 +0.0881 0.0583 0.4836 +0.1165 0.0796 0.5139 +0.1444 0.1019 0.5442 +0.1717 0.1251 0.5745 +0.1984 0.1492 0.6048 +0.2245 0.1742 0.6351 +0.2500 0.2000 0.6654 +primID: 4 +startangle_c: 1 +endpose_c: 7 2 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0377 0.0156 0.3927 +0.0754 0.0312 0.3927 +0.1131 0.0468 0.3927 +0.1508 0.0623 0.3736 +0.1893 0.0758 0.2989 +0.2287 0.0863 0.2242 +0.2687 0.0939 0.1494 +0.3092 0.0985 0.0747 +0.3500 0.1000 -0.0000 +primID: 5 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0056 0.0056 0.7854 +0.0111 0.0111 0.7854 +0.0167 0.0167 0.7854 +0.0222 0.0222 0.7854 +0.0278 0.0278 0.7854 +0.0333 0.0333 0.7854 +0.0389 0.0389 0.7854 +0.0444 0.0444 0.7854 +0.0500 0.0500 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 6 6 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0056 -0.0056 0.7854 +-0.0111 -0.0111 0.7854 +-0.0167 -0.0167 0.7854 +-0.0222 -0.0222 0.7854 +-0.0278 -0.0278 0.7854 +-0.0333 -0.0333 0.7854 +-0.0389 -0.0389 0.7854 +-0.0444 -0.0444 0.7854 +-0.0500 -0.0500 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 5 7 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0678 0.0684 0.8151 +0.1000 0.1043 0.8669 +0.1302 0.1418 0.9188 +0.1584 0.1809 0.9707 +0.1846 0.2213 1.0225 +0.2086 0.2631 1.0744 +0.2304 0.3060 1.1262 +0.2500 0.3500 1.1781 +primID: 4 +startangle_c: 2 +endpose_c: 7 5 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0684 0.0678 0.7557 +0.1043 0.1000 0.7039 +0.1418 0.1302 0.6520 +0.1809 0.1584 0.6001 +0.2213 0.1846 0.5483 +0.2631 0.2086 0.4964 +0.3060 0.2304 0.4446 +0.3500 0.2500 0.3927 +primID: 5 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0056 0.0111 1.1781 +0.0111 0.0222 1.1781 +0.0167 0.0333 1.1781 +0.0222 0.0444 1.1781 +0.0278 0.0556 1.1781 +0.0333 0.0667 1.1781 +0.0389 0.0778 1.1781 +0.0444 0.0889 1.1781 +0.0500 0.1000 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 3 6 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0167 0.0333 1.1781 +0.0333 0.0667 1.1781 +0.0500 0.1000 1.1781 +0.0667 0.1333 1.1781 +0.0833 0.1667 1.1781 +0.1000 0.2000 1.1781 +0.1167 0.2333 1.1781 +0.1333 0.2667 1.1781 +0.1500 0.3000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0056 -0.0111 1.1781 +-0.0111 -0.0222 1.1781 +-0.0167 -0.0333 1.1781 +-0.0222 -0.0444 1.1781 +-0.0278 -0.0556 1.1781 +-0.0333 -0.0667 1.1781 +-0.0389 -0.0778 1.1781 +-0.0444 -0.0889 1.1781 +-0.0500 -0.1000 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 4 5 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0184 0.0298 1.1478 +0.0379 0.0592 1.1175 +0.0583 0.0881 1.0872 +0.0796 0.1165 1.0569 +0.1019 0.1444 1.0266 +0.1251 0.1717 0.9963 +0.1492 0.1984 0.9660 +0.1742 0.2245 0.9357 +0.2000 0.2500 0.9054 +primID: 4 +startangle_c: 3 +endpose_c: 2 7 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0156 0.0377 1.1781 +0.0312 0.0754 1.1781 +0.0468 0.1131 1.1781 +0.0623 0.1508 1.1972 +0.0758 0.1893 1.2719 +0.0863 0.2287 1.3466 +0.0939 0.2687 1.4214 +0.0985 0.3092 1.4961 +0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0056 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0167 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0278 1.5708 +0.0000 0.0333 1.5708 +0.0000 0.0389 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0500 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 8 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2222 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3111 1.5708 +0.0000 0.3556 1.5708 +0.0000 0.4000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0056 1.5708 +0.0000 -0.0111 1.5708 +0.0000 -0.0167 1.5708 +0.0000 -0.0222 1.5708 +0.0000 -0.0278 1.5708 +0.0000 -0.0333 1.5708 +0.0000 -0.0389 1.5708 +0.0000 -0.0444 1.5708 +0.0000 -0.0500 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -1 8 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +-0.0008 0.1807 1.6196 +-0.0045 0.2257 1.6884 +-0.0114 0.2703 1.7572 +-0.0213 0.3144 1.8259 +-0.0342 0.3577 1.8947 +-0.0500 0.4000 1.9635 +primID: 4 +startangle_c: 4 +endpose_c: 1 8 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +0.0008 0.1807 1.5220 +0.0045 0.2257 1.4532 +0.0114 0.2703 1.3844 +0.0213 0.3144 1.3156 +0.0342 0.3577 1.2469 +0.0500 0.4000 1.1781 +primID: 5 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0056 0.0111 1.9635 +-0.0111 0.0222 1.9635 +-0.0167 0.0333 1.9635 +-0.0222 0.0444 1.9635 +-0.0278 0.0556 1.9635 +-0.0333 0.0667 1.9635 +-0.0389 0.0778 1.9635 +-0.0444 0.0889 1.9635 +-0.0500 0.1000 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -3 6 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0167 0.0333 1.9635 +-0.0333 0.0667 1.9635 +-0.0500 0.1000 1.9635 +-0.0667 0.1333 1.9635 +-0.0833 0.1667 1.9635 +-0.1000 0.2000 1.9635 +-0.1167 0.2333 1.9635 +-0.1333 0.2667 1.9635 +-0.1500 0.3000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0056 -0.0111 1.9635 +0.0111 -0.0222 1.9635 +0.0167 -0.0333 1.9635 +0.0222 -0.0444 1.9635 +0.0278 -0.0556 1.9635 +0.0333 -0.0667 1.9635 +0.0389 -0.0778 1.9635 +0.0444 -0.0889 1.9635 +0.0500 -0.1000 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -4 5 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0184 0.0298 1.9938 +-0.0379 0.0592 2.0241 +-0.0583 0.0881 2.0544 +-0.0796 0.1165 2.0847 +-0.1019 0.1444 2.1150 +-0.1251 0.1717 2.1453 +-0.1492 0.1984 2.1756 +-0.1742 0.2245 2.2059 +-0.2000 0.2500 2.2362 +primID: 4 +startangle_c: 5 +endpose_c: -2 7 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0156 0.0377 1.9635 +-0.0312 0.0754 1.9635 +-0.0468 0.1131 1.9635 +-0.0623 0.1508 1.9444 +-0.0758 0.1893 1.8697 +-0.0863 0.2287 1.7950 +-0.0939 0.2687 1.7202 +-0.0985 0.3092 1.6455 +-0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0056 0.0056 2.3562 +-0.0111 0.0111 2.3562 +-0.0167 0.0167 2.3562 +-0.0222 0.0222 2.3562 +-0.0278 0.0278 2.3562 +-0.0333 0.0333 2.3562 +-0.0389 0.0389 2.3562 +-0.0444 0.0444 2.3562 +-0.0500 0.0500 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -6 6 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0056 -0.0056 2.3562 +0.0111 -0.0111 2.3562 +0.0167 -0.0167 2.3562 +0.0222 -0.0222 2.3562 +0.0278 -0.0278 2.3562 +0.0333 -0.0333 2.3562 +0.0389 -0.0389 2.3562 +0.0444 -0.0444 2.3562 +0.0500 -0.0500 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -7 5 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0684 0.0678 2.3859 +-0.1043 0.1000 2.4377 +-0.1418 0.1302 2.4896 +-0.1809 0.1584 2.5415 +-0.2213 0.1846 2.5933 +-0.2631 0.2086 2.6452 +-0.3060 0.2304 2.6970 +-0.3500 0.2500 2.7489 +primID: 4 +startangle_c: 6 +endpose_c: -5 7 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0678 0.0684 2.3265 +-0.1000 0.1043 2.2747 +-0.1302 0.1418 2.2228 +-0.1584 0.1809 2.1709 +-0.1846 0.2213 2.1191 +-0.2086 0.2631 2.0672 +-0.2304 0.3060 2.0154 +-0.2500 0.3500 1.9635 +primID: 5 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0111 0.0056 2.7489 +-0.0222 0.0111 2.7489 +-0.0333 0.0167 2.7489 +-0.0444 0.0222 2.7489 +-0.0556 0.0278 2.7489 +-0.0667 0.0333 2.7489 +-0.0778 0.0389 2.7489 +-0.0889 0.0444 2.7489 +-0.1000 0.0500 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -6 3 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0333 0.0167 2.7489 +-0.0667 0.0333 2.7489 +-0.1000 0.0500 2.7489 +-0.1333 0.0667 2.7489 +-0.1667 0.0833 2.7489 +-0.2000 0.1000 2.7489 +-0.2333 0.1167 2.7489 +-0.2667 0.1333 2.7489 +-0.3000 0.1500 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0111 -0.0056 2.7489 +0.0222 -0.0111 2.7489 +0.0333 -0.0167 2.7489 +0.0444 -0.0222 2.7489 +0.0556 -0.0278 2.7489 +0.0667 -0.0333 2.7489 +0.0778 -0.0389 2.7489 +0.0889 -0.0444 2.7489 +0.1000 -0.0500 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -5 4 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0298 0.0184 2.7186 +-0.0592 0.0379 2.6883 +-0.0881 0.0583 2.6580 +-0.1165 0.0796 2.6277 +-0.1444 0.1019 2.5974 +-0.1717 0.1251 2.5671 +-0.1984 0.1492 2.5368 +-0.2245 0.1742 2.5065 +-0.2500 0.2000 2.4762 +primID: 4 +startangle_c: 7 +endpose_c: -7 2 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0377 0.0156 2.7489 +-0.0754 0.0312 2.7489 +-0.1131 0.0468 2.7489 +-0.1508 0.0623 2.7680 +-0.1893 0.0758 2.8427 +-0.2287 0.0863 2.9174 +-0.2687 0.0939 2.9921 +-0.3092 0.0985 3.0669 +-0.3500 0.1000 3.1416 +primID: 5 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0056 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0167 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0278 0.0000 3.1416 +-0.0333 0.0000 3.1416 +-0.0389 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0500 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -8 0 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2222 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3111 0.0000 3.1416 +-0.3556 0.0000 3.1416 +-0.4000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0056 0.0000 3.1416 +0.0111 0.0000 3.1416 +0.0167 0.0000 3.1416 +0.0222 0.0000 3.1416 +0.0278 0.0000 3.1416 +0.0333 0.0000 3.1416 +0.0389 0.0000 3.1416 +0.0444 0.0000 3.1416 +0.0500 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -8 -1 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 -0.0008 3.1904 +-0.2257 -0.0045 3.2592 +-0.2703 -0.0114 3.3280 +-0.3144 -0.0213 3.3967 +-0.3577 -0.0342 3.4655 +-0.4000 -0.0500 3.5343 +primID: 4 +startangle_c: 8 +endpose_c: -8 1 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 0.0008 3.0928 +-0.2257 0.0045 3.0240 +-0.2703 0.0114 2.9552 +-0.3144 0.0213 2.8864 +-0.3577 0.0342 2.8177 +-0.4000 0.0500 2.7489 +primID: 5 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0111 -0.0056 3.5343 +-0.0222 -0.0111 3.5343 +-0.0333 -0.0167 3.5343 +-0.0444 -0.0222 3.5343 +-0.0556 -0.0278 3.5343 +-0.0667 -0.0333 3.5343 +-0.0778 -0.0389 3.5343 +-0.0889 -0.0444 3.5343 +-0.1000 -0.0500 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -6 -3 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0333 -0.0167 3.5343 +-0.0667 -0.0333 3.5343 +-0.1000 -0.0500 3.5343 +-0.1333 -0.0667 3.5343 +-0.1667 -0.0833 3.5343 +-0.2000 -0.1000 3.5343 +-0.2333 -0.1167 3.5343 +-0.2667 -0.1333 3.5343 +-0.3000 -0.1500 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0111 0.0056 3.5343 +0.0222 0.0111 3.5343 +0.0333 0.0167 3.5343 +0.0444 0.0222 3.5343 +0.0556 0.0278 3.5343 +0.0667 0.0333 3.5343 +0.0778 0.0389 3.5343 +0.0889 0.0444 3.5343 +0.1000 0.0500 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -5 -4 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0298 -0.0184 3.5646 +-0.0592 -0.0379 3.5949 +-0.0881 -0.0583 3.6252 +-0.1165 -0.0796 3.6555 +-0.1444 -0.1019 3.6858 +-0.1717 -0.1251 3.7161 +-0.1984 -0.1492 3.7464 +-0.2245 -0.1742 3.7767 +-0.2500 -0.2000 3.8070 +primID: 4 +startangle_c: 9 +endpose_c: -7 -2 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0377 -0.0156 3.5343 +-0.0754 -0.0312 3.5343 +-0.1131 -0.0468 3.5343 +-0.1508 -0.0623 3.5152 +-0.1893 -0.0758 3.4405 +-0.2287 -0.0863 3.3658 +-0.2687 -0.0939 3.2910 +-0.3092 -0.0985 3.2163 +-0.3500 -0.1000 3.1416 +primID: 5 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0056 -0.0056 3.9270 +-0.0111 -0.0111 3.9270 +-0.0167 -0.0167 3.9270 +-0.0222 -0.0222 3.9270 +-0.0278 -0.0278 3.9270 +-0.0333 -0.0333 3.9270 +-0.0389 -0.0389 3.9270 +-0.0444 -0.0444 3.9270 +-0.0500 -0.0500 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -6 -6 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0056 0.0056 3.9270 +0.0111 0.0111 3.9270 +0.0167 0.0167 3.9270 +0.0222 0.0222 3.9270 +0.0278 0.0278 3.9270 +0.0333 0.0333 3.9270 +0.0389 0.0389 3.9270 +0.0444 0.0444 3.9270 +0.0500 0.0500 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -5 -7 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0678 -0.0684 3.9567 +-0.1000 -0.1043 4.0085 +-0.1302 -0.1418 4.0604 +-0.1584 -0.1809 4.1123 +-0.1846 -0.2213 4.1641 +-0.2086 -0.2631 4.2160 +-0.2304 -0.3060 4.2678 +-0.2500 -0.3500 4.3197 +primID: 4 +startangle_c: 10 +endpose_c: -7 -5 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0684 -0.0678 3.8973 +-0.1043 -0.1000 3.8455 +-0.1418 -0.1302 3.7936 +-0.1809 -0.1584 3.7417 +-0.2213 -0.1846 3.6899 +-0.2631 -0.2086 3.6380 +-0.3060 -0.2304 3.5862 +-0.3500 -0.2500 3.5343 +primID: 5 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0056 -0.0111 4.3197 +-0.0111 -0.0222 4.3197 +-0.0167 -0.0333 4.3197 +-0.0222 -0.0444 4.3197 +-0.0278 -0.0556 4.3197 +-0.0333 -0.0667 4.3197 +-0.0389 -0.0778 4.3197 +-0.0444 -0.0889 4.3197 +-0.0500 -0.1000 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -3 -6 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0167 -0.0333 4.3197 +-0.0333 -0.0667 4.3197 +-0.0500 -0.1000 4.3197 +-0.0667 -0.1333 4.3197 +-0.0833 -0.1667 4.3197 +-0.1000 -0.2000 4.3197 +-0.1167 -0.2333 4.3197 +-0.1333 -0.2667 4.3197 +-0.1500 -0.3000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0056 0.0111 4.3197 +0.0111 0.0222 4.3197 +0.0167 0.0333 4.3197 +0.0222 0.0444 4.3197 +0.0278 0.0556 4.3197 +0.0333 0.0667 4.3197 +0.0389 0.0778 4.3197 +0.0444 0.0889 4.3197 +0.0500 0.1000 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -4 -5 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0184 -0.0298 4.2894 +-0.0379 -0.0592 4.2591 +-0.0583 -0.0881 4.2288 +-0.0796 -0.1165 4.1985 +-0.1019 -0.1444 4.1682 +-0.1251 -0.1717 4.1379 +-0.1492 -0.1984 4.1076 +-0.1742 -0.2245 4.0773 +-0.2000 -0.2500 4.0470 +primID: 4 +startangle_c: 11 +endpose_c: -2 -7 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0156 -0.0377 4.3197 +-0.0312 -0.0754 4.3197 +-0.0468 -0.1131 4.3197 +-0.0623 -0.1508 4.3388 +-0.0758 -0.1893 4.4135 +-0.0863 -0.2287 4.4882 +-0.0939 -0.2687 4.5629 +-0.0985 -0.3092 4.6377 +-0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0056 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0167 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0278 4.7124 +0.0000 -0.0333 4.7124 +0.0000 -0.0389 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0500 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -8 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2222 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3111 4.7124 +0.0000 -0.3556 4.7124 +0.0000 -0.4000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0056 4.7124 +0.0000 0.0111 4.7124 +0.0000 0.0167 4.7124 +0.0000 0.0222 4.7124 +0.0000 0.0278 4.7124 +0.0000 0.0333 4.7124 +0.0000 0.0389 4.7124 +0.0000 0.0444 4.7124 +0.0000 0.0500 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 1 -8 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0452 4.7124 +0.0000 -0.0904 4.7124 +0.0000 -0.1355 4.7124 +0.0008 -0.1807 4.7612 +0.0045 -0.2257 4.8300 +0.0114 -0.2703 4.8988 +0.0213 -0.3144 4.9675 +0.0342 -0.3577 5.0363 +0.0500 -0.4000 5.1051 +primID: 4 +startangle_c: 12 +endpose_c: -1 -8 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0000 -0.0452 4.7124 +-0.0000 -0.0904 4.7124 +-0.0000 -0.1355 4.7124 +-0.0008 -0.1807 4.6636 +-0.0045 -0.2257 4.5948 +-0.0114 -0.2703 4.5260 +-0.0213 -0.3144 4.4572 +-0.0342 -0.3577 4.3885 +-0.0500 -0.4000 4.3197 +primID: 5 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0056 -0.0111 5.1051 +0.0111 -0.0222 5.1051 +0.0167 -0.0333 5.1051 +0.0222 -0.0444 5.1051 +0.0278 -0.0556 5.1051 +0.0333 -0.0667 5.1051 +0.0389 -0.0778 5.1051 +0.0444 -0.0889 5.1051 +0.0500 -0.1000 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 3 -6 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0167 -0.0333 5.1051 +0.0333 -0.0667 5.1051 +0.0500 -0.1000 5.1051 +0.0667 -0.1333 5.1051 +0.0833 -0.1667 5.1051 +0.1000 -0.2000 5.1051 +0.1167 -0.2333 5.1051 +0.1333 -0.2667 5.1051 +0.1500 -0.3000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0056 0.0111 5.1051 +-0.0111 0.0222 5.1051 +-0.0167 0.0333 5.1051 +-0.0222 0.0444 5.1051 +-0.0278 0.0556 5.1051 +-0.0333 0.0667 5.1051 +-0.0389 0.0778 5.1051 +-0.0444 0.0889 5.1051 +-0.0500 0.1000 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 4 -5 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0184 -0.0298 5.1354 +0.0379 -0.0592 5.1657 +0.0583 -0.0881 5.1960 +0.0796 -0.1165 5.2263 +0.1019 -0.1444 5.2566 +0.1251 -0.1717 5.2869 +0.1492 -0.1984 5.3172 +0.1742 -0.2245 5.3475 +0.2000 -0.2500 5.3778 +primID: 4 +startangle_c: 13 +endpose_c: 2 -7 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0156 -0.0377 5.1051 +0.0312 -0.0754 5.1051 +0.0468 -0.1131 5.1051 +0.0623 -0.1508 5.0860 +0.0758 -0.1893 5.0113 +0.0863 -0.2287 4.9366 +0.0939 -0.2687 4.8618 +0.0985 -0.3092 4.7871 +0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0056 -0.0056 5.4978 +0.0111 -0.0111 5.4978 +0.0167 -0.0167 5.4978 +0.0222 -0.0222 5.4978 +0.0278 -0.0278 5.4978 +0.0333 -0.0333 5.4978 +0.0389 -0.0389 5.4978 +0.0444 -0.0444 5.4978 +0.0500 -0.0500 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 6 -6 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0056 0.0056 5.4978 +-0.0111 0.0111 5.4978 +-0.0167 0.0167 5.4978 +-0.0222 0.0222 5.4978 +-0.0278 0.0278 5.4978 +-0.0333 0.0333 5.4978 +-0.0389 0.0389 5.4978 +-0.0444 0.0444 5.4978 +-0.0500 0.0500 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 7 -5 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0684 -0.0678 5.5275 +0.1043 -0.1000 5.5793 +0.1418 -0.1302 5.6312 +0.1809 -0.1584 5.6830 +0.2213 -0.1846 5.7349 +0.2631 -0.2086 5.7868 +0.3060 -0.2304 5.8386 +0.3500 -0.2500 5.8905 +primID: 4 +startangle_c: 14 +endpose_c: 5 -7 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0678 -0.0684 5.4681 +0.1000 -0.1043 5.4162 +0.1302 -0.1418 5.3644 +0.1584 -0.1809 5.3125 +0.1846 -0.2213 5.2607 +0.2086 -0.2631 5.2088 +0.2304 -0.3060 5.1569 +0.2500 -0.3500 5.1051 +primID: 5 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0111 -0.0056 5.8905 +0.0222 -0.0111 5.8905 +0.0333 -0.0167 5.8905 +0.0444 -0.0222 5.8905 +0.0556 -0.0278 5.8905 +0.0667 -0.0333 5.8905 +0.0778 -0.0389 5.8905 +0.0889 -0.0444 5.8905 +0.1000 -0.0500 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 6 -3 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0333 -0.0167 5.8905 +0.0667 -0.0333 5.8905 +0.1000 -0.0500 5.8905 +0.1333 -0.0667 5.8905 +0.1667 -0.0833 5.8905 +0.2000 -0.1000 5.8905 +0.2333 -0.1167 5.8905 +0.2667 -0.1333 5.8905 +0.3000 -0.1500 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0111 0.0056 5.8905 +-0.0222 0.0111 5.8905 +-0.0333 0.0167 5.8905 +-0.0444 0.0222 5.8905 +-0.0556 0.0278 5.8905 +-0.0667 0.0333 5.8905 +-0.0778 0.0389 5.8905 +-0.0889 0.0444 5.8905 +-0.1000 0.0500 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 5 -4 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0298 -0.0184 5.8602 +0.0592 -0.0379 5.8299 +0.0881 -0.0583 5.7996 +0.1165 -0.0796 5.7693 +0.1444 -0.1019 5.7390 +0.1717 -0.1251 5.7087 +0.1984 -0.1492 5.6784 +0.2245 -0.1742 5.6481 +0.2500 -0.2000 5.6178 +primID: 4 +startangle_c: 15 +endpose_c: 7 -2 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0377 -0.0156 5.8905 +0.0754 -0.0312 5.8905 +0.1131 -0.0468 5.8905 +0.1508 -0.0623 5.9096 +0.1893 -0.0758 5.9843 +0.2287 -0.0863 6.0590 +0.2687 -0.0939 6.1337 +0.3092 -0.0985 6.2085 +0.3500 -0.1000 6.2832 +primID: 5 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 200 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.2360 +0.0000 0.0000 4.5815 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.2725 +0.0000 0.0000 2.6180 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.3090 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.0000 diff --git a/config/runtime/mprim/unicycle_5cm_noreverse_trolley.mprim b/config/runtime/mprim/unicycle_5cm_noreverse_trolley.mprim new file mode 100755 index 0000000..596f5c5 --- /dev/null +++ b/config/runtime/mprim/unicycle_5cm_noreverse_trolley.mprim @@ -0,0 +1,2403 @@ +resolution_m: 0.050000 +numberofangles: 16 +totalnumberofprimitives: 160 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0056 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0167 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0278 0.0000 0.0000 +0.0333 0.0000 0.0000 +0.0389 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0500 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 8 0 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2222 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3111 0.0000 0.0000 +0.3556 0.0000 0.0000 +0.4000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: 16 4 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0904 0.0095 0.0349 +0.1806 0.0222 0.0699 +0.2707 0.0381 0.1048 +0.3604 0.0572 0.1398 +0.4496 0.0795 0.1747 +0.5383 0.1050 0.2097 +0.6264 0.1335 0.2446 +0.7136 0.1652 0.2796 +0.8000 0.2000 0.3145 +primID: 3 +startangle_c: 0 +endpose_c: 16 -4 -1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0904 -0.0095 -0.0349 +0.1806 -0.0222 -0.0699 +0.2707 -0.0381 -0.1048 +0.3604 -0.0572 -0.1398 +0.4496 -0.0795 -0.1747 +0.5383 -0.1050 -0.2097 +0.6264 -0.1335 -0.2446 +0.7136 -0.1652 -0.2796 +0.8000 -0.2000 -0.3145 +primID: 4 +startangle_c: 0 +endpose_c: 5 2 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0280 0.0085 0.0223 +0.0559 0.0177 0.0445 +0.0839 0.0275 0.0668 +0.1117 0.0380 0.0890 +0.1396 0.0491 0.1113 +0.1673 0.0609 0.1335 +0.1950 0.0733 0.1558 +0.2225 0.0863 0.1781 +0.2500 0.1000 0.2003 +primID: 5 +startangle_c: 0 +endpose_c: 5 -2 -1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0280 -0.0085 -0.0223 +0.0559 -0.0177 -0.0445 +0.0839 -0.0275 -0.0668 +0.1117 -0.0380 -0.0890 +0.1396 -0.0491 -0.1113 +0.1673 -0.0609 -0.1335 +0.1950 -0.0733 -0.1558 +0.2225 -0.0863 -0.1781 +0.2500 -0.1000 -0.2003 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 7 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 8 +startangle_c: 0 +endpose_c: 8 1 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0056 0.0000 +0.0889 0.0111 0.0000 +0.1333 0.0167 0.0000 +0.1778 0.0222 0.0000 +0.2222 0.0278 0.0000 +0.2667 0.0333 0.0000 +0.3111 0.0389 0.0000 +0.3556 0.0444 0.0000 +0.4000 0.0500 0.0000 +primID: 9 +startangle_c: 0 +endpose_c: 8 -1 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 -0.0056 0.0000 +0.0889 -0.0111 0.0000 +0.1333 -0.0167 0.0000 +0.1778 -0.0222 0.0000 +0.2222 -0.0278 0.0000 +0.2667 -0.0333 0.0000 +0.3111 -0.0389 0.0000 +0.3556 -0.0444 0.0000 +0.4000 -0.0500 0.0000 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0111 0.0056 0.3927 +0.0222 0.0111 0.3927 +0.0333 0.0167 0.3927 +0.0444 0.0222 0.3927 +0.0556 0.0278 0.3927 +0.0667 0.0333 0.3927 +0.0778 0.0389 0.3927 +0.0889 0.0444 0.3927 +0.1000 0.0500 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 6 3 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0333 0.0167 0.3927 +0.0667 0.0333 0.3927 +0.1000 0.0500 0.3927 +0.1333 0.0667 0.3927 +0.1667 0.0833 0.3927 +0.2000 0.1000 0.3927 +0.2333 0.1167 0.3927 +0.2667 0.1333 0.3927 +0.3000 0.1500 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: 13 9 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0793 0.0378 0.4329 +0.1572 0.0787 0.4732 +0.2334 0.1229 0.5134 +0.3079 0.1701 0.5537 +0.3805 0.2204 0.5939 +0.4512 0.2736 0.6342 +0.5197 0.3296 0.6744 +0.5860 0.3885 0.7147 +0.6500 0.4500 0.7549 +primID: 3 +startangle_c: 1 +endpose_c: 14 3 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0741 0.0305 0.3774 +0.1493 0.0582 0.3302 +0.2256 0.0824 0.2830 +0.3031 0.1030 0.2359 +0.3814 0.1199 0.1887 +0.4604 0.1330 0.1415 +0.5400 0.1424 0.0943 +0.6199 0.1481 0.0472 +0.7000 0.1500 -0.0000 +primID: 4 +startangle_c: 1 +endpose_c: 5 4 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0298 0.0184 0.4230 +0.0592 0.0379 0.4533 +0.0881 0.0583 0.4836 +0.1165 0.0796 0.5139 +0.1444 0.1019 0.5442 +0.1717 0.1251 0.5745 +0.1984 0.1492 0.6048 +0.2245 0.1742 0.6351 +0.2500 0.2000 0.6654 +primID: 5 +startangle_c: 1 +endpose_c: 6 1 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0320 0.0105 0.3551 +0.0644 0.0197 0.3174 +0.0973 0.0278 0.2798 +0.1304 0.0346 0.2421 +0.1639 0.0402 0.2045 +0.1977 0.0446 0.1669 +0.2316 0.0476 0.1292 +0.2658 0.0495 0.0916 +0.3000 0.0500 0.0540 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 7 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 8 +startangle_c: 1 +endpose_c: 7 2 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0389 0.0111 0.3927 +0.0778 0.0222 0.3927 +0.1167 0.0333 0.3927 +0.1556 0.0444 0.3927 +0.1944 0.0556 0.3927 +0.2333 0.0667 0.3927 +0.2722 0.0778 0.3927 +0.3111 0.0889 0.3927 +0.3500 0.1000 0.3927 +primID: 9 +startangle_c: 1 +endpose_c: 5 4 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0278 0.0222 0.3927 +0.0556 0.0444 0.3927 +0.0833 0.0667 0.3927 +0.1111 0.0889 0.3927 +0.1389 0.1111 0.3927 +0.1667 0.1333 0.3927 +0.1944 0.1556 0.3927 +0.2222 0.1778 0.3927 +0.2500 0.2000 0.3927 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0056 0.0056 0.7854 +0.0111 0.0111 0.7854 +0.0167 0.0167 0.7854 +0.0222 0.0222 0.7854 +0.0278 0.0278 0.7854 +0.0333 0.0333 0.7854 +0.0389 0.0389 0.7854 +0.0444 0.0444 0.7854 +0.0500 0.0500 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 6 6 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: 11 14 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0705 0.0705 0.7854 +0.1411 0.1411 0.7854 +0.2116 0.2116 0.7854 +0.2816 0.2828 0.8201 +0.3469 0.3581 0.8917 +0.4068 0.4379 0.9633 +0.4607 0.5218 1.0349 +0.5086 0.6093 1.1065 +0.5500 0.7000 1.1781 +primID: 3 +startangle_c: 2 +endpose_c: 14 11 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0705 0.0705 0.7854 +0.1411 0.1411 0.7854 +0.2116 0.2116 0.7854 +0.2828 0.2816 0.7507 +0.3581 0.3469 0.6791 +0.4379 0.4068 0.6075 +0.5218 0.4607 0.5359 +0.6093 0.5086 0.4643 +0.7000 0.5500 0.3927 +primID: 4 +startangle_c: 2 +endpose_c: 4 6 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0278 0.0292 0.8288 +0.0543 0.0595 0.8722 +0.0795 0.0910 0.9156 +0.1033 0.1235 0.9590 +0.1257 0.1571 1.0024 +0.1466 0.1916 1.0458 +0.1659 0.2269 1.0892 +0.1838 0.2631 1.1326 +0.2000 0.3000 1.1760 +primID: 5 +startangle_c: 2 +endpose_c: 6 4 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0292 0.0278 0.7420 +0.0595 0.0543 0.6986 +0.0910 0.0795 0.6552 +0.1235 0.1033 0.6118 +0.1571 0.1257 0.5684 +0.1916 0.1466 0.5250 +0.2269 0.1659 0.4816 +0.2631 0.1838 0.4382 +0.3000 0.2000 0.3948 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 7 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 8 +startangle_c: 2 +endpose_c: 6 7 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0389 0.7854 +0.0667 0.0778 0.7854 +0.1000 0.1167 0.7854 +0.1333 0.1556 0.7854 +0.1667 0.1944 0.7854 +0.2000 0.2333 0.7854 +0.2333 0.2722 0.7854 +0.2667 0.3111 0.7854 +0.3000 0.3500 0.7854 +primID: 9 +startangle_c: 2 +endpose_c: 7 6 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0389 0.0333 0.7854 +0.0778 0.0667 0.7854 +0.1167 0.1000 0.7854 +0.1556 0.1333 0.7854 +0.1944 0.1667 0.7854 +0.2333 0.2000 0.7854 +0.2722 0.2333 0.7854 +0.3111 0.2667 0.7854 +0.3500 0.3000 0.7854 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0056 0.0111 1.1781 +0.0111 0.0222 1.1781 +0.0167 0.0333 1.1781 +0.0222 0.0444 1.1781 +0.0278 0.0556 1.1781 +0.0333 0.0667 1.1781 +0.0389 0.0778 1.1781 +0.0444 0.0889 1.1781 +0.0500 0.1000 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 3 6 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0167 0.0333 1.1781 +0.0333 0.0667 1.1781 +0.0500 0.1000 1.1781 +0.0667 0.1333 1.1781 +0.0833 0.1667 1.1781 +0.1000 0.2000 1.1781 +0.1167 0.2333 1.1781 +0.1333 0.2667 1.1781 +0.1500 0.3000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: 9 13 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0378 0.0793 1.1378 +0.0787 0.1572 1.0976 +0.1229 0.2334 1.0574 +0.1701 0.3079 1.0171 +0.2204 0.3805 0.9769 +0.2736 0.4512 0.9366 +0.3296 0.5197 0.8964 +0.3885 0.5860 0.8561 +0.4500 0.6500 0.8159 +primID: 3 +startangle_c: 3 +endpose_c: 3 14 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0305 0.0741 1.1934 +0.0582 0.1493 1.2406 +0.0824 0.2256 1.2878 +0.1030 0.3031 1.3349 +0.1199 0.3814 1.3821 +0.1330 0.4604 1.4293 +0.1424 0.5400 1.4765 +0.1481 0.6199 1.5236 +0.1500 0.7000 1.5708 +primID: 4 +startangle_c: 3 +endpose_c: 4 5 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0184 0.0298 1.1478 +0.0379 0.0592 1.1175 +0.0583 0.0881 1.0872 +0.0796 0.1165 1.0569 +0.1019 0.1444 1.0266 +0.1251 0.1717 0.9963 +0.1492 0.1984 0.9660 +0.1742 0.2245 0.9357 +0.2000 0.2500 0.9054 +primID: 5 +startangle_c: 3 +endpose_c: 1 6 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0105 0.0320 1.2157 +0.0197 0.0644 1.2534 +0.0278 0.0973 1.2910 +0.0346 0.1304 1.3286 +0.0402 0.1639 1.3663 +0.0446 0.1977 1.4039 +0.0476 0.2316 1.4416 +0.0495 0.2658 1.4792 +0.0500 0.3000 1.5168 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 7 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 8 +startangle_c: 3 +endpose_c: 2 7 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0111 0.0389 1.1781 +0.0222 0.0778 1.1781 +0.0333 0.1167 1.1781 +0.0444 0.1556 1.1781 +0.0556 0.1944 1.1781 +0.0667 0.2333 1.1781 +0.0778 0.2722 1.1781 +0.0889 0.3111 1.1781 +0.1000 0.3500 1.1781 +primID: 9 +startangle_c: 3 +endpose_c: 4 5 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0222 0.0278 1.1781 +0.0444 0.0556 1.1781 +0.0667 0.0833 1.1781 +0.0889 0.1111 1.1781 +0.1111 0.1389 1.1781 +0.1333 0.1667 1.1781 +0.1556 0.1944 1.1781 +0.1778 0.2222 1.1781 +0.2000 0.2500 1.1781 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0056 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0167 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0278 1.5708 +0.0000 0.0333 1.5708 +0.0000 0.0389 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0500 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 8 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2222 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3111 1.5708 +0.0000 0.3556 1.5708 +0.0000 0.4000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: -4 16 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +-0.0095 0.0904 1.6057 +-0.0222 0.1806 1.6407 +-0.0381 0.2707 1.6756 +-0.0572 0.3604 1.7106 +-0.0795 0.4496 1.7455 +-0.1050 0.5383 1.7805 +-0.1335 0.6264 1.8154 +-0.1652 0.7136 1.8503 +-0.2000 0.8000 1.8853 +primID: 3 +startangle_c: 4 +endpose_c: 4 16 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0095 0.0904 1.5359 +0.0222 0.1806 1.5009 +0.0381 0.2707 1.4660 +0.0572 0.3604 1.4310 +0.0795 0.4496 1.3961 +0.1050 0.5383 1.3611 +0.1335 0.6264 1.3262 +0.1652 0.7136 1.2912 +0.2000 0.8000 1.2563 +primID: 4 +startangle_c: 4 +endpose_c: -2 5 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +-0.0085 0.0280 1.5931 +-0.0177 0.0559 1.6153 +-0.0275 0.0839 1.6376 +-0.0380 0.1117 1.6598 +-0.0491 0.1396 1.6821 +-0.0609 0.1673 1.7043 +-0.0733 0.1950 1.7266 +-0.0863 0.2225 1.7489 +-0.1000 0.2500 1.7711 +primID: 5 +startangle_c: 4 +endpose_c: 2 5 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0085 0.0280 1.5485 +0.0177 0.0559 1.5263 +0.0275 0.0839 1.5040 +0.0380 0.1117 1.4818 +0.0491 0.1396 1.4595 +0.0609 0.1673 1.4373 +0.0733 0.1950 1.4150 +0.0863 0.2225 1.3927 +0.1000 0.2500 1.3705 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 7 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 8 +startangle_c: 4 +endpose_c: -1 8 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +-0.0056 0.0444 1.5708 +-0.0111 0.0889 1.5708 +-0.0167 0.1333 1.5708 +-0.0222 0.1778 1.5708 +-0.0278 0.2222 1.5708 +-0.0333 0.2667 1.5708 +-0.0389 0.3111 1.5708 +-0.0444 0.3556 1.5708 +-0.0500 0.4000 1.5708 +primID: 9 +startangle_c: 4 +endpose_c: 1 8 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0056 0.0444 1.5708 +0.0111 0.0889 1.5708 +0.0167 0.1333 1.5708 +0.0222 0.1778 1.5708 +0.0278 0.2222 1.5708 +0.0333 0.2667 1.5708 +0.0389 0.3111 1.5708 +0.0444 0.3556 1.5708 +0.0500 0.4000 1.5708 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0056 0.0111 1.9635 +-0.0111 0.0222 1.9635 +-0.0167 0.0333 1.9635 +-0.0222 0.0444 1.9635 +-0.0278 0.0556 1.9635 +-0.0333 0.0667 1.9635 +-0.0389 0.0778 1.9635 +-0.0444 0.0889 1.9635 +-0.0500 0.1000 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -3 6 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0167 0.0333 1.9635 +-0.0333 0.0667 1.9635 +-0.0500 0.1000 1.9635 +-0.0667 0.1333 1.9635 +-0.0833 0.1667 1.9635 +-0.1000 0.2000 1.9635 +-0.1167 0.2333 1.9635 +-0.1333 0.2667 1.9635 +-0.1500 0.3000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: -9 13 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0378 0.0793 2.0037 +-0.0787 0.1572 2.0440 +-0.1229 0.2334 2.0842 +-0.1701 0.3079 2.1245 +-0.2204 0.3805 2.1647 +-0.2736 0.4512 2.2050 +-0.3296 0.5197 2.2452 +-0.3885 0.5860 2.2855 +-0.4500 0.6500 2.3257 +primID: 3 +startangle_c: 5 +endpose_c: -3 14 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0305 0.0741 1.9482 +-0.0582 0.1493 1.9010 +-0.0824 0.2256 1.8538 +-0.1030 0.3031 1.8067 +-0.1199 0.3814 1.7595 +-0.1330 0.4604 1.7123 +-0.1424 0.5400 1.6651 +-0.1481 0.6199 1.6180 +-0.1500 0.7000 1.5708 +primID: 4 +startangle_c: 5 +endpose_c: -4 5 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0184 0.0298 1.9938 +-0.0379 0.0592 2.0241 +-0.0583 0.0881 2.0544 +-0.0796 0.1165 2.0847 +-0.1019 0.1444 2.1150 +-0.1251 0.1717 2.1453 +-0.1492 0.1984 2.1756 +-0.1742 0.2245 2.2059 +-0.2000 0.2500 2.2362 +primID: 5 +startangle_c: 5 +endpose_c: -1 6 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0105 0.0320 1.9259 +-0.0197 0.0644 1.8882 +-0.0278 0.0973 1.8506 +-0.0346 0.1304 1.8129 +-0.0402 0.1639 1.7753 +-0.0446 0.1977 1.7377 +-0.0476 0.2316 1.7000 +-0.0495 0.2658 1.6624 +-0.0500 0.3000 1.6248 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 7 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 8 +startangle_c: 5 +endpose_c: -2 7 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0111 0.0389 1.9635 +-0.0222 0.0778 1.9635 +-0.0333 0.1167 1.9635 +-0.0444 0.1556 1.9635 +-0.0556 0.1944 1.9635 +-0.0667 0.2333 1.9635 +-0.0778 0.2722 1.9635 +-0.0889 0.3111 1.9635 +-0.1000 0.3500 1.9635 +primID: 9 +startangle_c: 5 +endpose_c: -4 5 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0222 0.0278 1.9635 +-0.0444 0.0556 1.9635 +-0.0667 0.0833 1.9635 +-0.0889 0.1111 1.9635 +-0.1111 0.1389 1.9635 +-0.1333 0.1667 1.9635 +-0.1556 0.1944 1.9635 +-0.1778 0.2222 1.9635 +-0.2000 0.2500 1.9635 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0056 0.0056 2.3562 +-0.0111 0.0111 2.3562 +-0.0167 0.0167 2.3562 +-0.0222 0.0222 2.3562 +-0.0278 0.0278 2.3562 +-0.0333 0.0333 2.3562 +-0.0389 0.0389 2.3562 +-0.0444 0.0444 2.3562 +-0.0500 0.0500 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -6 6 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: -14 11 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0705 0.0705 2.3562 +-0.1411 0.1411 2.3562 +-0.2116 0.2116 2.3562 +-0.2828 0.2816 2.3909 +-0.3581 0.3469 2.4625 +-0.4379 0.4068 2.5341 +-0.5218 0.4607 2.6057 +-0.6093 0.5086 2.6773 +-0.7000 0.5500 2.7489 +primID: 3 +startangle_c: 6 +endpose_c: -11 14 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0705 0.0705 2.3562 +-0.1411 0.1411 2.3562 +-0.2116 0.2116 2.3562 +-0.2816 0.2828 2.3215 +-0.3469 0.3581 2.2499 +-0.4068 0.4379 2.1783 +-0.4607 0.5218 2.1067 +-0.5086 0.6093 2.0351 +-0.5500 0.7000 1.9635 +primID: 4 +startangle_c: 6 +endpose_c: -6 4 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0292 0.0278 2.3996 +-0.0595 0.0543 2.4430 +-0.0910 0.0795 2.4864 +-0.1235 0.1033 2.5298 +-0.1571 0.1257 2.5732 +-0.1916 0.1466 2.6166 +-0.2269 0.1659 2.6600 +-0.2631 0.1838 2.7034 +-0.3000 0.2000 2.7468 +primID: 5 +startangle_c: 6 +endpose_c: -4 6 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0278 0.0292 2.3128 +-0.0543 0.0595 2.2694 +-0.0795 0.0910 2.2260 +-0.1033 0.1235 2.1826 +-0.1257 0.1571 2.1392 +-0.1466 0.1916 2.0958 +-0.1659 0.2269 2.0524 +-0.1838 0.2631 2.0090 +-0.2000 0.3000 1.9656 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 7 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 8 +startangle_c: 6 +endpose_c: -7 6 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0389 0.0333 2.3562 +-0.0778 0.0667 2.3562 +-0.1167 0.1000 2.3562 +-0.1556 0.1333 2.3562 +-0.1944 0.1667 2.3562 +-0.2333 0.2000 2.3562 +-0.2722 0.2333 2.3562 +-0.3111 0.2667 2.3562 +-0.3500 0.3000 2.3562 +primID: 9 +startangle_c: 6 +endpose_c: -6 7 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0389 2.3562 +-0.0667 0.0778 2.3562 +-0.1000 0.1167 2.3562 +-0.1333 0.1556 2.3562 +-0.1667 0.1944 2.3562 +-0.2000 0.2333 2.3562 +-0.2333 0.2722 2.3562 +-0.2667 0.3111 2.3562 +-0.3000 0.3500 2.3562 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0111 0.0056 2.7489 +-0.0222 0.0111 2.7489 +-0.0333 0.0167 2.7489 +-0.0444 0.0222 2.7489 +-0.0556 0.0278 2.7489 +-0.0667 0.0333 2.7489 +-0.0778 0.0389 2.7489 +-0.0889 0.0444 2.7489 +-0.1000 0.0500 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -6 3 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0333 0.0167 2.7489 +-0.0667 0.0333 2.7489 +-0.1000 0.0500 2.7489 +-0.1333 0.0667 2.7489 +-0.1667 0.0833 2.7489 +-0.2000 0.1000 2.7489 +-0.2333 0.1167 2.7489 +-0.2667 0.1333 2.7489 +-0.3000 0.1500 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: -13 9 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0793 0.0378 2.7086 +-0.1572 0.0787 2.6684 +-0.2334 0.1229 2.6281 +-0.3079 0.1701 2.5879 +-0.3805 0.2204 2.5477 +-0.4512 0.2736 2.5074 +-0.5197 0.3296 2.4672 +-0.5860 0.3885 2.4269 +-0.6500 0.4500 2.3867 +primID: 3 +startangle_c: 7 +endpose_c: -14 3 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0741 0.0305 2.7642 +-0.1493 0.0582 2.8114 +-0.2256 0.0824 2.8586 +-0.3031 0.1030 2.9057 +-0.3814 0.1199 2.9529 +-0.4604 0.1330 3.0001 +-0.5400 0.1424 3.0472 +-0.6199 0.1481 3.0944 +-0.7000 0.1500 3.1416 +primID: 4 +startangle_c: 7 +endpose_c: -5 4 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0298 0.0184 2.7186 +-0.0592 0.0379 2.6883 +-0.0881 0.0583 2.6580 +-0.1165 0.0796 2.6277 +-0.1444 0.1019 2.5974 +-0.1717 0.1251 2.5671 +-0.1984 0.1492 2.5368 +-0.2245 0.1742 2.5065 +-0.2500 0.2000 2.4762 +primID: 5 +startangle_c: 7 +endpose_c: -6 1 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0320 0.0105 2.7865 +-0.0644 0.0197 2.8242 +-0.0973 0.0278 2.8618 +-0.1304 0.0346 2.8994 +-0.1639 0.0402 2.9371 +-0.1977 0.0446 2.9747 +-0.2316 0.0476 3.0124 +-0.2658 0.0495 3.0500 +-0.3000 0.0500 3.0876 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 7 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 8 +startangle_c: 7 +endpose_c: -7 2 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0389 0.0111 2.7489 +-0.0778 0.0222 2.7489 +-0.1167 0.0333 2.7489 +-0.1556 0.0444 2.7489 +-0.1944 0.0556 2.7489 +-0.2333 0.0667 2.7489 +-0.2722 0.0778 2.7489 +-0.3111 0.0889 2.7489 +-0.3500 0.1000 2.7489 +primID: 9 +startangle_c: 7 +endpose_c: -5 4 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0278 0.0222 2.7489 +-0.0556 0.0444 2.7489 +-0.0833 0.0667 2.7489 +-0.1111 0.0889 2.7489 +-0.1389 0.1111 2.7489 +-0.1667 0.1333 2.7489 +-0.1944 0.1556 2.7489 +-0.2222 0.1778 2.7489 +-0.2500 0.2000 2.7489 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0056 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0167 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0278 0.0000 3.1416 +-0.0333 0.0000 3.1416 +-0.0389 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0500 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -8 0 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2222 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3111 0.0000 3.1416 +-0.3556 0.0000 3.1416 +-0.4000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: -16 -4 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0904 -0.0095 3.1765 +-0.1806 -0.0222 3.2115 +-0.2707 -0.0381 3.2464 +-0.3604 -0.0572 3.2814 +-0.4496 -0.0795 3.3163 +-0.5383 -0.1050 3.3513 +-0.6264 -0.1335 3.3862 +-0.7136 -0.1652 3.4211 +-0.8000 -0.2000 3.4561 +primID: 3 +startangle_c: 8 +endpose_c: -16 4 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0904 0.0095 3.1066 +-0.1806 0.0222 3.0717 +-0.2707 0.0381 3.0368 +-0.3604 0.0572 3.0018 +-0.4496 0.0795 2.9669 +-0.5383 0.1050 2.9319 +-0.6264 0.1335 2.8970 +-0.7136 0.1652 2.8620 +-0.8000 0.2000 2.8271 +primID: 4 +startangle_c: 8 +endpose_c: -5 -2 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0280 -0.0085 3.1639 +-0.0559 -0.0177 3.1861 +-0.0839 -0.0275 3.2084 +-0.1117 -0.0380 3.2306 +-0.1396 -0.0491 3.2529 +-0.1673 -0.0609 3.2751 +-0.1950 -0.0733 3.2974 +-0.2225 -0.0863 3.3197 +-0.2500 -0.1000 3.3419 +primID: 5 +startangle_c: 8 +endpose_c: -5 2 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0280 0.0085 3.1193 +-0.0559 0.0177 3.0971 +-0.0839 0.0275 3.0748 +-0.1117 0.0380 3.0526 +-0.1396 0.0491 3.0303 +-0.1673 0.0609 3.0080 +-0.1950 0.0733 2.9858 +-0.2225 0.0863 2.9635 +-0.2500 0.1000 2.9413 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 7 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 8 +startangle_c: 8 +endpose_c: -8 -1 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 -0.0056 3.1416 +-0.0889 -0.0111 3.1416 +-0.1333 -0.0167 3.1416 +-0.1778 -0.0222 3.1416 +-0.2222 -0.0278 3.1416 +-0.2667 -0.0333 3.1416 +-0.3111 -0.0389 3.1416 +-0.3556 -0.0444 3.1416 +-0.4000 -0.0500 3.1416 +primID: 9 +startangle_c: 8 +endpose_c: -8 1 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0056 3.1416 +-0.0889 0.0111 3.1416 +-0.1333 0.0167 3.1416 +-0.1778 0.0222 3.1416 +-0.2222 0.0278 3.1416 +-0.2667 0.0333 3.1416 +-0.3111 0.0389 3.1416 +-0.3556 0.0444 3.1416 +-0.4000 0.0500 3.1416 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0111 -0.0056 3.5343 +-0.0222 -0.0111 3.5343 +-0.0333 -0.0167 3.5343 +-0.0444 -0.0222 3.5343 +-0.0556 -0.0278 3.5343 +-0.0667 -0.0333 3.5343 +-0.0778 -0.0389 3.5343 +-0.0889 -0.0444 3.5343 +-0.1000 -0.0500 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -6 -3 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0333 -0.0167 3.5343 +-0.0667 -0.0333 3.5343 +-0.1000 -0.0500 3.5343 +-0.1333 -0.0667 3.5343 +-0.1667 -0.0833 3.5343 +-0.2000 -0.1000 3.5343 +-0.2333 -0.1167 3.5343 +-0.2667 -0.1333 3.5343 +-0.3000 -0.1500 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: -13 -9 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0793 -0.0378 3.5745 +-0.1572 -0.0787 3.6148 +-0.2334 -0.1229 3.6550 +-0.3079 -0.1701 3.6953 +-0.3805 -0.2204 3.7355 +-0.4512 -0.2736 3.7758 +-0.5197 -0.3296 3.8160 +-0.5860 -0.3885 3.8563 +-0.6500 -0.4500 3.8965 +primID: 3 +startangle_c: 9 +endpose_c: -14 -3 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0741 -0.0305 3.5190 +-0.1493 -0.0582 3.4718 +-0.2256 -0.0824 3.4246 +-0.3031 -0.1030 3.3775 +-0.3814 -0.1199 3.3303 +-0.4604 -0.1330 3.2831 +-0.5400 -0.1424 3.2359 +-0.6199 -0.1481 3.1888 +-0.7000 -0.1500 3.1416 +primID: 4 +startangle_c: 9 +endpose_c: -5 -4 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0298 -0.0184 3.5646 +-0.0592 -0.0379 3.5949 +-0.0881 -0.0583 3.6252 +-0.1165 -0.0796 3.6555 +-0.1444 -0.1019 3.6858 +-0.1717 -0.1251 3.7161 +-0.1984 -0.1492 3.7464 +-0.2245 -0.1742 3.7767 +-0.2500 -0.2000 3.8070 +primID: 5 +startangle_c: 9 +endpose_c: -6 -1 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0320 -0.0105 3.4967 +-0.0644 -0.0197 3.4590 +-0.0973 -0.0278 3.4214 +-0.1304 -0.0346 3.3837 +-0.1639 -0.0402 3.3461 +-0.1977 -0.0446 3.3085 +-0.2316 -0.0476 3.2708 +-0.2658 -0.0495 3.2332 +-0.3000 -0.0500 3.1955 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 7 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 8 +startangle_c: 9 +endpose_c: -7 -2 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0389 -0.0111 3.5343 +-0.0778 -0.0222 3.5343 +-0.1167 -0.0333 3.5343 +-0.1556 -0.0444 3.5343 +-0.1944 -0.0556 3.5343 +-0.2333 -0.0667 3.5343 +-0.2722 -0.0778 3.5343 +-0.3111 -0.0889 3.5343 +-0.3500 -0.1000 3.5343 +primID: 9 +startangle_c: 9 +endpose_c: -5 -4 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0278 -0.0222 3.5343 +-0.0556 -0.0444 3.5343 +-0.0833 -0.0667 3.5343 +-0.1111 -0.0889 3.5343 +-0.1389 -0.1111 3.5343 +-0.1667 -0.1333 3.5343 +-0.1944 -0.1556 3.5343 +-0.2222 -0.1778 3.5343 +-0.2500 -0.2000 3.5343 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0056 -0.0056 3.9270 +-0.0111 -0.0111 3.9270 +-0.0167 -0.0167 3.9270 +-0.0222 -0.0222 3.9270 +-0.0278 -0.0278 3.9270 +-0.0333 -0.0333 3.9270 +-0.0389 -0.0389 3.9270 +-0.0444 -0.0444 3.9270 +-0.0500 -0.0500 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -6 -6 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: -11 -14 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0705 -0.0705 3.9270 +-0.1411 -0.1411 3.9270 +-0.2116 -0.2116 3.9270 +-0.2816 -0.2828 3.9617 +-0.3469 -0.3581 4.0333 +-0.4068 -0.4379 4.1049 +-0.4607 -0.5218 4.1765 +-0.5086 -0.6093 4.2481 +-0.5500 -0.7000 4.3197 +primID: 3 +startangle_c: 10 +endpose_c: -14 -11 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0705 -0.0705 3.9270 +-0.1411 -0.1411 3.9270 +-0.2116 -0.2116 3.9270 +-0.2828 -0.2816 3.8923 +-0.3581 -0.3469 3.8207 +-0.4379 -0.4068 3.7491 +-0.5218 -0.4607 3.6775 +-0.6093 -0.5086 3.6059 +-0.7000 -0.5500 3.5343 +primID: 4 +startangle_c: 10 +endpose_c: -4 -6 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0278 -0.0292 3.9704 +-0.0543 -0.0595 4.0138 +-0.0795 -0.0910 4.0572 +-0.1033 -0.1235 4.1006 +-0.1257 -0.1571 4.1440 +-0.1466 -0.1916 4.1874 +-0.1659 -0.2269 4.2308 +-0.1838 -0.2631 4.2742 +-0.2000 -0.3000 4.3176 +primID: 5 +startangle_c: 10 +endpose_c: -6 -4 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0292 -0.0278 3.8836 +-0.0595 -0.0543 3.8402 +-0.0910 -0.0795 3.7968 +-0.1235 -0.1033 3.7534 +-0.1571 -0.1257 3.7100 +-0.1916 -0.1466 3.6666 +-0.2269 -0.1659 3.6232 +-0.2631 -0.1838 3.5798 +-0.3000 -0.2000 3.5364 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 7 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 8 +startangle_c: 10 +endpose_c: -6 -7 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0389 3.9270 +-0.0667 -0.0778 3.9270 +-0.1000 -0.1167 3.9270 +-0.1333 -0.1556 3.9270 +-0.1667 -0.1944 3.9270 +-0.2000 -0.2333 3.9270 +-0.2333 -0.2722 3.9270 +-0.2667 -0.3111 3.9270 +-0.3000 -0.3500 3.9270 +primID: 9 +startangle_c: 10 +endpose_c: -7 -6 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0389 -0.0333 3.9270 +-0.0778 -0.0667 3.9270 +-0.1167 -0.1000 3.9270 +-0.1556 -0.1333 3.9270 +-0.1944 -0.1667 3.9270 +-0.2333 -0.2000 3.9270 +-0.2722 -0.2333 3.9270 +-0.3111 -0.2667 3.9270 +-0.3500 -0.3000 3.9270 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0056 -0.0111 4.3197 +-0.0111 -0.0222 4.3197 +-0.0167 -0.0333 4.3197 +-0.0222 -0.0444 4.3197 +-0.0278 -0.0556 4.3197 +-0.0333 -0.0667 4.3197 +-0.0389 -0.0778 4.3197 +-0.0444 -0.0889 4.3197 +-0.0500 -0.1000 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -3 -6 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0167 -0.0333 4.3197 +-0.0333 -0.0667 4.3197 +-0.0500 -0.1000 4.3197 +-0.0667 -0.1333 4.3197 +-0.0833 -0.1667 4.3197 +-0.1000 -0.2000 4.3197 +-0.1167 -0.2333 4.3197 +-0.1333 -0.2667 4.3197 +-0.1500 -0.3000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: -9 -13 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0378 -0.0793 4.2794 +-0.0787 -0.1572 4.2392 +-0.1229 -0.2334 4.1989 +-0.1701 -0.3079 4.1587 +-0.2204 -0.3805 4.1185 +-0.2736 -0.4512 4.0782 +-0.3296 -0.5197 4.0380 +-0.3885 -0.5860 3.9977 +-0.4500 -0.6500 3.9575 +primID: 3 +startangle_c: 11 +endpose_c: -3 -14 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0305 -0.0741 4.3350 +-0.0582 -0.1493 4.3822 +-0.0824 -0.2256 4.4294 +-0.1030 -0.3031 4.4765 +-0.1199 -0.3814 4.5237 +-0.1330 -0.4604 4.5709 +-0.1424 -0.5400 4.6180 +-0.1481 -0.6199 4.6652 +-0.1500 -0.7000 4.7124 +primID: 4 +startangle_c: 11 +endpose_c: -4 -5 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0184 -0.0298 4.2894 +-0.0379 -0.0592 4.2591 +-0.0583 -0.0881 4.2288 +-0.0796 -0.1165 4.1985 +-0.1019 -0.1444 4.1682 +-0.1251 -0.1717 4.1379 +-0.1492 -0.1984 4.1076 +-0.1742 -0.2245 4.0773 +-0.2000 -0.2500 4.0470 +primID: 5 +startangle_c: 11 +endpose_c: -1 -6 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0105 -0.0320 4.3573 +-0.0197 -0.0644 4.3950 +-0.0278 -0.0973 4.4326 +-0.0346 -0.1304 4.4702 +-0.0402 -0.1639 4.5079 +-0.0446 -0.1977 4.5455 +-0.0476 -0.2316 4.5832 +-0.0495 -0.2658 4.6208 +-0.0500 -0.3000 4.6584 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 7 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 8 +startangle_c: 11 +endpose_c: -2 -7 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0111 -0.0389 4.3197 +-0.0222 -0.0778 4.3197 +-0.0333 -0.1167 4.3197 +-0.0444 -0.1556 4.3197 +-0.0556 -0.1944 4.3197 +-0.0667 -0.2333 4.3197 +-0.0778 -0.2722 4.3197 +-0.0889 -0.3111 4.3197 +-0.1000 -0.3500 4.3197 +primID: 9 +startangle_c: 11 +endpose_c: -4 -5 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0222 -0.0278 4.3197 +-0.0444 -0.0556 4.3197 +-0.0667 -0.0833 4.3197 +-0.0889 -0.1111 4.3197 +-0.1111 -0.1389 4.3197 +-0.1333 -0.1667 4.3197 +-0.1556 -0.1944 4.3197 +-0.1778 -0.2222 4.3197 +-0.2000 -0.2500 4.3197 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0056 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0167 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0278 4.7124 +0.0000 -0.0333 4.7124 +0.0000 -0.0389 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0500 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -8 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2222 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3111 4.7124 +0.0000 -0.3556 4.7124 +0.0000 -0.4000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 4 -16 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0095 -0.0904 4.7473 +0.0222 -0.1806 4.7823 +0.0381 -0.2707 4.8172 +0.0572 -0.3604 4.8522 +0.0795 -0.4496 4.8871 +0.1050 -0.5383 4.9221 +0.1335 -0.6264 4.9570 +0.1652 -0.7136 4.9919 +0.2000 -0.8000 5.0269 +primID: 3 +startangle_c: 12 +endpose_c: -4 -16 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0095 -0.0904 4.6774 +-0.0222 -0.1806 4.6425 +-0.0381 -0.2707 4.6076 +-0.0572 -0.3604 4.5726 +-0.0795 -0.4496 4.5377 +-0.1050 -0.5383 4.5027 +-0.1335 -0.6264 4.4678 +-0.1652 -0.7136 4.4328 +-0.2000 -0.8000 4.3979 +primID: 4 +startangle_c: 12 +endpose_c: 2 -5 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0085 -0.0280 4.7346 +0.0177 -0.0559 4.7569 +0.0275 -0.0839 4.7792 +0.0380 -0.1117 4.8014 +0.0491 -0.1396 4.8237 +0.0609 -0.1673 4.8459 +0.0733 -0.1950 4.8682 +0.0863 -0.2225 4.8904 +0.1000 -0.2500 4.9127 +primID: 5 +startangle_c: 12 +endpose_c: -2 -5 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0085 -0.0280 4.6901 +-0.0177 -0.0559 4.6679 +-0.0275 -0.0839 4.6456 +-0.0380 -0.1117 4.6234 +-0.0491 -0.1396 4.6011 +-0.0609 -0.1673 4.5788 +-0.0733 -0.1950 4.5566 +-0.0863 -0.2225 4.5343 +-0.1000 -0.2500 4.5121 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 7 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 8 +startangle_c: 12 +endpose_c: 1 -8 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0056 -0.0444 4.7124 +0.0111 -0.0889 4.7124 +0.0167 -0.1333 4.7124 +0.0222 -0.1778 4.7124 +0.0278 -0.2222 4.7124 +0.0333 -0.2667 4.7124 +0.0389 -0.3111 4.7124 +0.0444 -0.3556 4.7124 +0.0500 -0.4000 4.7124 +primID: 9 +startangle_c: 12 +endpose_c: -1 -8 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0056 -0.0444 4.7124 +-0.0111 -0.0889 4.7124 +-0.0167 -0.1333 4.7124 +-0.0222 -0.1778 4.7124 +-0.0278 -0.2222 4.7124 +-0.0333 -0.2667 4.7124 +-0.0389 -0.3111 4.7124 +-0.0444 -0.3556 4.7124 +-0.0500 -0.4000 4.7124 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0056 -0.0111 5.1051 +0.0111 -0.0222 5.1051 +0.0167 -0.0333 5.1051 +0.0222 -0.0444 5.1051 +0.0278 -0.0556 5.1051 +0.0333 -0.0667 5.1051 +0.0389 -0.0778 5.1051 +0.0444 -0.0889 5.1051 +0.0500 -0.1000 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 3 -6 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0167 -0.0333 5.1051 +0.0333 -0.0667 5.1051 +0.0500 -0.1000 5.1051 +0.0667 -0.1333 5.1051 +0.0833 -0.1667 5.1051 +0.1000 -0.2000 5.1051 +0.1167 -0.2333 5.1051 +0.1333 -0.2667 5.1051 +0.1500 -0.3000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: 9 -13 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0378 -0.0793 5.1453 +0.0787 -0.1572 5.1856 +0.1229 -0.2334 5.2258 +0.1701 -0.3079 5.2661 +0.2204 -0.3805 5.3063 +0.2736 -0.4512 5.3466 +0.3296 -0.5197 5.3868 +0.3885 -0.5860 5.4271 +0.4500 -0.6500 5.4673 +primID: 3 +startangle_c: 13 +endpose_c: 3 -14 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0305 -0.0741 5.0898 +0.0582 -0.1493 5.0426 +0.0824 -0.2256 4.9954 +0.1030 -0.3031 4.9482 +0.1199 -0.3814 4.9011 +0.1330 -0.4604 4.8539 +0.1424 -0.5400 4.8067 +0.1481 -0.6199 4.7596 +0.1500 -0.7000 4.7124 +primID: 4 +startangle_c: 13 +endpose_c: 4 -5 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0184 -0.0298 5.1354 +0.0379 -0.0592 5.1657 +0.0583 -0.0881 5.1960 +0.0796 -0.1165 5.2263 +0.1019 -0.1444 5.2566 +0.1251 -0.1717 5.2869 +0.1492 -0.1984 5.3172 +0.1742 -0.2245 5.3475 +0.2000 -0.2500 5.3778 +primID: 5 +startangle_c: 13 +endpose_c: 1 -6 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0105 -0.0320 5.0674 +0.0197 -0.0644 5.0298 +0.0278 -0.0973 4.9922 +0.0346 -0.1304 4.9545 +0.0402 -0.1639 4.9169 +0.0446 -0.1977 4.8793 +0.0476 -0.2316 4.8416 +0.0495 -0.2658 4.8040 +0.0500 -0.3000 4.7663 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 7 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 8 +startangle_c: 13 +endpose_c: 2 -7 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0111 -0.0389 5.1051 +0.0222 -0.0778 5.1051 +0.0333 -0.1167 5.1051 +0.0444 -0.1556 5.1051 +0.0556 -0.1944 5.1051 +0.0667 -0.2333 5.1051 +0.0778 -0.2722 5.1051 +0.0889 -0.3111 5.1051 +0.1000 -0.3500 5.1051 +primID: 9 +startangle_c: 13 +endpose_c: 4 -5 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0222 -0.0278 5.1051 +0.0444 -0.0556 5.1051 +0.0667 -0.0833 5.1051 +0.0889 -0.1111 5.1051 +0.1111 -0.1389 5.1051 +0.1333 -0.1667 5.1051 +0.1556 -0.1944 5.1051 +0.1778 -0.2222 5.1051 +0.2000 -0.2500 5.1051 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0056 -0.0056 5.4978 +0.0111 -0.0111 5.4978 +0.0167 -0.0167 5.4978 +0.0222 -0.0222 5.4978 +0.0278 -0.0278 5.4978 +0.0333 -0.0333 5.4978 +0.0389 -0.0389 5.4978 +0.0444 -0.0444 5.4978 +0.0500 -0.0500 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 6 -6 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: 14 -11 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0705 -0.0705 5.4978 +0.1411 -0.1411 5.4978 +0.2116 -0.2116 5.4978 +0.2828 -0.2816 5.5325 +0.3581 -0.3469 5.6041 +0.4379 -0.4068 5.6757 +0.5218 -0.4607 5.7473 +0.6093 -0.5086 5.8189 +0.7000 -0.5500 5.8905 +primID: 3 +startangle_c: 14 +endpose_c: 11 -14 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0705 -0.0705 5.4978 +0.1411 -0.1411 5.4978 +0.2116 -0.2116 5.4978 +0.2816 -0.2828 5.4631 +0.3469 -0.3581 5.3915 +0.4068 -0.4379 5.3199 +0.4607 -0.5218 5.2483 +0.5086 -0.6093 5.1767 +0.5500 -0.7000 5.1051 +primID: 4 +startangle_c: 14 +endpose_c: 6 -4 15 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0292 -0.0278 5.5412 +0.0595 -0.0543 5.5846 +0.0910 -0.0795 5.6280 +0.1235 -0.1033 5.6714 +0.1571 -0.1257 5.7148 +0.1916 -0.1466 5.7582 +0.2269 -0.1659 5.8016 +0.2631 -0.1838 5.8450 +0.3000 -0.2000 5.8884 +primID: 5 +startangle_c: 14 +endpose_c: 4 -6 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0278 -0.0292 5.4544 +0.0543 -0.0595 5.4110 +0.0795 -0.0910 5.3676 +0.1033 -0.1235 5.3242 +0.1257 -0.1571 5.2808 +0.1466 -0.1916 5.2374 +0.1659 -0.2269 5.1940 +0.1838 -0.2631 5.1506 +0.2000 -0.3000 5.1072 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 7 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 8 +startangle_c: 14 +endpose_c: 7 -6 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0389 -0.0333 5.4978 +0.0778 -0.0667 5.4978 +0.1167 -0.1000 5.4978 +0.1556 -0.1333 5.4978 +0.1944 -0.1667 5.4978 +0.2333 -0.2000 5.4978 +0.2722 -0.2333 5.4978 +0.3111 -0.2667 5.4978 +0.3500 -0.3000 5.4978 +primID: 9 +startangle_c: 14 +endpose_c: 6 -7 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0389 5.4978 +0.0667 -0.0778 5.4978 +0.1000 -0.1167 5.4978 +0.1333 -0.1556 5.4978 +0.1667 -0.1944 5.4978 +0.2000 -0.2333 5.4978 +0.2333 -0.2722 5.4978 +0.2667 -0.3111 5.4978 +0.3000 -0.3500 5.4978 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0111 -0.0056 5.8905 +0.0222 -0.0111 5.8905 +0.0333 -0.0167 5.8905 +0.0444 -0.0222 5.8905 +0.0556 -0.0278 5.8905 +0.0667 -0.0333 5.8905 +0.0778 -0.0389 5.8905 +0.0889 -0.0444 5.8905 +0.1000 -0.0500 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 6 -3 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0333 -0.0167 5.8905 +0.0667 -0.0333 5.8905 +0.1000 -0.0500 5.8905 +0.1333 -0.0667 5.8905 +0.1667 -0.0833 5.8905 +0.2000 -0.1000 5.8905 +0.2333 -0.1167 5.8905 +0.2667 -0.1333 5.8905 +0.3000 -0.1500 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: 13 -9 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0793 -0.0378 5.8502 +0.1572 -0.0787 5.8100 +0.2334 -0.1229 5.7697 +0.3079 -0.1701 5.7295 +0.3805 -0.2204 5.6892 +0.4512 -0.2736 5.6490 +0.5197 -0.3296 5.6088 +0.5860 -0.3885 5.5685 +0.6500 -0.4500 5.5283 +primID: 3 +startangle_c: 15 +endpose_c: 14 -3 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0741 -0.0305 5.9058 +0.1493 -0.0582 5.9530 +0.2256 -0.0824 6.0002 +0.3031 -0.1030 6.0473 +0.3814 -0.1199 6.0945 +0.4604 -0.1330 6.1417 +0.5400 -0.1424 6.1888 +0.6199 -0.1481 6.2360 +0.7000 -0.1500 6.2832 +primID: 4 +startangle_c: 15 +endpose_c: 5 -4 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0298 -0.0184 5.8602 +0.0592 -0.0379 5.8299 +0.0881 -0.0583 5.7996 +0.1165 -0.0796 5.7693 +0.1444 -0.1019 5.7390 +0.1717 -0.1251 5.7087 +0.1984 -0.1492 5.6784 +0.2245 -0.1742 5.6481 +0.2500 -0.2000 5.6178 +primID: 5 +startangle_c: 15 +endpose_c: 6 -1 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0320 -0.0105 5.9281 +0.0644 -0.0197 5.9658 +0.0973 -0.0278 6.0034 +0.1304 -0.0346 6.0410 +0.1639 -0.0402 6.0787 +0.1977 -0.0446 6.1163 +0.2316 -0.0476 6.1540 +0.2658 -0.0495 6.1916 +0.3000 -0.0500 6.2292 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 7 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 1000 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.2360 +0.0000 0.0000 4.5815 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.2725 +0.0000 0.0000 2.6180 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.3090 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.0000 +primID: 8 +startangle_c: 15 +endpose_c: 7 -2 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0389 -0.0111 5.8905 +0.0778 -0.0222 5.8905 +0.1167 -0.0333 5.8905 +0.1556 -0.0444 5.8905 +0.1944 -0.0556 5.8905 +0.2333 -0.0667 5.8905 +0.2722 -0.0778 5.8905 +0.3111 -0.0889 5.8905 +0.3500 -0.1000 5.8905 +primID: 9 +startangle_c: 15 +endpose_c: 5 -4 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0278 -0.0222 5.8905 +0.0556 -0.0444 5.8905 +0.0833 -0.0667 5.8905 +0.1111 -0.0889 5.8905 +0.1389 -0.1111 5.8905 +0.1667 -0.1333 5.8905 +0.1944 -0.1556 5.8905 +0.2222 -0.1778 5.8905 +0.2500 -0.2000 5.8905 diff --git a/config/runtime/mprim/unicycle_highcost_10cm.mprim b/config/runtime/mprim/unicycle_highcost_10cm.mprim new file mode 100755 index 0000000..de16976 --- /dev/null +++ b/config/runtime/mprim/unicycle_highcost_10cm.mprim @@ -0,0 +1,1683 @@ +resolution_m: 0.100000 +numberofangles: 16 +totalnumberofprimitives: 112 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0333 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0556 0.0000 0.0000 +0.0667 0.0000 0.0000 +0.0778 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1000 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 4 0 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2222 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3111 0.0000 0.0000 +0.3556 0.0000 0.0000 +0.4000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0111 0.0000 0.0000 +-0.0222 0.0000 0.0000 +-0.0333 0.0000 0.0000 +-0.0444 0.0000 0.0000 +-0.0556 0.0000 0.0000 +-0.0667 0.0000 0.0000 +-0.0778 0.0000 0.0000 +-0.0889 0.0000 0.0000 +-0.1000 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 4 1 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 0.0048 0.0349 +0.0903 0.0111 0.0699 +0.1353 0.0191 0.1048 +0.1802 0.0286 0.1398 +0.2248 0.0398 0.1747 +0.2692 0.0525 0.2097 +0.3132 0.0668 0.2446 +0.3568 0.0826 0.2796 +0.4000 0.1000 0.3145 +primID: 4 +startangle_c: 0 +endpose_c: 4 -1 -1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 -0.0048 -0.0349 +0.0903 -0.0111 -0.0699 +0.1353 -0.0191 -0.1048 +0.1802 -0.0286 -0.1398 +0.2248 -0.0398 -0.1747 +0.2692 -0.0525 -0.2097 +0.3132 -0.0668 -0.2446 +0.3568 -0.0826 -0.2796 +0.4000 -0.1000 -0.3145 +primID: 5 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0222 0.0111 0.3927 +0.0444 0.0222 0.3927 +0.0667 0.0333 0.3927 +0.0889 0.0444 0.3927 +0.1111 0.0556 0.3927 +0.1333 0.0667 0.3927 +0.1556 0.0778 0.3927 +0.1778 0.0889 0.3927 +0.2000 0.1000 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 6 3 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0667 0.0333 0.3927 +0.1333 0.0667 0.3927 +0.2000 0.1000 0.3927 +0.2667 0.1333 0.3927 +0.3333 0.1667 0.3927 +0.4000 0.2000 0.3927 +0.4667 0.2333 0.3927 +0.5333 0.2667 0.3927 +0.6000 0.3000 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0222 -0.0111 0.3927 +-0.0444 -0.0222 0.3927 +-0.0667 -0.0333 0.3927 +-0.0889 -0.0444 0.3927 +-0.1111 -0.0556 0.3927 +-0.1333 -0.0667 0.3927 +-0.1556 -0.0778 0.3927 +-0.1778 -0.0889 0.3927 +-0.2000 -0.1000 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 3 2 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0369 0.0162 0.4345 +0.0731 0.0339 0.4783 +0.1085 0.0533 0.5222 +0.1430 0.0741 0.5661 +0.1766 0.0965 0.6099 +0.2091 0.1203 0.6538 +0.2405 0.1455 0.6977 +0.2709 0.1721 0.7415 +0.3000 0.2000 0.7854 +primID: 4 +startangle_c: 1 +endpose_c: 4 1 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0427 0.0177 0.3927 +0.0854 0.0354 0.3927 +0.1283 0.0523 0.3477 +0.1722 0.0668 0.2898 +0.2168 0.0787 0.2318 +0.2621 0.0880 0.1739 +0.3078 0.0947 0.1159 +0.3538 0.0987 0.0580 +0.4000 0.1000 0.0000 +primID: 5 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0111 0.0111 0.7854 +0.0222 0.0222 0.7854 +0.0333 0.0333 0.7854 +0.0444 0.0444 0.7854 +0.0556 0.0556 0.7854 +0.0667 0.0667 0.7854 +0.0778 0.0778 0.7854 +0.0889 0.0889 0.7854 +0.1000 0.1000 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 3 3 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0111 -0.0111 0.7854 +-0.0222 -0.0222 0.7854 +-0.0333 -0.0333 0.7854 +-0.0444 -0.0444 0.7854 +-0.0556 -0.0556 0.7854 +-0.0667 -0.0667 0.7854 +-0.0778 -0.0778 0.7854 +-0.0889 -0.0889 0.7854 +-0.1000 -0.1000 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 2 4 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0262 0.0411 0.8119 +0.0515 0.0831 0.8384 +0.0758 0.1260 0.8649 +0.0991 0.1697 0.8913 +0.1214 0.2142 0.9178 +0.1426 0.2595 0.9443 +0.1628 0.3056 0.9708 +0.1820 0.3525 0.9973 +0.2000 0.4000 1.0238 +primID: 4 +startangle_c: 2 +endpose_c: 4 2 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0411 0.0262 0.7589 +0.0831 0.0515 0.7324 +0.1260 0.0758 0.7059 +0.1697 0.0991 0.6795 +0.2142 0.1214 0.6530 +0.2595 0.1426 0.6265 +0.3056 0.1628 0.6000 +0.3525 0.1820 0.5735 +0.4000 0.2000 0.5470 +primID: 5 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0111 0.0222 1.1781 +0.0222 0.0444 1.1781 +0.0333 0.0667 1.1781 +0.0444 0.0889 1.1781 +0.0556 0.1111 1.1781 +0.0667 0.1333 1.1781 +0.0778 0.1556 1.1781 +0.0889 0.1778 1.1781 +0.1000 0.2000 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 3 6 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0333 0.0667 1.1781 +0.0667 0.1333 1.1781 +0.1000 0.2000 1.1781 +0.1333 0.2667 1.1781 +0.1667 0.3333 1.1781 +0.2000 0.4000 1.1781 +0.2333 0.4667 1.1781 +0.2667 0.5333 1.1781 +0.3000 0.6000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0111 -0.0222 1.1781 +-0.0222 -0.0444 1.1781 +-0.0333 -0.0667 1.1781 +-0.0444 -0.0889 1.1781 +-0.0556 -0.1111 1.1781 +-0.0667 -0.1333 1.1781 +-0.0778 -0.1556 1.1781 +-0.0889 -0.1778 1.1781 +-0.1000 -0.2000 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 2 3 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0162 0.0369 1.1363 +0.0339 0.0731 1.0925 +0.0533 0.1085 1.0486 +0.0741 0.1430 1.0047 +0.0965 0.1766 0.9609 +0.1203 0.2091 0.9170 +0.1455 0.2405 0.8731 +0.1721 0.2709 0.8293 +0.2000 0.3000 0.7854 +primID: 4 +startangle_c: 3 +endpose_c: 1 4 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0177 0.0427 1.1781 +0.0354 0.0854 1.1781 +0.0523 0.1283 1.2231 +0.0668 0.1722 1.2810 +0.0787 0.2168 1.3390 +0.0880 0.2621 1.3969 +0.0947 0.3078 1.4549 +0.0987 0.3538 1.5128 +0.1000 0.4000 1.5708 +primID: 5 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0333 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0556 1.5708 +0.0000 0.0667 1.5708 +0.0000 0.0778 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1000 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 4 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2222 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3111 1.5708 +0.0000 0.3556 1.5708 +0.0000 0.4000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0111 1.5708 +0.0000 -0.0222 1.5708 +0.0000 -0.0333 1.5708 +0.0000 -0.0444 1.5708 +0.0000 -0.0556 1.5708 +0.0000 -0.0667 1.5708 +0.0000 -0.0778 1.5708 +0.0000 -0.0889 1.5708 +0.0000 -0.1000 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -1 4 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +-0.0048 0.0452 1.6057 +-0.0111 0.0903 1.6407 +-0.0191 0.1353 1.6756 +-0.0286 0.1802 1.7106 +-0.0398 0.2248 1.7455 +-0.0525 0.2692 1.7805 +-0.0668 0.3132 1.8154 +-0.0826 0.3568 1.8503 +-0.1000 0.4000 1.8853 +primID: 4 +startangle_c: 4 +endpose_c: 1 4 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0048 0.0452 1.5359 +0.0111 0.0903 1.5009 +0.0191 0.1353 1.4660 +0.0286 0.1802 1.4310 +0.0398 0.2248 1.3961 +0.0525 0.2692 1.3611 +0.0668 0.3132 1.3262 +0.0826 0.3568 1.2912 +0.1000 0.4000 1.2563 +primID: 5 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0111 0.0222 1.9635 +-0.0222 0.0444 1.9635 +-0.0333 0.0667 1.9635 +-0.0444 0.0889 1.9635 +-0.0556 0.1111 1.9635 +-0.0667 0.1333 1.9635 +-0.0778 0.1556 1.9635 +-0.0889 0.1778 1.9635 +-0.1000 0.2000 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -3 6 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0333 0.0667 1.9635 +-0.0667 0.1333 1.9635 +-0.1000 0.2000 1.9635 +-0.1333 0.2667 1.9635 +-0.1667 0.3333 1.9635 +-0.2000 0.4000 1.9635 +-0.2333 0.4667 1.9635 +-0.2667 0.5333 1.9635 +-0.3000 0.6000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0111 -0.0222 1.9635 +0.0222 -0.0444 1.9635 +0.0333 -0.0667 1.9635 +0.0444 -0.0889 1.9635 +0.0556 -0.1111 1.9635 +0.0667 -0.1333 1.9635 +0.0778 -0.1556 1.9635 +0.0889 -0.1778 1.9635 +0.1000 -0.2000 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -2 3 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0162 0.0369 2.0053 +-0.0339 0.0731 2.0491 +-0.0533 0.1085 2.0930 +-0.0741 0.1430 2.1369 +-0.0965 0.1766 2.1807 +-0.1203 0.2091 2.2246 +-0.1455 0.2405 2.2685 +-0.1721 0.2709 2.3123 +-0.2000 0.3000 2.3562 +primID: 4 +startangle_c: 5 +endpose_c: -1 4 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0177 0.0427 1.9635 +-0.0354 0.0854 1.9635 +-0.0523 0.1283 1.9185 +-0.0668 0.1722 1.8606 +-0.0787 0.2168 1.8026 +-0.0880 0.2621 1.7447 +-0.0947 0.3078 1.6867 +-0.0987 0.3538 1.6287 +-0.1000 0.4000 1.5708 +primID: 5 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0111 0.0111 2.3562 +-0.0222 0.0222 2.3562 +-0.0333 0.0333 2.3562 +-0.0444 0.0444 2.3562 +-0.0556 0.0556 2.3562 +-0.0667 0.0667 2.3562 +-0.0778 0.0778 2.3562 +-0.0889 0.0889 2.3562 +-0.1000 0.1000 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -3 3 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0111 -0.0111 2.3562 +0.0222 -0.0222 2.3562 +0.0333 -0.0333 2.3562 +0.0444 -0.0444 2.3562 +0.0556 -0.0556 2.3562 +0.0667 -0.0667 2.3562 +0.0778 -0.0778 2.3562 +0.0889 -0.0889 2.3562 +0.1000 -0.1000 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -4 2 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0411 0.0262 2.3827 +-0.0831 0.0515 2.4092 +-0.1260 0.0758 2.4357 +-0.1697 0.0991 2.4621 +-0.2142 0.1214 2.4886 +-0.2595 0.1426 2.5151 +-0.3056 0.1628 2.5416 +-0.3525 0.1820 2.5681 +-0.4000 0.2000 2.5946 +primID: 4 +startangle_c: 6 +endpose_c: -2 4 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0262 0.0411 2.3297 +-0.0515 0.0831 2.3032 +-0.0758 0.1260 2.2767 +-0.0991 0.1697 2.2502 +-0.1214 0.2142 2.2238 +-0.1426 0.2595 2.1973 +-0.1628 0.3056 2.1708 +-0.1820 0.3525 2.1443 +-0.2000 0.4000 2.1178 +primID: 5 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0222 0.0111 2.7489 +-0.0444 0.0222 2.7489 +-0.0667 0.0333 2.7489 +-0.0889 0.0444 2.7489 +-0.1111 0.0556 2.7489 +-0.1333 0.0667 2.7489 +-0.1556 0.0778 2.7489 +-0.1778 0.0889 2.7489 +-0.2000 0.1000 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -6 3 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0667 0.0333 2.7489 +-0.1333 0.0667 2.7489 +-0.2000 0.1000 2.7489 +-0.2667 0.1333 2.7489 +-0.3333 0.1667 2.7489 +-0.4000 0.2000 2.7489 +-0.4667 0.2333 2.7489 +-0.5333 0.2667 2.7489 +-0.6000 0.3000 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0222 -0.0111 2.7489 +0.0444 -0.0222 2.7489 +0.0667 -0.0333 2.7489 +0.0889 -0.0444 2.7489 +0.1111 -0.0556 2.7489 +0.1333 -0.0667 2.7489 +0.1556 -0.0778 2.7489 +0.1778 -0.0889 2.7489 +0.2000 -0.1000 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -3 2 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0369 0.0162 2.7071 +-0.0731 0.0339 2.6633 +-0.1085 0.0533 2.6194 +-0.1430 0.0741 2.5755 +-0.1766 0.0965 2.5317 +-0.2091 0.1203 2.4878 +-0.2405 0.1455 2.4439 +-0.2709 0.1721 2.4001 +-0.3000 0.2000 2.3562 +primID: 4 +startangle_c: 7 +endpose_c: -4 1 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0427 0.0177 2.7489 +-0.0854 0.0354 2.7489 +-0.1283 0.0523 2.7939 +-0.1722 0.0668 2.8518 +-0.2168 0.0787 2.9098 +-0.2621 0.0880 2.9677 +-0.3078 0.0947 3.0257 +-0.3538 0.0987 3.0836 +-0.4000 0.1000 3.1416 +primID: 5 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0333 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0556 0.0000 3.1416 +-0.0667 0.0000 3.1416 +-0.0778 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1000 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -4 0 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2222 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3111 0.0000 3.1416 +-0.3556 0.0000 3.1416 +-0.4000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0111 0.0000 3.1416 +0.0222 0.0000 3.1416 +0.0333 0.0000 3.1416 +0.0444 0.0000 3.1416 +0.0556 0.0000 3.1416 +0.0667 0.0000 3.1416 +0.0778 0.0000 3.1416 +0.0889 0.0000 3.1416 +0.1000 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -4 -1 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 -0.0048 3.1765 +-0.0903 -0.0111 3.2115 +-0.1353 -0.0191 3.2464 +-0.1802 -0.0286 3.2814 +-0.2248 -0.0398 3.3163 +-0.2692 -0.0525 3.3513 +-0.3132 -0.0668 3.3862 +-0.3568 -0.0826 3.4211 +-0.4000 -0.1000 3.4561 +primID: 4 +startangle_c: 8 +endpose_c: -4 1 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0048 3.1066 +-0.0903 0.0111 3.0717 +-0.1353 0.0191 3.0368 +-0.1802 0.0286 3.0018 +-0.2248 0.0398 2.9669 +-0.2692 0.0525 2.9319 +-0.3132 0.0668 2.8970 +-0.3568 0.0826 2.8620 +-0.4000 0.1000 2.8271 +primID: 5 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0222 -0.0111 3.5343 +-0.0444 -0.0222 3.5343 +-0.0667 -0.0333 3.5343 +-0.0889 -0.0444 3.5343 +-0.1111 -0.0556 3.5343 +-0.1333 -0.0667 3.5343 +-0.1556 -0.0778 3.5343 +-0.1778 -0.0889 3.5343 +-0.2000 -0.1000 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -6 -3 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0667 -0.0333 3.5343 +-0.1333 -0.0667 3.5343 +-0.2000 -0.1000 3.5343 +-0.2667 -0.1333 3.5343 +-0.3333 -0.1667 3.5343 +-0.4000 -0.2000 3.5343 +-0.4667 -0.2333 3.5343 +-0.5333 -0.2667 3.5343 +-0.6000 -0.3000 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0222 0.0111 3.5343 +0.0444 0.0222 3.5343 +0.0667 0.0333 3.5343 +0.0889 0.0444 3.5343 +0.1111 0.0556 3.5343 +0.1333 0.0667 3.5343 +0.1556 0.0778 3.5343 +0.1778 0.0889 3.5343 +0.2000 0.1000 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -3 -2 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0369 -0.0162 3.5761 +-0.0731 -0.0339 3.6199 +-0.1085 -0.0533 3.6638 +-0.1430 -0.0741 3.7077 +-0.1766 -0.0965 3.7515 +-0.2091 -0.1203 3.7954 +-0.2405 -0.1455 3.8393 +-0.2709 -0.1721 3.8831 +-0.3000 -0.2000 3.9270 +primID: 4 +startangle_c: 9 +endpose_c: -4 -1 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0427 -0.0177 3.5343 +-0.0854 -0.0354 3.5343 +-0.1283 -0.0523 3.4893 +-0.1722 -0.0668 3.4313 +-0.2168 -0.0787 3.3734 +-0.2621 -0.0880 3.3154 +-0.3078 -0.0947 3.2575 +-0.3538 -0.0987 3.1995 +-0.4000 -0.1000 3.1416 +primID: 5 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0111 -0.0111 3.9270 +-0.0222 -0.0222 3.9270 +-0.0333 -0.0333 3.9270 +-0.0444 -0.0444 3.9270 +-0.0556 -0.0556 3.9270 +-0.0667 -0.0667 3.9270 +-0.0778 -0.0778 3.9270 +-0.0889 -0.0889 3.9270 +-0.1000 -0.1000 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -3 -3 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0111 0.0111 3.9270 +0.0222 0.0222 3.9270 +0.0333 0.0333 3.9270 +0.0444 0.0444 3.9270 +0.0556 0.0556 3.9270 +0.0667 0.0667 3.9270 +0.0778 0.0778 3.9270 +0.0889 0.0889 3.9270 +0.1000 0.1000 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -2 -4 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0262 -0.0411 3.9535 +-0.0515 -0.0831 3.9800 +-0.0758 -0.1260 4.0064 +-0.0991 -0.1697 4.0329 +-0.1214 -0.2142 4.0594 +-0.1426 -0.2595 4.0859 +-0.1628 -0.3056 4.1124 +-0.1820 -0.3525 4.1389 +-0.2000 -0.4000 4.1654 +primID: 4 +startangle_c: 10 +endpose_c: -4 -2 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0411 -0.0262 3.9005 +-0.0831 -0.0515 3.8740 +-0.1260 -0.0758 3.8475 +-0.1697 -0.0991 3.8210 +-0.2142 -0.1214 3.7946 +-0.2595 -0.1426 3.7681 +-0.3056 -0.1628 3.7416 +-0.3525 -0.1820 3.7151 +-0.4000 -0.2000 3.6886 +primID: 5 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0111 -0.0222 4.3197 +-0.0222 -0.0444 4.3197 +-0.0333 -0.0667 4.3197 +-0.0444 -0.0889 4.3197 +-0.0556 -0.1111 4.3197 +-0.0667 -0.1333 4.3197 +-0.0778 -0.1556 4.3197 +-0.0889 -0.1778 4.3197 +-0.1000 -0.2000 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -3 -6 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0333 -0.0667 4.3197 +-0.0667 -0.1333 4.3197 +-0.1000 -0.2000 4.3197 +-0.1333 -0.2667 4.3197 +-0.1667 -0.3333 4.3197 +-0.2000 -0.4000 4.3197 +-0.2333 -0.4667 4.3197 +-0.2667 -0.5333 4.3197 +-0.3000 -0.6000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0111 0.0222 4.3197 +0.0222 0.0444 4.3197 +0.0333 0.0667 4.3197 +0.0444 0.0889 4.3197 +0.0556 0.1111 4.3197 +0.0667 0.1333 4.3197 +0.0778 0.1556 4.3197 +0.0889 0.1778 4.3197 +0.1000 0.2000 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -2 -3 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0162 -0.0369 4.2779 +-0.0339 -0.0731 4.2341 +-0.0533 -0.1085 4.1902 +-0.0741 -0.1430 4.1463 +-0.0965 -0.1766 4.1025 +-0.1203 -0.2091 4.0586 +-0.1455 -0.2405 4.0147 +-0.1721 -0.2709 3.9709 +-0.2000 -0.3000 3.9270 +primID: 4 +startangle_c: 11 +endpose_c: -1 -4 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0177 -0.0427 4.3197 +-0.0354 -0.0854 4.3197 +-0.0523 -0.1283 4.3647 +-0.0668 -0.1722 4.4226 +-0.0787 -0.2168 4.4806 +-0.0880 -0.2621 4.5385 +-0.0947 -0.3078 4.5965 +-0.0987 -0.3538 4.6544 +-0.1000 -0.4000 4.7124 +primID: 5 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0333 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0556 4.7124 +0.0000 -0.0667 4.7124 +0.0000 -0.0778 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1000 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -4 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2222 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3111 4.7124 +0.0000 -0.3556 4.7124 +0.0000 -0.4000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0111 4.7124 +0.0000 0.0222 4.7124 +0.0000 0.0333 4.7124 +0.0000 0.0444 4.7124 +0.0000 0.0556 4.7124 +0.0000 0.0667 4.7124 +0.0000 0.0778 4.7124 +0.0000 0.0889 4.7124 +0.0000 0.1000 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 1 -4 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0048 -0.0452 4.7473 +0.0111 -0.0903 4.7823 +0.0191 -0.1353 4.8172 +0.0286 -0.1802 4.8522 +0.0398 -0.2248 4.8871 +0.0525 -0.2692 4.9221 +0.0668 -0.3132 4.9570 +0.0826 -0.3568 4.9919 +0.1000 -0.4000 5.0269 +primID: 4 +startangle_c: 12 +endpose_c: -1 -4 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0048 -0.0452 4.6774 +-0.0111 -0.0903 4.6425 +-0.0191 -0.1353 4.6076 +-0.0286 -0.1802 4.5726 +-0.0398 -0.2248 4.5377 +-0.0525 -0.2692 4.5027 +-0.0668 -0.3132 4.4678 +-0.0826 -0.3568 4.4328 +-0.1000 -0.4000 4.3979 +primID: 5 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0111 -0.0222 5.1051 +0.0222 -0.0444 5.1051 +0.0333 -0.0667 5.1051 +0.0444 -0.0889 5.1051 +0.0556 -0.1111 5.1051 +0.0667 -0.1333 5.1051 +0.0778 -0.1556 5.1051 +0.0889 -0.1778 5.1051 +0.1000 -0.2000 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 3 -6 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0333 -0.0667 5.1051 +0.0667 -0.1333 5.1051 +0.1000 -0.2000 5.1051 +0.1333 -0.2667 5.1051 +0.1667 -0.3333 5.1051 +0.2000 -0.4000 5.1051 +0.2333 -0.4667 5.1051 +0.2667 -0.5333 5.1051 +0.3000 -0.6000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0111 0.0222 5.1051 +-0.0222 0.0444 5.1051 +-0.0333 0.0667 5.1051 +-0.0444 0.0889 5.1051 +-0.0556 0.1111 5.1051 +-0.0667 0.1333 5.1051 +-0.0778 0.1556 5.1051 +-0.0889 0.1778 5.1051 +-0.1000 0.2000 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 2 -3 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0162 -0.0369 5.1469 +0.0339 -0.0731 5.1907 +0.0533 -0.1085 5.2346 +0.0741 -0.1430 5.2785 +0.0965 -0.1766 5.3223 +0.1203 -0.2091 5.3662 +0.1455 -0.2405 5.4101 +0.1721 -0.2709 5.4539 +0.2000 -0.3000 5.4978 +primID: 4 +startangle_c: 13 +endpose_c: 1 -4 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0177 -0.0427 5.1051 +0.0354 -0.0854 5.1051 +0.0523 -0.1283 5.0601 +0.0668 -0.1722 5.0021 +0.0787 -0.2168 4.9442 +0.0880 -0.2621 4.8862 +0.0947 -0.3078 4.8283 +0.0987 -0.3538 4.7703 +0.1000 -0.4000 4.7124 +primID: 5 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0111 -0.0111 5.4978 +0.0222 -0.0222 5.4978 +0.0333 -0.0333 5.4978 +0.0444 -0.0444 5.4978 +0.0556 -0.0556 5.4978 +0.0667 -0.0667 5.4978 +0.0778 -0.0778 5.4978 +0.0889 -0.0889 5.4978 +0.1000 -0.1000 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 3 -3 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0111 0.0111 5.4978 +-0.0222 0.0222 5.4978 +-0.0333 0.0333 5.4978 +-0.0444 0.0444 5.4978 +-0.0556 0.0556 5.4978 +-0.0667 0.0667 5.4978 +-0.0778 0.0778 5.4978 +-0.0889 0.0889 5.4978 +-0.1000 0.1000 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 4 -2 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0411 -0.0262 5.5243 +0.0831 -0.0515 5.5508 +0.1260 -0.0758 5.5772 +0.1697 -0.0991 5.6037 +0.2142 -0.1214 5.6302 +0.2595 -0.1426 5.6567 +0.3056 -0.1628 5.6832 +0.3525 -0.1820 5.7097 +0.4000 -0.2000 5.7362 +primID: 4 +startangle_c: 14 +endpose_c: 2 -4 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0262 -0.0411 5.4713 +0.0515 -0.0831 5.4448 +0.0758 -0.1260 5.4183 +0.0991 -0.1697 5.3918 +0.1214 -0.2142 5.3654 +0.1426 -0.2595 5.3389 +0.1628 -0.3056 5.3124 +0.1820 -0.3525 5.2859 +0.2000 -0.4000 5.2594 +primID: 5 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0222 -0.0111 5.8905 +0.0444 -0.0222 5.8905 +0.0667 -0.0333 5.8905 +0.0889 -0.0444 5.8905 +0.1111 -0.0556 5.8905 +0.1333 -0.0667 5.8905 +0.1556 -0.0778 5.8905 +0.1778 -0.0889 5.8905 +0.2000 -0.1000 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 6 -3 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0667 -0.0333 5.8905 +0.1333 -0.0667 5.8905 +0.2000 -0.1000 5.8905 +0.2667 -0.1333 5.8905 +0.3333 -0.1667 5.8905 +0.4000 -0.2000 5.8905 +0.4667 -0.2333 5.8905 +0.5333 -0.2667 5.8905 +0.6000 -0.3000 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0222 0.0111 5.8905 +-0.0444 0.0222 5.8905 +-0.0667 0.0333 5.8905 +-0.0889 0.0444 5.8905 +-0.1111 0.0556 5.8905 +-0.1333 0.0667 5.8905 +-0.1556 0.0778 5.8905 +-0.1778 0.0889 5.8905 +-0.2000 0.1000 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 3 -2 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0369 -0.0162 5.8487 +0.0731 -0.0339 5.8049 +0.1085 -0.0533 5.7610 +0.1430 -0.0741 5.7171 +0.1766 -0.0965 5.6733 +0.2091 -0.1203 5.6294 +0.2405 -0.1455 5.5855 +0.2709 -0.1721 5.5417 +0.3000 -0.2000 5.4978 +primID: 4 +startangle_c: 15 +endpose_c: 4 -1 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0427 -0.0177 5.8905 +0.0854 -0.0354 5.8905 +0.1283 -0.0523 5.9355 +0.1722 -0.0668 5.9934 +0.2168 -0.0787 6.0514 +0.2621 -0.0880 6.1093 +0.3078 -0.0947 6.1673 +0.3538 -0.0987 6.2252 +0.4000 -0.1000 6.2832 +primID: 5 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.2360 +0.0000 0.0000 4.5815 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.2725 +0.0000 0.0000 2.6180 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.3090 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.0000 diff --git a/config/runtime/mprim/unicycle_highcost_1cm.mprim b/config/runtime/mprim/unicycle_highcost_1cm.mprim new file mode 100755 index 0000000..aa9670d --- /dev/null +++ b/config/runtime/mprim/unicycle_highcost_1cm.mprim @@ -0,0 +1,1683 @@ +resolution_m: 0.010000 +numberofangles: 16 +totalnumberofprimitives: 112 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0011 0.0000 0.0000 +0.0022 0.0000 0.0000 +0.0033 0.0000 0.0000 +0.0044 0.0000 0.0000 +0.0056 0.0000 0.0000 +0.0067 0.0000 0.0000 +0.0078 0.0000 0.0000 +0.0089 0.0000 0.0000 +0.0100 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 20 0 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0667 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1111 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1556 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0011 0.0000 0.0000 +-0.0022 0.0000 0.0000 +-0.0033 0.0000 0.0000 +-0.0044 0.0000 0.0000 +-0.0056 0.0000 0.0000 +-0.0067 0.0000 0.0000 +-0.0078 0.0000 0.0000 +-0.0089 0.0000 0.0000 +-0.0100 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 40 5 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 -0.0000 0.0000 +0.0904 -0.0000 0.0000 +0.1355 -0.0000 0.0000 +0.1807 0.0008 0.0488 +0.2257 0.0045 0.1176 +0.2703 0.0114 0.1864 +0.3144 0.0213 0.2551 +0.3577 0.0342 0.3239 +0.4000 0.0500 0.3927 +primID: 4 +startangle_c: 0 +endpose_c: 40 -5 -1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 0.0000 0.0000 +0.0904 0.0000 0.0000 +0.1355 0.0000 0.0000 +0.1807 -0.0008 -0.0488 +0.2257 -0.0045 -0.1176 +0.2703 -0.0114 -0.1864 +0.3144 -0.0213 -0.2551 +0.3577 -0.0342 -0.3239 +0.4000 -0.0500 -0.3927 +primID: 5 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0022 0.0011 0.3927 +0.0044 0.0022 0.3927 +0.0067 0.0033 0.3927 +0.0089 0.0044 0.3927 +0.0111 0.0056 0.3927 +0.0133 0.0067 0.3927 +0.0156 0.0078 0.3927 +0.0178 0.0089 0.3927 +0.0200 0.0100 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 20 10 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0222 0.0111 0.3927 +0.0444 0.0222 0.3927 +0.0667 0.0333 0.3927 +0.0889 0.0444 0.3927 +0.1111 0.0556 0.3927 +0.1333 0.0667 0.3927 +0.1556 0.0778 0.3927 +0.1778 0.0889 0.3927 +0.2000 0.1000 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0022 -0.0011 0.3927 +-0.0044 -0.0022 0.3927 +-0.0067 -0.0033 0.3927 +-0.0089 -0.0044 0.3927 +-0.0111 -0.0056 0.3927 +-0.0133 -0.0067 0.3927 +-0.0156 -0.0078 0.3927 +-0.0178 -0.0089 0.3927 +-0.0200 -0.0100 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 25 20 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0298 0.0184 0.4230 +0.0592 0.0379 0.4533 +0.0881 0.0583 0.4836 +0.1165 0.0796 0.5139 +0.1444 0.1019 0.5442 +0.1717 0.1251 0.5745 +0.1984 0.1492 0.6048 +0.2245 0.1742 0.6351 +0.2500 0.2000 0.6654 +primID: 4 +startangle_c: 1 +endpose_c: 35 10 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0377 0.0156 0.3927 +0.0754 0.0312 0.3927 +0.1131 0.0468 0.3927 +0.1508 0.0623 0.3736 +0.1893 0.0758 0.2989 +0.2287 0.0863 0.2242 +0.2687 0.0939 0.1494 +0.3092 0.0985 0.0747 +0.3500 0.1000 -0.0000 +primID: 5 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0011 0.0011 0.7854 +0.0022 0.0022 0.7854 +0.0033 0.0033 0.7854 +0.0044 0.0044 0.7854 +0.0056 0.0056 0.7854 +0.0067 0.0067 0.7854 +0.0078 0.0078 0.7854 +0.0089 0.0089 0.7854 +0.0100 0.0100 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 10 10 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0111 0.0111 0.7854 +0.0222 0.0222 0.7854 +0.0333 0.0333 0.7854 +0.0444 0.0444 0.7854 +0.0556 0.0556 0.7854 +0.0667 0.0667 0.7854 +0.0778 0.0778 0.7854 +0.0889 0.0889 0.7854 +0.1000 0.1000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0011 -0.0011 0.7854 +-0.0022 -0.0022 0.7854 +-0.0033 -0.0033 0.7854 +-0.0044 -0.0044 0.7854 +-0.0056 -0.0056 0.7854 +-0.0067 -0.0067 0.7854 +-0.0078 -0.0078 0.7854 +-0.0089 -0.0089 0.7854 +-0.0100 -0.0100 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 25 35 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0678 0.0684 0.8151 +0.1000 0.1043 0.8669 +0.1302 0.1418 0.9188 +0.1584 0.1809 0.9707 +0.1846 0.2213 1.0225 +0.2086 0.2631 1.0744 +0.2304 0.3060 1.1262 +0.2500 0.3500 1.1781 +primID: 4 +startangle_c: 2 +endpose_c: 35 25 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0684 0.0678 0.7557 +0.1043 0.1000 0.7039 +0.1418 0.1302 0.6520 +0.1809 0.1584 0.6001 +0.2213 0.1846 0.5483 +0.2631 0.2086 0.4964 +0.3060 0.2304 0.4446 +0.3500 0.2500 0.3927 +primID: 5 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0011 0.0022 1.1781 +0.0022 0.0044 1.1781 +0.0033 0.0067 1.1781 +0.0044 0.0089 1.1781 +0.0056 0.0111 1.1781 +0.0067 0.0133 1.1781 +0.0078 0.0156 1.1781 +0.0089 0.0178 1.1781 +0.0100 0.0200 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 10 20 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0111 0.0222 1.1781 +0.0222 0.0444 1.1781 +0.0333 0.0667 1.1781 +0.0444 0.0889 1.1781 +0.0556 0.1111 1.1781 +0.0667 0.1333 1.1781 +0.0778 0.1556 1.1781 +0.0889 0.1778 1.1781 +0.1000 0.2000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0011 -0.0022 1.1781 +-0.0022 -0.0044 1.1781 +-0.0033 -0.0067 1.1781 +-0.0044 -0.0089 1.1781 +-0.0056 -0.0111 1.1781 +-0.0067 -0.0133 1.1781 +-0.0078 -0.0156 1.1781 +-0.0089 -0.0178 1.1781 +-0.0100 -0.0200 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 20 25 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0184 0.0298 1.1478 +0.0379 0.0592 1.1175 +0.0583 0.0881 1.0872 +0.0796 0.1165 1.0569 +0.1019 0.1444 1.0266 +0.1251 0.1717 0.9963 +0.1492 0.1984 0.9660 +0.1742 0.2245 0.9357 +0.2000 0.2500 0.9054 +primID: 4 +startangle_c: 3 +endpose_c: 10 35 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0156 0.0377 1.1781 +0.0312 0.0754 1.1781 +0.0468 0.1131 1.1781 +0.0623 0.1508 1.1972 +0.0758 0.1893 1.2719 +0.0863 0.2287 1.3466 +0.0939 0.2687 1.4214 +0.0985 0.3092 1.4961 +0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0011 1.5708 +0.0000 0.0022 1.5708 +0.0000 0.0033 1.5708 +0.0000 0.0044 1.5708 +0.0000 0.0056 1.5708 +0.0000 0.0067 1.5708 +0.0000 0.0078 1.5708 +0.0000 0.0089 1.5708 +0.0000 0.0100 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 20 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0667 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1111 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1556 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0011 1.5708 +0.0000 -0.0022 1.5708 +0.0000 -0.0033 1.5708 +0.0000 -0.0044 1.5708 +0.0000 -0.0056 1.5708 +0.0000 -0.0067 1.5708 +0.0000 -0.0078 1.5708 +0.0000 -0.0089 1.5708 +0.0000 -0.0100 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -5 40 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +-0.0008 0.1807 1.6196 +-0.0045 0.2257 1.6884 +-0.0114 0.2703 1.7572 +-0.0213 0.3144 1.8259 +-0.0342 0.3577 1.8947 +-0.0500 0.4000 1.9635 +primID: 4 +startangle_c: 4 +endpose_c: 5 40 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +0.0008 0.1807 1.5220 +0.0045 0.2257 1.4532 +0.0114 0.2703 1.3844 +0.0213 0.3144 1.3156 +0.0342 0.3577 1.2469 +0.0500 0.4000 1.1781 +primID: 5 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0011 0.0022 1.9635 +-0.0022 0.0044 1.9635 +-0.0033 0.0067 1.9635 +-0.0044 0.0089 1.9635 +-0.0056 0.0111 1.9635 +-0.0067 0.0133 1.9635 +-0.0078 0.0156 1.9635 +-0.0089 0.0178 1.9635 +-0.0100 0.0200 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -10 20 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0111 0.0222 1.9635 +-0.0222 0.0444 1.9635 +-0.0333 0.0667 1.9635 +-0.0444 0.0889 1.9635 +-0.0556 0.1111 1.9635 +-0.0667 0.1333 1.9635 +-0.0778 0.1556 1.9635 +-0.0889 0.1778 1.9635 +-0.1000 0.2000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0011 -0.0022 1.9635 +0.0022 -0.0044 1.9635 +0.0033 -0.0067 1.9635 +0.0044 -0.0089 1.9635 +0.0056 -0.0111 1.9635 +0.0067 -0.0133 1.9635 +0.0078 -0.0156 1.9635 +0.0089 -0.0178 1.9635 +0.0100 -0.0200 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -20 25 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0184 0.0298 1.9938 +-0.0379 0.0592 2.0241 +-0.0583 0.0881 2.0544 +-0.0796 0.1165 2.0847 +-0.1019 0.1444 2.1150 +-0.1251 0.1717 2.1453 +-0.1492 0.1984 2.1756 +-0.1742 0.2245 2.2059 +-0.2000 0.2500 2.2362 +primID: 4 +startangle_c: 5 +endpose_c: -10 35 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0156 0.0377 1.9635 +-0.0312 0.0754 1.9635 +-0.0468 0.1131 1.9635 +-0.0623 0.1508 1.9444 +-0.0758 0.1893 1.8697 +-0.0863 0.2287 1.7950 +-0.0939 0.2687 1.7202 +-0.0985 0.3092 1.6455 +-0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0011 0.0011 2.3562 +-0.0022 0.0022 2.3562 +-0.0033 0.0033 2.3562 +-0.0044 0.0044 2.3562 +-0.0056 0.0056 2.3562 +-0.0067 0.0067 2.3562 +-0.0078 0.0078 2.3562 +-0.0089 0.0089 2.3562 +-0.0100 0.0100 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -10 10 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0111 0.0111 2.3562 +-0.0222 0.0222 2.3562 +-0.0333 0.0333 2.3562 +-0.0444 0.0444 2.3562 +-0.0556 0.0556 2.3562 +-0.0667 0.0667 2.3562 +-0.0778 0.0778 2.3562 +-0.0889 0.0889 2.3562 +-0.1000 0.1000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0011 -0.0011 2.3562 +0.0022 -0.0022 2.3562 +0.0033 -0.0033 2.3562 +0.0044 -0.0044 2.3562 +0.0056 -0.0056 2.3562 +0.0067 -0.0067 2.3562 +0.0078 -0.0078 2.3562 +0.0089 -0.0089 2.3562 +0.0100 -0.0100 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -35 25 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0684 0.0678 2.3859 +-0.1043 0.1000 2.4377 +-0.1418 0.1302 2.4896 +-0.1809 0.1584 2.5415 +-0.2213 0.1846 2.5933 +-0.2631 0.2086 2.6452 +-0.3060 0.2304 2.6970 +-0.3500 0.2500 2.7489 +primID: 4 +startangle_c: 6 +endpose_c: -25 35 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0678 0.0684 2.3265 +-0.1000 0.1043 2.2747 +-0.1302 0.1418 2.2228 +-0.1584 0.1809 2.1709 +-0.1846 0.2213 2.1191 +-0.2086 0.2631 2.0672 +-0.2304 0.3060 2.0154 +-0.2500 0.3500 1.9635 +primID: 5 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0022 0.0011 2.7489 +-0.0044 0.0022 2.7489 +-0.0067 0.0033 2.7489 +-0.0089 0.0044 2.7489 +-0.0111 0.0056 2.7489 +-0.0133 0.0067 2.7489 +-0.0156 0.0078 2.7489 +-0.0178 0.0089 2.7489 +-0.0200 0.0100 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -20 10 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0222 0.0111 2.7489 +-0.0444 0.0222 2.7489 +-0.0667 0.0333 2.7489 +-0.0889 0.0444 2.7489 +-0.1111 0.0556 2.7489 +-0.1333 0.0667 2.7489 +-0.1556 0.0778 2.7489 +-0.1778 0.0889 2.7489 +-0.2000 0.1000 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0022 -0.0011 2.7489 +0.0044 -0.0022 2.7489 +0.0067 -0.0033 2.7489 +0.0089 -0.0044 2.7489 +0.0111 -0.0056 2.7489 +0.0133 -0.0067 2.7489 +0.0156 -0.0078 2.7489 +0.0178 -0.0089 2.7489 +0.0200 -0.0100 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -25 20 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0298 0.0184 2.7186 +-0.0592 0.0379 2.6883 +-0.0881 0.0583 2.6580 +-0.1165 0.0796 2.6277 +-0.1444 0.1019 2.5974 +-0.1717 0.1251 2.5671 +-0.1984 0.1492 2.5368 +-0.2245 0.1742 2.5065 +-0.2500 0.2000 2.4762 +primID: 4 +startangle_c: 7 +endpose_c: -35 10 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0377 0.0156 2.7489 +-0.0754 0.0312 2.7489 +-0.1131 0.0468 2.7489 +-0.1508 0.0623 2.7680 +-0.1893 0.0758 2.8427 +-0.2287 0.0863 2.9174 +-0.2687 0.0939 2.9921 +-0.3092 0.0985 3.0669 +-0.3500 0.1000 3.1416 +primID: 5 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0011 0.0000 3.1416 +-0.0022 0.0000 3.1416 +-0.0033 0.0000 3.1416 +-0.0044 0.0000 3.1416 +-0.0056 0.0000 3.1416 +-0.0067 0.0000 3.1416 +-0.0078 0.0000 3.1416 +-0.0089 0.0000 3.1416 +-0.0100 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -20 0 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0667 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1111 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1556 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0011 0.0000 3.1416 +0.0022 0.0000 3.1416 +0.0033 0.0000 3.1416 +0.0044 0.0000 3.1416 +0.0056 0.0000 3.1416 +0.0067 0.0000 3.1416 +0.0078 0.0000 3.1416 +0.0089 0.0000 3.1416 +0.0100 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -40 -5 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 -0.0008 3.1904 +-0.2257 -0.0045 3.2592 +-0.2703 -0.0114 3.3280 +-0.3144 -0.0213 3.3967 +-0.3577 -0.0342 3.4655 +-0.4000 -0.0500 3.5343 +primID: 4 +startangle_c: 8 +endpose_c: -40 5 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 0.0008 3.0928 +-0.2257 0.0045 3.0240 +-0.2703 0.0114 2.9552 +-0.3144 0.0213 2.8864 +-0.3577 0.0342 2.8177 +-0.4000 0.0500 2.7489 +primID: 5 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0022 -0.0011 3.5343 +-0.0044 -0.0022 3.5343 +-0.0067 -0.0033 3.5343 +-0.0089 -0.0044 3.5343 +-0.0111 -0.0056 3.5343 +-0.0133 -0.0067 3.5343 +-0.0156 -0.0078 3.5343 +-0.0178 -0.0089 3.5343 +-0.0200 -0.0100 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -20 -10 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0222 -0.0111 3.5343 +-0.0444 -0.0222 3.5343 +-0.0667 -0.0333 3.5343 +-0.0889 -0.0444 3.5343 +-0.1111 -0.0556 3.5343 +-0.1333 -0.0667 3.5343 +-0.1556 -0.0778 3.5343 +-0.1778 -0.0889 3.5343 +-0.2000 -0.1000 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0022 0.0011 3.5343 +0.0044 0.0022 3.5343 +0.0067 0.0033 3.5343 +0.0089 0.0044 3.5343 +0.0111 0.0056 3.5343 +0.0133 0.0067 3.5343 +0.0156 0.0078 3.5343 +0.0178 0.0089 3.5343 +0.0200 0.0100 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -25 -20 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0298 -0.0184 3.5646 +-0.0592 -0.0379 3.5949 +-0.0881 -0.0583 3.6252 +-0.1165 -0.0796 3.6555 +-0.1444 -0.1019 3.6858 +-0.1717 -0.1251 3.7161 +-0.1984 -0.1492 3.7464 +-0.2245 -0.1742 3.7767 +-0.2500 -0.2000 3.8070 +primID: 4 +startangle_c: 9 +endpose_c: -35 -10 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0377 -0.0156 3.5343 +-0.0754 -0.0312 3.5343 +-0.1131 -0.0468 3.5343 +-0.1508 -0.0623 3.5152 +-0.1893 -0.0758 3.4405 +-0.2287 -0.0863 3.3658 +-0.2687 -0.0939 3.2910 +-0.3092 -0.0985 3.2163 +-0.3500 -0.1000 3.1416 +primID: 5 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0011 -0.0011 3.9270 +-0.0022 -0.0022 3.9270 +-0.0033 -0.0033 3.9270 +-0.0044 -0.0044 3.9270 +-0.0056 -0.0056 3.9270 +-0.0067 -0.0067 3.9270 +-0.0078 -0.0078 3.9270 +-0.0089 -0.0089 3.9270 +-0.0100 -0.0100 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -10 -10 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0111 -0.0111 3.9270 +-0.0222 -0.0222 3.9270 +-0.0333 -0.0333 3.9270 +-0.0444 -0.0444 3.9270 +-0.0556 -0.0556 3.9270 +-0.0667 -0.0667 3.9270 +-0.0778 -0.0778 3.9270 +-0.0889 -0.0889 3.9270 +-0.1000 -0.1000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0011 0.0011 3.9270 +0.0022 0.0022 3.9270 +0.0033 0.0033 3.9270 +0.0044 0.0044 3.9270 +0.0056 0.0056 3.9270 +0.0067 0.0067 3.9270 +0.0078 0.0078 3.9270 +0.0089 0.0089 3.9270 +0.0100 0.0100 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -25 -35 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0678 -0.0684 3.9567 +-0.1000 -0.1043 4.0085 +-0.1302 -0.1418 4.0604 +-0.1584 -0.1809 4.1123 +-0.1846 -0.2213 4.1641 +-0.2086 -0.2631 4.2160 +-0.2304 -0.3060 4.2678 +-0.2500 -0.3500 4.3197 +primID: 4 +startangle_c: 10 +endpose_c: -35 -25 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0684 -0.0678 3.8973 +-0.1043 -0.1000 3.8455 +-0.1418 -0.1302 3.7936 +-0.1809 -0.1584 3.7417 +-0.2213 -0.1846 3.6899 +-0.2631 -0.2086 3.6380 +-0.3060 -0.2304 3.5862 +-0.3500 -0.2500 3.5343 +primID: 5 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0011 -0.0022 4.3197 +-0.0022 -0.0044 4.3197 +-0.0033 -0.0067 4.3197 +-0.0044 -0.0089 4.3197 +-0.0056 -0.0111 4.3197 +-0.0067 -0.0133 4.3197 +-0.0078 -0.0156 4.3197 +-0.0089 -0.0178 4.3197 +-0.0100 -0.0200 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -10 -20 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0111 -0.0222 4.3197 +-0.0222 -0.0444 4.3197 +-0.0333 -0.0667 4.3197 +-0.0444 -0.0889 4.3197 +-0.0556 -0.1111 4.3197 +-0.0667 -0.1333 4.3197 +-0.0778 -0.1556 4.3197 +-0.0889 -0.1778 4.3197 +-0.1000 -0.2000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0011 0.0022 4.3197 +0.0022 0.0044 4.3197 +0.0033 0.0067 4.3197 +0.0044 0.0089 4.3197 +0.0056 0.0111 4.3197 +0.0067 0.0133 4.3197 +0.0078 0.0156 4.3197 +0.0089 0.0178 4.3197 +0.0100 0.0200 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -20 -25 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0184 -0.0298 4.2894 +-0.0379 -0.0592 4.2591 +-0.0583 -0.0881 4.2288 +-0.0796 -0.1165 4.1985 +-0.1019 -0.1444 4.1682 +-0.1251 -0.1717 4.1379 +-0.1492 -0.1984 4.1076 +-0.1742 -0.2245 4.0773 +-0.2000 -0.2500 4.0470 +primID: 4 +startangle_c: 11 +endpose_c: -10 -35 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0156 -0.0377 4.3197 +-0.0312 -0.0754 4.3197 +-0.0468 -0.1131 4.3197 +-0.0623 -0.1508 4.3388 +-0.0758 -0.1893 4.4135 +-0.0863 -0.2287 4.4882 +-0.0939 -0.2687 4.5629 +-0.0985 -0.3092 4.6377 +-0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0011 4.7124 +0.0000 -0.0022 4.7124 +0.0000 -0.0033 4.7124 +0.0000 -0.0044 4.7124 +0.0000 -0.0056 4.7124 +0.0000 -0.0067 4.7124 +0.0000 -0.0078 4.7124 +0.0000 -0.0089 4.7124 +0.0000 -0.0100 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -20 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0667 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1111 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1556 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0011 4.7124 +0.0000 0.0022 4.7124 +0.0000 0.0033 4.7124 +0.0000 0.0044 4.7124 +0.0000 0.0056 4.7124 +0.0000 0.0067 4.7124 +0.0000 0.0078 4.7124 +0.0000 0.0089 4.7124 +0.0000 0.0100 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 5 -40 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0452 4.7124 +0.0000 -0.0904 4.7124 +0.0000 -0.1355 4.7124 +0.0008 -0.1807 4.7612 +0.0045 -0.2257 4.8300 +0.0114 -0.2703 4.8988 +0.0213 -0.3144 4.9675 +0.0342 -0.3577 5.0363 +0.0500 -0.4000 5.1051 +primID: 4 +startangle_c: 12 +endpose_c: -5 -40 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0000 -0.0452 4.7124 +-0.0000 -0.0904 4.7124 +-0.0000 -0.1355 4.7124 +-0.0008 -0.1807 4.6636 +-0.0045 -0.2257 4.5948 +-0.0114 -0.2703 4.5260 +-0.0213 -0.3144 4.4572 +-0.0342 -0.3577 4.3885 +-0.0500 -0.4000 4.3197 +primID: 5 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0011 -0.0022 5.1051 +0.0022 -0.0044 5.1051 +0.0033 -0.0067 5.1051 +0.0044 -0.0089 5.1051 +0.0056 -0.0111 5.1051 +0.0067 -0.0133 5.1051 +0.0078 -0.0156 5.1051 +0.0089 -0.0178 5.1051 +0.0100 -0.0200 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 10 -20 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0111 -0.0222 5.1051 +0.0222 -0.0444 5.1051 +0.0333 -0.0667 5.1051 +0.0444 -0.0889 5.1051 +0.0556 -0.1111 5.1051 +0.0667 -0.1333 5.1051 +0.0778 -0.1556 5.1051 +0.0889 -0.1778 5.1051 +0.1000 -0.2000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0011 0.0022 5.1051 +-0.0022 0.0044 5.1051 +-0.0033 0.0067 5.1051 +-0.0044 0.0089 5.1051 +-0.0056 0.0111 5.1051 +-0.0067 0.0133 5.1051 +-0.0078 0.0156 5.1051 +-0.0089 0.0178 5.1051 +-0.0100 0.0200 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 20 -25 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0184 -0.0298 5.1354 +0.0379 -0.0592 5.1657 +0.0583 -0.0881 5.1960 +0.0796 -0.1165 5.2263 +0.1019 -0.1444 5.2566 +0.1251 -0.1717 5.2869 +0.1492 -0.1984 5.3172 +0.1742 -0.2245 5.3475 +0.2000 -0.2500 5.3778 +primID: 4 +startangle_c: 13 +endpose_c: 10 -35 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0156 -0.0377 5.1051 +0.0312 -0.0754 5.1051 +0.0468 -0.1131 5.1051 +0.0623 -0.1508 5.0860 +0.0758 -0.1893 5.0113 +0.0863 -0.2287 4.9366 +0.0939 -0.2687 4.8618 +0.0985 -0.3092 4.7871 +0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0011 -0.0011 5.4978 +0.0022 -0.0022 5.4978 +0.0033 -0.0033 5.4978 +0.0044 -0.0044 5.4978 +0.0056 -0.0056 5.4978 +0.0067 -0.0067 5.4978 +0.0078 -0.0078 5.4978 +0.0089 -0.0089 5.4978 +0.0100 -0.0100 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 10 -10 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0111 -0.0111 5.4978 +0.0222 -0.0222 5.4978 +0.0333 -0.0333 5.4978 +0.0444 -0.0444 5.4978 +0.0556 -0.0556 5.4978 +0.0667 -0.0667 5.4978 +0.0778 -0.0778 5.4978 +0.0889 -0.0889 5.4978 +0.1000 -0.1000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0011 0.0011 5.4978 +-0.0022 0.0022 5.4978 +-0.0033 0.0033 5.4978 +-0.0044 0.0044 5.4978 +-0.0056 0.0056 5.4978 +-0.0067 0.0067 5.4978 +-0.0078 0.0078 5.4978 +-0.0089 0.0089 5.4978 +-0.0100 0.0100 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 35 -25 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0684 -0.0678 5.5275 +0.1043 -0.1000 5.5793 +0.1418 -0.1302 5.6312 +0.1809 -0.1584 5.6830 +0.2213 -0.1846 5.7349 +0.2631 -0.2086 5.7868 +0.3060 -0.2304 5.8386 +0.3500 -0.2500 5.8905 +primID: 4 +startangle_c: 14 +endpose_c: 25 -35 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0678 -0.0684 5.4681 +0.1000 -0.1043 5.4162 +0.1302 -0.1418 5.3644 +0.1584 -0.1809 5.3125 +0.1846 -0.2213 5.2607 +0.2086 -0.2631 5.2088 +0.2304 -0.3060 5.1569 +0.2500 -0.3500 5.1051 +primID: 5 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0022 -0.0011 5.8905 +0.0044 -0.0022 5.8905 +0.0067 -0.0033 5.8905 +0.0089 -0.0044 5.8905 +0.0111 -0.0056 5.8905 +0.0133 -0.0067 5.8905 +0.0156 -0.0078 5.8905 +0.0178 -0.0089 5.8905 +0.0200 -0.0100 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 20 -10 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0222 -0.0111 5.8905 +0.0444 -0.0222 5.8905 +0.0667 -0.0333 5.8905 +0.0889 -0.0444 5.8905 +0.1111 -0.0556 5.8905 +0.1333 -0.0667 5.8905 +0.1556 -0.0778 5.8905 +0.1778 -0.0889 5.8905 +0.2000 -0.1000 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0022 0.0011 5.8905 +-0.0044 0.0022 5.8905 +-0.0067 0.0033 5.8905 +-0.0089 0.0044 5.8905 +-0.0111 0.0056 5.8905 +-0.0133 0.0067 5.8905 +-0.0156 0.0078 5.8905 +-0.0178 0.0089 5.8905 +-0.0200 0.0100 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 25 -20 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0298 -0.0184 5.8602 +0.0592 -0.0379 5.8299 +0.0881 -0.0583 5.7996 +0.1165 -0.0796 5.7693 +0.1444 -0.1019 5.7390 +0.1717 -0.1251 5.7087 +0.1984 -0.1492 5.6784 +0.2245 -0.1742 5.6481 +0.2500 -0.2000 5.6178 +primID: 4 +startangle_c: 15 +endpose_c: 35 -10 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0377 -0.0156 5.8905 +0.0754 -0.0312 5.8905 +0.1131 -0.0468 5.8905 +0.1508 -0.0623 5.9096 +0.1893 -0.0758 5.9843 +0.2287 -0.0863 6.0590 +0.2687 -0.0939 6.1337 +0.3092 -0.0985 6.2085 +0.3500 -0.1000 6.2832 +primID: 5 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.2360 +0.0000 0.0000 4.5815 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.2725 +0.0000 0.0000 2.6180 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.3090 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.0000 diff --git a/config/runtime/mprim/unicycle_highcost_2_5cm.mprim b/config/runtime/mprim/unicycle_highcost_2_5cm.mprim new file mode 100755 index 0000000..6bf962e --- /dev/null +++ b/config/runtime/mprim/unicycle_highcost_2_5cm.mprim @@ -0,0 +1,1683 @@ +resolution_m: 0.025000 +numberofangles: 16 +totalnumberofprimitives: 112 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0028 0.0000 0.0000 +0.0056 0.0000 0.0000 +0.0083 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0139 0.0000 0.0000 +0.0167 0.0000 0.0000 +0.0194 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0250 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 12 0 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0333 0.0000 0.0000 +0.0667 0.0000 0.0000 +0.1000 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1667 0.0000 0.0000 +0.2000 0.0000 0.0000 +0.2333 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0028 0.0000 0.0000 +-0.0056 0.0000 0.0000 +-0.0083 0.0000 0.0000 +-0.0111 0.0000 0.0000 +-0.0139 0.0000 0.0000 +-0.0167 0.0000 0.0000 +-0.0194 0.0000 0.0000 +-0.0222 0.0000 0.0000 +-0.0250 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 16 2 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 -0.0000 0.0000 +0.0904 -0.0000 0.0000 +0.1355 -0.0000 0.0000 +0.1807 0.0008 0.0488 +0.2257 0.0045 0.1176 +0.2703 0.0114 0.1864 +0.3144 0.0213 0.2551 +0.3577 0.0342 0.3239 +0.4000 0.0500 0.3927 +primID: 4 +startangle_c: 0 +endpose_c: 16 -2 -1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 0.0000 0.0000 +0.0904 0.0000 0.0000 +0.1355 0.0000 0.0000 +0.1807 -0.0008 -0.0488 +0.2257 -0.0045 -0.1176 +0.2703 -0.0114 -0.1864 +0.3144 -0.0213 -0.2551 +0.3577 -0.0342 -0.3239 +0.4000 -0.0500 -0.3927 +primID: 5 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0056 0.0028 0.3927 +0.0111 0.0056 0.3927 +0.0167 0.0083 0.3927 +0.0222 0.0111 0.3927 +0.0278 0.0139 0.3927 +0.0333 0.0167 0.3927 +0.0389 0.0194 0.3927 +0.0444 0.0222 0.3927 +0.0500 0.0250 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 12 6 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0333 0.0167 0.3927 +0.0667 0.0333 0.3927 +0.1000 0.0500 0.3927 +0.1333 0.0667 0.3927 +0.1667 0.0833 0.3927 +0.2000 0.1000 0.3927 +0.2333 0.1167 0.3927 +0.2667 0.1333 0.3927 +0.3000 0.1500 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0056 -0.0028 0.3927 +-0.0111 -0.0056 0.3927 +-0.0167 -0.0083 0.3927 +-0.0222 -0.0111 0.3927 +-0.0278 -0.0139 0.3927 +-0.0333 -0.0167 0.3927 +-0.0389 -0.0194 0.3927 +-0.0444 -0.0222 0.3927 +-0.0500 -0.0250 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 10 8 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0298 0.0184 0.4230 +0.0592 0.0379 0.4533 +0.0881 0.0583 0.4836 +0.1165 0.0796 0.5139 +0.1444 0.1019 0.5442 +0.1717 0.1251 0.5745 +0.1984 0.1492 0.6048 +0.2245 0.1742 0.6351 +0.2500 0.2000 0.6654 +primID: 4 +startangle_c: 1 +endpose_c: 14 4 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0377 0.0156 0.3927 +0.0754 0.0312 0.3927 +0.1131 0.0468 0.3927 +0.1508 0.0623 0.3736 +0.1893 0.0758 0.2989 +0.2287 0.0863 0.2242 +0.2687 0.0939 0.1494 +0.3092 0.0985 0.0747 +0.3500 0.1000 -0.0000 +primID: 5 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0028 0.0028 0.7854 +0.0056 0.0056 0.7854 +0.0083 0.0083 0.7854 +0.0111 0.0111 0.7854 +0.0139 0.0139 0.7854 +0.0167 0.0167 0.7854 +0.0194 0.0194 0.7854 +0.0222 0.0222 0.7854 +0.0250 0.0250 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 12 12 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0028 -0.0028 0.7854 +-0.0056 -0.0056 0.7854 +-0.0083 -0.0083 0.7854 +-0.0111 -0.0111 0.7854 +-0.0139 -0.0139 0.7854 +-0.0167 -0.0167 0.7854 +-0.0194 -0.0194 0.7854 +-0.0222 -0.0222 0.7854 +-0.0250 -0.0250 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 10 14 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0678 0.0684 0.8151 +0.1000 0.1043 0.8669 +0.1302 0.1418 0.9188 +0.1584 0.1809 0.9707 +0.1846 0.2213 1.0225 +0.2086 0.2631 1.0744 +0.2304 0.3060 1.1262 +0.2500 0.3500 1.1781 +primID: 4 +startangle_c: 2 +endpose_c: 14 10 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0684 0.0678 0.7557 +0.1043 0.1000 0.7039 +0.1418 0.1302 0.6520 +0.1809 0.1584 0.6001 +0.2213 0.1846 0.5483 +0.2631 0.2086 0.4964 +0.3060 0.2304 0.4446 +0.3500 0.2500 0.3927 +primID: 5 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0028 0.0056 1.1781 +0.0056 0.0111 1.1781 +0.0083 0.0167 1.1781 +0.0111 0.0222 1.1781 +0.0139 0.0278 1.1781 +0.0167 0.0333 1.1781 +0.0194 0.0389 1.1781 +0.0222 0.0444 1.1781 +0.0250 0.0500 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 6 12 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0167 0.0333 1.1781 +0.0333 0.0667 1.1781 +0.0500 0.1000 1.1781 +0.0667 0.1333 1.1781 +0.0833 0.1667 1.1781 +0.1000 0.2000 1.1781 +0.1167 0.2333 1.1781 +0.1333 0.2667 1.1781 +0.1500 0.3000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0028 -0.0056 1.1781 +-0.0056 -0.0111 1.1781 +-0.0083 -0.0167 1.1781 +-0.0111 -0.0222 1.1781 +-0.0139 -0.0278 1.1781 +-0.0167 -0.0333 1.1781 +-0.0194 -0.0389 1.1781 +-0.0222 -0.0444 1.1781 +-0.0250 -0.0500 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 8 10 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0184 0.0298 1.1478 +0.0379 0.0592 1.1175 +0.0583 0.0881 1.0872 +0.0796 0.1165 1.0569 +0.1019 0.1444 1.0266 +0.1251 0.1717 0.9963 +0.1492 0.1984 0.9660 +0.1742 0.2245 0.9357 +0.2000 0.2500 0.9054 +primID: 4 +startangle_c: 3 +endpose_c: 4 14 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0156 0.0377 1.1781 +0.0312 0.0754 1.1781 +0.0468 0.1131 1.1781 +0.0623 0.1508 1.1972 +0.0758 0.1893 1.2719 +0.0863 0.2287 1.3466 +0.0939 0.2687 1.4214 +0.0985 0.3092 1.4961 +0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0028 1.5708 +0.0000 0.0056 1.5708 +0.0000 0.0083 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0139 1.5708 +0.0000 0.0167 1.5708 +0.0000 0.0194 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0250 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 12 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0333 1.5708 +0.0000 0.0667 1.5708 +0.0000 0.1000 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1667 1.5708 +0.0000 0.2000 1.5708 +0.0000 0.2333 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0028 1.5708 +0.0000 -0.0056 1.5708 +0.0000 -0.0083 1.5708 +0.0000 -0.0111 1.5708 +0.0000 -0.0139 1.5708 +0.0000 -0.0167 1.5708 +0.0000 -0.0194 1.5708 +0.0000 -0.0222 1.5708 +0.0000 -0.0250 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -2 16 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +-0.0008 0.1807 1.6196 +-0.0045 0.2257 1.6884 +-0.0114 0.2703 1.7572 +-0.0213 0.3144 1.8259 +-0.0342 0.3577 1.8947 +-0.0500 0.4000 1.9635 +primID: 4 +startangle_c: 4 +endpose_c: 2 16 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +0.0008 0.1807 1.5220 +0.0045 0.2257 1.4532 +0.0114 0.2703 1.3844 +0.0213 0.3144 1.3156 +0.0342 0.3577 1.2469 +0.0500 0.4000 1.1781 +primID: 5 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0028 0.0056 1.9635 +-0.0056 0.0111 1.9635 +-0.0083 0.0167 1.9635 +-0.0111 0.0222 1.9635 +-0.0139 0.0278 1.9635 +-0.0167 0.0333 1.9635 +-0.0194 0.0389 1.9635 +-0.0222 0.0444 1.9635 +-0.0250 0.0500 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -6 12 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0167 0.0333 1.9635 +-0.0333 0.0667 1.9635 +-0.0500 0.1000 1.9635 +-0.0667 0.1333 1.9635 +-0.0833 0.1667 1.9635 +-0.1000 0.2000 1.9635 +-0.1167 0.2333 1.9635 +-0.1333 0.2667 1.9635 +-0.1500 0.3000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0028 -0.0056 1.9635 +0.0056 -0.0111 1.9635 +0.0083 -0.0167 1.9635 +0.0111 -0.0222 1.9635 +0.0139 -0.0278 1.9635 +0.0167 -0.0333 1.9635 +0.0194 -0.0389 1.9635 +0.0222 -0.0444 1.9635 +0.0250 -0.0500 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -8 10 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0184 0.0298 1.9938 +-0.0379 0.0592 2.0241 +-0.0583 0.0881 2.0544 +-0.0796 0.1165 2.0847 +-0.1019 0.1444 2.1150 +-0.1251 0.1717 2.1453 +-0.1492 0.1984 2.1756 +-0.1742 0.2245 2.2059 +-0.2000 0.2500 2.2362 +primID: 4 +startangle_c: 5 +endpose_c: -4 14 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0156 0.0377 1.9635 +-0.0312 0.0754 1.9635 +-0.0468 0.1131 1.9635 +-0.0623 0.1508 1.9444 +-0.0758 0.1893 1.8697 +-0.0863 0.2287 1.7950 +-0.0939 0.2687 1.7202 +-0.0985 0.3092 1.6455 +-0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0028 0.0028 2.3562 +-0.0056 0.0056 2.3562 +-0.0083 0.0083 2.3562 +-0.0111 0.0111 2.3562 +-0.0139 0.0139 2.3562 +-0.0167 0.0167 2.3562 +-0.0194 0.0194 2.3562 +-0.0222 0.0222 2.3562 +-0.0250 0.0250 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -12 12 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0028 -0.0028 2.3562 +0.0056 -0.0056 2.3562 +0.0083 -0.0083 2.3562 +0.0111 -0.0111 2.3562 +0.0139 -0.0139 2.3562 +0.0167 -0.0167 2.3562 +0.0194 -0.0194 2.3562 +0.0222 -0.0222 2.3562 +0.0250 -0.0250 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -14 10 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0684 0.0678 2.3859 +-0.1043 0.1000 2.4377 +-0.1418 0.1302 2.4896 +-0.1809 0.1584 2.5415 +-0.2213 0.1846 2.5933 +-0.2631 0.2086 2.6452 +-0.3060 0.2304 2.6970 +-0.3500 0.2500 2.7489 +primID: 4 +startangle_c: 6 +endpose_c: -10 14 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0678 0.0684 2.3265 +-0.1000 0.1043 2.2747 +-0.1302 0.1418 2.2228 +-0.1584 0.1809 2.1709 +-0.1846 0.2213 2.1191 +-0.2086 0.2631 2.0672 +-0.2304 0.3060 2.0154 +-0.2500 0.3500 1.9635 +primID: 5 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0056 0.0028 2.7489 +-0.0111 0.0056 2.7489 +-0.0167 0.0083 2.7489 +-0.0222 0.0111 2.7489 +-0.0278 0.0139 2.7489 +-0.0333 0.0167 2.7489 +-0.0389 0.0194 2.7489 +-0.0444 0.0222 2.7489 +-0.0500 0.0250 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -12 6 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0333 0.0167 2.7489 +-0.0667 0.0333 2.7489 +-0.1000 0.0500 2.7489 +-0.1333 0.0667 2.7489 +-0.1667 0.0833 2.7489 +-0.2000 0.1000 2.7489 +-0.2333 0.1167 2.7489 +-0.2667 0.1333 2.7489 +-0.3000 0.1500 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0056 -0.0028 2.7489 +0.0111 -0.0056 2.7489 +0.0167 -0.0083 2.7489 +0.0222 -0.0111 2.7489 +0.0278 -0.0139 2.7489 +0.0333 -0.0167 2.7489 +0.0389 -0.0194 2.7489 +0.0444 -0.0222 2.7489 +0.0500 -0.0250 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -10 8 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0298 0.0184 2.7186 +-0.0592 0.0379 2.6883 +-0.0881 0.0583 2.6580 +-0.1165 0.0796 2.6277 +-0.1444 0.1019 2.5974 +-0.1717 0.1251 2.5671 +-0.1984 0.1492 2.5368 +-0.2245 0.1742 2.5065 +-0.2500 0.2000 2.4762 +primID: 4 +startangle_c: 7 +endpose_c: -14 4 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0377 0.0156 2.7489 +-0.0754 0.0312 2.7489 +-0.1131 0.0468 2.7489 +-0.1508 0.0623 2.7680 +-0.1893 0.0758 2.8427 +-0.2287 0.0863 2.9174 +-0.2687 0.0939 2.9921 +-0.3092 0.0985 3.0669 +-0.3500 0.1000 3.1416 +primID: 5 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0028 0.0000 3.1416 +-0.0056 0.0000 3.1416 +-0.0083 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0139 0.0000 3.1416 +-0.0167 0.0000 3.1416 +-0.0194 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0250 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -12 0 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0333 0.0000 3.1416 +-0.0667 0.0000 3.1416 +-0.1000 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1667 0.0000 3.1416 +-0.2000 0.0000 3.1416 +-0.2333 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0028 0.0000 3.1416 +0.0056 0.0000 3.1416 +0.0083 0.0000 3.1416 +0.0111 0.0000 3.1416 +0.0139 0.0000 3.1416 +0.0167 0.0000 3.1416 +0.0194 0.0000 3.1416 +0.0222 0.0000 3.1416 +0.0250 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -16 -2 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 -0.0008 3.1904 +-0.2257 -0.0045 3.2592 +-0.2703 -0.0114 3.3280 +-0.3144 -0.0213 3.3967 +-0.3577 -0.0342 3.4655 +-0.4000 -0.0500 3.5343 +primID: 4 +startangle_c: 8 +endpose_c: -16 2 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 0.0008 3.0928 +-0.2257 0.0045 3.0240 +-0.2703 0.0114 2.9552 +-0.3144 0.0213 2.8864 +-0.3577 0.0342 2.8177 +-0.4000 0.0500 2.7489 +primID: 5 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0056 -0.0028 3.5343 +-0.0111 -0.0056 3.5343 +-0.0167 -0.0083 3.5343 +-0.0222 -0.0111 3.5343 +-0.0278 -0.0139 3.5343 +-0.0333 -0.0167 3.5343 +-0.0389 -0.0194 3.5343 +-0.0444 -0.0222 3.5343 +-0.0500 -0.0250 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -12 -6 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0333 -0.0167 3.5343 +-0.0667 -0.0333 3.5343 +-0.1000 -0.0500 3.5343 +-0.1333 -0.0667 3.5343 +-0.1667 -0.0833 3.5343 +-0.2000 -0.1000 3.5343 +-0.2333 -0.1167 3.5343 +-0.2667 -0.1333 3.5343 +-0.3000 -0.1500 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0056 0.0028 3.5343 +0.0111 0.0056 3.5343 +0.0167 0.0083 3.5343 +0.0222 0.0111 3.5343 +0.0278 0.0139 3.5343 +0.0333 0.0167 3.5343 +0.0389 0.0194 3.5343 +0.0444 0.0222 3.5343 +0.0500 0.0250 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -10 -8 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0298 -0.0184 3.5646 +-0.0592 -0.0379 3.5949 +-0.0881 -0.0583 3.6252 +-0.1165 -0.0796 3.6555 +-0.1444 -0.1019 3.6858 +-0.1717 -0.1251 3.7161 +-0.1984 -0.1492 3.7464 +-0.2245 -0.1742 3.7767 +-0.2500 -0.2000 3.8070 +primID: 4 +startangle_c: 9 +endpose_c: -14 -4 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0377 -0.0156 3.5343 +-0.0754 -0.0312 3.5343 +-0.1131 -0.0468 3.5343 +-0.1508 -0.0623 3.5152 +-0.1893 -0.0758 3.4405 +-0.2287 -0.0863 3.3658 +-0.2687 -0.0939 3.2910 +-0.3092 -0.0985 3.2163 +-0.3500 -0.1000 3.1416 +primID: 5 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0028 -0.0028 3.9270 +-0.0056 -0.0056 3.9270 +-0.0083 -0.0083 3.9270 +-0.0111 -0.0111 3.9270 +-0.0139 -0.0139 3.9270 +-0.0167 -0.0167 3.9270 +-0.0194 -0.0194 3.9270 +-0.0222 -0.0222 3.9270 +-0.0250 -0.0250 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -12 -12 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0028 0.0028 3.9270 +0.0056 0.0056 3.9270 +0.0083 0.0083 3.9270 +0.0111 0.0111 3.9270 +0.0139 0.0139 3.9270 +0.0167 0.0167 3.9270 +0.0194 0.0194 3.9270 +0.0222 0.0222 3.9270 +0.0250 0.0250 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -10 -14 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0678 -0.0684 3.9567 +-0.1000 -0.1043 4.0085 +-0.1302 -0.1418 4.0604 +-0.1584 -0.1809 4.1123 +-0.1846 -0.2213 4.1641 +-0.2086 -0.2631 4.2160 +-0.2304 -0.3060 4.2678 +-0.2500 -0.3500 4.3197 +primID: 4 +startangle_c: 10 +endpose_c: -14 -10 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0684 -0.0678 3.8973 +-0.1043 -0.1000 3.8455 +-0.1418 -0.1302 3.7936 +-0.1809 -0.1584 3.7417 +-0.2213 -0.1846 3.6899 +-0.2631 -0.2086 3.6380 +-0.3060 -0.2304 3.5862 +-0.3500 -0.2500 3.5343 +primID: 5 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0028 -0.0056 4.3197 +-0.0056 -0.0111 4.3197 +-0.0083 -0.0167 4.3197 +-0.0111 -0.0222 4.3197 +-0.0139 -0.0278 4.3197 +-0.0167 -0.0333 4.3197 +-0.0194 -0.0389 4.3197 +-0.0222 -0.0444 4.3197 +-0.0250 -0.0500 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -6 -12 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0167 -0.0333 4.3197 +-0.0333 -0.0667 4.3197 +-0.0500 -0.1000 4.3197 +-0.0667 -0.1333 4.3197 +-0.0833 -0.1667 4.3197 +-0.1000 -0.2000 4.3197 +-0.1167 -0.2333 4.3197 +-0.1333 -0.2667 4.3197 +-0.1500 -0.3000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0028 0.0056 4.3197 +0.0056 0.0111 4.3197 +0.0083 0.0167 4.3197 +0.0111 0.0222 4.3197 +0.0139 0.0278 4.3197 +0.0167 0.0333 4.3197 +0.0194 0.0389 4.3197 +0.0222 0.0444 4.3197 +0.0250 0.0500 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -8 -10 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0184 -0.0298 4.2894 +-0.0379 -0.0592 4.2591 +-0.0583 -0.0881 4.2288 +-0.0796 -0.1165 4.1985 +-0.1019 -0.1444 4.1682 +-0.1251 -0.1717 4.1379 +-0.1492 -0.1984 4.1076 +-0.1742 -0.2245 4.0773 +-0.2000 -0.2500 4.0470 +primID: 4 +startangle_c: 11 +endpose_c: -4 -14 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0156 -0.0377 4.3197 +-0.0312 -0.0754 4.3197 +-0.0468 -0.1131 4.3197 +-0.0623 -0.1508 4.3388 +-0.0758 -0.1893 4.4135 +-0.0863 -0.2287 4.4882 +-0.0939 -0.2687 4.5629 +-0.0985 -0.3092 4.6377 +-0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0028 4.7124 +0.0000 -0.0056 4.7124 +0.0000 -0.0083 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0139 4.7124 +0.0000 -0.0167 4.7124 +0.0000 -0.0194 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0250 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -12 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0333 4.7124 +0.0000 -0.0667 4.7124 +0.0000 -0.1000 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1667 4.7124 +0.0000 -0.2000 4.7124 +0.0000 -0.2333 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0028 4.7124 +0.0000 0.0056 4.7124 +0.0000 0.0083 4.7124 +0.0000 0.0111 4.7124 +0.0000 0.0139 4.7124 +0.0000 0.0167 4.7124 +0.0000 0.0194 4.7124 +0.0000 0.0222 4.7124 +0.0000 0.0250 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 2 -16 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0452 4.7124 +0.0000 -0.0904 4.7124 +0.0000 -0.1355 4.7124 +0.0008 -0.1807 4.7612 +0.0045 -0.2257 4.8300 +0.0114 -0.2703 4.8988 +0.0213 -0.3144 4.9675 +0.0342 -0.3577 5.0363 +0.0500 -0.4000 5.1051 +primID: 4 +startangle_c: 12 +endpose_c: -2 -16 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0000 -0.0452 4.7124 +-0.0000 -0.0904 4.7124 +-0.0000 -0.1355 4.7124 +-0.0008 -0.1807 4.6636 +-0.0045 -0.2257 4.5948 +-0.0114 -0.2703 4.5260 +-0.0213 -0.3144 4.4572 +-0.0342 -0.3577 4.3885 +-0.0500 -0.4000 4.3197 +primID: 5 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0028 -0.0056 5.1051 +0.0056 -0.0111 5.1051 +0.0083 -0.0167 5.1051 +0.0111 -0.0222 5.1051 +0.0139 -0.0278 5.1051 +0.0167 -0.0333 5.1051 +0.0194 -0.0389 5.1051 +0.0222 -0.0444 5.1051 +0.0250 -0.0500 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 6 -12 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0167 -0.0333 5.1051 +0.0333 -0.0667 5.1051 +0.0500 -0.1000 5.1051 +0.0667 -0.1333 5.1051 +0.0833 -0.1667 5.1051 +0.1000 -0.2000 5.1051 +0.1167 -0.2333 5.1051 +0.1333 -0.2667 5.1051 +0.1500 -0.3000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0028 0.0056 5.1051 +-0.0056 0.0111 5.1051 +-0.0083 0.0167 5.1051 +-0.0111 0.0222 5.1051 +-0.0139 0.0278 5.1051 +-0.0167 0.0333 5.1051 +-0.0194 0.0389 5.1051 +-0.0222 0.0444 5.1051 +-0.0250 0.0500 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 8 -10 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0184 -0.0298 5.1354 +0.0379 -0.0592 5.1657 +0.0583 -0.0881 5.1960 +0.0796 -0.1165 5.2263 +0.1019 -0.1444 5.2566 +0.1251 -0.1717 5.2869 +0.1492 -0.1984 5.3172 +0.1742 -0.2245 5.3475 +0.2000 -0.2500 5.3778 +primID: 4 +startangle_c: 13 +endpose_c: 4 -14 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0156 -0.0377 5.1051 +0.0312 -0.0754 5.1051 +0.0468 -0.1131 5.1051 +0.0623 -0.1508 5.0860 +0.0758 -0.1893 5.0113 +0.0863 -0.2287 4.9366 +0.0939 -0.2687 4.8618 +0.0985 -0.3092 4.7871 +0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0028 -0.0028 5.4978 +0.0056 -0.0056 5.4978 +0.0083 -0.0083 5.4978 +0.0111 -0.0111 5.4978 +0.0139 -0.0139 5.4978 +0.0167 -0.0167 5.4978 +0.0194 -0.0194 5.4978 +0.0222 -0.0222 5.4978 +0.0250 -0.0250 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 12 -12 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0028 0.0028 5.4978 +-0.0056 0.0056 5.4978 +-0.0083 0.0083 5.4978 +-0.0111 0.0111 5.4978 +-0.0139 0.0139 5.4978 +-0.0167 0.0167 5.4978 +-0.0194 0.0194 5.4978 +-0.0222 0.0222 5.4978 +-0.0250 0.0250 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 14 -10 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0684 -0.0678 5.5275 +0.1043 -0.1000 5.5793 +0.1418 -0.1302 5.6312 +0.1809 -0.1584 5.6830 +0.2213 -0.1846 5.7349 +0.2631 -0.2086 5.7868 +0.3060 -0.2304 5.8386 +0.3500 -0.2500 5.8905 +primID: 4 +startangle_c: 14 +endpose_c: 10 -14 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0678 -0.0684 5.4681 +0.1000 -0.1043 5.4162 +0.1302 -0.1418 5.3644 +0.1584 -0.1809 5.3125 +0.1846 -0.2213 5.2607 +0.2086 -0.2631 5.2088 +0.2304 -0.3060 5.1569 +0.2500 -0.3500 5.1051 +primID: 5 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0056 -0.0028 5.8905 +0.0111 -0.0056 5.8905 +0.0167 -0.0083 5.8905 +0.0222 -0.0111 5.8905 +0.0278 -0.0139 5.8905 +0.0333 -0.0167 5.8905 +0.0389 -0.0194 5.8905 +0.0444 -0.0222 5.8905 +0.0500 -0.0250 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 12 -6 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0333 -0.0167 5.8905 +0.0667 -0.0333 5.8905 +0.1000 -0.0500 5.8905 +0.1333 -0.0667 5.8905 +0.1667 -0.0833 5.8905 +0.2000 -0.1000 5.8905 +0.2333 -0.1167 5.8905 +0.2667 -0.1333 5.8905 +0.3000 -0.1500 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0056 0.0028 5.8905 +-0.0111 0.0056 5.8905 +-0.0167 0.0083 5.8905 +-0.0222 0.0111 5.8905 +-0.0278 0.0139 5.8905 +-0.0333 0.0167 5.8905 +-0.0389 0.0194 5.8905 +-0.0444 0.0222 5.8905 +-0.0500 0.0250 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 10 -8 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0298 -0.0184 5.8602 +0.0592 -0.0379 5.8299 +0.0881 -0.0583 5.7996 +0.1165 -0.0796 5.7693 +0.1444 -0.1019 5.7390 +0.1717 -0.1251 5.7087 +0.1984 -0.1492 5.6784 +0.2245 -0.1742 5.6481 +0.2500 -0.2000 5.6178 +primID: 4 +startangle_c: 15 +endpose_c: 14 -4 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0377 -0.0156 5.8905 +0.0754 -0.0312 5.8905 +0.1131 -0.0468 5.8905 +0.1508 -0.0623 5.9096 +0.1893 -0.0758 5.9843 +0.2287 -0.0863 6.0590 +0.2687 -0.0939 6.1337 +0.3092 -0.0985 6.2085 +0.3500 -0.1000 6.2832 +primID: 5 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.2360 +0.0000 0.0000 4.5815 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.2725 +0.0000 0.0000 2.6180 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.3090 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.0000 diff --git a/config/runtime/mprim/unicycle_highcost_2cm.mprim b/config/runtime/mprim/unicycle_highcost_2cm.mprim new file mode 100755 index 0000000..b87c310 --- /dev/null +++ b/config/runtime/mprim/unicycle_highcost_2cm.mprim @@ -0,0 +1,1683 @@ +resolution_m: 0.020000 +numberofangles: 16 +totalnumberofprimitives: 112 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0022 0.0000 0.0000 +0.0044 0.0000 0.0000 +0.0067 0.0000 0.0000 +0.0089 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0133 0.0000 0.0000 +0.0156 0.0000 0.0000 +0.0178 0.0000 0.0000 +0.0200 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 20 0 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2222 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3111 0.0000 0.0000 +0.3556 0.0000 0.0000 +0.4000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0022 0.0000 0.0000 +-0.0044 0.0000 0.0000 +-0.0067 0.0000 0.0000 +-0.0089 0.0000 0.0000 +-0.0111 0.0000 0.0000 +-0.0133 0.0000 0.0000 +-0.0156 0.0000 0.0000 +-0.0178 0.0000 0.0000 +-0.0200 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 15 3 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0342 0.0008 0.0434 +0.0683 0.0031 0.0868 +0.1023 0.0069 0.1302 +0.1361 0.0121 0.1736 +0.1696 0.0188 0.2170 +0.2029 0.0270 0.2604 +0.2357 0.0366 0.3038 +0.2681 0.0476 0.3472 +0.3000 0.0600 0.3906 +primID: 4 +startangle_c: 0 +endpose_c: 15 -3 -1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0342 -0.0008 -0.0434 +0.0683 -0.0031 -0.0868 +0.1023 -0.0069 -0.1302 +0.1361 -0.0121 -0.1736 +0.1696 -0.0188 -0.2170 +0.2029 -0.0270 -0.2604 +0.2357 -0.0366 -0.3038 +0.2681 -0.0476 -0.3472 +0.3000 -0.0600 -0.3906 +primID: 5 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0044 0.0022 0.3927 +0.0089 0.0044 0.3927 +0.0133 0.0067 0.3927 +0.0178 0.0089 0.3927 +0.0222 0.0111 0.3927 +0.0267 0.0133 0.3927 +0.0311 0.0156 0.3927 +0.0356 0.0178 0.3927 +0.0400 0.0200 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 15 8 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0333 0.0178 0.3927 +0.0667 0.0356 0.3927 +0.1000 0.0533 0.3927 +0.1333 0.0711 0.3927 +0.1667 0.0889 0.3927 +0.2000 0.1067 0.3927 +0.2333 0.1244 0.3927 +0.2667 0.1422 0.3927 +0.3000 0.1600 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0044 -0.0022 0.3927 +-0.0089 -0.0044 0.3927 +-0.0133 -0.0067 0.3927 +-0.0178 -0.0089 0.3927 +-0.0222 -0.0111 0.3927 +-0.0267 -0.0133 0.3927 +-0.0311 -0.0156 0.3927 +-0.0356 -0.0178 0.3927 +-0.0400 -0.0200 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 12 10 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0285 0.0188 0.4210 +0.0566 0.0385 0.4492 +0.0842 0.0590 0.4775 +0.1115 0.0804 0.5057 +0.1382 0.1027 0.5340 +0.1645 0.1258 0.5623 +0.1902 0.1497 0.5905 +0.2154 0.1745 0.6188 +0.2400 0.2000 0.6470 +primID: 4 +startangle_c: 1 +endpose_c: 18 5 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0387 0.0160 0.3927 +0.0774 0.0320 0.3927 +0.1161 0.0481 0.3927 +0.1549 0.0636 0.3512 +0.1947 0.0766 0.2809 +0.2353 0.0868 0.2107 +0.2765 0.0941 0.1405 +0.3182 0.0985 0.0702 +0.3600 0.1000 0.0000 +primID: 5 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0022 0.0022 0.7854 +0.0044 0.0044 0.7854 +0.0067 0.0067 0.7854 +0.0089 0.0089 0.7854 +0.0111 0.0111 0.7854 +0.0133 0.0133 0.7854 +0.0156 0.0156 0.7854 +0.0178 0.0178 0.7854 +0.0200 0.0200 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 15 15 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0022 -0.0022 0.7854 +-0.0044 -0.0044 0.7854 +-0.0067 -0.0067 0.7854 +-0.0089 -0.0089 0.7854 +-0.0111 -0.0111 0.7854 +-0.0133 -0.0133 0.7854 +-0.0156 -0.0156 0.7854 +-0.0178 -0.0178 0.7854 +-0.0200 -0.0200 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 12 18 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0334 0.0350 0.8288 +0.0652 0.0714 0.8722 +0.0954 0.1092 0.9156 +0.1240 0.1482 0.9590 +0.1508 0.1885 1.0024 +0.1759 0.2299 1.0458 +0.1991 0.2723 1.0892 +0.2205 0.3157 1.1326 +0.2400 0.3600 1.1760 +primID: 4 +startangle_c: 2 +endpose_c: 18 12 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0350 0.0334 0.7420 +0.0714 0.0652 0.6986 +0.1092 0.0954 0.6552 +0.1482 0.1240 0.6118 +0.1885 0.1508 0.5684 +0.2299 0.1759 0.5250 +0.2723 0.1991 0.4816 +0.3157 0.2205 0.4382 +0.3600 0.2400 0.3948 +primID: 5 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0022 0.0044 1.1781 +0.0044 0.0089 1.1781 +0.0067 0.0133 1.1781 +0.0089 0.0178 1.1781 +0.0111 0.0222 1.1781 +0.0133 0.0267 1.1781 +0.0156 0.0311 1.1781 +0.0178 0.0356 1.1781 +0.0200 0.0400 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 8 15 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0178 0.0333 1.1781 +0.0356 0.0667 1.1781 +0.0533 0.1000 1.1781 +0.0711 0.1333 1.1781 +0.0889 0.1667 1.1781 +0.1067 0.2000 1.1781 +0.1244 0.2333 1.1781 +0.1422 0.2667 1.1781 +0.1600 0.3000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0022 -0.0044 1.1781 +-0.0044 -0.0089 1.1781 +-0.0067 -0.0133 1.1781 +-0.0089 -0.0178 1.1781 +-0.0111 -0.0222 1.1781 +-0.0133 -0.0267 1.1781 +-0.0156 -0.0311 1.1781 +-0.0178 -0.0356 1.1781 +-0.0200 -0.0400 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 10 12 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0188 0.0285 1.1498 +0.0385 0.0566 1.1216 +0.0590 0.0842 1.0933 +0.0804 0.1115 1.0651 +0.1027 0.1382 1.0368 +0.1258 0.1645 1.0085 +0.1497 0.1902 0.9803 +0.1745 0.2154 0.9520 +0.2000 0.2400 0.9238 +primID: 4 +startangle_c: 3 +endpose_c: 5 18 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0160 0.0387 1.1781 +0.0320 0.0774 1.1781 +0.0481 0.1161 1.1781 +0.0636 0.1549 1.2196 +0.0766 0.1947 1.2898 +0.0868 0.2353 1.3601 +0.0941 0.2765 1.4303 +0.0985 0.3182 1.5006 +0.1000 0.3600 1.5708 +primID: 5 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0022 1.5708 +0.0000 0.0044 1.5708 +0.0000 0.0067 1.5708 +0.0000 0.0089 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0133 1.5708 +0.0000 0.0156 1.5708 +0.0000 0.0178 1.5708 +0.0000 0.0200 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 20 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2222 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3111 1.5708 +0.0000 0.3556 1.5708 +0.0000 0.4000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0022 1.5708 +0.0000 -0.0044 1.5708 +0.0000 -0.0067 1.5708 +0.0000 -0.0089 1.5708 +0.0000 -0.0111 1.5708 +0.0000 -0.0133 1.5708 +0.0000 -0.0156 1.5708 +0.0000 -0.0178 1.5708 +0.0000 -0.0200 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -3 15 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +-0.0008 0.0342 1.6142 +-0.0031 0.0683 1.6576 +-0.0069 0.1023 1.7010 +-0.0121 0.1361 1.7444 +-0.0188 0.1696 1.7878 +-0.0270 0.2029 1.8312 +-0.0366 0.2357 1.8746 +-0.0476 0.2681 1.9180 +-0.0600 0.3000 1.9614 +primID: 4 +startangle_c: 4 +endpose_c: 3 15 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0008 0.0342 1.5274 +0.0031 0.0683 1.4840 +0.0069 0.1023 1.4406 +0.0121 0.1361 1.3972 +0.0188 0.1696 1.3538 +0.0270 0.2029 1.3104 +0.0366 0.2357 1.2670 +0.0476 0.2681 1.2236 +0.0600 0.3000 1.1802 +primID: 5 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0022 0.0044 1.9635 +-0.0044 0.0089 1.9635 +-0.0067 0.0133 1.9635 +-0.0089 0.0178 1.9635 +-0.0111 0.0222 1.9635 +-0.0133 0.0267 1.9635 +-0.0156 0.0311 1.9635 +-0.0178 0.0356 1.9635 +-0.0200 0.0400 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -8 15 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0178 0.0333 1.9635 +-0.0356 0.0667 1.9635 +-0.0533 0.1000 1.9635 +-0.0711 0.1333 1.9635 +-0.0889 0.1667 1.9635 +-0.1067 0.2000 1.9635 +-0.1244 0.2333 1.9635 +-0.1422 0.2667 1.9635 +-0.1600 0.3000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0022 -0.0044 1.9635 +0.0044 -0.0089 1.9635 +0.0067 -0.0133 1.9635 +0.0089 -0.0178 1.9635 +0.0111 -0.0222 1.9635 +0.0133 -0.0267 1.9635 +0.0156 -0.0311 1.9635 +0.0178 -0.0356 1.9635 +0.0200 -0.0400 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -10 12 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0188 0.0285 1.9918 +-0.0385 0.0566 2.0200 +-0.0590 0.0842 2.0483 +-0.0804 0.1115 2.0765 +-0.1027 0.1382 2.1048 +-0.1258 0.1645 2.1330 +-0.1497 0.1902 2.1613 +-0.1745 0.2154 2.1896 +-0.2000 0.2400 2.2178 +primID: 4 +startangle_c: 5 +endpose_c: -5 18 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0160 0.0387 1.9635 +-0.0320 0.0774 1.9635 +-0.0481 0.1161 1.9635 +-0.0636 0.1549 1.9220 +-0.0766 0.1947 1.8517 +-0.0868 0.2353 1.7815 +-0.0941 0.2765 1.7113 +-0.0985 0.3182 1.6410 +-0.1000 0.3600 1.5708 +primID: 5 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0022 0.0022 2.3562 +-0.0044 0.0044 2.3562 +-0.0067 0.0067 2.3562 +-0.0089 0.0089 2.3562 +-0.0111 0.0111 2.3562 +-0.0133 0.0133 2.3562 +-0.0156 0.0156 2.3562 +-0.0178 0.0178 2.3562 +-0.0200 0.0200 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -15 15 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0022 -0.0022 2.3562 +0.0044 -0.0044 2.3562 +0.0067 -0.0067 2.3562 +0.0089 -0.0089 2.3562 +0.0111 -0.0111 2.3562 +0.0133 -0.0133 2.3562 +0.0156 -0.0156 2.3562 +0.0178 -0.0178 2.3562 +0.0200 -0.0200 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -18 12 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0350 0.0334 2.3996 +-0.0714 0.0652 2.4430 +-0.1092 0.0954 2.4864 +-0.1482 0.1240 2.5298 +-0.1885 0.1508 2.5732 +-0.2299 0.1759 2.6166 +-0.2723 0.1991 2.6600 +-0.3157 0.2205 2.7034 +-0.3600 0.2400 2.7468 +primID: 4 +startangle_c: 6 +endpose_c: -12 18 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0334 0.0350 2.3128 +-0.0652 0.0714 2.2694 +-0.0954 0.1092 2.2260 +-0.1240 0.1482 2.1826 +-0.1508 0.1885 2.1392 +-0.1759 0.2299 2.0958 +-0.1991 0.2723 2.0524 +-0.2205 0.3157 2.0090 +-0.2400 0.3600 1.9656 +primID: 5 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0044 0.0022 2.7489 +-0.0089 0.0044 2.7489 +-0.0133 0.0067 2.7489 +-0.0178 0.0089 2.7489 +-0.0222 0.0111 2.7489 +-0.0267 0.0133 2.7489 +-0.0311 0.0156 2.7489 +-0.0356 0.0178 2.7489 +-0.0400 0.0200 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -15 8 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0333 0.0178 2.7489 +-0.0667 0.0356 2.7489 +-0.1000 0.0533 2.7489 +-0.1333 0.0711 2.7489 +-0.1667 0.0889 2.7489 +-0.2000 0.1067 2.7489 +-0.2333 0.1244 2.7489 +-0.2667 0.1422 2.7489 +-0.3000 0.1600 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0044 -0.0022 2.7489 +0.0089 -0.0044 2.7489 +0.0133 -0.0067 2.7489 +0.0178 -0.0089 2.7489 +0.0222 -0.0111 2.7489 +0.0267 -0.0133 2.7489 +0.0311 -0.0156 2.7489 +0.0356 -0.0178 2.7489 +0.0400 -0.0200 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -12 10 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0285 0.0188 2.7206 +-0.0566 0.0385 2.6924 +-0.0842 0.0590 2.6641 +-0.1115 0.0804 2.6359 +-0.1382 0.1027 2.6076 +-0.1645 0.1258 2.5793 +-0.1902 0.1497 2.5511 +-0.2154 0.1745 2.5228 +-0.2400 0.2000 2.4946 +primID: 4 +startangle_c: 7 +endpose_c: -18 5 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0387 0.0160 2.7489 +-0.0774 0.0320 2.7489 +-0.1161 0.0481 2.7489 +-0.1549 0.0636 2.7904 +-0.1947 0.0766 2.8606 +-0.2353 0.0868 2.9309 +-0.2765 0.0941 3.0011 +-0.3182 0.0985 3.0714 +-0.3600 0.1000 3.1416 +primID: 5 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0022 0.0000 3.1416 +-0.0044 0.0000 3.1416 +-0.0067 0.0000 3.1416 +-0.0089 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0133 0.0000 3.1416 +-0.0156 0.0000 3.1416 +-0.0178 0.0000 3.1416 +-0.0200 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -20 0 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2222 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3111 0.0000 3.1416 +-0.3556 0.0000 3.1416 +-0.4000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0022 0.0000 3.1416 +0.0044 0.0000 3.1416 +0.0067 0.0000 3.1416 +0.0089 0.0000 3.1416 +0.0111 0.0000 3.1416 +0.0133 0.0000 3.1416 +0.0156 0.0000 3.1416 +0.0178 0.0000 3.1416 +0.0200 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -15 -3 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0342 -0.0008 3.1850 +-0.0683 -0.0031 3.2284 +-0.1023 -0.0069 3.2718 +-0.1361 -0.0121 3.3152 +-0.1696 -0.0188 3.3586 +-0.2029 -0.0270 3.4020 +-0.2357 -0.0366 3.4454 +-0.2681 -0.0476 3.4888 +-0.3000 -0.0600 3.5322 +primID: 4 +startangle_c: 8 +endpose_c: -15 3 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0342 0.0008 3.0982 +-0.0683 0.0031 3.0548 +-0.1023 0.0069 3.0114 +-0.1361 0.0121 2.9680 +-0.1696 0.0188 2.9246 +-0.2029 0.0270 2.8812 +-0.2357 0.0366 2.8378 +-0.2681 0.0476 2.7944 +-0.3000 0.0600 2.7510 +primID: 5 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0044 -0.0022 3.5343 +-0.0089 -0.0044 3.5343 +-0.0133 -0.0067 3.5343 +-0.0178 -0.0089 3.5343 +-0.0222 -0.0111 3.5343 +-0.0267 -0.0133 3.5343 +-0.0311 -0.0156 3.5343 +-0.0356 -0.0178 3.5343 +-0.0400 -0.0200 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -15 -8 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0333 -0.0178 3.5343 +-0.0667 -0.0356 3.5343 +-0.1000 -0.0533 3.5343 +-0.1333 -0.0711 3.5343 +-0.1667 -0.0889 3.5343 +-0.2000 -0.1067 3.5343 +-0.2333 -0.1244 3.5343 +-0.2667 -0.1422 3.5343 +-0.3000 -0.1600 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0044 0.0022 3.5343 +0.0089 0.0044 3.5343 +0.0133 0.0067 3.5343 +0.0178 0.0089 3.5343 +0.0222 0.0111 3.5343 +0.0267 0.0133 3.5343 +0.0311 0.0156 3.5343 +0.0356 0.0178 3.5343 +0.0400 0.0200 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -12 -10 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0285 -0.0188 3.5626 +-0.0566 -0.0385 3.5908 +-0.0842 -0.0590 3.6191 +-0.1115 -0.0804 3.6473 +-0.1382 -0.1027 3.6756 +-0.1645 -0.1258 3.7038 +-0.1902 -0.1497 3.7321 +-0.2154 -0.1745 3.7604 +-0.2400 -0.2000 3.7886 +primID: 4 +startangle_c: 9 +endpose_c: -18 -5 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0387 -0.0160 3.5343 +-0.0774 -0.0320 3.5343 +-0.1161 -0.0481 3.5343 +-0.1549 -0.0636 3.4928 +-0.1947 -0.0766 3.4225 +-0.2353 -0.0868 3.3523 +-0.2765 -0.0941 3.2821 +-0.3182 -0.0985 3.2118 +-0.3600 -0.1000 3.1416 +primID: 5 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0022 -0.0022 3.9270 +-0.0044 -0.0044 3.9270 +-0.0067 -0.0067 3.9270 +-0.0089 -0.0089 3.9270 +-0.0111 -0.0111 3.9270 +-0.0133 -0.0133 3.9270 +-0.0156 -0.0156 3.9270 +-0.0178 -0.0178 3.9270 +-0.0200 -0.0200 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -15 -15 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0022 0.0022 3.9270 +0.0044 0.0044 3.9270 +0.0067 0.0067 3.9270 +0.0089 0.0089 3.9270 +0.0111 0.0111 3.9270 +0.0133 0.0133 3.9270 +0.0156 0.0156 3.9270 +0.0178 0.0178 3.9270 +0.0200 0.0200 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -12 -18 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0334 -0.0350 3.9704 +-0.0652 -0.0714 4.0138 +-0.0954 -0.1092 4.0572 +-0.1240 -0.1482 4.1006 +-0.1508 -0.1885 4.1440 +-0.1759 -0.2299 4.1874 +-0.1991 -0.2723 4.2308 +-0.2205 -0.3157 4.2742 +-0.2400 -0.3600 4.3176 +primID: 4 +startangle_c: 10 +endpose_c: -18 -12 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0350 -0.0334 3.8836 +-0.0714 -0.0652 3.8402 +-0.1092 -0.0954 3.7968 +-0.1482 -0.1240 3.7534 +-0.1885 -0.1508 3.7100 +-0.2299 -0.1759 3.6666 +-0.2723 -0.1991 3.6232 +-0.3157 -0.2205 3.5798 +-0.3600 -0.2400 3.5364 +primID: 5 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0022 -0.0044 4.3197 +-0.0044 -0.0089 4.3197 +-0.0067 -0.0133 4.3197 +-0.0089 -0.0178 4.3197 +-0.0111 -0.0222 4.3197 +-0.0133 -0.0267 4.3197 +-0.0156 -0.0311 4.3197 +-0.0178 -0.0356 4.3197 +-0.0200 -0.0400 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -8 -15 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0178 -0.0333 4.3197 +-0.0356 -0.0667 4.3197 +-0.0533 -0.1000 4.3197 +-0.0711 -0.1333 4.3197 +-0.0889 -0.1667 4.3197 +-0.1067 -0.2000 4.3197 +-0.1244 -0.2333 4.3197 +-0.1422 -0.2667 4.3197 +-0.1600 -0.3000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0022 0.0044 4.3197 +0.0044 0.0089 4.3197 +0.0067 0.0133 4.3197 +0.0089 0.0178 4.3197 +0.0111 0.0222 4.3197 +0.0133 0.0267 4.3197 +0.0156 0.0311 4.3197 +0.0178 0.0356 4.3197 +0.0200 0.0400 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -10 -12 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0188 -0.0285 4.2914 +-0.0385 -0.0566 4.2632 +-0.0590 -0.0842 4.2349 +-0.0804 -0.1115 4.2067 +-0.1027 -0.1382 4.1784 +-0.1258 -0.1645 4.1501 +-0.1497 -0.1902 4.1219 +-0.1745 -0.2154 4.0936 +-0.2000 -0.2400 4.0654 +primID: 4 +startangle_c: 11 +endpose_c: -5 -18 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0160 -0.0387 4.3197 +-0.0320 -0.0774 4.3197 +-0.0481 -0.1161 4.3197 +-0.0636 -0.1549 4.3612 +-0.0766 -0.1947 4.4314 +-0.0868 -0.2353 4.5017 +-0.0941 -0.2765 4.5719 +-0.0985 -0.3182 4.6422 +-0.1000 -0.3600 4.7124 +primID: 5 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0022 4.7124 +0.0000 -0.0044 4.7124 +0.0000 -0.0067 4.7124 +0.0000 -0.0089 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0133 4.7124 +0.0000 -0.0156 4.7124 +0.0000 -0.0178 4.7124 +0.0000 -0.0200 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -20 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2222 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3111 4.7124 +0.0000 -0.3556 4.7124 +0.0000 -0.4000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0022 4.7124 +0.0000 0.0044 4.7124 +0.0000 0.0067 4.7124 +0.0000 0.0089 4.7124 +0.0000 0.0111 4.7124 +0.0000 0.0133 4.7124 +0.0000 0.0156 4.7124 +0.0000 0.0178 4.7124 +0.0000 0.0200 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 3 -15 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0008 -0.0342 4.7558 +0.0031 -0.0683 4.7992 +0.0069 -0.1023 4.8426 +0.0121 -0.1361 4.8860 +0.0188 -0.1696 4.9294 +0.0270 -0.2029 4.9728 +0.0366 -0.2357 5.0162 +0.0476 -0.2681 5.0596 +0.0600 -0.3000 5.1030 +primID: 4 +startangle_c: 12 +endpose_c: -3 -15 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0008 -0.0342 4.6690 +-0.0031 -0.0683 4.6256 +-0.0069 -0.1023 4.5822 +-0.0121 -0.1361 4.5388 +-0.0188 -0.1696 4.4954 +-0.0270 -0.2029 4.4520 +-0.0366 -0.2357 4.4086 +-0.0476 -0.2681 4.3652 +-0.0600 -0.3000 4.3218 +primID: 5 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0022 -0.0044 5.1051 +0.0044 -0.0089 5.1051 +0.0067 -0.0133 5.1051 +0.0089 -0.0178 5.1051 +0.0111 -0.0222 5.1051 +0.0133 -0.0267 5.1051 +0.0156 -0.0311 5.1051 +0.0178 -0.0356 5.1051 +0.0200 -0.0400 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 8 -15 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0178 -0.0333 5.1051 +0.0356 -0.0667 5.1051 +0.0533 -0.1000 5.1051 +0.0711 -0.1333 5.1051 +0.0889 -0.1667 5.1051 +0.1067 -0.2000 5.1051 +0.1244 -0.2333 5.1051 +0.1422 -0.2667 5.1051 +0.1600 -0.3000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0022 0.0044 5.1051 +-0.0044 0.0089 5.1051 +-0.0067 0.0133 5.1051 +-0.0089 0.0178 5.1051 +-0.0111 0.0222 5.1051 +-0.0133 0.0267 5.1051 +-0.0156 0.0311 5.1051 +-0.0178 0.0356 5.1051 +-0.0200 0.0400 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 10 -12 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0188 -0.0285 5.1333 +0.0385 -0.0566 5.1616 +0.0590 -0.0842 5.1899 +0.0804 -0.1115 5.2181 +0.1027 -0.1382 5.2464 +0.1258 -0.1645 5.2746 +0.1497 -0.1902 5.3029 +0.1745 -0.2154 5.3312 +0.2000 -0.2400 5.3594 +primID: 4 +startangle_c: 13 +endpose_c: 5 -18 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0160 -0.0387 5.1051 +0.0320 -0.0774 5.1051 +0.0481 -0.1161 5.1051 +0.0636 -0.1549 5.0636 +0.0766 -0.1947 4.9933 +0.0868 -0.2353 4.9231 +0.0941 -0.2765 4.8529 +0.0985 -0.3182 4.7826 +0.1000 -0.3600 4.7124 +primID: 5 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0022 -0.0022 5.4978 +0.0044 -0.0044 5.4978 +0.0067 -0.0067 5.4978 +0.0089 -0.0089 5.4978 +0.0111 -0.0111 5.4978 +0.0133 -0.0133 5.4978 +0.0156 -0.0156 5.4978 +0.0178 -0.0178 5.4978 +0.0200 -0.0200 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 15 -15 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0022 0.0022 5.4978 +-0.0044 0.0044 5.4978 +-0.0067 0.0067 5.4978 +-0.0089 0.0089 5.4978 +-0.0111 0.0111 5.4978 +-0.0133 0.0133 5.4978 +-0.0156 0.0156 5.4978 +-0.0178 0.0178 5.4978 +-0.0200 0.0200 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 18 -12 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0350 -0.0334 5.5412 +0.0714 -0.0652 5.5846 +0.1092 -0.0954 5.6280 +0.1482 -0.1240 5.6714 +0.1885 -0.1508 5.7148 +0.2299 -0.1759 5.7582 +0.2723 -0.1991 5.8016 +0.3157 -0.2205 5.8450 +0.3600 -0.2400 5.8884 +primID: 4 +startangle_c: 14 +endpose_c: 12 -18 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0334 -0.0350 5.4544 +0.0652 -0.0714 5.4110 +0.0954 -0.1092 5.3676 +0.1240 -0.1482 5.3242 +0.1508 -0.1885 5.2808 +0.1759 -0.2299 5.2374 +0.1991 -0.2723 5.1940 +0.2205 -0.3157 5.1506 +0.2400 -0.3600 5.1072 +primID: 5 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 10 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0044 -0.0022 5.8905 +0.0089 -0.0044 5.8905 +0.0133 -0.0067 5.8905 +0.0178 -0.0089 5.8905 +0.0222 -0.0111 5.8905 +0.0267 -0.0133 5.8905 +0.0311 -0.0156 5.8905 +0.0356 -0.0178 5.8905 +0.0400 -0.0200 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 15 -8 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0333 -0.0178 5.8905 +0.0667 -0.0356 5.8905 +0.1000 -0.0533 5.8905 +0.1333 -0.0711 5.8905 +0.1667 -0.0889 5.8905 +0.2000 -0.1067 5.8905 +0.2333 -0.1244 5.8905 +0.2667 -0.1422 5.8905 +0.3000 -0.1600 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 50 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0044 0.0022 5.8905 +-0.0089 0.0044 5.8905 +-0.0133 0.0067 5.8905 +-0.0178 0.0089 5.8905 +-0.0222 0.0111 5.8905 +-0.0267 0.0133 5.8905 +-0.0311 0.0156 5.8905 +-0.0356 0.0178 5.8905 +-0.0400 0.0200 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 12 -10 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0285 -0.0188 5.8622 +0.0566 -0.0385 5.8340 +0.0842 -0.0590 5.8057 +0.1115 -0.0804 5.7775 +0.1382 -0.1027 5.7492 +0.1645 -0.1258 5.7209 +0.1902 -0.1497 5.6927 +0.2154 -0.1745 5.6644 +0.2400 -0.2000 5.6362 +primID: 4 +startangle_c: 15 +endpose_c: 18 -5 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0387 -0.0160 5.8905 +0.0774 -0.0320 5.8905 +0.1161 -0.0481 5.8905 +0.1549 -0.0636 5.9320 +0.1947 -0.0766 6.0022 +0.2353 -0.0868 6.0725 +0.2765 -0.0941 6.1427 +0.3182 -0.0985 6.2129 +0.3600 -0.1000 6.2832 +primID: 5 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 100 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.2360 +0.0000 0.0000 4.5815 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.2725 +0.0000 0.0000 2.6180 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.3090 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.0000 diff --git a/config/runtime/mprim/unicycle_highcost_5cm.mprim b/config/runtime/mprim/unicycle_highcost_5cm.mprim new file mode 100755 index 0000000..bff2688 --- /dev/null +++ b/config/runtime/mprim/unicycle_highcost_5cm.mprim @@ -0,0 +1,1683 @@ +resolution_m: 0.050000 +numberofangles: 16 +totalnumberofprimitives: 112 +primID: 0 +startangle_c: 0 +endpose_c: 1 0 0 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0056 0.0000 0.0000 +0.0111 0.0000 0.0000 +0.0167 0.0000 0.0000 +0.0222 0.0000 0.0000 +0.0278 0.0000 0.0000 +0.0333 0.0000 0.0000 +0.0389 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0500 0.0000 0.0000 +primID: 1 +startangle_c: 0 +endpose_c: 8 0 0 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0444 0.0000 0.0000 +0.0889 0.0000 0.0000 +0.1333 0.0000 0.0000 +0.1778 0.0000 0.0000 +0.2222 0.0000 0.0000 +0.2667 0.0000 0.0000 +0.3111 0.0000 0.0000 +0.3556 0.0000 0.0000 +0.4000 0.0000 0.0000 +primID: 2 +startangle_c: 0 +endpose_c: -1 0 0 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 0.0000 +-0.0056 0.0000 0.0000 +-0.0111 0.0000 0.0000 +-0.0167 0.0000 0.0000 +-0.0222 0.0000 0.0000 +-0.0278 0.0000 0.0000 +-0.0333 0.0000 0.0000 +-0.0389 0.0000 0.0000 +-0.0444 0.0000 0.0000 +-0.0500 0.0000 0.0000 +primID: 3 +startangle_c: 0 +endpose_c: 8 1 1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 -0.0000 0.0000 +0.0904 -0.0000 0.0000 +0.1355 -0.0000 0.0000 +0.1807 0.0008 0.0488 +0.2257 0.0045 0.1176 +0.2703 0.0114 0.1864 +0.3144 0.0213 0.2551 +0.3577 0.0342 0.3239 +0.4000 0.0500 0.3927 +primID: 4 +startangle_c: 0 +endpose_c: 8 -1 -1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0452 0.0000 0.0000 +0.0904 0.0000 0.0000 +0.1355 0.0000 0.0000 +0.1807 -0.0008 -0.0488 +0.2257 -0.0045 -0.1176 +0.2703 -0.0114 -0.1864 +0.3144 -0.0213 -0.2551 +0.3577 -0.0342 -0.3239 +0.4000 -0.0500 -0.3927 +primID: 5 +startangle_c: 0 +endpose_c: 0 0 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3927 +primID: 6 +startangle_c: 0 +endpose_c: 0 0 -1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.0000 +0.0000 0.0000 -0.0436 +0.0000 0.0000 -0.0873 +0.0000 0.0000 -0.1309 +0.0000 0.0000 -0.1745 +0.0000 0.0000 -0.2182 +0.0000 0.0000 -0.2618 +0.0000 0.0000 -0.3054 +0.0000 0.0000 -0.3491 +0.0000 0.0000 -0.3927 +primID: 0 +startangle_c: 1 +endpose_c: 2 1 1 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0111 0.0056 0.3927 +0.0222 0.0111 0.3927 +0.0333 0.0167 0.3927 +0.0444 0.0222 0.3927 +0.0556 0.0278 0.3927 +0.0667 0.0333 0.3927 +0.0778 0.0389 0.3927 +0.0889 0.0444 0.3927 +0.1000 0.0500 0.3927 +primID: 1 +startangle_c: 1 +endpose_c: 6 3 1 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0333 0.0167 0.3927 +0.0667 0.0333 0.3927 +0.1000 0.0500 0.3927 +0.1333 0.0667 0.3927 +0.1667 0.0833 0.3927 +0.2000 0.1000 0.3927 +0.2333 0.1167 0.3927 +0.2667 0.1333 0.3927 +0.3000 0.1500 0.3927 +primID: 2 +startangle_c: 1 +endpose_c: -2 -1 1 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 0.3927 +-0.0111 -0.0056 0.3927 +-0.0222 -0.0111 0.3927 +-0.0333 -0.0167 0.3927 +-0.0444 -0.0222 0.3927 +-0.0556 -0.0278 0.3927 +-0.0667 -0.0333 0.3927 +-0.0778 -0.0389 0.3927 +-0.0889 -0.0444 0.3927 +-0.1000 -0.0500 0.3927 +primID: 3 +startangle_c: 1 +endpose_c: 5 4 2 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0298 0.0184 0.4230 +0.0592 0.0379 0.4533 +0.0881 0.0583 0.4836 +0.1165 0.0796 0.5139 +0.1444 0.1019 0.5442 +0.1717 0.1251 0.5745 +0.1984 0.1492 0.6048 +0.2245 0.1742 0.6351 +0.2500 0.2000 0.6654 +primID: 4 +startangle_c: 1 +endpose_c: 7 2 0 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0377 0.0156 0.3927 +0.0754 0.0312 0.3927 +0.1131 0.0468 0.3927 +0.1508 0.0623 0.3736 +0.1893 0.0758 0.2989 +0.2287 0.0863 0.2242 +0.2687 0.0939 0.1494 +0.3092 0.0985 0.0747 +0.3500 0.1000 -0.0000 +primID: 5 +startangle_c: 1 +endpose_c: 0 0 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 1 +endpose_c: 0 0 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.3927 +0.0000 0.0000 0.3491 +0.0000 0.0000 0.3054 +0.0000 0.0000 0.2618 +0.0000 0.0000 0.2182 +0.0000 0.0000 0.1745 +0.0000 0.0000 0.1309 +0.0000 0.0000 0.0873 +0.0000 0.0000 0.0436 +0.0000 0.0000 0.0000 +primID: 0 +startangle_c: 2 +endpose_c: 1 1 2 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0056 0.0056 0.7854 +0.0111 0.0111 0.7854 +0.0167 0.0167 0.7854 +0.0222 0.0222 0.7854 +0.0278 0.0278 0.7854 +0.0333 0.0333 0.7854 +0.0389 0.0389 0.7854 +0.0444 0.0444 0.7854 +0.0500 0.0500 0.7854 +primID: 1 +startangle_c: 2 +endpose_c: 6 6 2 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0333 0.0333 0.7854 +0.0667 0.0667 0.7854 +0.1000 0.1000 0.7854 +0.1333 0.1333 0.7854 +0.1667 0.1667 0.7854 +0.2000 0.2000 0.7854 +0.2333 0.2333 0.7854 +0.2667 0.2667 0.7854 +0.3000 0.3000 0.7854 +primID: 2 +startangle_c: 2 +endpose_c: -1 -1 2 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 0.7854 +-0.0056 -0.0056 0.7854 +-0.0111 -0.0111 0.7854 +-0.0167 -0.0167 0.7854 +-0.0222 -0.0222 0.7854 +-0.0278 -0.0278 0.7854 +-0.0333 -0.0333 0.7854 +-0.0389 -0.0389 0.7854 +-0.0444 -0.0444 0.7854 +-0.0500 -0.0500 0.7854 +primID: 3 +startangle_c: 2 +endpose_c: 5 7 3 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0678 0.0684 0.8151 +0.1000 0.1043 0.8669 +0.1302 0.1418 0.9188 +0.1584 0.1809 0.9707 +0.1846 0.2213 1.0225 +0.2086 0.2631 1.0744 +0.2304 0.3060 1.1262 +0.2500 0.3500 1.1781 +primID: 4 +startangle_c: 2 +endpose_c: 7 5 1 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0341 0.0341 0.7854 +0.0684 0.0678 0.7557 +0.1043 0.1000 0.7039 +0.1418 0.1302 0.6520 +0.1809 0.1584 0.6001 +0.2213 0.1846 0.5483 +0.2631 0.2086 0.4964 +0.3060 0.2304 0.4446 +0.3500 0.2500 0.3927 +primID: 5 +startangle_c: 2 +endpose_c: 0 0 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.9599 +0.0000 0.0000 1.0036 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.1781 +primID: 6 +startangle_c: 2 +endpose_c: 0 0 1 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 0.7854 +0.0000 0.0000 0.7418 +0.0000 0.0000 0.6981 +0.0000 0.0000 0.6545 +0.0000 0.0000 0.6109 +0.0000 0.0000 0.5672 +0.0000 0.0000 0.5236 +0.0000 0.0000 0.4800 +0.0000 0.0000 0.4363 +0.0000 0.0000 0.3927 +primID: 0 +startangle_c: 3 +endpose_c: 1 2 3 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0056 0.0111 1.1781 +0.0111 0.0222 1.1781 +0.0167 0.0333 1.1781 +0.0222 0.0444 1.1781 +0.0278 0.0556 1.1781 +0.0333 0.0667 1.1781 +0.0389 0.0778 1.1781 +0.0444 0.0889 1.1781 +0.0500 0.1000 1.1781 +primID: 1 +startangle_c: 3 +endpose_c: 3 6 3 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0167 0.0333 1.1781 +0.0333 0.0667 1.1781 +0.0500 0.1000 1.1781 +0.0667 0.1333 1.1781 +0.0833 0.1667 1.1781 +0.1000 0.2000 1.1781 +0.1167 0.2333 1.1781 +0.1333 0.2667 1.1781 +0.1500 0.3000 1.1781 +primID: 2 +startangle_c: 3 +endpose_c: -1 -2 3 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 1.1781 +-0.0056 -0.0111 1.1781 +-0.0111 -0.0222 1.1781 +-0.0167 -0.0333 1.1781 +-0.0222 -0.0444 1.1781 +-0.0278 -0.0556 1.1781 +-0.0333 -0.0667 1.1781 +-0.0389 -0.0778 1.1781 +-0.0444 -0.0889 1.1781 +-0.0500 -0.1000 1.1781 +primID: 3 +startangle_c: 3 +endpose_c: 4 5 2 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0184 0.0298 1.1478 +0.0379 0.0592 1.1175 +0.0583 0.0881 1.0872 +0.0796 0.1165 1.0569 +0.1019 0.1444 1.0266 +0.1251 0.1717 0.9963 +0.1492 0.1984 0.9660 +0.1742 0.2245 0.9357 +0.2000 0.2500 0.9054 +primID: 4 +startangle_c: 3 +endpose_c: 2 7 4 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0156 0.0377 1.1781 +0.0312 0.0754 1.1781 +0.0468 0.1131 1.1781 +0.0623 0.1508 1.1972 +0.0758 0.1893 1.2719 +0.0863 0.2287 1.3466 +0.0939 0.2687 1.4214 +0.0985 0.3092 1.4961 +0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 3 +endpose_c: 0 0 2 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.1345 +0.0000 0.0000 1.0908 +0.0000 0.0000 1.0472 +0.0000 0.0000 1.0036 +0.0000 0.0000 0.9599 +0.0000 0.0000 0.9163 +0.0000 0.0000 0.8727 +0.0000 0.0000 0.8290 +0.0000 0.0000 0.7854 +primID: 6 +startangle_c: 3 +endpose_c: 0 0 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.1781 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 4 +endpose_c: 0 1 4 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0056 1.5708 +0.0000 0.0111 1.5708 +0.0000 0.0167 1.5708 +0.0000 0.0222 1.5708 +0.0000 0.0278 1.5708 +0.0000 0.0333 1.5708 +0.0000 0.0389 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0500 1.5708 +primID: 1 +startangle_c: 4 +endpose_c: 0 8 4 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0444 1.5708 +0.0000 0.0889 1.5708 +0.0000 0.1333 1.5708 +0.0000 0.1778 1.5708 +0.0000 0.2222 1.5708 +0.0000 0.2667 1.5708 +0.0000 0.3111 1.5708 +0.0000 0.3556 1.5708 +0.0000 0.4000 1.5708 +primID: 2 +startangle_c: 4 +endpose_c: 0 -1 4 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 -0.0056 1.5708 +0.0000 -0.0111 1.5708 +0.0000 -0.0167 1.5708 +0.0000 -0.0222 1.5708 +0.0000 -0.0278 1.5708 +0.0000 -0.0333 1.5708 +0.0000 -0.0389 1.5708 +0.0000 -0.0444 1.5708 +0.0000 -0.0500 1.5708 +primID: 3 +startangle_c: 4 +endpose_c: -1 8 5 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +-0.0008 0.1807 1.6196 +-0.0045 0.2257 1.6884 +-0.0114 0.2703 1.7572 +-0.0213 0.3144 1.8259 +-0.0342 0.3577 1.8947 +-0.0500 0.4000 1.9635 +primID: 4 +startangle_c: 4 +endpose_c: 1 8 3 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0452 1.5708 +0.0000 0.0904 1.5708 +0.0000 0.1355 1.5708 +0.0008 0.1807 1.5220 +0.0045 0.2257 1.4532 +0.0114 0.2703 1.3844 +0.0213 0.3144 1.3156 +0.0342 0.3577 1.2469 +0.0500 0.4000 1.1781 +primID: 5 +startangle_c: 4 +endpose_c: 0 0 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.9635 +primID: 6 +startangle_c: 4 +endpose_c: 0 0 3 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.5708 +0.0000 0.0000 1.5272 +0.0000 0.0000 1.4835 +0.0000 0.0000 1.4399 +0.0000 0.0000 1.3963 +0.0000 0.0000 1.3526 +0.0000 0.0000 1.3090 +0.0000 0.0000 1.2654 +0.0000 0.0000 1.2217 +0.0000 0.0000 1.1781 +primID: 0 +startangle_c: 5 +endpose_c: -1 2 5 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0056 0.0111 1.9635 +-0.0111 0.0222 1.9635 +-0.0167 0.0333 1.9635 +-0.0222 0.0444 1.9635 +-0.0278 0.0556 1.9635 +-0.0333 0.0667 1.9635 +-0.0389 0.0778 1.9635 +-0.0444 0.0889 1.9635 +-0.0500 0.1000 1.9635 +primID: 1 +startangle_c: 5 +endpose_c: -3 6 5 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0167 0.0333 1.9635 +-0.0333 0.0667 1.9635 +-0.0500 0.1000 1.9635 +-0.0667 0.1333 1.9635 +-0.0833 0.1667 1.9635 +-0.1000 0.2000 1.9635 +-0.1167 0.2333 1.9635 +-0.1333 0.2667 1.9635 +-0.1500 0.3000 1.9635 +primID: 2 +startangle_c: 5 +endpose_c: 1 -2 5 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0056 -0.0111 1.9635 +0.0111 -0.0222 1.9635 +0.0167 -0.0333 1.9635 +0.0222 -0.0444 1.9635 +0.0278 -0.0556 1.9635 +0.0333 -0.0667 1.9635 +0.0389 -0.0778 1.9635 +0.0444 -0.0889 1.9635 +0.0500 -0.1000 1.9635 +primID: 3 +startangle_c: 5 +endpose_c: -4 5 6 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0184 0.0298 1.9938 +-0.0379 0.0592 2.0241 +-0.0583 0.0881 2.0544 +-0.0796 0.1165 2.0847 +-0.1019 0.1444 2.1150 +-0.1251 0.1717 2.1453 +-0.1492 0.1984 2.1756 +-0.1742 0.2245 2.2059 +-0.2000 0.2500 2.2362 +primID: 4 +startangle_c: 5 +endpose_c: -2 7 4 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 1.9635 +-0.0156 0.0377 1.9635 +-0.0312 0.0754 1.9635 +-0.0468 0.1131 1.9635 +-0.0623 0.1508 1.9444 +-0.0758 0.1893 1.8697 +-0.0863 0.2287 1.7950 +-0.0939 0.2687 1.7202 +-0.0985 0.3092 1.6455 +-0.1000 0.3500 1.5708 +primID: 5 +startangle_c: 5 +endpose_c: 0 0 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 2.0071 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 5 +endpose_c: 0 0 4 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 1.9635 +0.0000 0.0000 1.9199 +0.0000 0.0000 1.8762 +0.0000 0.0000 1.8326 +0.0000 0.0000 1.7890 +0.0000 0.0000 1.7453 +0.0000 0.0000 1.7017 +0.0000 0.0000 1.6581 +0.0000 0.0000 1.6144 +0.0000 0.0000 1.5708 +primID: 0 +startangle_c: 6 +endpose_c: -1 1 6 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0056 0.0056 2.3562 +-0.0111 0.0111 2.3562 +-0.0167 0.0167 2.3562 +-0.0222 0.0222 2.3562 +-0.0278 0.0278 2.3562 +-0.0333 0.0333 2.3562 +-0.0389 0.0389 2.3562 +-0.0444 0.0444 2.3562 +-0.0500 0.0500 2.3562 +primID: 1 +startangle_c: 6 +endpose_c: -6 6 6 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0333 0.0333 2.3562 +-0.0667 0.0667 2.3562 +-0.1000 0.1000 2.3562 +-0.1333 0.1333 2.3562 +-0.1667 0.1667 2.3562 +-0.2000 0.2000 2.3562 +-0.2333 0.2333 2.3562 +-0.2667 0.2667 2.3562 +-0.3000 0.3000 2.3562 +primID: 2 +startangle_c: 6 +endpose_c: 1 -1 6 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0056 -0.0056 2.3562 +0.0111 -0.0111 2.3562 +0.0167 -0.0167 2.3562 +0.0222 -0.0222 2.3562 +0.0278 -0.0278 2.3562 +0.0333 -0.0333 2.3562 +0.0389 -0.0389 2.3562 +0.0444 -0.0444 2.3562 +0.0500 -0.0500 2.3562 +primID: 3 +startangle_c: 6 +endpose_c: -7 5 7 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0684 0.0678 2.3859 +-0.1043 0.1000 2.4377 +-0.1418 0.1302 2.4896 +-0.1809 0.1584 2.5415 +-0.2213 0.1846 2.5933 +-0.2631 0.2086 2.6452 +-0.3060 0.2304 2.6970 +-0.3500 0.2500 2.7489 +primID: 4 +startangle_c: 6 +endpose_c: -5 7 5 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.3562 +-0.0341 0.0341 2.3562 +-0.0678 0.0684 2.3265 +-0.1000 0.1043 2.2747 +-0.1302 0.1418 2.2228 +-0.1584 0.1809 2.1709 +-0.1846 0.2213 2.1191 +-0.2086 0.2631 2.0672 +-0.2304 0.3060 2.0154 +-0.2500 0.3500 1.9635 +primID: 5 +startangle_c: 6 +endpose_c: 0 0 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.7489 +primID: 6 +startangle_c: 6 +endpose_c: 0 0 5 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.3562 +0.0000 0.0000 2.3126 +0.0000 0.0000 2.2689 +0.0000 0.0000 2.2253 +0.0000 0.0000 2.1817 +0.0000 0.0000 2.1380 +0.0000 0.0000 2.0944 +0.0000 0.0000 2.0508 +0.0000 0.0000 2.0071 +0.0000 0.0000 1.9635 +primID: 0 +startangle_c: 7 +endpose_c: -2 1 7 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0111 0.0056 2.7489 +-0.0222 0.0111 2.7489 +-0.0333 0.0167 2.7489 +-0.0444 0.0222 2.7489 +-0.0556 0.0278 2.7489 +-0.0667 0.0333 2.7489 +-0.0778 0.0389 2.7489 +-0.0889 0.0444 2.7489 +-0.1000 0.0500 2.7489 +primID: 1 +startangle_c: 7 +endpose_c: -6 3 7 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0333 0.0167 2.7489 +-0.0667 0.0333 2.7489 +-0.1000 0.0500 2.7489 +-0.1333 0.0667 2.7489 +-0.1667 0.0833 2.7489 +-0.2000 0.1000 2.7489 +-0.2333 0.1167 2.7489 +-0.2667 0.1333 2.7489 +-0.3000 0.1500 2.7489 +primID: 2 +startangle_c: 7 +endpose_c: 2 -1 7 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0111 -0.0056 2.7489 +0.0222 -0.0111 2.7489 +0.0333 -0.0167 2.7489 +0.0444 -0.0222 2.7489 +0.0556 -0.0278 2.7489 +0.0667 -0.0333 2.7489 +0.0778 -0.0389 2.7489 +0.0889 -0.0444 2.7489 +0.1000 -0.0500 2.7489 +primID: 3 +startangle_c: 7 +endpose_c: -5 4 6 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0298 0.0184 2.7186 +-0.0592 0.0379 2.6883 +-0.0881 0.0583 2.6580 +-0.1165 0.0796 2.6277 +-0.1444 0.1019 2.5974 +-0.1717 0.1251 2.5671 +-0.1984 0.1492 2.5368 +-0.2245 0.1742 2.5065 +-0.2500 0.2000 2.4762 +primID: 4 +startangle_c: 7 +endpose_c: -7 2 8 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 2.7489 +-0.0377 0.0156 2.7489 +-0.0754 0.0312 2.7489 +-0.1131 0.0468 2.7489 +-0.1508 0.0623 2.7680 +-0.1893 0.0758 2.8427 +-0.2287 0.0863 2.9174 +-0.2687 0.0939 2.9921 +-0.3092 0.0985 3.0669 +-0.3500 0.1000 3.1416 +primID: 5 +startangle_c: 7 +endpose_c: 0 0 6 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7053 +0.0000 0.0000 2.6616 +0.0000 0.0000 2.6180 +0.0000 0.0000 2.5744 +0.0000 0.0000 2.5307 +0.0000 0.0000 2.4871 +0.0000 0.0000 2.4435 +0.0000 0.0000 2.3998 +0.0000 0.0000 2.3562 +primID: 6 +startangle_c: 7 +endpose_c: 0 0 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 2.7489 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.9671 +0.0000 0.0000 3.0107 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 8 +endpose_c: -1 0 8 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0056 0.0000 3.1416 +-0.0111 0.0000 3.1416 +-0.0167 0.0000 3.1416 +-0.0222 0.0000 3.1416 +-0.0278 0.0000 3.1416 +-0.0333 0.0000 3.1416 +-0.0389 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0500 0.0000 3.1416 +primID: 1 +startangle_c: 8 +endpose_c: -8 0 8 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0444 0.0000 3.1416 +-0.0889 0.0000 3.1416 +-0.1333 0.0000 3.1416 +-0.1778 0.0000 3.1416 +-0.2222 0.0000 3.1416 +-0.2667 0.0000 3.1416 +-0.3111 0.0000 3.1416 +-0.3556 0.0000 3.1416 +-0.4000 0.0000 3.1416 +primID: 2 +startangle_c: 8 +endpose_c: 1 0 8 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0056 0.0000 3.1416 +0.0111 0.0000 3.1416 +0.0167 0.0000 3.1416 +0.0222 0.0000 3.1416 +0.0278 0.0000 3.1416 +0.0333 0.0000 3.1416 +0.0389 0.0000 3.1416 +0.0444 0.0000 3.1416 +0.0500 0.0000 3.1416 +primID: 3 +startangle_c: 8 +endpose_c: -8 -1 9 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 -0.0008 3.1904 +-0.2257 -0.0045 3.2592 +-0.2703 -0.0114 3.3280 +-0.3144 -0.0213 3.3967 +-0.3577 -0.0342 3.4655 +-0.4000 -0.0500 3.5343 +primID: 4 +startangle_c: 8 +endpose_c: -8 1 7 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.1416 +-0.0452 0.0000 3.1416 +-0.0904 0.0000 3.1416 +-0.1355 0.0000 3.1416 +-0.1807 0.0008 3.0928 +-0.2257 0.0045 3.0240 +-0.2703 0.0114 2.9552 +-0.3144 0.0213 2.8864 +-0.3577 0.0342 2.8177 +-0.4000 0.0500 2.7489 +primID: 5 +startangle_c: 8 +endpose_c: 0 0 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.5343 +primID: 6 +startangle_c: 8 +endpose_c: 0 0 7 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.1416 +0.0000 0.0000 3.0980 +0.0000 0.0000 3.0543 +0.0000 0.0000 3.0107 +0.0000 0.0000 2.9671 +0.0000 0.0000 2.9234 +0.0000 0.0000 2.8798 +0.0000 0.0000 2.8362 +0.0000 0.0000 2.7925 +0.0000 0.0000 2.7489 +primID: 0 +startangle_c: 9 +endpose_c: -2 -1 9 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0111 -0.0056 3.5343 +-0.0222 -0.0111 3.5343 +-0.0333 -0.0167 3.5343 +-0.0444 -0.0222 3.5343 +-0.0556 -0.0278 3.5343 +-0.0667 -0.0333 3.5343 +-0.0778 -0.0389 3.5343 +-0.0889 -0.0444 3.5343 +-0.1000 -0.0500 3.5343 +primID: 1 +startangle_c: 9 +endpose_c: -6 -3 9 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0333 -0.0167 3.5343 +-0.0667 -0.0333 3.5343 +-0.1000 -0.0500 3.5343 +-0.1333 -0.0667 3.5343 +-0.1667 -0.0833 3.5343 +-0.2000 -0.1000 3.5343 +-0.2333 -0.1167 3.5343 +-0.2667 -0.1333 3.5343 +-0.3000 -0.1500 3.5343 +primID: 2 +startangle_c: 9 +endpose_c: 2 1 9 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0111 0.0056 3.5343 +0.0222 0.0111 3.5343 +0.0333 0.0167 3.5343 +0.0444 0.0222 3.5343 +0.0556 0.0278 3.5343 +0.0667 0.0333 3.5343 +0.0778 0.0389 3.5343 +0.0889 0.0444 3.5343 +0.1000 0.0500 3.5343 +primID: 3 +startangle_c: 9 +endpose_c: -5 -4 10 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0298 -0.0184 3.5646 +-0.0592 -0.0379 3.5949 +-0.0881 -0.0583 3.6252 +-0.1165 -0.0796 3.6555 +-0.1444 -0.1019 3.6858 +-0.1717 -0.1251 3.7161 +-0.1984 -0.1492 3.7464 +-0.2245 -0.1742 3.7767 +-0.2500 -0.2000 3.8070 +primID: 4 +startangle_c: 9 +endpose_c: -7 -2 8 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.5343 +-0.0377 -0.0156 3.5343 +-0.0754 -0.0312 3.5343 +-0.1131 -0.0468 3.5343 +-0.1508 -0.0623 3.5152 +-0.1893 -0.0758 3.4405 +-0.2287 -0.0863 3.3658 +-0.2687 -0.0939 3.2910 +-0.3092 -0.0985 3.2163 +-0.3500 -0.1000 3.1416 +primID: 5 +startangle_c: 9 +endpose_c: 0 0 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 9 +endpose_c: 0 0 8 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.5343 +0.0000 0.0000 3.4907 +0.0000 0.0000 3.4470 +0.0000 0.0000 3.4034 +0.0000 0.0000 3.3598 +0.0000 0.0000 3.3161 +0.0000 0.0000 3.2725 +0.0000 0.0000 3.2289 +0.0000 0.0000 3.1852 +0.0000 0.0000 3.1416 +primID: 0 +startangle_c: 10 +endpose_c: -1 -1 10 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0056 -0.0056 3.9270 +-0.0111 -0.0111 3.9270 +-0.0167 -0.0167 3.9270 +-0.0222 -0.0222 3.9270 +-0.0278 -0.0278 3.9270 +-0.0333 -0.0333 3.9270 +-0.0389 -0.0389 3.9270 +-0.0444 -0.0444 3.9270 +-0.0500 -0.0500 3.9270 +primID: 1 +startangle_c: 10 +endpose_c: -6 -6 10 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0333 -0.0333 3.9270 +-0.0667 -0.0667 3.9270 +-0.1000 -0.1000 3.9270 +-0.1333 -0.1333 3.9270 +-0.1667 -0.1667 3.9270 +-0.2000 -0.2000 3.9270 +-0.2333 -0.2333 3.9270 +-0.2667 -0.2667 3.9270 +-0.3000 -0.3000 3.9270 +primID: 2 +startangle_c: 10 +endpose_c: 1 1 10 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0056 0.0056 3.9270 +0.0111 0.0111 3.9270 +0.0167 0.0167 3.9270 +0.0222 0.0222 3.9270 +0.0278 0.0278 3.9270 +0.0333 0.0333 3.9270 +0.0389 0.0389 3.9270 +0.0444 0.0444 3.9270 +0.0500 0.0500 3.9270 +primID: 3 +startangle_c: 10 +endpose_c: -5 -7 11 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0678 -0.0684 3.9567 +-0.1000 -0.1043 4.0085 +-0.1302 -0.1418 4.0604 +-0.1584 -0.1809 4.1123 +-0.1846 -0.2213 4.1641 +-0.2086 -0.2631 4.2160 +-0.2304 -0.3060 4.2678 +-0.2500 -0.3500 4.3197 +primID: 4 +startangle_c: 10 +endpose_c: -7 -5 9 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 3.9270 +-0.0341 -0.0341 3.9270 +-0.0684 -0.0678 3.8973 +-0.1043 -0.1000 3.8455 +-0.1418 -0.1302 3.7936 +-0.1809 -0.1584 3.7417 +-0.2213 -0.1846 3.6899 +-0.2631 -0.2086 3.6380 +-0.3060 -0.2304 3.5862 +-0.3500 -0.2500 3.5343 +primID: 5 +startangle_c: 10 +endpose_c: 0 0 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.9706 +0.0000 0.0000 4.0143 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.3197 +primID: 6 +startangle_c: 10 +endpose_c: 0 0 9 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 3.9270 +0.0000 0.0000 3.8834 +0.0000 0.0000 3.8397 +0.0000 0.0000 3.7961 +0.0000 0.0000 3.7525 +0.0000 0.0000 3.7088 +0.0000 0.0000 3.6652 +0.0000 0.0000 3.6216 +0.0000 0.0000 3.5779 +0.0000 0.0000 3.5343 +primID: 0 +startangle_c: 11 +endpose_c: -1 -2 11 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0056 -0.0111 4.3197 +-0.0111 -0.0222 4.3197 +-0.0167 -0.0333 4.3197 +-0.0222 -0.0444 4.3197 +-0.0278 -0.0556 4.3197 +-0.0333 -0.0667 4.3197 +-0.0389 -0.0778 4.3197 +-0.0444 -0.0889 4.3197 +-0.0500 -0.1000 4.3197 +primID: 1 +startangle_c: 11 +endpose_c: -3 -6 11 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0167 -0.0333 4.3197 +-0.0333 -0.0667 4.3197 +-0.0500 -0.1000 4.3197 +-0.0667 -0.1333 4.3197 +-0.0833 -0.1667 4.3197 +-0.1000 -0.2000 4.3197 +-0.1167 -0.2333 4.3197 +-0.1333 -0.2667 4.3197 +-0.1500 -0.3000 4.3197 +primID: 2 +startangle_c: 11 +endpose_c: 1 2 11 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0056 0.0111 4.3197 +0.0111 0.0222 4.3197 +0.0167 0.0333 4.3197 +0.0222 0.0444 4.3197 +0.0278 0.0556 4.3197 +0.0333 0.0667 4.3197 +0.0389 0.0778 4.3197 +0.0444 0.0889 4.3197 +0.0500 0.1000 4.3197 +primID: 3 +startangle_c: 11 +endpose_c: -4 -5 10 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0184 -0.0298 4.2894 +-0.0379 -0.0592 4.2591 +-0.0583 -0.0881 4.2288 +-0.0796 -0.1165 4.1985 +-0.1019 -0.1444 4.1682 +-0.1251 -0.1717 4.1379 +-0.1492 -0.1984 4.1076 +-0.1742 -0.2245 4.0773 +-0.2000 -0.2500 4.0470 +primID: 4 +startangle_c: 11 +endpose_c: -2 -7 12 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.3197 +-0.0156 -0.0377 4.3197 +-0.0312 -0.0754 4.3197 +-0.0468 -0.1131 4.3197 +-0.0623 -0.1508 4.3388 +-0.0758 -0.1893 4.4135 +-0.0863 -0.2287 4.4882 +-0.0939 -0.2687 4.5629 +-0.0985 -0.3092 4.6377 +-0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 11 +endpose_c: 0 0 10 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.2761 +0.0000 0.0000 4.2324 +0.0000 0.0000 4.1888 +0.0000 0.0000 4.1452 +0.0000 0.0000 4.1015 +0.0000 0.0000 4.0579 +0.0000 0.0000 4.0143 +0.0000 0.0000 3.9706 +0.0000 0.0000 3.9270 +primID: 6 +startangle_c: 11 +endpose_c: 0 0 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.3197 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 12 +endpose_c: 0 -1 12 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0056 4.7124 +0.0000 -0.0111 4.7124 +0.0000 -0.0167 4.7124 +0.0000 -0.0222 4.7124 +0.0000 -0.0278 4.7124 +0.0000 -0.0333 4.7124 +0.0000 -0.0389 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0500 4.7124 +primID: 1 +startangle_c: 12 +endpose_c: 0 -8 12 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0444 4.7124 +0.0000 -0.0889 4.7124 +0.0000 -0.1333 4.7124 +0.0000 -0.1778 4.7124 +0.0000 -0.2222 4.7124 +0.0000 -0.2667 4.7124 +0.0000 -0.3111 4.7124 +0.0000 -0.3556 4.7124 +0.0000 -0.4000 4.7124 +primID: 2 +startangle_c: 12 +endpose_c: 0 1 12 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0056 4.7124 +0.0000 0.0111 4.7124 +0.0000 0.0167 4.7124 +0.0000 0.0222 4.7124 +0.0000 0.0278 4.7124 +0.0000 0.0333 4.7124 +0.0000 0.0389 4.7124 +0.0000 0.0444 4.7124 +0.0000 0.0500 4.7124 +primID: 3 +startangle_c: 12 +endpose_c: 1 -8 13 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 -0.0452 4.7124 +0.0000 -0.0904 4.7124 +0.0000 -0.1355 4.7124 +0.0008 -0.1807 4.7612 +0.0045 -0.2257 4.8300 +0.0114 -0.2703 4.8988 +0.0213 -0.3144 4.9675 +0.0342 -0.3577 5.0363 +0.0500 -0.4000 5.1051 +primID: 4 +startangle_c: 12 +endpose_c: -1 -8 11 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 4.7124 +-0.0000 -0.0452 4.7124 +-0.0000 -0.0904 4.7124 +-0.0000 -0.1355 4.7124 +-0.0008 -0.1807 4.6636 +-0.0045 -0.2257 4.5948 +-0.0114 -0.2703 4.5260 +-0.0213 -0.3144 4.4572 +-0.0342 -0.3577 4.3885 +-0.0500 -0.4000 4.3197 +primID: 5 +startangle_c: 12 +endpose_c: 0 0 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.9742 +0.0000 0.0000 5.0178 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.1051 +primID: 6 +startangle_c: 12 +endpose_c: 0 0 11 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 4.7124 +0.0000 0.0000 4.6688 +0.0000 0.0000 4.6251 +0.0000 0.0000 4.5815 +0.0000 0.0000 4.5379 +0.0000 0.0000 4.4942 +0.0000 0.0000 4.4506 +0.0000 0.0000 4.4070 +0.0000 0.0000 4.3633 +0.0000 0.0000 4.3197 +primID: 0 +startangle_c: 13 +endpose_c: 1 -2 13 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0056 -0.0111 5.1051 +0.0111 -0.0222 5.1051 +0.0167 -0.0333 5.1051 +0.0222 -0.0444 5.1051 +0.0278 -0.0556 5.1051 +0.0333 -0.0667 5.1051 +0.0389 -0.0778 5.1051 +0.0444 -0.0889 5.1051 +0.0500 -0.1000 5.1051 +primID: 1 +startangle_c: 13 +endpose_c: 3 -6 13 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0167 -0.0333 5.1051 +0.0333 -0.0667 5.1051 +0.0500 -0.1000 5.1051 +0.0667 -0.1333 5.1051 +0.0833 -0.1667 5.1051 +0.1000 -0.2000 5.1051 +0.1167 -0.2333 5.1051 +0.1333 -0.2667 5.1051 +0.1500 -0.3000 5.1051 +primID: 2 +startangle_c: 13 +endpose_c: -1 2 13 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 5.1051 +-0.0056 0.0111 5.1051 +-0.0111 0.0222 5.1051 +-0.0167 0.0333 5.1051 +-0.0222 0.0444 5.1051 +-0.0278 0.0556 5.1051 +-0.0333 0.0667 5.1051 +-0.0389 0.0778 5.1051 +-0.0444 0.0889 5.1051 +-0.0500 0.1000 5.1051 +primID: 3 +startangle_c: 13 +endpose_c: 4 -5 14 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0184 -0.0298 5.1354 +0.0379 -0.0592 5.1657 +0.0583 -0.0881 5.1960 +0.0796 -0.1165 5.2263 +0.1019 -0.1444 5.2566 +0.1251 -0.1717 5.2869 +0.1492 -0.1984 5.3172 +0.1742 -0.2245 5.3475 +0.2000 -0.2500 5.3778 +primID: 4 +startangle_c: 13 +endpose_c: 2 -7 12 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0156 -0.0377 5.1051 +0.0312 -0.0754 5.1051 +0.0468 -0.1131 5.1051 +0.0623 -0.1508 5.0860 +0.0758 -0.1893 5.0113 +0.0863 -0.2287 4.9366 +0.0939 -0.2687 4.8618 +0.0985 -0.3092 4.7871 +0.1000 -0.3500 4.7124 +primID: 5 +startangle_c: 13 +endpose_c: 0 0 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 13 +endpose_c: 0 0 12 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.1051 +0.0000 0.0000 5.0615 +0.0000 0.0000 5.0178 +0.0000 0.0000 4.9742 +0.0000 0.0000 4.9306 +0.0000 0.0000 4.8869 +0.0000 0.0000 4.8433 +0.0000 0.0000 4.7997 +0.0000 0.0000 4.7560 +0.0000 0.0000 4.7124 +primID: 0 +startangle_c: 14 +endpose_c: 1 -1 14 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0056 -0.0056 5.4978 +0.0111 -0.0111 5.4978 +0.0167 -0.0167 5.4978 +0.0222 -0.0222 5.4978 +0.0278 -0.0278 5.4978 +0.0333 -0.0333 5.4978 +0.0389 -0.0389 5.4978 +0.0444 -0.0444 5.4978 +0.0500 -0.0500 5.4978 +primID: 1 +startangle_c: 14 +endpose_c: 6 -6 14 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0333 -0.0333 5.4978 +0.0667 -0.0667 5.4978 +0.1000 -0.1000 5.4978 +0.1333 -0.1333 5.4978 +0.1667 -0.1667 5.4978 +0.2000 -0.2000 5.4978 +0.2333 -0.2333 5.4978 +0.2667 -0.2667 5.4978 +0.3000 -0.3000 5.4978 +primID: 2 +startangle_c: 14 +endpose_c: -1 1 14 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 5.4978 +-0.0056 0.0056 5.4978 +-0.0111 0.0111 5.4978 +-0.0167 0.0167 5.4978 +-0.0222 0.0222 5.4978 +-0.0278 0.0278 5.4978 +-0.0333 0.0333 5.4978 +-0.0389 0.0389 5.4978 +-0.0444 0.0444 5.4978 +-0.0500 0.0500 5.4978 +primID: 3 +startangle_c: 14 +endpose_c: 7 -5 15 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0684 -0.0678 5.5275 +0.1043 -0.1000 5.5793 +0.1418 -0.1302 5.6312 +0.1809 -0.1584 5.6830 +0.2213 -0.1846 5.7349 +0.2631 -0.2086 5.7868 +0.3060 -0.2304 5.8386 +0.3500 -0.2500 5.8905 +primID: 4 +startangle_c: 14 +endpose_c: 5 -7 13 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0341 -0.0341 5.4978 +0.0678 -0.0684 5.4681 +0.1000 -0.1043 5.4162 +0.1302 -0.1418 5.3644 +0.1584 -0.1809 5.3125 +0.1846 -0.2213 5.2607 +0.2086 -0.2631 5.2088 +0.2304 -0.3060 5.1569 +0.2500 -0.3500 5.1051 +primID: 5 +startangle_c: 14 +endpose_c: 0 0 15 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8905 +primID: 6 +startangle_c: 14 +endpose_c: 0 0 13 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.4978 +0.0000 0.0000 5.4542 +0.0000 0.0000 5.4105 +0.0000 0.0000 5.3669 +0.0000 0.0000 5.3233 +0.0000 0.0000 5.2796 +0.0000 0.0000 5.2360 +0.0000 0.0000 5.1924 +0.0000 0.0000 5.1487 +0.0000 0.0000 5.1051 +primID: 0 +startangle_c: 15 +endpose_c: 2 -1 15 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0111 -0.0056 5.8905 +0.0222 -0.0111 5.8905 +0.0333 -0.0167 5.8905 +0.0444 -0.0222 5.8905 +0.0556 -0.0278 5.8905 +0.0667 -0.0333 5.8905 +0.0778 -0.0389 5.8905 +0.0889 -0.0444 5.8905 +0.1000 -0.0500 5.8905 +primID: 1 +startangle_c: 15 +endpose_c: 6 -3 15 +additionalactioncostmult: 1 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0333 -0.0167 5.8905 +0.0667 -0.0333 5.8905 +0.1000 -0.0500 5.8905 +0.1333 -0.0667 5.8905 +0.1667 -0.0833 5.8905 +0.2000 -0.1000 5.8905 +0.2333 -0.1167 5.8905 +0.2667 -0.1333 5.8905 +0.3000 -0.1500 5.8905 +primID: 2 +startangle_c: 15 +endpose_c: -2 1 15 +additionalactioncostmult: 40 +intermediateposes: 10 +0.0000 0.0000 5.8905 +-0.0111 0.0056 5.8905 +-0.0222 0.0111 5.8905 +-0.0333 0.0167 5.8905 +-0.0444 0.0222 5.8905 +-0.0556 0.0278 5.8905 +-0.0667 0.0333 5.8905 +-0.0778 0.0389 5.8905 +-0.0889 0.0444 5.8905 +-0.1000 0.0500 5.8905 +primID: 3 +startangle_c: 15 +endpose_c: 5 -4 14 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0298 -0.0184 5.8602 +0.0592 -0.0379 5.8299 +0.0881 -0.0583 5.7996 +0.1165 -0.0796 5.7693 +0.1444 -0.1019 5.7390 +0.1717 -0.1251 5.7087 +0.1984 -0.1492 5.6784 +0.2245 -0.1742 5.6481 +0.2500 -0.2000 5.6178 +primID: 4 +startangle_c: 15 +endpose_c: 7 -2 0 +additionalactioncostmult: 2 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0377 -0.0156 5.8905 +0.0754 -0.0312 5.8905 +0.1131 -0.0468 5.8905 +0.1508 -0.0623 5.9096 +0.1893 -0.0758 5.9843 +0.2287 -0.0863 6.0590 +0.2687 -0.0939 6.1337 +0.3092 -0.0985 6.2085 +0.3500 -0.1000 6.2832 +primID: 5 +startangle_c: 15 +endpose_c: 0 0 14 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.8469 +0.0000 0.0000 5.8032 +0.0000 0.0000 5.7596 +0.0000 0.0000 5.7160 +0.0000 0.0000 5.6723 +0.0000 0.0000 5.6287 +0.0000 0.0000 5.5851 +0.0000 0.0000 5.5414 +0.0000 0.0000 5.4978 +primID: 6 +startangle_c: 15 +endpose_c: 0 0 0 +additionalactioncostmult: 20 +intermediateposes: 10 +0.0000 0.0000 5.8905 +0.0000 0.0000 5.9341 +0.0000 0.0000 5.9778 +0.0000 0.0000 6.0214 +0.0000 0.0000 6.0650 +0.0000 0.0000 6.1087 +0.0000 0.0000 6.1523 +0.0000 0.0000 6.1959 +0.0000 0.0000 6.2396 +0.0000 0.0000 0.0000 diff --git a/config/runtime/pnkx_local_planner_params.yaml b/config/runtime/pnkx_local_planner_params.yaml new file mode 100644 index 0000000..128fd04 --- /dev/null +++ b/config/runtime/pnkx_local_planner_params.yaml @@ -0,0 +1,203 @@ +yaw_goal_tolerance: 0.02 +xy_goal_tolerance: 0.03 +min_approach_linear_velocity: 0.05 + +LocalPlannerAdapter: + library_path: liblocal_planner_adapter +PNKXLocalPlanner: + # Thuật toán + library_path: libpnkx_local_planner + trajectory_generator_name: LimitedAccelGenerator + algorithm_nav_name: MKTAlgorithmDiffPredictiveTrajectory + algorithm_rotate_name: MKTAlgorithmDiffRotateToGoal + # Bộ kiểm tra đã tới goal + goal_checker_name: GoalChecker + +PNKXDockingLocalPlanner: + # Thuật toán + library_path: libpnkx_local_planner + trajectory_generator_name: LimitedAccelGenerator + algorithm_nav_name: MKTAlgorithmDiffPredictiveTrajectory + algorithm_rotate_name: MKTAlgorithmDiffRotateToGoal + # Bộ kiểm tra đã tới goal + goal_checker_name: GoalChecker + +PNKXGoStraightLocalPlanner: + # Thuật toán + library_path: libpnkx_local_planner + trajectory_generator_name: LimitedAccelGenerator + algorithm_nav_name: MKTAlgorithmDiffGoStraight + # Bộ kiểm tra đã tới goal + goal_checker_name: GoalChecker + +PNKXRotateLocalPlanner: + # Thuật toán + library_path: libpnkx_local_planner + algorithm_rotate_name: MKTAlgorithmDiffRotateToGoal + trajectory_generator_name: LimitedAccelGenerator + # Bộ kiểm tra đã tới goal + goal_checker_name: SimpleGoalChecker + stateful: true + +LimitedAccelGenerator: + library_path: libmkt_plugins_standard_traj_generator + max_vel_x: 1.2 + min_vel_x: -1.2 + + max_vel_y: 0.0 # robot vi sai: không có chuyển động ngang + min_vel_y: 0.0 # robot vi sai: không có chuyển động ngang + + max_speed_xy: 2.0 # [m/s] trần tốc độ tịnh tiến. Đặt thấp hơn khả năng thật của base một chút + min_speed_xy: 0.25 # [m/s] tốc độ tịnh tiến tối thiểu khi gần như không quay + + max_vel_theta: 0.4 # [rad/s] trần tốc độ quay. Đặt thấp hơn khả năng thật của base một chút + min_vel_theta: 0.05 # [rad/s] tốc độ quay tối thiểu khi gần như không tịnh tiến + + acc_lim_x: 3.0 + acc_lim_y: 0.0 # robot vi sai: không có chuyển động ngang + acc_lim_theta: 1.5 + decel_lim_x: -3.0 + decel_lim_y: -0.0 + decel_lim_theta: -2.0 + + # Có cắt path thành từng chặng hay không + split_path: true + sim_time: 1.5 + vx_samples: 15 + vy_samples: 1 + vtheta_samples: 10 + discretize_by_time: true + angular_granularity: 0.05 + linear_granularity: 0.1 + # sim_period: lấy theo chu kỳ điều khiển + include_last_point: true + +MKTAlgorithmDiffPredictiveTrajectory: + library_path: libmkt_algorithm_diff + xy_local_goal_tolerance: 0.05 + angle_threshold: 0.6 + index_samples: 60 + follow_step_path: true + + # Chỉnh bộ lọc Kalman (lọc lệnh v và w trước khi gửi xuống base). + # q_* = nhiễu quá trình, r_* = nhiễu đo. Tăng r_* -> lọc mạnh, lệnh mượt nhưng chậm đáp ứng + kf_q_v: 0.25 + kf_q_w: 0.8 + kf_r_v: 0.05 + kf_r_w: 0.08 + kf_p0: 0.5 + kf_filter_angular: false + + # ----- Điểm nhìn trước (lookahead) ----- + use_velocity_scaled_lookahead_dist: true # true = cự ly nhìn trước co giãn theo vận tốc; false = dùng cố định lookahead_dist. (mặc định: false) + # chỉ có tác dụng khi cờ trên = false: + lookahead_dist: 0.5 # [m] cự ly nhìn trước cố định để chọn điểm bám. (mặc định: 0.6) + # chỉ có tác dụng khi cờ trên = true: + min_lookahead_dist: 0.6 # [m] cận dưới của cự ly nhìn trước. Nhỏ quá thì robot lắc ở tốc độ thấp. (mặc định: 0.3) + max_lookahead_dist: 2.0 # [m] cận trên của cự ly nhìn trước. Lớn quá thì robot cắt cua. (mặc định: 0.9) + lookahead_time: 1.9 # [s] nhân với vận tốc hiện tại ra cự ly nhìn trước, tức hệ số lookahead. (mặc định: 1.5) + min_journey_squared: 0.2 # [m^2] quãng đường bình phương tối thiểu mới xét tới goal (mặc định: 0.2) + max_journey_squared: 0.5 # [m^2] quãng đường bình phương tối đa còn xét tới goal (mặc định: 0.2) + max_lateral_accel: 0.9 # [m/s^2] trần gia tốc ngang, dùng để tự giảm tốc khi vào cua + + # ----- Quay tại chỗ về đúng hướng ----- + # Chỉ được bật MỘT trong hai: use_rotate_to_heading hoặc allow_reversing + use_rotate_to_heading: true # Cho phép quay tại chỗ về hướng path và về hướng goal. Nên bật với mọi robot quay tại chỗ được. (mặc định: true) + # chỉ có tác dụng khi cờ trên = true: + rotate_to_heading_min_angle: 0.03 # [rad] lệch hướng giữa path và robot vượt ngưỡng này thì quay tại chỗ trước khi chạy. (mặc định: 0.785) + angular_decel_zone: 0.1 + + # Ngưỡng coi robot là ĐÃ DỪNG + rot_stopped_velocity: 0.03 + trans_stopped_velocity: 0.03 + + use_final_heading_alignment: true + final_heading_xy_tolerance: 0.1 + final_heading_angle_tolerance: 0.05 + final_heading_min_velocity: 0.05 + final_heading_kp_angular: 1.2 + final_heading_ki_angular: 0.002 + final_heading_kd_angular: 0.12 + +MKTAlgorithmDiffGoStraight: + library_path: libmkt_algorithm_diff + xy_local_goal_tolerance: 0.05 + angle_threshold: 0.8 + index_samples: 60 + follow_step_path: true + + # ----- Điểm nhìn trước (lookahead) ----- + use_velocity_scaled_lookahead_dist: true # true = cự ly nhìn trước co giãn theo vận tốc; false = dùng cố định lookahead_dist. (mặc định: false) + # chỉ có tác dụng khi cờ trên = false: + lookahead_dist: 0.5 # [m] cự ly nhìn trước cố định để chọn điểm bám. (mặc định: 0.6) + # chỉ có tác dụng khi cờ trên = true: + min_lookahead_dist: 0.6 # [m] cận dưới của cự ly nhìn trước. Nhỏ quá thì robot lắc ở tốc độ thấp. (mặc định: 0.3) + max_lookahead_dist: 2.0 # [m] cận trên của cự ly nhìn trước. Lớn quá thì robot cắt cua. (mặc định: 0.9) + lookahead_time: 2.0 # [s] nhân với vận tốc hiện tại ra cự ly nhìn trước, tức hệ số lookahead. (mặc định: 1.5) + min_journey_squared: 1.0 # [m^2] quãng đường bình phương tối thiểu mới xét tới goal (mặc định: 0.2) + max_journey_squared: 1.0 # [m^2] quãng đường bình phương tối đa còn xét tới goal (mặc định: 0.2) + max_lateral_accel: 0.9 # [m/s^2] trần gia tốc ngang, dùng để tự giảm tốc khi vào cua + + # ----- Quay tại chỗ về đúng hướng ----- + # Chỉ được bật MỘT trong hai: use_rotate_to_heading hoặc allow_reversing + use_rotate_to_heading: true # Cho phép quay tại chỗ về hướng path và về hướng goal. Nên bật với mọi robot quay tại chỗ được. (mặc định: true) + # chỉ có tác dụng khi cờ trên = true: + rotate_to_heading_min_angle: 0.03 # [rad] lệch hướng giữa path và robot vượt ngưỡng này thì quay tại chỗ trước khi chạy. (mặc định: 0.785) + angular_decel_zone: 0.1 + + # Ngưỡng coi robot là ĐÃ DỪNG + rot_stopped_velocity: 0.03 + trans_stopped_velocity: 0.03 + + use_final_heading_alignment: true + final_heading_xy_tolerance: 0.1 + final_heading_angle_tolerance: 0.05 + final_heading_min_velocity: 0.05 + final_heading_kp_angular: 1.5 + final_heading_ki_angular: 0.2 + final_heading_kd_angular: 0.05 + +MKTAlgorithmDiffRotateToGoal: + library_path: libmkt_algorithm_diff + xy_local_goal_tolerance: 0.05 + angle_threshold: 0.47 + index_samples: 60 + follow_step_path: true + + # ----- Điểm nhìn trước (lookahead) ----- + use_velocity_scaled_lookahead_dist: true # true = cự ly nhìn trước co giãn theo vận tốc; false = dùng cố định lookahead_dist. (mặc định: false) + # chỉ có tác dụng khi cờ trên = false: + lookahead_dist: 0.5 # [m] cự ly nhìn trước cố định để chọn điểm bám. (mặc định: 0.6) + # chỉ có tác dụng khi cờ trên = true: + min_lookahead_dist: 0.6 # [m] cận dưới của cự ly nhìn trước. Nhỏ quá thì robot lắc ở tốc độ thấp. (mặc định: 0.3) + max_lookahead_dist: 2.0 # [m] cận trên của cự ly nhìn trước. Lớn quá thì robot cắt cua. (mặc định: 0.9) + lookahead_time: 1.9 # [s] nhân với vận tốc hiện tại ra cự ly nhìn trước, tức hệ số lookahead. (mặc định: 1.5) + min_journey_squared: 0.2 # [m^2] quãng đường bình phương tối thiểu mới xét tới goal (mặc định: 0.2) + max_journey_squared: 0.8 # [m^2] quãng đường bình phương tối đa còn xét tới goal (mặc định: 0.2) + max_lateral_accel: 0.9 # [m/s^2] trần gia tốc ngang, dùng để tự giảm tốc khi vào cua + + # ----- Quay tại chỗ về đúng hướng ----- + # Chỉ được bật MỘT trong hai: use_rotate_to_heading hoặc allow_reversing + use_rotate_to_heading: true # Cho phép quay tại chỗ về hướng path và về hướng goal. Nên bật với mọi robot quay tại chỗ được. (mặc định: true) + # chỉ có tác dụng khi cờ trên = true: + rotate_to_heading_min_angle: 0.03 # [rad] lệch hướng giữa path và robot vượt ngưỡng này thì quay tại chỗ trước khi chạy. (mặc định: 0.785) + angular_decel_zone: 0.1 + + # Ngưỡng coi robot là ĐÃ DỪNG + rot_stopped_velocity: 0.03 + trans_stopped_velocity: 0.03 + + use_final_heading_alignment: true + final_heading_xy_tolerance: 0.1 + final_heading_angle_tolerance: 0.05 + final_heading_min_velocity: 0.05 + final_heading_kp_angular: 2.0 + near_goal_heading_kp: 1.5 + near_goal_heading_ki: 0.0 + near_goal_heading_kd: 0.0 + +GoalChecker: + library_path: libmkt_plugins_goal_checker + +SimpleGoalChecker: + library_path: libmkt_plugins_goal_checker \ No newline at end of file diff --git a/config/runtime/priest_local_planner_params.yaml b/config/runtime/priest_local_planner_params.yaml new file mode 100644 index 0000000..a6d982c --- /dev/null +++ b/config/runtime/priest_local_planner_params.yaml @@ -0,0 +1,259 @@ +PriestLocalPlanner: + library_path: libpriest_local_planner + + # ================= Tầm nhìn / bộ tối ưu ================= + t_fin: 7.0 # [s] tầm nhìn dự báo, robot lập kế hoạch trước bao lâu + t_fin_min: 1.0 # [s] > 0 = BẬT co horizon theo path còn lại: gần cuối tuyến, + # t_fin hiệu dụng = arc_còn_lại / reference_velocity (không nhỏ hơn sàn + # này) — quỹ đạo phủ path còn lại Ở ĐÚNG tốc độ hành trình, hết bò + # (v ~ remaining/t_fin) và hết mốc 25/50/75 chồng dồn, trong MỘT bộ điều + # khiển, không chuyển chế độ. Chính sàn này định hình cú phanh cuối: + # v ~ remaining/t_fin_min trên đoạn reference_velocity x t_fin_min chót + # (1.0 -> phanh trên 0.4 m cuối). Nhiễu ngang CEM tự co theo tỉ lệ + # horizon. 0 = tắt (horizon cố định như cũ; goal_approach_distance cũ + # lúc đó mới có tác dụng) + num_steps: 30 # số điểm mẫu trên mỗi quỹ đạo trong tầm nhìn đó + num_batch: 60 # số quỹ đạo sinh ra mỗi vòng lặp CEM. Tăng = tìm kỹ hơn, tốn CPU hơn + initial_up_sampling: 5 # hệ số sinh dư ứng viên ở vòng đầu trước khi lọc + ellite_num: 40 # số quỹ đạo "tinh hoa" giữ lại, xếp hạng theo sai số chiếu + num_warm: 20 # số quỹ đạo mang từ chu kỳ trước sang để khởi động nóng + max_proj_iter: 8 # số vòng lặp chiếu luân phiên (alternating projection) + proj_early_exit_tolerance: 0.01 # thoát sớm vòng chiếu khi tổng residual hết cải thiện quá tỉ lệ + # này (0 = tắt, chạy đủ max_proj_iter). Đường thoáng hội tụ sau 3-4 + # vòng — phần còn lại tính lại y nguyên kết quả. Sát vật cản residual + # còn động nên vẫn chạy đủ ngân sách; log proj_it= cho thấy số vòng thật + proj_early_exit_residual: 0.05 # [m] vế TUYỆT ĐỐI của early-exit: residual của ELITE TỆ NHẤT (hạng + # ellite_num) dưới ngưỡng này là thoát — mọi thứ CEM sẽ dùng đã khả thi. + # Thiếu vế này tiêu chí tương đối chạy NGƯỢC: thoáng không bao giờ thoát + # (residual bé nhưng còn giảm >1%/vòng), sát vật cản lại thoát sớm khi + # residual LỚN nhưng chững. 0 = tắt vế + max_cem_iter: 3 # số vòng lặp CEM mỗi chu kỳ điều khiển + optimizer_threads: 4 # số thread giới hạn. Đừng lấy hết số core — overhead nuốt hết lợi ích + solve_time_warn_ms: 30.0 # [ms] cảnh báo khi giải lâu hơn ngưỡng này, chừa biên trong chu kỳ 30 Hz + lateral_std: 0.8 # [m] độ lệch chuẩn khi nhiễu loạn waypoint theo phương ngang. + # Lớn = khám phá rộng, dễ tìm đường vòng; nhỏ = bám sát path toàn cục + + # ================= Giới hạn robot (dẫn động vi sai) ================= + max_velocity: 0.5 # [m/s] trần vận tốc tiến + max_angular_velocity: 0.4 # [rad/s] đồng thời được ép bên trong bộ tối ưu dưới dạng + # chặn gia tốc ngang |a_n| <= max_angular_velocity * v + max_acceleration: 0.5 # [m/s^2] dùng trong phép chiếu quỹ đạo + reference_velocity: 0.4 # [m/s] tốc độ hành trình mong muốn dọc path + v_eps: 0.05 # [m/s] chậm hơn ngưỡng này thì bỏ qua phần chặn/phạt độ cong, + # tránh chia cho số gần 0 khi robot gần đứng yên + v_min_seed: 0.05 # [m/s] vận tốc mồi theo hướng yaw khi robot đang đứng yên, + # để bộ tối ưu có điểm xuất phát khác 0 + + # Đổi quỹ đạo -> lệnh vi sai (v, omega), có feedforward theo độ cong: + # omega = clamp(omega_traj, +-max_angular_velocity) - heading_gain * sai_số_hướng + heading_gain: 1.5 # [1/s] hệ số phản hồi trên sai số hướng. + # Tăng = bẻ về path nhanh hơn nhưng dễ dao động + heading_error_stop: 1.2 # [rad] lệch hướng lớn hơn ngưỡng này thì quay tại chỗ (v = 0) + min_in_place_yawrate: 0.2 # [rad/s] tốc độ quay tối thiểu khi quay tại chỗ, tránh quay quá chậm + rotate_to_path_enabled: true # bật = XOAY TẠI CHỖ về hướng path, CHỈ MỘT LẦN Ở ĐẦU PLAN (như + # stanley/hybrid; vào khi lệch > heading_error_stop, ra khi < nửa + # ngưỡng). Không có nó thì mission quay đầu bị vẽ thành cung rẽ tiến + # bán kính v/max_angular_velocity = 1 m quét qua vật cản. GIỮA mission + # không bao giờ pivot lại: lúc né, heading lệch tangent là CÓ CHỦ ĐÍCH + # (tangent chỉ thẳng vào vật cản đang né) — pivot giữa bãi từng quét + # góc thân vào tiếp xúc (sim 19/8, sv=28). Pivot cũng bị bỏ qua nếu + # probe footprint chạm costmap. Robot không xoay tại chỗ được phải TẮT + rotate_settle_yawrate: 0.05 # [rad/s] > 0 = ramp hạ cánh cho CẢ hai pha xoay tại chỗ (xoay về yaw + # goal sau latch + rotate-to-path đầu plan): trong vùng settle + # (|sai số| <= 0.3 rad) sàn tốc độ quay hạ từ min_in_place_yawrate + # xuống giá trị này — tốc độ đổ dốc theo sai số như deadbandClip + # [0.05, 0.3] của stanley Phase B, thay vì giữ 0.2 rad/s tới tận nơi + # rồi dừng phắt (bước 0.0067 rad/chu kỳ qua dải đích 0.02 rad — gắt, + # dễ lắc mép). Còn xa vẫn dùng sàn min_in_place_yawrate để thắng ma + # sát. 0 = tắt (một sàn duy nhất như cũ) + + # ================= Goal / plan ================= + xy_goal_tolerance: 0.02 # [m] sai số vị trí chấp nhận là đã tới goal + yaw_goal_tolerance: 0.01 # [rad] sai số góc chấp nhận là đã tới goal + xy_latch_release_factor: 5.0 # chốt XY: vào trong xy_goal_tolerance là coi phần vị trí XONG, chỉ + # [19/8] 2.0 với tolerance 0.02 = vành nhả 0.04 m — robot latch lúc + # còn trôi 0.2 m/s (phanh cần 4-6 cm) là văng khỏi vành ngay, xoay + # tại chỗ cũng lắc quá 4 cm (đo: nhả ở 0.041 và 0.042, orbit 74 s + # quanh goal). 5.0 = vành 0.10 m, đủ nuốt quán tính + rung khi xoay. + # còn XOAY TẠI CHỖ về yaw goal. Không chốt thì hai dung sai phải trùng + # cùng một chu kỳ — robot lượn quanh goal chờ trùng khoảnh khắc (đo + # sim 18/8: 22-38 s mới xong hoặc không bao giờ). Nhả chốt khi bị đẩy + # ra quá xy_goal_tolerance x hệ số này (hysteresis). <= 1.0 = tắt + # (hành vi cũ). Robot KHÔNG xoay tại chỗ được (một bánh lái) thì phải + # tắt và để profile rotate lo phần yaw + goal_approach_distance: 0.0 # [m] vùng tiếp cận goal. Hành lang SẠCH vật cản: bỏ PRIEST, chạy thẳng + # về goal pose với profile giảm tốc vật lý sqrt(2*a_max*dist) — hết bò + # (terminal ghim trải arc còn lại lên trọn t_fin) lẫn lắc đầu (CEM tách + # hai họ cắt-cua/bám-cua trên đoạn cong). CÓ vật cản trong hành lang: + # vẫn PRIEST với reference_velocity co theo quãng còn lại. 0 = tắt + omega_ff_min_speed: 0.15 # [m/s] dưới tốc độ này feedforward độ cong mờ dần tuyến tính. + # omega_ff = cross/v^2 — bò chậm trên đoạn CONG là nó kịch trần và lật + # dấu theo nhiễu (lắc đầu; đoạn thẳng tử số ~0 nên không lắc). Feedback + # heading vẫn lái. 0 = tắt (feedforward đầy đủ mọi tốc độ như cũ) + max_global_plan_lookahead_dist: 3.0 # [m] chỉ lấy phần path toàn cục trong tầm này để bám + hold_timeout: 10.0 # [s] đứng chờ (pivot bị chặn ở goal / fallback bị chặn) quá chừng + # này thì trả fail cho move_base2 leo thang (recovery/abort báo fleet). + # Trước đây chờ VÔ HẠN: obs tĩnh đè goal + planner_frequency 0 = treo + # câm 30+ s không ai biết (đo 19/8 20h35). 0 = chờ vô hạn như cũ + goal_blocked_check_radius: 1.5 # [m] trong bán kính này quanh goal thì dò ĐĨA nửa thân robot quanh goal trên costmap + # mỗi cycle: cell nào cost >= 253 (vỏ obs đè goal — lidar chỉ mark vỏ, cell tâm thân obs vẫn free/unknown) thì DỪNG-CHỜ + # kiểu hybrid thay vì bám nghiệm solver lượn quanh obs (đo 19/8: 2 vòng + # orbit 0.8-1.9 m). Obs dọn đi thì tự chạy tiếp; không thì hold_timeout + # leo thang. 0 = tắt kiểm tra + + # ================= Vật cản (lấy từ local costmap) ================= + num_obs: 250 # số vật cản đưa vào hàm chi phí CEM + num_obs_proj: 200 # số vật cản gần nhất đưa vào phép chiếu + obstacle_range: 2.8 # [m] bán kính quét costmap quanh robot + robot_radius: 0.50 # [m] bán kính robot dùng cho phép kiểm va chạm + obstacle_point_radius: 0.08 # [m] bán kính quy ước cho mỗi điểm vật cản + footprint_padding: 0.05 # [m] nới footprint thêm để có biên an toàn + obstacle_cost_threshold: 253 # ô costmap có cost >= ngưỡng này mới coi là vật cản + obstacle_cell_step: 2 # bước nhảy khi quét ô costmap. Lớn = nhanh hơn, bỏ sót nhiều hơn + max_obstacle_points: 250 # trần số điểm vật cản, chặn chi phí tính toán khi môi trường dày + + # Footprint phủ bằng nhiều circle dọc thân robot thay cho một disc tại base_link. + # Robot 1.166x0.96 m: disc robot_radius 0.50 hụt mũi/đuôi ~0.13 m (bán kính ngoại tiếp 0.755) — + # lách là quệt góc; phình disc che đủ thì khe ~1.8 m mới qua. 3 circle r=0.52 tâm {-0.39, 0, +0.39} + # che kín chữ nhật mà khe ~1.3 m vẫn lách được. Mỗi cặp (vật cản, circle) là một virtual obstacle + # dịch theo heading quỹ đạo; nhờ sparse gating chi phí chỉ nhân vào cặp va chạm. + footprint_circle_count: 3 # số circle. 1 = disc cũ tại base_link (dùng robot_radius, bỏ qua + # hai khoá dưới) + footprint_circle_spacing: 0.39 # [m] khoảng cách tâm hai circle kề nhau, xếp đối xứng quanh base_link + footprint_circle_radius: 0.52 # [m] bán kính mỗi circle khi count > 1; cộng obstacle_point_radius + # + footprint_padding thành ellipse va chạm mỗi circle + start_violation_ramp_time: 1.5 # [s] > 0 = BẬT ramp cho vật cản mà robot ĐANG vi phạm ellipse ngay + # tại điểm xuất phát (đỗ cách tường 0.5-0.6 m là dính, vì ellipse + # mô hình 0.65 m phóng đại hơn thân thật): không ramp thì phép chiếu + # VÔ NGHIỆM từ sample 0 — res có sàn dương vĩnh viễn, optimizer phát + # lệnh "ít tệ nhất" và robot trườn vào tiếp xúc thật (đo sim 19/8: + # res treo 4-7 suốt 10 s dù thấy đủ 80/88 điểm). Bật: ellipse của + # riêng vật cản đó co về sát khoảng cách hiện tại rồi nở lại đầy đủ + # trong chừng này giây đầu horizon — ràng buộc thành "không chui sâu + # hơn, thoát ra dần". Chỉ áp cho phép chiếu; cost giữ ellipse đầy đủ + # nên vẫn đẩy robot ra xa. 0 = tắt + + # Chọn điểm theo HÀNH LANG dọc plan thay vì gần robot nhất: lọc điểm trong bán kính + # corridor_radius quanh polyline plan (đã cắt lookahead) + vị trí robot, và chia đều trần + # num_obs dọc hành lang (round-robin) — hết cảnh một bức tường sát robot nuốt trọn budget + # trong khi vật cản 2 m phía trước trên tuyến thì vô hình. + obstacle_corridor_enabled: true # bật trên cây sim để đánh giá; tắt = chọn gần robot nhất như cũ + corridor_radius: 1.2 # [m] nửa bề rộng hành lang chọn điểm. Sàn tự động = robot_radius + + # obstacle_point_radius + footprint_padding; rộng hơn = nhìn xa hai + # bên hơn nhưng tốn suất điểm hơn + corridor_sample_spacing: 0.3 # [m] bước lấy mẫu plan làm xương hành lang. Nhỏ = bucket mịn, + # chia suất đều hơn dọc tuyến; không cần nhỏ hơn nhiều so với + # resolution costmap (0.05) + + # ================= Cổng va chạm sau solve ================= + # Ràng buộc vật cản trong optimizer là MỀM (ADMM) và mô hình disc không phủ hết footprint chữ + # nhật thật — solve "thành công" vẫn có thể phát quỹ đạo quệt vật cản. Cổng này tra costmap dọc + # phần đầu quỹ đạo được chọn, tại 3 điểm trên trục robot mỗi sample: đuôi / tâm / mũi (xoay theo + # heading của quỹ đạo). Dính vật cản thì KHÔNG phát lệnh (robot dừng, move_base2 leo thang theo + # controller_patience). Chi phí ~30 lần tra ô mỗi chu kỳ — không đáng kể. + collision_check_enabled: false # tắt = hành vi cũ (tin hoàn toàn ràng buộc mềm của optimizer) + collision_check_time: 2.0 # [s] chỉ kiểm phần quỹ đạo robot sẽ đi trong khoảng này. + # Xa hơn sẽ còn được replan nhiều lần trước khi tới nơi; + # tăng = dừng sớm hơn nhưng dễ dừng oan vì dự đoán xa. + collision_check_front_offset: 0.583 # [m] tầm mũi robot tính từ base_link (theo footprint T800 + # trong move_base2_control.launch: nửa dài 0.583) + collision_check_rear_offset: 0.583 # [m] tầm đuôi robot tính từ base_link + collision_check_side_offset: 0.48 # [m] thêm 2 probe HÔNG trái/phải cách trục dọc chừng này (nửa bề + # rộng robot 0.48) — 3 probe trục dọc chỉ che chiều dài, cú quệt + # hông đầu mission 4 (sim 18/8) lách đúng chỗ này. 0 = 3 probe cũ + collision_check_cost_threshold: 253 # cost costmap >= ngưỡng này coi là chạm (253 = + # INSCRIBED_INFLATED_OBSTACLE, 254 = LETHAL; ô NO_INFORMATION + # được bỏ qua). Hạ xuống là gate nhạy hơn theo vùng inflation. + + # Head slowdown — bản MỀM của gate: thay vì từ chối lệnh, GIẢM TỐC khi đầu quỹ đạo đi vào + # vùng costmap XẤU HƠN chỗ thân robot đang đứng (5 điểm probe chung với gate, đo cả tại pose + # hiện tại làm baseline). SO TƯƠNG ĐỐI là bắt buộc: trong hành lang hẹp hai probe hông nằm + # vĩnh viễn trong vành inscribed (253) — bản so tuyệt đối phanh đáy suốt 81 s, mission 40 s + # thành 125 s (đo sim 19/8 chiều). Mức phanh còn NHÂN theo ĐỘ GẦN thời gian của ô xấu: + # ô 253 ở tận mép cửa sổ (t=1.45/1.5 s) chỉ rà nhẹ ~0.97 (nằm trong dead-band, coi như + # không phanh), ở 0.75 s -> 0.60, sát mũi 0.2 s -> 0.31 — không có nó, VÀO CỬA hành lang + # (base còn 60, đầu đã chạm band) bị ghim đáy 25 s chờ baseline leo lên. Xấu hơn cả + # baseline đã 253 (LETHAL phía trước) vẫn nhân độ gần. Phanh NGAY, nhả có debounce (ô mép + # nhấp nháy làm lệnh giật). Scale cả v lẫn omega — đường hình học giữ nguyên, chỉ chậm lại. + # Log: engaged/released kèm head/base/t của sample quyết định mức phanh, mức 2 in định kỳ. + head_slowdown_time: 1.5 # [s] cửa sổ đầu quỹ đạo được probe. 0 = TẮT toàn bộ + head_slowdown_cost_free: 128 # sàn dưới của baseline: cost <= max(baseline, ngưỡng này) chạy + # đủ tốc độ; từ đó tới 253 giảm tuyến tính + head_slowdown_min_scale: 0.35 # sàn tỉ lệ tốc độ khi có ô LETHAL (254) trước mũi — tiếp xúc + # dự báo thật. Đừng đặt 0 — đứng im vĩnh viễn không leo thang + # được như gate ném exception + head_slowdown_inscribed_scale: 0.7 # tỉ lệ khi ô xấu nhất chỉ là INSCRIBED (253). Probe nằm ở MÉP + # thân robot mà 253 mang ngữ nghĩa "TÂM robot ở đây thì chắc chắn + # va" — áp cho điểm mép là đếm footprint hai lần: probe hông cách + # tường 0.17 m đọc 253 trong khi thân hoàn toàn ổn. Đo 19/8: mỗi + # lần VÀO band phanh 0.5 -> 0.09 rồi ngay sau đó chạy 0.5 trong + # band ngon lành. 253 chỉ đáng rà nhẹ (0.7), 254 mới đạp sâu. + # 1.0 = coi 253 như tự do + head_slowdown_release_cycles: 10 # số chu kỳ SẠCH liên tiếp mới nhả phanh (10 ~ 0.33 s @30 Hz); + # trong lúc chờ giữ nguyên mức phanh cuối. 0 = nhả tức thì + + # ================= Trọng số hàm chi phí ================= + # Chỉnh các trọng số này là chỉnh "tính cách" của planner. Tăng một cái tức là + # giảm tương đối tất cả những cái còn lại. + weight_smoothness: 0.1 # phạt quỹ đạo gãy khúc + weight_track: 0.2 # phạt lệch khỏi path toàn cục + weight_obs: 1.2 # phạt tiến gần vật cản + weight_clearance: 3.0 # phần thưởng giữ khoảng hở, giá trị trong (0,1]: bằng 1 ngay tại + # tâm vật cản, 0.5 tại biên va chạm, 0 khi ngoài tầm + weight_angular: 0.5 # phạt kiểu bản lề khi |omega| vượt max_angular_velocity + weight_velocity_deficit: 2.0 # phạt HỤT TỐC ở ĐOẠN ĐẦU quỹ đạo (1/4 horizon đầu, chuẩn hoá 0..1). + # Endpoint bị pin nên mean speed toàn horizon gần bằng nhau cả batch — + # nghiệm "chậm" thực chất chậm ở ĐẦU (né tới bãi vật cản muộn hơn trong + # horizon nên ít cặp va chạm hơn, thắng ranking) mà đầu lại chính là + # phần được phát lệnh. Đo sim 19/8: vtraj sập 0.11-0.13 suốt ~7 s khi + # res treo 2.7-3.0 dù không gì phanh. Mốc so = min(v_des, + # arc_còn_lại/t_fin) nên KHÔNG chống lại cú phanh cuối của re-time. + # Test A/B: settle 0.33 -> 0.42 m/s cạnh bãi obs. 0 = tắt + cem_lamda: 0.9 # nhiệt độ CEM. Thấp = chỉ tin nhóm tinh hoa, hội tụ nhanh nhưng dễ kẹt + cem_alpha: 0.7 # hệ số pha trộn mean/cov giữa hai vòng CEM. Cao = đổi chậm, ổn định hơn + + # Hysteresis chọn bên khi né vật cản nằm giữa tuyến. Không neo bên thì CEM có hai nghiệm + # trái/phải cost gần bằng nhau: mean phân bố "cưỡi" lên vật cản (trung bình của vòng trái và + # vòng phải là đường xuyên tâm), quỹ đạo nhảy qua lại hai bên và robot trườn dần vào vật cản. + # Bật: lọc elite ngược bên khỏi bước cập nhật CEM, nhớ bên đã chọn qua các chu kỳ. + side_hysteresis_enabled: true # bật trên cây sim; tắt = hành vi CEM cũ (có thể dao động hai bên) + side_switch_margin: 0.2 # bên kia phải rẻ hơn ít nhất tỉ lệ này mới được đổi bên (0.2 = 20%). + # Tăng = lì hơn, hết nhảy nhưng chậm nhận đường tốt hơn khi map đổi; + # giảm về 0 = tắt tác dụng hysteresis dù cờ đang bật + side_hold_cycles: 60 # số chu kỳ KHOÁ bên vừa commit, chồng lên side_switch_margin. Trường + # vật cản dày cost hai bên đều lớn và nhiễu, chênh 20% giữa hai chu kỳ + # là chuyện thường nên margin đơn lẻ vẫn flap (đo sim 18/8: đảo bên 4 + # lần/11 s). Khoá nhả sớm nếu bên cũ biến mất khỏi elite. 0 = tắt + side_infeasible_res: 0.3 # [m] "khả thi thắng bất khả thi": bên đang commit có residual elite + # tốt nhất TRÊN ngưỡng này trong khi bên kia có elite DƯỚI ngưỡng -> + # đổi bên NGAY, bỏ qua cả side_switch_margin lẫn side_hold_cycles. + # Margin so COST chứ không so tính khả thi — đo sim 19/8: robot ôm bên + # bất khả thi 13 s (res 1.2-2.8) trườn dần vào vật cản vì chênh cost + # không bao giờ đạt 20%, trong khi bên kia đổi phát là res sập về 0.03. + # Hai bên cùng khả thi thì margin + hold vẫn cầm quyền như cũ. 0 = tắt + side_switch_feasible_res: 0.25 # [m] > 0 = guard ĐỔI BÊN: rời bên đã commit chỉ được chấp nhận khi + # elite tốt nhất của BÊN MỚI có residual <= ngưỡng này (nghiệm mới + # THỰC THI ĐƯỢC từ pose hiện tại). Giữa bãi vật cản, nghiệm bên kia + # còn CẮT XUYÊN vật cản (start ghim vào pose robot) — margin so cost + # vẫn cho nhảy và thân quét ngang qua vật cản đang né (đo sim 19/8: + # flip ở sv=10, res 2.9-3.9, sv vọt 54, quệt thật). Bị chặn thì ở lại + # bên cũ; đếm trong log sblk=. Margin + hold vẫn áp bình thường. + # Bên cũ hết elite thì guard tự nhường. 0 = tắt + + # ================= Debug ================= + # Nhóm log chẩn đoán [DBG-PRIEST-*]. debug_level là công tắc tổng; ba cờ dưới chọn nhóm. + # Mức 3 in mỗi chu kỳ (~30 dòng/giây @ 30 Hz) — chỉ dùng khi truy lỗi, xong trả về 0. + debug_level: 0 # 0=tắt 1=chỉ log khi sự kiện đổi (solve fail/hồi, điểm vật cản chạm trần) + # 2=log định kỳ throttle 1 Hz 3=log mọi chu kỳ điều khiển + debug_solve: true # [DBG-PRIEST-SOLVE] thời gian từng stage của optimizer [ms], số cặp + # (điểm quỹ đạo, vật cản) va chạm / tổng, residual + cost của quỹ đạo + # được chọn, warm start. Dùng khi đo CPU/solve time (vd trên RK3588S). + debug_obstacles: true # [DBG-PRIEST-OBS] số điểm vật cản gom từ costmap so với trần thật + # (trần = min(max_obstacle_points, num_obs)). Chạm trần = optimizer + # đang mù vật cản xa hơn theo hướng chạy — cảnh báo một lần khi đổi trạng thái. + debug_command: true # [DBG-PRIEST-CMD] lệnh phát ra + trạng thái lúc đó, một dòng đủ + # ngữ cảnh: state (track / inplace / rot2path / rot2goal / fallback), + # v & omega SAU clamp, vtraj (tốc độ theo quỹ đạo trước chuyển đổi), + # ff, zeta, hscale (mức head slowdown đã áp), vmeas (tốc độ đo), + # dist tới goal, res/sv/side của solver. Mức 2 throttle 1 Hz, + # mức 3 in mỗi chu kỳ — ồn nhất, xong việc trả về false. diff --git a/config/runtime/recovery_behaviors_params.yaml b/config/runtime/recovery_behaviors_params.yaml new file mode 100644 index 0000000..cfe69ee --- /dev/null +++ b/config/runtime/recovery_behaviors_params.yaml @@ -0,0 +1,310 @@ +# ================================================================================================= +# recovery_core — bộ recovery behavior (gen-2, tick-based) và tham số vận hành. +# +# Quy ước comment: dòng mô tả = LÀ GÌ / vì sao; `► Chỉnh:` = tăng giảm theo triệu chứng nào. +# +# Đây là cây config RUNTIME. Bản dùng cho test của gói nằm ở +# `Test/recovery_core/test/config/recovery_behaviors_params.yaml` — sửa tham số vận hành thì sửa ở +# đây, đừng sửa bản test. +# +# Danh sách này được `recovery_core::RecoveryRegistry` đọc; caller (RecoveryRunner của move_base2) +# truyền namespace `recovery` vào. Khoá `recovery_behaviors:` trong `move_base_common_params.yaml` +# thuộc về move_base cũ và KHÔNG liên quan tới file này. +# ================================================================================================= + +recovery: + # `behaviors` là registry mọi plugin/instance CÓ THỂ dùng. Thứ tự ở đây chỉ là thứ tự nạp, + # không còn quyết định luồng chạy. `routes` bên dưới chọn riêng chuỗi theo trigger. + # + # wait : không di chuyển. Vật cản động (người, xe khác) tự đi qua là xong. + # clear : xoá vật cản đã tích trong costmap, gần trước rồi xa sau. + # rotate : quay tại chỗ cho costmap nhìn lại xung quanh. + # back_up: LÙI — hướng robot không có sensor, nên xếp cuối cùng. + # + # ► Chỉnh: khai ở đây KHÔNG làm behavior chạy — phải đưa tên nó vào một `route` bên dưới. Một + # `type` được phép khai nhiều `name` khác nhau để có nhiều instance khác tuning (vd một + # `back_up` lùi 0.1 m và một `back_up_far` lùi 0.6 m). + behaviors: + - {name: wait, type: WaitRecovery} + - {name: clear, type: ClearCostmapRecovery} + # Đặt schema trước plugin: chưa có `DetourPathRecovery`/library_path thì RecoveryRunner bỏ + # entry này cùng warning, và bỏ nó khỏi từng route. Khi plugin SBPL được thêm sau này, không + # cần sửa move_base2 hay route. + - {name: detour_path, type: DetourPathRecovery} + - {name: rotate, type: RotateRecovery} + - {name: back_up, type: BackUpRecovery} + + # trigger -> tên behavior thử tuần tự; lần lỗi kế tiếp cùng trigger mới tiến tới phần tử tiếp + # theo của route đó. Đường quay về sau khi một behavior kết thúc (contract 2026-08-04b): + # - planning_failed -> quay về PLANNING lập plan lại (không có plan nào để bám); + # - controlling/oscillation-> quay về CONTROLLING bám tiếp GLOBAL PATH CŨ, KHÔNG lập plan lại + # (thay plan trong lúc chạy là việc riêng của planner_frequency); + # riêng khi leo thang từ PLANNING vì mất pose thì về PLANNING; + # - behavior họ detour (output kPath, vd DetourPathRecovery) nộp path mới -> path đó được áp + # và robot bám tiếp — cách duy nhất một recovery được thay plan. + # Robot đi được quá `oscillation_distance` thì mọi cursor route được reset — ngân sách recovery + # đầy lại theo tiến độ thật (2026-08-04). + # + # Ý NGHĨA TỪNG TRIGGER: + # planning_failed : planner CÓ dữ liệu nhưng không tìm được đường. + # controlling_failed : MẤT DỮ LIỆU/LỆNH — controller không ra lệnh (kể cả mất pose) quá + # `controller_patience`, hoặc mất pose ngay trong PLANNING, hoặc costmap + # stale liên tục quá `sensor_patience`. + # oscillation : quẩn trong bán kính `oscillation_distance` quá `oscillation_timeout`. + # path_blocked : DỰ BÁO tuyến phía trước bị chắn (giám sát tuyến). + # off_path : DỰ BÁO robot đã lệch khỏi plan quá ngưỡng. + # + # ► Chỉnh route: + # - route RỖNG = tắt hẳn trigger đó. `path_blocked`/`off_path` được phép rỗng; ba route còn lại + # bắt buộc có ít nhất một behavior (config validate chặn). + # - route được phép LẶP behavior: mỗi lần xuất hiện là một lượt thử (`[detour, wait, detour]`). + # - route dài hơn = kiên nhẫn hơn nhưng chậm báo lỗi lên fleet hơn. + # - thứ tự nên đi từ RẺ và AN TOÀN tới ĐẮT và RỦI RO: wait/clear -> rotate -> detour -> back_up. + routes: + planning_failed: [wait, clear] + controlling_failed: [detour_path] + oscillation: [wait] + # Cursor reset (2026-08-05): recovery THÀNH CÔNG + NỘP PATH MỚI (detour) thì cursor của trigger + # đó reset NGAY — lần chắn kế tiếp là sự cố mới, detour được chạy lại. Từ chối/thất bại mới ăn + # vào ngân sách route. + # + # Cạn route KHÔNG còn nghĩa là ABORT (contract 2026-08-05e): `path_blocked`/`off_path` là DỰ + # BÁO, plan vẫn hợp lệ và controller vẫn ra lệnh được, nên robot bám tiếp plan cũ và trigger bị + # KHOÁ tới khi đi được quá `oscillation_distance`. Đường ABORT hợp lệ duy nhất đi qua + # `controlling_failed` (controller thật sự hết ra lệnh quá controller_patience) hoặc + # `planning_failed`. + path_blocked: [detour_path] + off_path: [detour_path] + + # --- wait: đứng yên, không phát vận tốc --------------------------------------------------------- + wait: + # [s] Thời gian đứng yên. + # ► Chỉnh: TĂNG (5–10) ở khu đông người để vật cản động kịp đi qua; GIẢM nếu robot đứng chờ quá + # lâu ở chỗ vật cản thật ra là tĩnh. Thời gian này robot KHÔNG phát cmd_vel. + wait_duration: 3.0 + + # --- clear: xoá vật cản đã tích trong costmap --------------------------------------------------- + # + # Đường thoát đúng khi bẫy là VẬT CẢN MA (costmap giữ lại thứ không còn ở đó). Rẻ nhất trong bộ, + # nên thường đặt đầu route. + clear: + # [m] Cạnh vùng vuông quanh robot sẽ bị xoá. + # ► Chỉnh: TĂNG nếu ma nằm xa hơn (nhưng xoá rộng = mất cả vật cản THẬT vừa quan sát được, robot + # có thể lao vào chỗ vừa xoá). GIẢM để an toàn hơn. Đừng vượt quá cửa sổ costmap local (8 m). + reset_distance: 3.0 + # false = xoá BÊN TRONG vùng; true = xoá BÊN NGOÀI (giữ lại vùng gần robot). + # ► Chỉnh: true chỉ hợp lý khi muốn giữ vật cản gần và bỏ dữ liệu xa đã cũ. + invert_area_to_clear: false + # local | global | both — costmap nào bị xoá. + # ► Chỉnh: `local` nếu chỉ muốn làm mới dữ liệu sensor mà không đụng bản đồ tích luỹ. + affected_maps: both + # Phải khớp `plugins:` của costmap; sai tên -> log kèm tên layer thật. + # ► Chỉnh: thêm tên layer nếu costmap có nhiều layer vật cản (vd `[obstacles, voxel_layer]`). + # Đây KHÔNG phải số tinh chỉnh — sai tên là behavior không xoá gì cả. + layer_names: [obstacles] + + # --- rotate: quay tại chỗ cho sensor quét lại xung quanh ----------------------------------------- + rotate: + # true = quay đủ 2*pi để costmap thấy toàn bộ xung quanh. + # ► Chỉnh: false = quay theo `goal.angle` do caller đặt, và nếu caller không đặt thì dùng + # `target_angle` bên dưới. Giữ true cho mục đích "nhìn lại xung quanh". + full_rotation: true + + # [rad] Góc quay mặc định khi `full_rotation: false` VÀ caller không truyền `goal.angle`. + # Giá trị hiện tại = 2*pi (tức bằng full_rotation), nên khi `full_rotation: true` nó nằm im. + # ► Chỉnh: viết SỐ CỤ THỂ, đừng viết biểu thức kiểu `2 * 3.14159` — parser YAML không tính. + # Dấu quyết định chiều quay. Ví dụ nửa vòng: 3.141592653589793. + # Giá trị bị clamp về |target_angle| nên không thể quay quá một vòng. + target_angle: 6.283185307179586 + # [rad/s] Độ lớn tốc độ quay; dấu do goal.angle quyết định. + # ► Chỉnh: phải <= max_vel_theta của robot. GIẢM nếu có tải cao/dễ đổ; TĂNG để recovery nhanh + # hơn nhưng sensor có thể nhoè khi quét. + angular_speed: 0.4 + # [rad/s^2] Ramp gia tốc, tránh giật khi có tải. + # ► Chỉnh: GIẢM khi chở hàng dễ đổ; TĂNG nếu robot mất quá nhiều thời gian mới đạt tốc độ. + acc_lim_theta: 0.8 + # [rad] Bước quét footprint dọc cung lúc start (kiểm va chạm trước khi quay). + # ► Chỉnh: GIẢM (0.05) để kiểm kỹ hơn ở chỗ chật, đổi lại tốn CPU lúc start. TĂNG thì có nguy cơ + # bỏ sót một vị trí góc bị chạm. + sim_granularity: 0.1 + # [s] Lưới cuối nếu robot bị giữ cơ học (bánh trượt, bị chèn). + # ► Chỉnh: phải > thời gian quay 2*pi ở `angular_speed` (2π/0.4 ≈ 15.7 s) cộng dư địa ramp. + # Đặt thấp hơn là behavior LUÔN kết thúc bằng timeout. + timeout: 20.0 + + # --- back_up: lùi thẳng ------------------------------------------------------------------------- + # + # Hướng lùi KHÔNG có sensor -> rủi ro cao nhất trong bộ, thường xếp cuối route. + back_up: + # [m] Quãng lùi mặc định khi caller không chỉ định. + # ► Chỉnh: TĂNG (0.3–0.6) nếu robot cần lùi hẳn ra khỏi hốc/khe kệ mới xoay được; GIẢM nếu phía + # sau thường có người/vật. Nhớ phía sau là vùng mù. + backup_distance: 0.1 + # [m] Trần cứng, chặn cả `goal.distance` do caller truyền lẫn param ở trên. + # ► Chỉnh: đây là chốt an toàn, đặt bằng quãng lùi mù xa nhất còn chấp nhận được ở hiện trường. + backup_distance_max: 1.0 + # [m/s] ĐỘ LỚN; dấu âm (lùi) do plugin đặt. + # ► Chỉnh: giữ chậm (<= 0.15) vì đi mù. TĂNG chỉ khi có sensor sau. + linear_speed: 0.1 + # [m/s^2] Ramp gia tốc. + # ► Chỉnh: GIẢM khi chở tải dễ đổ. + acc_lim_x: 0.3 + # [s] Lưới cuối. + # ► Chỉnh: phải > backup_distance_max / linear_speed (1.0/0.1 = 10 s) cộng dư địa ramp. + timeout: 15.0 + + # --- detour_path: lập đường vòng quanh vật cản rồi NỐI LẠI tuyến -------------------------------- + # + # Gói `sbpl_recovery`, họ kPath: nó KHÔNG lái robot, chỉ TRẢ VỀ một path; runtime áp path đó và + # local planner đang active bám theo. Đường vòng được bám ngay, không replan (contract 08-04b). + detour_path: + # Instance planner RIÊNG, không dùng chung SBPLLatticePlanner của backup: detour gọi makePlan + # ĐỒNG BỘ trên control thread, nên `allocated_time` của instance này là trần treo control loop + # mỗi tick. Xem khối SBPLDetourPlanner ở cuối file. + # + # ► Chỉnh: `planner_name` là NAMESPACE PARAM (khối bên dưới), `planner_symbol` là ALIAS Boost.DLL + # CÓ THẬT trong .so. Đây không phải số tinh chỉnh — đổi sai là runtime không nạp được plugin. + planner_name: SBPLDetourPlanner + planner_symbol: SBPLLatticePlanner # libsbpl_lattice_planner chỉ export đúng một symbol này. + # Khác bộ local planner, nơi mỗi biến thể là một class riêng + # nên tên instance trùng alias. + + # "combined" (2026-08-05, vòng 3 — LƯỚI GỘP, xem DETOUR_MERGED_GRID_PLAN.md): snapshot global + # làm nền (tường/kệ tĩnh toàn bản đồ) + đè cửa sổ local lên (vật cản sensor tươi), SBPL lập + # đường TRÊN BẢN CHỤP GỘP — không giữ mutex costmap nào trong lúc search, map update không bị + # bỏ đói dù attempt thua. Một bên báo chắn là chắn; local FREE không xoá tường global. + # Cần planner export capability "ExternalGrid" (sbpl_lattice_planner có sẵn). + # + # ► Chỉnh: giữ `combined`. `local` = chỉ cửa sổ lăn, cho hệ không có global costmap — điểm nối + # kẹt trong cửa sổ. `global` = chỉ lưới tĩnh: ĐÃ ĐO và LOẠI trên sim, global không nạp sensor + # nên goal nào SBPL cũng vẽ xuyên đúng chỗ vật cản tươi (6/6 attempt hỏng). + costmap_source: combined + + # [m] Điểm nối phải cách robot tối thiểu chừng này (đo Euclid). + # ► Chỉnh: TĂNG nếu đường vòng quá ngắn/gấp khiến local planner không bám nổi. GIẢM nếu ở chỗ + # chật không tìm nổi điểm nối. Phải < `max_rejoin_distance` khi cái đó > 0. + planning_distance: 1.0 + + # [m] TRẦN quét dọc plan, thuần tuỳ chọn. 0 = quét tới CUỐI PLAN (lưới gộp phủ toàn bản đồ nên + # không còn ràng buộc cửa sổ local). Quét luôn tự dừng ở rìa lưới. + # ► Chỉnh: GIỮ 0. Hai lần sim 2026-08-05 đặt cap hữu hạn (3.8 rồi 8.0) đều cắt quét ngay sau pose + # bẩn cuối và báo "không có chỗ sạch" OAN. Chỉ đặt > 0 khi muốn chặn cứng độ dài đường vòng. + max_rejoin_distance: 0.0 + + # [m] Khoảng cách dọc plan giữa hai ứng viên điểm nối liên tiếp. + # ► Chỉnh: TĂNG để ba ứng viên trải rộng hơn (thử được nhiều chỗ khác nhau hơn); GIẢM để thử + # dày quanh một vùng. Cùng `attempts_per_run` quyết định tầm phủ: 3 x 0.5 = ~1.5 m. + sample_step: 0.5 + + # [m] Điểm nối phải cách pose bẩn gần nhất CẢ HAI PHÍA dọc plan chừng này, và nằm SAU pose bẩn + # CUỐI CÙNG CÒN NHÌN THẤY ĐƯỢC (trong cửa sổ local — contract 2026-08-05f). Chỗ chắn ngoài tầm + # nhìn là dữ liệu cũ, không được quyền quyết định điểm nối. + # ► Chỉnh: TĂNG (0.8–1.0) nếu nhiều lượt SBPL báo `Solution not found` — 0.5 m có thể quá sát: + # "bẩn" ở đây do kiểm MỘT ô, còn SBPL kiểm footprint đầy đủ (0.6x0.6 + inflation 0.55 m). + # GIẢM nếu ở khu chật không bao giờ tìm được điểm nối. + rejoin_clearance: 0.5 + + # Số ứng viên điểm nối thử tối đa trong một lượt; mỗi control cycle thử ĐÚNG MỘT ứng viên. + # ► Chỉnh: TĂNG = kiên nhẫn hơn nhưng mỗi lượt hỏng tốn thêm `allocated_time` giây treo control + # thread. GIẢM = từ bỏ nhanh, nhường cho behavior kế tiếp của route. + attempts_per_run: 3 + + # Tuyến để NỐI LẠI (2026-08-05e). "reference" = tuyến GỐC của chặng, tức plan do planner sinh và + # recovery không thay được: đường vòng luôn quay về tuyến order, và `max_deviation` đo đúng hành + # lang fleet đã duyệt. "current" = plan đang bám (hành vi cũ) — sim đo được tuyến bị ăn mòn dần + # qua từng lượt detour (rejoin 106/305 -> 130/289 -> 132/273) và robot không bao giờ về tuyến. + # ► Chỉnh: giữ `reference`. Chỉ đổi sang `current` khi runtime không cấp được tuyến tham chiếu + # (khi đó behavior tự quay về `current` kèm cảnh báo, không cần sửa gì). + rejoin_on: reference + + # [m] Hành lang lệch tuyến cho phép quanh tuyến gốc của order. 0 = KHÔNG giới hạn. + # ► Chỉnh: giữ 0 cho tới khi biết dung sai thật của fleet master — đặt số mò còn tệ hơn tắt. + # Khi bật, đặt bằng chiều rộng hành lang mà fleet cho phép robot rời tuyến (thường 1–2 m). + # Đường vòng vượt hành lang sẽ bị TỪ CHỐI và thử ứng viên kế tiếp. + max_deviation: 0.0 + + # [s] Trần cho cả lượt recovery này (base cưỡng chế, khác `allocated_time` của một lượt SBPL). + # ► Chỉnh: phải > attempts_per_run * allocated_time (3 x 0.4 = 1.2 s) cộng dư địa, nếu không + # behavior bị cắt giữa chừng trước khi thử hết ứng viên. + timeout: 10.0 + +# Bảng symbol -> thư viện cho Boost.DLL. KHÔNG phải tham số tinh chỉnh — thiếu khoá `library_path` +# là nguyên nhân phổ biến nhất của lỗi "plugin build xong nhưng runtime báo không tìm thấy". +WaitRecovery: + library_path: librecovery_core_wait_recovery + +ClearCostmapRecovery: + library_path: librecovery_core_clear_costmap_recovery + +RotateRecovery: + library_path: librecovery_core_rotate_recovery + +BackUpRecovery: + library_path: librecovery_core_back_up_recovery + +DetourPathRecovery: + library_path: libsbpl_recovery + +# ================================================================================================= +# Instance SBPL RIÊNG cho detour — cùng .so với SBPLLatticePlanner, khác tuning. +# +# Vì sao không dùng chung: `DetourPathRecovery::onUpdate` gọi makePlan ĐỒNG BỘ trên control thread, +# nên `allocated_time` ở đây là trần thời gian control loop bị treo mỗi tick — `cancel`/`pause` từ +# host không được xử lý trong khoảng đó. Bản backup để 10.0 s là hợp lý cho vai trò của nó, nhưng +# treo loop 10 s thì không. +# ================================================================================================= +SBPLDetourPlanner: + # KHÔNG có `library_path` ở đây: `SBPLDetourPlanner` không phải symbol, nó chỉ là namespace param. + # Việc nạp .so đi theo `planner_symbol: SBPLLatticePlanner` ở trên. + + # Kiểu môi trường và thuật toán. XYThetaLattice là loại DUY NHẤT port này hỗ trợ. + # ► Chỉnh: `planner_type` có ARAPlanner (anytime, dùng epsilon) và ADPlanner (anytime + dynamic, + # tận dụng thay đổi costmap giữa hai lượt). Giữ ARAPlanner trừ khi đo được ADPlanner nhanh hơn. + environment_type: XYThetaLattice + planner_type: ARAPlanner + + # [s] TRẦN CỨNG cho một lượt SBPL — cũng là trần treo control thread mỗi tick. + # ► Chỉnh: TĂNG nếu log nhiều `Solution not found` mà thời điểm trả về đúng bằng giá trị này (tức + # HẾT GIỜ). GIẢM nếu control loop bị giật khi detour chạy. Trả về sớm hơn nhiều giá trị này + # nghĩa là search CẠN STATE — tăng thêm cũng vô ích, vấn đề nằm ở goal không tới được. + allocated_time: 0.4 + + # Hệ số nới heuristic của ARA*: nghiệm đầu được phép đắt gấp `initial_epsilon` lần tối ưu, rồi + # thuật toán siết dần trong thời gian còn lại. + # ► Chỉnh: đây là nút ĐÁNH ĐỔI TỐC ĐỘ/CHẤT LƯỢNG quan trọng nhất. + # - TĂNG (5–15) = ra nghiệm rất nhanh nhưng đường xấu: gấp khúc, xoay tại chỗ, vòng xoắn. + # - GIẢM (1.0–2.0) = đường đẹp nhưng chậm, dễ hết giờ ở quãng xa. + # Đường vòng xấu mà vẫn ra nghiệm ⇒ giảm số này TRƯỚC khi đụng vào .mprim. + initial_epsilon: 2.0 + + # Số ô costmap thay đổi tối đa còn cho phép lập plan tăng dần; vượt ngưỡng thì lập lại từ đầu. + # ► Chỉnh: hiếm khi cần. GIẢM nếu nghi plan tăng dần đang dùng dữ liệu cũ. + force_scratch_limit: 10000 + + # Hướng tìm kiếm: true = từ start tới goal. + # ► Chỉnh: đổi sang false (backward) chỉ khi đo được nhanh hơn cho hình học tuyến của mình. + forward_search: true + + # Bỏ ràng buộc heading tại điểm xuất phát: SBPL được phép giả định robot đã xoay sẵn theo hướng + # tới goal, phần xoay để local planner lo. + # ► Chỉnh: `true` làm mỗi lượt HỎNG chạy HAI lần search (log: "no solution with free start + # heading, retrying with actual robot heading"), và lượt thành công có thể chạy BA lần (thêm + # một lượt "realign"). Đặt `false` cho detour để tiết kiệm — detour chạy khi robot ĐANG BÁM plan + # nên heading thật đã xuôi theo tuyến. Chỉ để `true` nếu local planner có bước xoay tại chỗ đầu + # path (turn_around_priority). + free_start_heading: true + + # [m/s] và [s] — dùng để quy quãng đường/góc thành CHI PHÍ thời gian, không phải giới hạn vận tốc + # thật của robot (giới hạn thật nằm ở local planner). + # ► Chỉnh: tỉ lệ giữa hai số này quyết định robot "thà đi vòng" hay "thà xoay tại chỗ". + # `timetoturn45degsinplace_secs` LỚN ⇒ xoay tại chỗ đắt ⇒ SBPL vẽ cung vòng thay vì xoay. + # Đặt sát tốc độ hành trình thật để chi phí phản ánh đúng thời gian. + nominalvel_mpersecs: 0.3 + timetoturn45degsinplace_secs: 1.31 + + # File motion primitive: tập cử động cơ sở (tiến, lùi, cung rẽ, xoay tại chỗ) kèm hệ số chi phí. + # ► Chỉnh: `resolution_m` trong file PHẢI khớp resolution costmap (0.05 m), nếu không SBPL từ chối + # nạp. Hình dạng đường vòng (gấp khúc / xoắn / nhiều đoạn xoay tại chỗ) do các + # `additionalactioncostmult` trong file này quyết định — sinh lại bằng `Test/mprim_gen`. Nên + # dùng file RIÊNG cho detour, đừng đè file mà global planner đang dùng chung. + primitive_filename: /home/duongtd/T800_ws/src/AMR_T800/Test/sbpl_lattice_planner/matlab/mprim/unicycle_highcost_5cm.mprim diff --git a/config/runtime/sbpl_global_params.yaml b/config/runtime/sbpl_global_params.yaml new file mode 100644 index 0000000..bc939ad --- /dev/null +++ b/config/runtime/sbpl_global_params.yaml @@ -0,0 +1,15 @@ +SBPLLatticePlanner: + library_path: libsbpl_lattice_planner + environment_type: XYThetaLattice + planner_type: ARAPlanner + allocated_time: 10.0 + initial_epsilon: 1.0 + force_scratch_limit: 10000 + forward_search: true + # Bỏ ràng buộc heading xuất phát: local planner đã có bước quay tại chỗ đầu path + # (turn_around_priority) nên không cần SBPL vẽ cung quay đầu khi goal ở phía sau. + # Nếu không ra nghiệm, planner tự retry một lần với heading thật của robot. + free_start_heading: true + nominalvel_mpersecs: 0.3 + timetoturn45degsinplace_secs: 1.31 # = 0.6 rad/s + primitive_filename: /home/duongtd/T800_ws/src/AMR_T800/Test/sbpl_lattice_planner/matlab/mprim/unicycle_highcost_5cm.mprim \ No newline at end of file diff --git a/config/runtime/sensor_store_params.yaml b/config/runtime/sensor_store_params.yaml new file mode 100644 index 0000000..2be7ace --- /dev/null +++ b/config/runtime/sensor_store_params.yaml @@ -0,0 +1,74 @@ +# ================================================================================================= +# Kho cảm biến THÔ dùng chung (`robot_sensor_ports`). +# +# Ai đọc file này: người cần cấp dữ liệu cảm biến cho một plugin — bộ dò dock, local planner học +# tăng cường — chứ không phải người tinh chỉnh costmap. +# +# Đây là đường THỨ HAI, chạy song song với đường vào costmap: +# +# host --> addLaserScan() --+--> kho (bản THÔ) <-- file này khai +# | +# +--> lọc SOR --> costmap <-- khối `sensors:` lo, khác hẳn +# +# Vì sao cần bản thô: costmap ở 0.05 m đã inflate và xoá mất thứ tự tia. Fit đường thẳng để bắt chữ +# V của trạm sạc thì hai cánh dài 0.2 m trên lưới đó chỉ còn là một cục — không dựng lại được. +# +# ► Quan trọng: kho KHÔNG lọc gì cả. Muốn lọc thì lọc trước khi đẩy vào. Bật `laser_sor_enabled` +# nghĩa là kho và costmap CỐ Ý nhìn hai bản khác nhau — costmap muốn bớt điểm nhiễu, bộ dò muốn +# hình dạng thật. +# +# Không khai topic nào (xoá khối này đi) là HỢP LỆ: không có consumer nào cần dữ liệu thô thì kho +# rỗng và im lặng, không tốn gì. +# +# Quy ước tên: khoá trỏ tới luồng cảm biến kết thúc bằng `_topic`; khoá trỏ tới frame TF kết thúc +# bằng `_frame`. +# ================================================================================================= + +sensor_store: + # [s] Chu kỳ in tình trạng kho ra terminal. 0 = tắt. + # + # ► Chỉnh: BẬT (3-5 s) khi chưa có consumer nào đọc kho — đó là lúc duy nhất không có cách nào + # khác để biết dữ liệu có vào tới nơi hay không, vì gõ sai `topic` và cảm biến chết cho CÙNG + # một triệu chứng. TẮT trên robot sản xuất: đây là log trong tiến trình điều khiển. + # + # Mỗi topic một dòng: Hz đo được, tuổi bản mới nhất, số bản đang giữ, số bản bị từ chối. + # Topic chưa từng nhận gì in ra cảnh báo NO DATA YET kèm nhắc kiểm tên. + report_period: 5.0 + + sensors: + # `topic` phải khớp CHÍNH XÁC chuỗi host truyền vào `addLaserScan(...)`. Dưới host ROS đó là tên + # topic ROS; dưới host .NET là chuỗi C# tự đặt. + # ► Chỉnh: gõ sai tên thì consumer chờ mãi không có gì, và triệu chứng GIỐNG HỆT cảm biến chết. + # Log lúc khởi động in ra danh sách topic kho đang giữ — đối chiếu ở đó. + - topic: /f_scan + # Tên ngắn hoặc đầy đủ đều được (`robot_sensor_msgs/LaserScan`). Sai tên -> từ chối LÚC BOOT. + data_type: LaserScan + + # Số bản đọc giữ lại. 1 = chỉ bản mới nhất. + # ► Chỉnh: chỉ nâng khi có consumer cần nhiều frame liên tiếp kèm đúng dt (ví dụ observation + # xếp chồng của RL). Tốn bộ nhớ nhân theo KÍCH THƯỚC message: 5 scan là vài KB, nhưng 5 mẫu + # depth camera là hàng chục MB. + capacity: 1 + + # [s] Quá tuổi này thì consumer phải coi bản đọc là stale. + # ► Chỉnh: đặt ~2-3 lần chu kỳ publish của cảm biến (lidar 15 Hz -> 0.13-0.2 s; để 0.5 s là + # rộng rãi). Ngắn quá thì jitter làm dữ liệu tốt bị chê oan; dài quá thì robot hành động + # theo thứ đã cũ. + max_age: 0.5 + + - topic: /b_scan + data_type: LaserScan + capacity: 1 + max_age: 0.5 + + # --- Ví dụ, đang TẮT --------------------------------------------------------------------------- + # Mở ra khi có consumer thật sự đọc. ⚠ MỘT mẫu depth đã hàng MB — đừng nâng `capacity` mà chưa đo. + # - topic: /camera/depth/data + # data_type: DepthCameraData + # capacity: 1 + # max_age: 0.3 # [s] depth chậm hơn lidar, nhưng dữ liệu cũ thì nguy hơn + # + # - topic: /camera/depth/points_proc + # data_type: PointCloud2 + # capacity: 1 + # max_age: 0.4 diff --git a/config/runtime/stanley_local_planner_params.yaml b/config/runtime/stanley_local_planner_params.yaml new file mode 100644 index 0000000..c4ec372 --- /dev/null +++ b/config/runtime/stanley_local_planner_params.yaml @@ -0,0 +1,615 @@ +LocalPlannerAdapter: + library_path: liblocal_planner_adapter + yaw_goal_tolerance: 0.017 + xy_goal_tolerance: 0.03 + min_approach_linear_velocity: 0.06 + +StanleyLocalPlanner: + library_path: libstanley_local_planner + + # ============================================================================ + # Ghi chú chung về cách chỉnh: + # - Mỗi tham số có dòng "Chỉnh:" mô tả tăng/giảm thì hành vi đổi thế nào và + # dấu hiệu nào cho biết cần chỉnh. Chỉnh TỪNG tham số một, chạy lại, rồi + # mới chỉnh tiếp — đổi nhiều thứ cùng lúc sẽ không biết cái nào có tác dụng. + # - Số đo hiện trường lấy từ log [DBG-OFF] / [DBG-CURVE] / [DBG-STEER]. + # ============================================================================ + + # ================= Giới hạn robot ================= + max_vel_x: 1.20 # [m/s] tốc độ tiến tối đa, > 0. + # Chỉnh: tăng khi cần chạy nhanh hơn; phải tăng kèm + # quãng phanh (xem goal_decel_limit) và kiểm tra servo + # còn theo kịp ([DBG-STEER]). Giảm nếu robot lắc ở tốc độ cao. + min_vel_x: -0.25 # [m/s] tốc độ lùi tối đa, < 0 (dấu âm = lùi). + # Chỉnh: như max_vel_x nhưng cho chiều lùi; lùi không có + # preview cảm biến phía sau nên để chậm hơn tiến. + wheel_base: 0.0 # [m] khoảng cách trục. 0 = tự đo từ TF front_axle_frame -> rear_axle_frame. + # Chỉnh: chỉ đặt số cứng khi TF không có hoặc sai; số sai + # làm feedforward atan(L*kappa) sai theo -> lệch cong. + front_axle_frame: "steer_link" + rear_axle_frame: "base_link" + + # Hai giới hạn góc lái RIÊNG BIỆT. + # Bám path không được dùng góc lái lớn: forward_vel_ tỉ lệ cos(delta) nên sụp về + # speed_base, và vel_steer = v/cos(steer) được guard về 0 khi cos -> 0. + # Xoay tại chỗ mới dùng hết 90 độ cơ khí. + steer_limit_standstill: 1.5708 # [rad] trần góc lái khi |v| ~ 0. CẦN ĐO THỰC TẾ. + # Chỉnh: giảm nếu robot bẻ lái quá gắt lúc khởi hành. + steer_limit_at_max_vel: 0.5000 # [rad] trần góc lái khi |v| = max_vel_x. CẦN ĐO THỰC TẾ. + # Chỉnh: giảm nếu lắc ở tốc độ cao; tăng nếu vào cua + # gắt ở tốc độ cao mà lái bị kẹp trần (delta chạm limit + # liên tục trong [DBG-OFF]). + align_steer_angle: 1.5708 # [rad] góc lái khi xoay tại chỗ. Ghi số cụ thể, KHÔNG ghi M_PI/2. + align_pivot_toward_curve: true # true: path cong ngay từ pose 0 (|ff| > 0.30 rad) thì pivot đỗ + # bánh về PHÍA cua sắp tới (-90 thay vì +90), khỏi quét 2.6-3.1 rad + # tại chỗ trước khi lăn bánh. ROBOT THẬT: kiểm tra drive nhận lệnh + # -1.5708 trước khi bật (drive từ chối lệnh quá 90°, test 09/08). + min_steer_angle: 0.20 # [rad] ngưỡng coi là "đang bẻ lái". + # Chỉnh: hiếm khi cần; tăng nếu profile tốc độ giảm + # oan vì các dao động lái nhỏ. + max_steer_rate: 1.00 # [rad/s] tốc độ quay servo lái. Đo bằng [DBG-STEER] 07/08: + # servo thật đạt đỉnh 1.08-1.35. + # Chỉnh: đặt THẤP HƠN đỉnh đo được một chút để lệnh không + # vượt quá khả năng servo; đặt cao hơn thực tế -> lệnh chạy + # trước bánh -> overshoot rồi lắc qua lại. + + # Offset zero của kênh lái, CỘNG vào mọi lệnh lái. + # Log 05/08: robot đi thẳng nhưng encoder đọc +0.0373 rad (2.1 độ) + # -> luật tỉ lệ phải "trả giá" bằng lệch ngang thường trực 5-8 cm. + # Là CẦU TẠM đến khi calib zero encoder servo; calib xong đặt lại 0.0. + steer_zero_offset: 0.0 # [rad] + # Chỉnh: đo lại khi robot đi thẳng ổn định — giá trị đúng + # là góc encoder đọc được lúc bánh thực sự thẳng. Sai dấu + # sẽ NHÂN ĐÔI lệch thay vì khử. Sim để 0.0. + + # ================= Dung sai đích ================= + xy_goal_tolerance: 0.030 # [m] dung sai vị trí. Phải khớp LocalPlannerAdapter. + # Chỉnh: giảm khi cần dừng chính xác (dock); giảm quá mức + # so với nhiễu định vị -> robot loay hoay mãi không latch đích. + yaw_goal_tolerance: 0.020 # [rad] dung sai góc tại đích. + # Chỉnh: như trên cho góc; nhỏ hơn nhiễu yaw -> xoay qua lại mãi. + goal_sq_dist_tol: 0.05 # [m^2] thoát sớm vòng scan điểm gần nhất. + # Chỉnh: hầu như không cần đụng; chỉ là tối ưu CPU. + + # ================= Luật điều khiển (Stanley) ================= + path_yaw_mode: "tangent" # tangent | bearing. "bearing" là hành vi cũ, giữ để rollback + # ngoài hiện trường không cần build lại. Luôn dùng "tangent". + control_gain_e: 2.0 # gain hướng (tangent path - yaw robot). + # Chỉnh: tăng -> quay đầu về hướng path nhanh hơn nhưng dễ + # dao động; giảm nếu robot "vẫy đầu" quanh path. Đổi 0.5/lần. + control_gain_d: 1.5 # gain nền của thành phần lệch ngang. ROBOT THẬT: 1.5. + # Chỉnh: tăng -> kéo về path mạnh hơn, quá tay thì lắc kiểu + # zigzag cắt qua path; giảm nếu zigzag, tăng nếu bám về quá chậm. + # Robot thật đang chạy 1.5. + gain_cte_weight: 0.8 # cộng vào k theo |lệch ngang| [1/m] — lệch to thì kéo mạnh hơn. + # Chỉnh: tăng nếu lệch lớn hồi về quá chậm; giảm nếu cú hồi + # đầu tiên bị giật. + gain_heading_weight: 0.5 # cộng vào k theo |lỗi hướng| [1/rad]. + # Chỉnh: ít khi cần; tăng nhẹ nếu robot vào path với góc lớn + # mà thành phần ngang phản ứng yếu. + gain_min: 0.5 # chặn dưới của k. Chỉnh: sàn an toàn, giữ nguyên. + gain_max: 1.8 # chặn trên của k. + # Chỉnh: giảm nếu tổng gain bùng lên gây lắc khi vừa lệch + # ngang vừa lệch hướng. + soft_min_vel: 0.20 # [m/s] SÀN của mẫu số atan2(k*e, v). KHÔNG có trần. + # Chỉnh: tăng -> lái dịu hơn ở tốc độ thấp (mẫu số to hơn); + # giảm -> nhạy hơn khi bò chậm. Nếu robot giật lái lúc khởi + # hành/gần dừng thì tăng lên 0.25-0.30. + alpha_gain: 0.0 # lọc thông thấp lệnh lái [0..1]; 0 = tắt, đã có max_steer_rate lo. + # Chỉnh: chỉ bật (0.2-0.5) nếu lệnh lái nhiễu răng cưa mà + # slew limit chưa đủ; bật to quá gây trễ pha -> lắc chậm. + curve_gain_e_bonus: 2.0 # cộng vào control_gain_e khi ở chế độ cong. + # Chỉnh: sau rework feedforward đã gánh phần cong, bonus này + # ít quan trọng hơn; giảm nếu trong cua robot phản ứng quá gắt. + tangent_window_pts: 3 # số điểm lấy trung bình tangent khi plan không kèm yaw. + # Chỉnh: tăng (5-7) nếu path răng cưa làm tangent nhiễu; + # tăng nhiều làm cắt góc ở cua gắt. + + # --- Rework bám cong (08/08) --- + # Lỗi ngang đo tại BASE cho CẢ HAI chiều (biến thể đo tại trục lái tự chế ra + # "phantom" L^2/2R trong cua — robot cắt VÀO TRONG cua khi tiến, dạt RA NGOÀI khi + # lùi); mốc hướng preview một đoạn ngắn ĐỐI XỨNG hai chiều; bản thân đường cong do + # feedforward atan(L*kappa) gánh. Sweep sim (R=1.5/3.0, hai chiều): + # lệch max 0.013-0.016 m so với 0.061/0.129 trước đó. + heading_preview: 0.10 # [m] mốc hướng (tangent) lấy TRƯỚC điểm neo base một đoạn này, + # chung cho tiến và lùi. + # Chỉnh: tăng (0.2-0.3) nếu servo trễ nhiều (robot thật trễ + # 0.2-0.4 s) — robot vào cua muộn, lệch xuất hiện ở ĐẦU cua; + # giảm về 0.1 nếu robot chớm cắt cua sớm. Quá to sẽ cắt góc + # như lỗi cũ (preview 1.31 m chính là nguồn cắt-trong-cua). + curve_feedforward_gain: 1.0 # gain feedforward atan(L*kappa); 0 = TẮT (rollback), + # 1.0 = danh nghĩa hình học. + # Chỉnh: nhìn dấu của lệch GIỮA cua trong [DBG-CURVE]: + # còn dạt ra NGOÀI cua -> tăng 0.1/lần (tối đa ~1.3); + # cắt vào TRONG cua -> giảm 0.1/lần. Sweep: 1.2 đã bắt đầu + # đổi dấu (bù lố), nên đừng vượt 1.3. Đặt 0 để về luật cũ + # không cần build lại. + + # ===== Bù lệch hướng (heading bias: yawR - course, đo được +0.030 rad 07/08) ===== + # Yaw estimate lệch so với hướng đi thật một hằng số RE-ANCHOR khác nhau mỗi phiên + # (IMU neo tuyệt đối), nên phải HỌC online từ course-over-ground chứ không cấu hình + # cứng. steer offset không bù được cái này: MỐC hướng sai, không phải cơ cấu lái. + heading_bias_mode: "log" # off = tắt | log = chỉ ước lượng | apply = trừ bias đã học. + # ROBOT THẬT: GIỮ "log". CHƯA bật "apply" — estimator vừa rework + # 08/08 (fit 1-2 m + median seed + loại outlier + gate cross-track). + # Nghiệm thu trước khi bật apply: chạy "log" 2 phiên (tắt nguồn + # giữa 2 phiên), est phải ổn định ~+0.03 VÀ khớp yawR-crs trong + # [DBG-SS] ở cả hai phiên. Lệch nhau = báo lại, đừng bật. + # Sức khoẻ estimator xem [DBG-YAWBIAS]: rej= mẫu bị loại, + # span= cửa sổ course [m], gate= (+ = đang học; c=course ngắn, + # s=không thẳng, v=chậm, w=bánh đang bẻ, e=lệch ngang chưa yên, + # t=teleport, o=outlier). SIM: "off". + # log = chỉ ước lượng, [DBG-YAWBIAS] in số calib + # apply= trừ bias đã học khỏi yaw đang điều khiển + # (rollback hiện trường: chuyển "log", không cần build) + # Chỉnh: quy trình chuẩn — chạy "log" vài phiên, số [DBG-YAWBIAS] + # ổn định quanh một giá trị thì chuyển "apply". Sim để "off". + heading_bias_tau: 30.0 # [s] hằng số thời gian EMA. + # Chỉnh: tăng -> học chậm mà mượt; giảm -> bám nhanh nhưng + # dễ nhiễm nhiễu course. 30 s là cân bằng cho phiên chạy dài. + heading_bias_min_vel: 0.20 # [m/s] dưới tốc độ này không học (theo |v|, áp cả chiều lùi). + # 0.20 (không phải 0.45 cũ): chất lượng course giờ phụ thuộc + # QUÃNG ĐƯỜNG của cửa sổ PCA 1-2 m, không phụ thuộc tốc độ — + # ngưỡng 0.45 là di sản của cửa sổ 2 điểm 0.15 m. Phải ≤ 0.25 + # thì các chặng LÙI (min_vel_x -0.25) mới học được. + heading_bias_clamp: 0.05 # [rad] trần của lượng bù ĐƯỢC ÁP. + # Chỉnh: an toàn — chỉ nâng khi [DBG-YAWBIAS] cho thấy bias + # thật vượt trần một cách ổn định. + heading_bias_min_samples: 30 # [chu kỳ] số mẫu học tối thiểu trước khi được áp. + # 30 (không phải 60): sau rework, est tại n~26 đã trùng est cuối + # phiên; để 60 thì route ngắn/nhiều lùi không bao giờ đủ mẫu — + # log 09/08: est=0.040 đo đúng mà applied=0 cả phiên vì n kẹt 38, + # robot trôi dần 3-5 cm trên đoạn thẳng trước cua. + # Chỉnh: tăng nếu thấy áp bù quá sớm khi số còn nhiễu. + + # ===== Tích phân bias lái (dọn phần dư) ===== + # Khi heading_bias_mode: apply thì nhiễu chính đã xử lý ở trên; tích phân này chỉ + # quét phần còn sót. KHÔNG chạy cả hai ở cường độ tối đa. + steer_bias_gain: 0.100 # [rad/(m*s)] 0 = TẮT. ROBOT THẬT: 0.10 — bộ bù CHÍNH khi mode + # != apply (đo 08/08: mission 10-20 s, gain 0.02 cần ~50 s chạy + # thẳng mới hội tụ nên không bao giờ tới; 0.10 xong trong ~1 chặng). + # Khi apply được nghiệm thu và bật: hạ về 0.02 quét vụn — + # KHÔNG chạy cả hai hết cỡ. + # Chỉnh: tăng nếu vẫn còn lệch ngang thường trực nhỏ sau khi + # đã xử lý zero offset + heading bias; tăng quá gây dao động + # chậm chu kỳ dài (đặc trưng của tích phân quá tay). + steer_bias_clamp: 0.05 # [rad] trần anti-windup. + # Chỉnh: giữ nhỏ; nếu bias thật > 0.05 thì vấn đề là calib + # phần cứng, không phải chỗ này. + steer_bias_decay: 0.9999 # hệ số xả khi không đủ điều kiện tích phân. ROBOT THẬT: 0.9999 + # (~0.3%/s) — robot đứng chờ 30-60 s giữa mission; 0.995 (14%/s) + # xả sạch bias mỗi lần đứng (log 08/08: 0.027 -> 0.010). + # Chỉnh: gần 1 = nhớ lâu; giảm (0.99) nếu bias cũ đeo bám + # sau khi điều kiện chạy đã đổi. + steer_bias_min_vel: 0.30 # [m/s] dưới tốc này không tích phân (đứng yên/bò chậm + # không phân biệt được bias với nhiễu). + steer_bias_max_heading_err: 0.10 # [rad] lỗi hướng trên ngưỡng này không tích phân + # (đang quay đầu chứ không phải bias). + + # ================= Cửa sổ plan / lookahead ================= + max_global_plan_lookahead_dist: 3.0 # [m] trần cửa sổ. + # Chỉnh: giảm nếu CPU nặng hoặc path xa gây nhiễu tangent; + # phải đủ chứa quãng phanh v^2/(2a). + min_lookahead: 0.50 # [m] sàn cửa sổ. + # Chỉnh: tăng nếu cửa sổ ngắn làm tangent nhiễu lúc bò chậm. + min_lookahead_near_goal: 0.40 # [m] sàn riêng khi gần đích. + # Chỉnh: giảm nhẹ nếu gần đích cửa sổ dài kéo hướng lệch đi. + dyn_lookahead_gain: 2.50 # [m/(m/s)] lookahead = min + gain*|v|. + # Chỉnh: tăng -> nhìn xa hơn khi chạy nhanh (mượt, cắt góc); + # giảm -> bám sát hơn (dễ lắc ở tốc độ cao). + near_goal_freeze_dist: 0.50 # [m] dưới ngưỡng này: đóng băng yaw_path, chỉ chạy theta_d. + # Chỉnh: tăng nếu cuối hành trình robot còn "vẹo đầu" theo + # cửa sổ đang co; giảm nếu freeze quá sớm làm vào đích xiên. + + # Ngưỡng liên tục chỉ số, tính bằng MÉT và quy ra index theo khoảng cách điểm đo + # lúc runtime — độ phân giải plan là lựa chọn của global planner, không phải hằng số. + # Áp cho CẢ closest (neo cửa sổ) lẫn target_idx_ (trong core). + max_advance_dist: 0.20 # [m] quãng tiến tối đa dọc plan mỗi chu kỳ. + # Chỉnh: phải > v_max * chu kỳ (0.04 m @ 1.2 m/s) nhiều lần; + # quá nhỏ -> neo tụt lại sau robot; quá to -> mất tác dụng + # chống nhảy index ở đoạn path gấp. + max_back_dist: 0.10 # [m] quãng lùi tối đa dọc plan mỗi chu kỳ. + # Chỉnh: giữ nhỏ hơn max_advance_dist; tăng nhẹ nếu sau + # replan hợp lệ neo không chịu lùi về điểm đúng. + + # ================= Độ cong ================= + high_curvature: 0.30 # [1/m] trên ngưỡng: co lookahead. + mid_curvature: 0.20 # [1/m] trên ngưỡng: cắt cửa sổ transform. + low_curvature: 0.10 # [1/m] trên ngưỡng: vào chế độ cong. + # Chỉnh bộ ba: giảm low_curvature nếu robot vào cua mà chưa + # kịp giảm tốc (vào chế độ cong sớm hơn); giữ thứ tự + # low < mid < high. + straight_confirm_steps: 110 # số chu kỳ thẳng liên tiếp trước khi rời chế độ cong. + # Chỉnh: giảm (~60) nếu sau cua robot giữ tốc độ chậm quá lâu; + # tăng nếu path cong-thẳng-cong liên tục làm nhảy chế độ. + + # ================= Profile tốc độ ================= + speed_base: 0.30 # [m/s] nền của profile lái cosine. + # Chỉnh: tốc độ "an toàn" khi đang bẻ lái nhiều; tăng nếu + # robot quá rụt rè trong cua. + curve_max_speed: 0.25 # [m/s] trần khi đang cong. + # Chỉnh: tăng dần khi bám cong đã tốt (sau rework có thể thử + # 0.3-0.35); lắc trong cua thì hạ xuống trước tiên. + min_drive_speed: 0.07 # [m/s] sàn khi đang chạy. + # Chỉnh: phải đủ thắng ma sát tĩnh của drive; robot khựng + # từng nhịp ở tốc thấp -> tăng nhẹ. + accel_distance: 2.00 # [m] quãng tăng tốc lại sau khi rời cua. + # Chỉnh: giảm nếu sau cua tăng tốc quá ì; tăng nếu vọt ra + # khỏi cua rồi lắc. + decel_min: 0.05 # [m/s mỗi chu kỳ] mức giảm tốc khi dự đoán va chạm. + decel_max: 0.10 # [m/s mỗi chu kỳ] + # Chỉnh cặp này theo độ "phanh gấp" chấp nhận được khi + # thấy vật cản; to quá gây giật, nhỏ quá phanh không kịp. + collision_horizon_factor: 2.0 # nhân với max_vel_x ra quãng kiểm tra va chạm. + # Chỉnh: tăng nếu tốc độ cao mà phát hiện vật cản trễ; + # tăng kéo theo CPU kiểm tra footprint dài hơn. + + # Governor quãng phanh: v <= sqrt(2*a*d_to_stop). Profile horizon một mình chỉ bắt + # đầu phanh ~v*horizon trước đích (1.5 m @ 1.2 m/s, đòi ~1 m/s^2) — drive không theo + # kịp và robot đã vượt đích 30 cm. + goal_decel_limit: 0.30 # [m/s^2] ROBOT THẬT: 0.3 ĐÃ XÁC NHẬN dừng đúng @1.2 m/s; 0.4 vượt đích 30 cm. + # Bắt đầu phanh tại v^2/(2a): 1.8 m @ 1.2 m/s, 0.3 m @ 0.5 m/s. + # Chỉnh: robot vượt đích -> GIẢM + # robot phanh quá sớm/bò vào đích lâu -> tăng dần + # 0.05/lần, dừng ngay khi chớm vượt đích. + min_approach_speed: 0.06 # [m/s] sàn tốc độ tiếp cận để profile sqrt vẫn chạm được đích. + # Chỉnh: tăng nhẹ nếu robot bò quá chậm đoạn cuối; to quá + # sẽ chạm đích với tốc độ dư -> dừng giật. + + # ================= Align / phase ================= + heading_eps: 0.020 # [rad] lỗi hướng chấp nhận là "đã thẳng hàng". + steer_eps: 0.020 # [rad] lỗi lái chấp nhận là "servo đã tới". + # Chỉnh cặp eps: nhỏ hơn nhiễu encoder/yaw -> chờ align mãi + # không xong (chatter wait_to_align); nới 0.005/lần. + heading_align_tol: 0.050 # [rad] cổng cho đoạn tiến thẳng cuối (0.01 cũ là quá chặt). + # Chỉnh: nới nếu cuối hành trình cứ dừng-xoay-dừng lặp lại. + near_goal_dist: 1.00 # [m] dưới ngưỡng: bật chế độ tiến thẳng cuối. + # Chỉnh: tăng nếu cần vào đích thẳng trục từ xa hơn (dock). + steer_realign_off: 0.503 # [rad] trên ngưỡng: CẮT drive để chỉnh lại bánh (0.16*pi). + steer_realign_on: 0.150 # [rad] dưới ngưỡng: CHẠY lại drive — phải NHỎ HƠN _off. + # Chỉnh cặp hysteresis: khe _off - _on rộng = ít bật/tắt hơn; + # nếu robot dừng/chạy lắt nhắt khi bẻ lái lớn thì NỚI RỘNG khe + # (hạ _on hoặc nâng _off), đừng thu hẹp. + steering_active: 0.094 # [rad] trên ngưỡng coi là lái đang hoạt động (0.03*pi). + segment_transition_threshold: 0.010 # [m] Chỉnh: hiếm khi đụng. + segment_end_ratio: 0.05 # phần còn lại của segment thì chuyển segment kế. + # Chỉnh: tăng nếu chuyển segment trễ gây khựng ở khớp nối. + xy_reached_gate_factor: 3.0 # nhân xy_goal_tolerance; cửa sổ 1 điểm chỉ được latch trong vùng này. + # Chỉnh: chống latch đích sớm từ xa; tăng nếu miss latch + # hợp lệ, giảm nếu latch khi còn cách đích xa. + + # ================= TF guard ================= + # Đo trên robot thật: 225 cú nhảy map->odom, max 12.381 m, trùng thời điểm + # localisation FinishTrajectory(1) 10:41:18 / AddTrajectory(2) 10:41:21. Nguồn nằm + # ngoài gói này; đây là be bờ, không phải chữa gốc. + tf_lookup_at_pose_stamp: true # true = tra tại pose.header.stamp thay vì "latest". + # "latest" trả entry khác nhau mỗi lần gọi khi buffer + # giữ hai transform map->odom. Giữ true. + transform_tolerance: 0.20 # [s] tuổi chấp nhận khi tra theo timestamp. + # Chỉnh: tăng nếu log báo transform quá cũ liên tục do + # localisation publish thưa; to quá thì dùng TF ôi. + max_plan_tf_jump_rate: 0.60 # [m/s] ROBOT THẬT: 0.60 — chặn xloc nhảy thật. SIM: nâng 1.5. + # SIM: 1.5 — dynamic TF sim jitter 0.02-0.065 m/chu kỳ, để 0.6 + # thì budget ~0.02 m/chu kỳ -> reject dồn 30/30 và reset giữa + # đường (log 08/08: 8 reset trong 2 lượt lùi). + # ROBOT THẬT: hạ về 0.60 — xloc nhảy thật sự cần chặn. + # Chỉnh: giảm nếu cú nhảy nhỏ vẫn lọt gây giật plan; + # tăng nếu correction hợp lệ của localisation bị chặn oan + # (đếm reject trong log [DBG-TF]). + max_plan_tf_jump_abs: 1.00 # [m] trần cứng của bước chấp nhận: budget theo rate lớn dần + # khi transform đứng yên lâu, không có trần thì cú nhảy + # nhiều mét sau đoạn tĩnh dài sẽ được nhận luôn. + # Chỉnh: giảm (0.5) nếu vẫn lọt cú nhảy lớn sau đoạn tĩnh. + max_plan_tf_yaw_jump: 0.20 # [rad] ngưỡng xoay - code cũ chỉ soi tịnh tiến. + # Chỉnh: giảm nếu plan xoay giật mà không bị bắt. + tf_reject_window_cycles: 30 # cửa sổ trượt; vượt nghĩa là relocalisation thật. + tf_reject_ratio: 0.5 # tỉ lệ reject trong cửa sổ thì kích reset. + + # --- Đóng băng transform plan->odom theo từng leg (chống lắc khi map nhảy) --- + plan_tf_freeze: false # true: transform map->odom yên đủ lâu thì KHÓA cho cả leg — + # correction giữa chừng không còn dịch path dưới chân robot. + # Dùng cho docking; false = live mỗi cycle như cũ. + freeze_settle_cycles: 30 # [cycle] số cycle yên liên tiếp trước khi khóa. Phải >= 2x + # chu kỳ update localization (AMCL ~2 Hz -> >= 1 s = 30 cycle), + # không thì cửa sổ lọt giữa hai lần correction. + freeze_settle_eps_xy: 0.005 # [m] bước transform/cycle dưới ngưỡng này tính là "yên". + freeze_settle_eps_yaw: 0.005 # [rad] + freeze_settle_timeout: 3.0 # [s] map nhảy liên tục không bao giờ yên -> hết hạn thì khóa + # bản mới nhất kèm WARNING (live tiếp = đúng cái lắc đang trị). + # Chỉnh cặp: window*ratio = số reject trước khi đầu hàng và + # nhận vị trí mới; tăng nếu reset quá vội khi TF chỉ nhiễu + # thoáng qua, giảm nếu ôm cache quá lâu sau relocalisation thật. + + # ================= Debug ================= + debug_tf: false # nhom log TF (accepted-step, authority, chi tiet reject, fallback). + # SIM: dynamic_tf nhieu chu dich -> tat cho log doc duoc. + # ROBOT THAT: bat lai (true) khi san TF that. + # Reset do reject keo dai van LUON duoc log bat ke cong tac nay. + debug_offset: true # [DBG-OFF] 5 Hz bam path + thong ke max/mean |e| moi luot cua + # (in kem dong DBG-CURVE exit) — soi lech trong duong cong. + debug_level: 2 # 0=off 1=khi state đổi 2=throttle 1 Hz 3=mọi chu kỳ + # 2 an toàn làm mặc định vận hành: gói này throttle bằng đồng hồ + # riêng từng mục đích (log_*_throttle của robot_cpp dùng CHUNG MỘT + # timer static cho cả process nên các dòng throttle nuốt lẫn nhau - + # đừng dựa vào nó). + # 3 in >1800 dòng/phút @ 30 Hz - chỉ dùng debug hiện trường. + +StanleyDockingLocalPlanner: + # Instance RIENG cua Stanley cho profile docking (cung .so, alias thu hai). + # Block nay la BAN COPY DAY DU cua StanleyLocalPlanner + override — YAML khong + # ke thua giua cac block: key thieu roi ve default C++ (vd steer_zero_offset 0), + # KHONG roi ve block position (bay log 23). Sua tham so chung thi sua CA HAI block. + # Cac dong override danh dau "DOCKING:". Comment chi tiet xem block position. + library_path: libstanley_local_planner + max_vel_x: 0.30 # [m/s] DOCKING: cham va co kiem soat + min_vel_x: -0.20 # [m/s] DOCKING: lui cham vao dock + wheel_base: 0.0 # [m] khoảng cách trục. 0 = tự đo từ TF front_axle_frame -> rear_axle_frame. + front_axle_frame: "steer_link" + rear_axle_frame: "base_link" + steer_limit_standstill: 1.5708 # [rad] trần góc lái khi |v| ~ 0. CẦN ĐO THỰC TẾ. + steer_limit_at_max_vel: 0.5000 # [rad] trần góc lái khi |v| = max_vel_x. CẦN ĐO THỰC TẾ. + align_steer_angle: 1.5708 # [rad] góc lái khi xoay tại chỗ. Ghi số cụ thể, KHÔNG ghi M_PI/2. + align_pivot_toward_curve: true # DOCKING: pivot do banh ve phia cua. ROBOT THAT: test drive nhan -90 truoc + min_steer_angle: 0.20 # [rad] ngưỡng coi là "đang bẻ lái". + max_steer_rate: 1.00 # [rad/s] tốc độ quay servo lái. Đo bằng [DBG-STEER] 07/08: + steer_zero_offset: 0.0 # [rad] + xy_goal_tolerance: 0.02 # [m] DOCKING: dung sai vi tri chat + yaw_goal_tolerance: 0.05 # [rad] DOCKING: dung sai goc chat + goal_sq_dist_tol: 0.05 # [m^2] thoát sớm vòng scan điểm gần nhất. + path_yaw_mode: "tangent" # tangent | bearing. "bearing" là hành vi cũ, giữ để rollback + control_gain_e: 2.0 # gain hướng (tangent path - yaw robot). + control_gain_d: 1.5 # gain nền của thành phần lệch ngang. ROBOT THẬT: 1.5. + gain_cte_weight: 0.8 # cộng vào k theo |lệch ngang| [1/m] — lệch to thì kéo mạnh hơn. + gain_heading_weight: 0.5 # cộng vào k theo |lỗi hướng| [1/rad]. + gain_min: 0.5 # chặn dưới của k. Chỉnh: sàn an toàn, giữ nguyên. + gain_max: 1.8 # chặn trên của k. + soft_min_vel: 0.20 # [m/s] SÀN của mẫu số atan2(k*e, v). KHÔNG có trần. + alpha_gain: 0.0 # lọc thông thấp lệnh lái [0..1]; 0 = tắt, đã có max_steer_rate lo. + curve_gain_e_bonus: 2.0 # cộng vào control_gain_e khi ở chế độ cong. + tangent_window_pts: 3 # số điểm lấy trung bình tangent khi plan không kèm yaw. + heading_preview: 0.10 # [m] mốc hướng (tangent) lấy TRƯỚC điểm neo base một đoạn này, + curve_feedforward_gain: 1.0 # gain feedforward atan(L*kappa); 0 = TẮT (rollback), + heading_bias_mode: "inherit" # DOCKING: thua huong bu heading tu instance position (SharedHeadingBias) + heading_bias_tau: 30.0 # [s] hằng số thời gian EMA. + heading_bias_min_vel: 0.20 # [m/s] dưới tốc độ này không học (theo |v|, áp cả chiều lùi). + heading_bias_clamp: 0.05 # [rad] trần của lượng bù ĐƯỢC ÁP. + heading_bias_min_samples: 30 # [chu kỳ] số mẫu học tối thiểu trước khi được áp. + steer_bias_gain: 0.100 # [rad/(m*s)] 0 = TẮT. ROBOT THẬT: 0.10 — bộ bù CHÍNH khi mode + steer_bias_clamp: 0.05 # [rad] trần anti-windup. + steer_bias_decay: 0.9999 # hệ số xả khi không đủ điều kiện tích phân. ROBOT THẬT: 0.9999 + steer_bias_min_vel: 0.15 # [m/s] SLOW PROFILE: 0.30 -> 0.15 (17/08). Cong nay lon hon + # max_vel_x cua profile nay nen tich phan khong bao gio chay: + # log 33 moi dong DBG-SS cua dock deu bias=0.0000, offset dong + # 2.8 cm khong ai khu. Nguong moi < toc do lam viec 0.20 m/s. + steer_bias_max_heading_err: 0.10 # [rad] lỗi hướng trên ngưỡng này không tích phân + max_global_plan_lookahead_dist: 3.0 # [m] trần cửa sổ. + min_lookahead: 0.50 # [m] sàn cửa sổ. + min_lookahead_near_goal: 0.40 # [m] sàn riêng khi gần đích. + dyn_lookahead_gain: 2.50 # [m/(m/s)] lookahead = min + gain*|v|. + near_goal_freeze_dist: 0.50 # [m] dưới ngưỡng này: đóng băng yaw_path, chỉ chạy theta_d. + max_advance_dist: 0.20 # [m] quãng tiến tối đa dọc plan mỗi chu kỳ. + max_back_dist: 0.10 # [m] quãng lùi tối đa dọc plan mỗi chu kỳ. + high_curvature: 0.30 # [1/m] trên ngưỡng: co lookahead. + mid_curvature: 0.20 # [1/m] trên ngưỡng: cắt cửa sổ transform. + low_curvature: 0.10 # [1/m] trên ngưỡng: vào chế độ cong. + straight_confirm_steps: 110 # số chu kỳ thẳng liên tiếp trước khi rời chế độ cong. + speed_base: 0.30 # [m/s] nền của profile lái cosine. + curve_max_speed: 0.25 # [m/s] trần khi đang cong. + min_drive_speed: 0.07 # [m/s] sàn khi đang chạy. + accel_distance: 2.00 # [m] quãng tăng tốc lại sau khi rời cua. + decel_min: 0.05 # [m/s mỗi chu kỳ] mức giảm tốc khi dự đoán va chạm. + decel_max: 0.10 # [m/s mỗi chu kỳ] + collision_horizon_factor: 2.0 # nhân với max_vel_x ra quãng kiểm tra va chạm. + goal_decel_limit: 0.30 # [m/s^2] ROBOT THẬT: 0.3 ĐÃ XÁC NHẬN dừng đúng @1.2 m/s; 0.4 vượt đích 30 cm. + min_approach_speed: 0.06 # [m/s] sàn tốc độ tiếp cận để profile sqrt vẫn chạm được đích. + heading_eps: 0.020 # [rad] lỗi hướng chấp nhận là "đã thẳng hàng". + steer_eps: 0.020 # [rad] lỗi lái chấp nhận là "servo đã tới". + heading_align_tol: 0.050 # [rad] cổng cho đoạn tiến thẳng cuối (0.01 cũ là quá chặt). + near_goal_dist: 1.00 # [m] dưới ngưỡng: bật chế độ tiến thẳng cuối. + steer_realign_off: 0.503 # [rad] trên ngưỡng: CẮT drive để chỉnh lại bánh (0.16*pi). + steer_realign_on: 0.150 # [rad] dưới ngưỡng: CHẠY lại drive — phải NHỎ HƠN _off. + steering_active: 0.094 # [rad] trên ngưỡng coi là lái đang hoạt động (0.03*pi). + segment_transition_threshold: 0.010 # [m] Chỉnh: hiếm khi đụng. + segment_end_ratio: 0.05 # phần còn lại của segment thì chuyển segment kế. + xy_reached_gate_factor: 3.0 # nhân xy_goal_tolerance; cửa sổ 1 điểm chỉ được latch trong vùng này. + tf_lookup_at_pose_stamp: true # true = tra tại pose.header.stamp thay vì "latest". + transform_tolerance: 0.20 # [s] tuổi chấp nhận khi tra theo timestamp. + max_plan_tf_jump_rate: 0.60 # [m/s] ROBOT THẬT: 0.60 — chặn xloc nhảy thật. SIM: nâng 1.5. + max_plan_tf_jump_abs: 1.00 # [m] trần cứng của bước chấp nhận: budget theo rate lớn dần + max_plan_tf_yaw_jump: 0.20 # [rad] ngưỡng xoay - code cũ chỉ soi tịnh tiến. + tf_reject_window_cycles: 30 # cửa sổ trượt; vượt nghĩa là relocalisation thật. + tf_reject_ratio: 0.5 # tỉ lệ reject trong cửa sổ thì kích reset. + plan_tf_freeze: true # DOCKING: khoa transform map->odom theo leg, chong lac khi map nhay + freeze_settle_cycles: 20 # [cycle] số cycle yên liên tiếp trước khi khóa. Phải >= 2x + freeze_settle_eps_xy: 0.005 # [m] bước transform/cycle dưới ngưỡng này tính là "yên". + freeze_settle_eps_yaw: 0.005 # [rad] + freeze_settle_timeout: 3.0 # [s] map nhảy liên tục không bao giờ yên -> hết hạn thì khóa + debug_tf: false # nhom log TF (accepted-step, authority, chi tiet reject, fallback). + debug_offset: true # [DBG-OFF] 5 Hz bam path + thong ke max/mean |e| moi luot cua + debug_level: 2 # 0=off 1=khi state đổi 2=throttle 1 Hz 3=mọi chu kỳ + +StanleyGoStraightLocalPlanner: + # Instance Stanley cho profile go_straight (cung .so, alias). Path 2 diem thang + # la truong hop bam tam thuong nhat cua Stanley; move_straight lock gan goal. + # Block la BAN COPY DAY DU cua StanleyLocalPlanner + override (YAML khong ke + # thua giua cac block — key thieu roi ve default C++, bay log 23). + library_path: libstanley_local_planner + max_vel_x: 0.30 # [m/s] GO_STRAIGHT: leg tiep can ngan, cham va chinh xac + min_vel_x: -0.20 # [m/s] GO_STRAIGHT: lui cham (vd lui ra khoi dock) + wheel_base: 0.0 # [m] khoảng cách trục. 0 = tự đo từ TF front_axle_frame -> rear_axle_frame. + front_axle_frame: "steer_link" + rear_axle_frame: "base_link" + steer_limit_standstill: 1.5708 # [rad] trần góc lái khi |v| ~ 0. CẦN ĐO THỰC TẾ. + steer_limit_at_max_vel: 0.5000 # [rad] trần góc lái khi |v| = max_vel_x. CẦN ĐO THỰC TẾ. + align_steer_angle: 1.5708 # [rad] góc lái khi xoay tại chỗ. Ghi số cụ thể, KHÔNG ghi M_PI/2. + align_pivot_toward_curve: true # true: path cong ngay từ pose 0 (|ff| > 0.30 rad) thì pivot đỗ + min_steer_angle: 0.20 # [rad] ngưỡng coi là "đang bẻ lái". + max_steer_rate: 1.00 # [rad/s] tốc độ quay servo lái. Đo bằng [DBG-STEER] 07/08: + steer_zero_offset: 0.0 # [rad] + xy_goal_tolerance: 0.0001 # [m] GO_STRAIGHT: dung sai chat nhu docking + yaw_goal_tolerance: 0.010 # [rad] + goal_sq_dist_tol: 0.05 # [m^2] thoát sớm vòng scan điểm gần nhất. + path_yaw_mode: "tangent" # tangent | bearing. "bearing" là hành vi cũ, giữ để rollback + control_gain_e: 2.0 # gain hướng (tangent path - yaw robot). + control_gain_d: 1.5 # gain nền của thành phần lệch ngang. ROBOT THẬT: 1.5. + gain_cte_weight: 0.8 # cộng vào k theo |lệch ngang| [1/m] — lệch to thì kéo mạnh hơn. + gain_heading_weight: 0.5 # cộng vào k theo |lỗi hướng| [1/rad]. + gain_min: 0.5 # chặn dưới của k. Chỉnh: sàn an toàn, giữ nguyên. + gain_max: 1.8 # chặn trên của k. + soft_min_vel: 0.20 # [m/s] SÀN của mẫu số atan2(k*e, v). KHÔNG có trần. + alpha_gain: 0.0 # lọc thông thấp lệnh lái [0..1]; 0 = tắt, đã có max_steer_rate lo. + curve_gain_e_bonus: 2.0 # cộng vào control_gain_e khi ở chế độ cong. + tangent_window_pts: 3 # số điểm lấy trung bình tangent khi plan không kèm yaw. + heading_preview: 0.10 # [m] mốc hướng (tangent) lấy TRƯỚC điểm neo base một đoạn này, + curve_feedforward_gain: 1.0 # gain feedforward atan(L*kappa); 0 = TẮT (rollback), + heading_bias_mode: "inherit" # GO_STRAIGHT: thua huong bu tu instance position + heading_bias_tau: 30.0 # [s] hằng số thời gian EMA. + heading_bias_min_vel: 0.20 # [m/s] dưới tốc độ này không học (theo |v|, áp cả chiều lùi). + heading_bias_clamp: 0.05 # [rad] trần của lượng bù ĐƯỢC ÁP. + heading_bias_min_samples: 30 # [chu kỳ] số mẫu học tối thiểu trước khi được áp. + steer_bias_gain: 0.100 # [rad/(m*s)] 0 = TẮT. ROBOT THẬT: 0.10 — bộ bù CHÍNH khi mode + steer_bias_clamp: 0.05 # [rad] trần anti-windup. + steer_bias_decay: 0.9999 # hệ số xả khi không đủ điều kiện tích phân. ROBOT THẬT: 0.9999 + steer_bias_min_vel: 0.15 # [m/s] SLOW PROFILE: 0.30 -> 0.15 (17/08). Cong nay lon hon + # max_vel_x cua profile nay nen tich phan khong bao gio chay: + # log 33 moi dong DBG-SS cua dock deu bias=0.0000, offset dong + # 2.8 cm khong ai khu. Nguong moi < toc do lam viec 0.20 m/s. + steer_bias_max_heading_err: 0.10 # [rad] lỗi hướng trên ngưỡng này không tích phân + max_global_plan_lookahead_dist: 3.0 # [m] trần cửa sổ. + min_lookahead: 0.50 # [m] sàn cửa sổ. + min_lookahead_near_goal: 0.40 # [m] sàn riêng khi gần đích. + dyn_lookahead_gain: 2.50 # [m/(m/s)] lookahead = min + gain*|v|. + near_goal_freeze_dist: 0.50 # [m] dưới ngưỡng này: đóng băng yaw_path, chỉ chạy theta_d. + max_advance_dist: 0.20 # [m] quãng tiến tối đa dọc plan mỗi chu kỳ. + max_back_dist: 0.10 # [m] quãng lùi tối đa dọc plan mỗi chu kỳ. + high_curvature: 0.30 # [1/m] trên ngưỡng: co lookahead. + mid_curvature: 0.20 # [1/m] trên ngưỡng: cắt cửa sổ transform. + low_curvature: 0.10 # [1/m] trên ngưỡng: vào chế độ cong. + straight_confirm_steps: 110 # số chu kỳ thẳng liên tiếp trước khi rời chế độ cong. + speed_base: 0.30 # [m/s] nền của profile lái cosine. + curve_max_speed: 0.25 # [m/s] trần khi đang cong. + min_drive_speed: 0.07 # [m/s] sàn khi đang chạy. + accel_distance: 2.00 # [m] quãng tăng tốc lại sau khi rời cua. + decel_min: 0.05 # [m/s mỗi chu kỳ] mức giảm tốc khi dự đoán va chạm. + decel_max: 0.10 # [m/s mỗi chu kỳ] + collision_horizon_factor: 2.0 # nhân với max_vel_x ra quãng kiểm tra va chạm. + goal_decel_limit: 0.30 # [m/s^2] ROBOT THẬT: 0.3 ĐÃ XÁC NHẬN dừng đúng @1.2 m/s; 0.4 vượt đích 30 cm. + min_approach_speed: 0.06 # [m/s] sàn tốc độ tiếp cận để profile sqrt vẫn chạm được đích. + heading_eps: 0.020 # [rad] lỗi hướng chấp nhận là "đã thẳng hàng". + steer_eps: 0.020 # [rad] lỗi lái chấp nhận là "servo đã tới". + heading_align_tol: 0.050 # [rad] cổng cho đoạn tiến thẳng cuối (0.01 cũ là quá chặt). + near_goal_dist: 1.00 # [m] dưới ngưỡng: bật chế độ tiến thẳng cuối. + steer_realign_off: 0.503 # [rad] trên ngưỡng: CẮT drive để chỉnh lại bánh (0.16*pi). + steer_realign_on: 0.150 # [rad] dưới ngưỡng: CHẠY lại drive — phải NHỎ HƠN _off. + steering_active: 0.094 # [rad] trên ngưỡng coi là lái đang hoạt động (0.03*pi). + segment_transition_threshold: 0.010 # [m] Chỉnh: hiếm khi đụng. + segment_end_ratio: 0.05 # phần còn lại của segment thì chuyển segment kế. + xy_reached_gate_factor: 3.0 # nhân xy_goal_tolerance; cửa sổ 1 điểm chỉ được latch trong vùng này. + tf_lookup_at_pose_stamp: true # true = tra tại pose.header.stamp thay vì "latest". + transform_tolerance: 0.20 # [s] tuổi chấp nhận khi tra theo timestamp. + max_plan_tf_jump_rate: 0.60 # [m/s] ROBOT THẬT: 0.60 — chặn xloc nhảy thật. SIM: nâng 1.5. + max_plan_tf_jump_abs: 1.00 # [m] trần cứng của bước chấp nhận: budget theo rate lớn dần + max_plan_tf_yaw_jump: 0.20 # [rad] ngưỡng xoay - code cũ chỉ soi tịnh tiến. + tf_reject_window_cycles: 30 # cửa sổ trượt; vượt nghĩa là relocalisation thật. + tf_reject_ratio: 0.5 # tỉ lệ reject trong cửa sổ thì kích reset. + plan_tf_freeze: true # GO_STRAIGHT: khoa transform theo leg, chong lac khi map nhay + freeze_settle_cycles: 30 # [cycle] số cycle yên liên tiếp trước khi khóa. Phải >= 2x + freeze_settle_eps_xy: 0.005 # [m] bước transform/cycle dưới ngưỡng này tính là "yên". + freeze_settle_eps_yaw: 0.005 # [rad] + freeze_settle_timeout: 3.0 # [s] map nhảy liên tục không bao giờ yên -> hết hạn thì khóa + debug_tf: false # nhom log TF (accepted-step, authority, chi tiet reject, fallback). + debug_offset: true # [DBG-OFF] 5 Hz bam path + thong ke max/mean |e| moi luot cua + debug_level: 2 # 0=off 1=khi state đổi 2=throttle 1 Hz 3=mọi chu kỳ + +StanleyRotateLocalPlanner: + # Instance Stanley cho profile rotate (cung .so, alias). Yeu cau rotate den voi + # XY da nam trong tolerance -> controller vao thang Phase B: do banh +/-90 va + # creep xoay ve yaw cua goal. Block la BAN COPY DAY DU + override (YAML khong + # ke thua giua cac block). + library_path: libstanley_local_planner + max_vel_x: 0.30 # [m/s] ROTATE: chi dung cho creep pivot + min_vel_x: -0.20 # [m/s] + wheel_base: 0.0 # [m] khoảng cách trục. 0 = tự đo từ TF front_axle_frame -> rear_axle_frame. + front_axle_frame: "steer_link" + rear_axle_frame: "base_link" + steer_limit_standstill: 1.5708 # [rad] trần góc lái khi |v| ~ 0. CẦN ĐO THỰC TẾ. + steer_limit_at_max_vel: 0.5000 # [rad] trần góc lái khi |v| = max_vel_x. CẦN ĐO THỰC TẾ. + align_steer_angle: 1.5708 # [rad] góc lái khi xoay tại chỗ. Ghi số cụ thể, KHÔNG ghi M_PI/2. + align_pivot_toward_curve: true # true: path cong ngay từ pose 0 (|ff| > 0.30 rad) thì pivot đỗ + min_steer_angle: 0.20 # [rad] ngưỡng coi là "đang bẻ lái". + max_steer_rate: 1.00 # [rad/s] tốc độ quay servo lái. Đo bằng [DBG-STEER] 07/08: + steer_zero_offset: 0.0 # [rad] + xy_goal_tolerance: 0.10 # [m] ROTATE: goal ngay duoi chan robot — latch XY ngay lap tuc, chi con xoay yaw (Phase B) + yaw_goal_tolerance: 0.010 # [rad] ROTATE: dung sai goc la san pham chinh + goal_sq_dist_tol: 0.05 # [m^2] thoát sớm vòng scan điểm gần nhất. + path_yaw_mode: "tangent" # tangent | bearing. "bearing" là hành vi cũ, giữ để rollback + control_gain_e: 2.0 # gain hướng (tangent path - yaw robot). + control_gain_d: 1.5 # gain nền của thành phần lệch ngang. ROBOT THẬT: 1.5. + gain_cte_weight: 0.8 # cộng vào k theo |lệch ngang| [1/m] — lệch to thì kéo mạnh hơn. + gain_heading_weight: 0.5 # cộng vào k theo |lỗi hướng| [1/rad]. + gain_min: 0.5 # chặn dưới của k. Chỉnh: sàn an toàn, giữ nguyên. + gain_max: 1.8 # chặn trên của k. + soft_min_vel: 0.20 # [m/s] SÀN của mẫu số atan2(k*e, v). KHÔNG có trần. + alpha_gain: 0.0 # lọc thông thấp lệnh lái [0..1]; 0 = tắt, đã có max_steer_rate lo. + curve_gain_e_bonus: 2.0 # cộng vào control_gain_e khi ở chế độ cong. + tangent_window_pts: 3 # số điểm lấy trung bình tangent khi plan không kèm yaw. + heading_preview: 0.10 # [m] mốc hướng (tangent) lấy TRƯỚC điểm neo base một đoạn này, + curve_feedforward_gain: 1.0 # gain feedforward atan(L*kappa); 0 = TẮT (rollback), + heading_bias_mode: "inherit" # ROTATE: xoay ve yaw tuyet doi nen can tru bu heading + heading_bias_tau: 30.0 # [s] hằng số thời gian EMA. + heading_bias_min_vel: 0.20 # [m/s] dưới tốc độ này không học (theo |v|, áp cả chiều lùi). + heading_bias_clamp: 0.05 # [rad] trần của lượng bù ĐƯỢC ÁP. + heading_bias_min_samples: 30 # [chu kỳ] số mẫu học tối thiểu trước khi được áp. + steer_bias_gain: 0.100 # [rad/(m*s)] 0 = TẮT. ROBOT THẬT: 0.10 — bộ bù CHÍNH khi mode + steer_bias_clamp: 0.05 # [rad] trần anti-windup. + steer_bias_decay: 0.9999 # hệ số xả khi không đủ điều kiện tích phân. ROBOT THẬT: 0.9999 + steer_bias_min_vel: 0.15 # [m/s] SLOW PROFILE: 0.30 -> 0.15 (17/08). Cong nay lon hon + # max_vel_x cua profile nay nen tich phan khong bao gio chay: + # log 33 moi dong DBG-SS cua dock deu bias=0.0000, offset dong + # 2.8 cm khong ai khu. Nguong moi < toc do lam viec 0.20 m/s. + steer_bias_max_heading_err: 0.10 # [rad] lỗi hướng trên ngưỡng này không tích phân + max_global_plan_lookahead_dist: 3.0 # [m] trần cửa sổ. + min_lookahead: 0.50 # [m] sàn cửa sổ. + min_lookahead_near_goal: 0.40 # [m] sàn riêng khi gần đích. + dyn_lookahead_gain: 2.50 # [m/(m/s)] lookahead = min + gain*|v|. + near_goal_freeze_dist: 0.50 # [m] dưới ngưỡng này: đóng băng yaw_path, chỉ chạy theta_d. + max_advance_dist: 0.20 # [m] quãng tiến tối đa dọc plan mỗi chu kỳ. + max_back_dist: 0.10 # [m] quãng lùi tối đa dọc plan mỗi chu kỳ. + high_curvature: 0.30 # [1/m] trên ngưỡng: co lookahead. + mid_curvature: 0.20 # [1/m] trên ngưỡng: cắt cửa sổ transform. + low_curvature: 0.10 # [1/m] trên ngưỡng: vào chế độ cong. + straight_confirm_steps: 110 # số chu kỳ thẳng liên tiếp trước khi rời chế độ cong. + speed_base: 0.30 # [m/s] nền của profile lái cosine. + curve_max_speed: 0.25 # [m/s] trần khi đang cong. + min_drive_speed: 0.07 # [m/s] sàn khi đang chạy. + accel_distance: 2.00 # [m] quãng tăng tốc lại sau khi rời cua. + decel_min: 0.05 # [m/s mỗi chu kỳ] mức giảm tốc khi dự đoán va chạm. + decel_max: 0.10 # [m/s mỗi chu kỳ] + collision_horizon_factor: 2.0 # nhân với max_vel_x ra quãng kiểm tra va chạm. + goal_decel_limit: 0.30 # [m/s^2] ROBOT THẬT: 0.3 ĐÃ XÁC NHẬN dừng đúng @1.2 m/s; 0.4 vượt đích 30 cm. + min_approach_speed: 0.06 # [m/s] sàn tốc độ tiếp cận để profile sqrt vẫn chạm được đích. + heading_eps: 0.020 # [rad] lỗi hướng chấp nhận là "đã thẳng hàng". + steer_eps: 0.020 # [rad] lỗi lái chấp nhận là "servo đã tới". + heading_align_tol: 0.050 # [rad] cổng cho đoạn tiến thẳng cuối (0.01 cũ là quá chặt). + near_goal_dist: 1.00 # [m] dưới ngưỡng: bật chế độ tiến thẳng cuối. + steer_realign_off: 0.503 # [rad] trên ngưỡng: CẮT drive để chỉnh lại bánh (0.16*pi). + steer_realign_on: 0.150 # [rad] dưới ngưỡng: CHẠY lại drive — phải NHỎ HƠN _off. + steering_active: 0.094 # [rad] trên ngưỡng coi là lái đang hoạt động (0.03*pi). + segment_transition_threshold: 0.010 # [m] Chỉnh: hiếm khi đụng. + segment_end_ratio: 0.05 # phần còn lại của segment thì chuyển segment kế. + xy_reached_gate_factor: 3.0 # nhân xy_goal_tolerance; cửa sổ 1 điểm chỉ được latch trong vùng này. + tf_lookup_at_pose_stamp: true # true = tra tại pose.header.stamp thay vì "latest". + transform_tolerance: 0.20 # [s] tuổi chấp nhận khi tra theo timestamp. + max_plan_tf_jump_rate: 0.60 # [m/s] ROBOT THẬT: 0.60 — chặn xloc nhảy thật. SIM: nâng 1.5. + max_plan_tf_jump_abs: 1.00 # [m] trần cứng của bước chấp nhận: budget theo rate lớn dần + max_plan_tf_yaw_jump: 0.20 # [rad] ngưỡng xoay - code cũ chỉ soi tịnh tiến. + tf_reject_window_cycles: 30 # cửa sổ trượt; vượt nghĩa là relocalisation thật. + tf_reject_ratio: 0.5 # tỉ lệ reject trong cửa sổ thì kích reset. + plan_tf_freeze: true # ROTATE: khoa transform — map nhay giua luc xoay khong keo lech goc tham chieu + freeze_settle_cycles: 30 # [cycle] số cycle yên liên tiếp trước khi khóa. Phải >= 2x + freeze_settle_eps_xy: 0.005 # [m] bước transform/cycle dưới ngưỡng này tính là "yên". + freeze_settle_eps_yaw: 0.005 # [rad] + freeze_settle_timeout: 3.0 # [s] map nhảy liên tục không bao giờ yên -> hết hạn thì khóa + debug_tf: false # nhom log TF (accepted-step, authority, chi tiet reject, fallback). + debug_offset: true # [DBG-OFF] 5 Hz bam path + thong ke max/mean |e| moi luot cua + debug_level: 2 # 0=off 1=khi state đổi 2=throttle 1 Hz 3=mọi chu kỳ diff --git a/config/runtime/two_points_global_params.yaml b/config/runtime/two_points_global_params.yaml new file mode 100644 index 0000000..cb9ca6b --- /dev/null +++ b/config/runtime/two_points_global_params.yaml @@ -0,0 +1,3 @@ +TwoPointsPlanner: + library_path: libtwo_points_planner + lethal_obstacle: 20 \ No newline at end of file diff --git a/doc/architecture_discussion.md b/doc/architecture_discussion.md new file mode 100644 index 0000000..d2c3a1c --- /dev/null +++ b/doc/architecture_discussion.md @@ -0,0 +1,673 @@ +# Thảo luận về Kiến trúc Navigation cho AMR + +## Mục tiêu dự án + +Nghiên cứu và phát triển hệ thống navigation (di chuyển bám quỹ đạo) cho robot AMR dạng hai bánh vi sai, **không sử dụng ROS**, viết thuần C++ với CMake trên Linux. + +## Yêu cầu chức năng + +Từ `readme.md`: + +- Có khả năng thay đổi mô hình kinematics (dạng hai bánh vi sai, dạng steering bicycle, ...) +- Có chức năng di chuyển từ điểm khởi đầu đến điểm đích +- Có chức năng xoay tròn +- Có chức năng đi thẳng +- Có chức năng thay đổi vận tốc + +## Sơ đồ kiến trúc hệ thống + +Kiến trúc được thiết kế theo mô hình layered, tách biệt các concerns và cho phép mở rộng dễ dàng: + +```mermaid +flowchart TB + %% ========== API LAYER ========== + subgraph API["🌐 API Layer"] + direction TB + CAPI["📦 C API
━━━━━━━━━━━━━━━━
🔌 nav_c_api
💻 P/Invoke cho .NET/C#
📝 Wrapper Functions
🔗 Interop Layer"] + style API fill:#E3F2FD,stroke:#1976D2,stroke-width:4px,color:#000 + style CAPI fill:#BBDEFB,stroke:#1976D2,stroke-width:3px,font-size:14px + end + + %% ========== USER CONTROLLER LAYER ========== + subgraph UserController["🎮 User Controller Layer"] + direction TB + UserCtrl["🔌 User Controller Plugin
━━━━━━━━━━━━━━━━
📚 Dynamic Loader
⚙️ boost::dll
🎯 Custom Behavior
🔄 Runtime Loading"] + style UserController fill:#F3E5F5,stroke:#7B1FA2,stroke-width:4px,color:#000 + style UserCtrl fill:#E1BEE7,stroke:#7B1FA2,stroke-width:3px,font-size:14px + end + + %% ========== INTERFACE LAYER ========== + subgraph Interface["🔌 Interface Layer"] + direction TB + BaseNav["📋 BaseNavigation
━━━━━━━━━━━━━━━━
🏗️ move_base_core::BaseNavigation
🎯 Abstract Interface
━━━━━━━━━━━━━━━━
📍 moveTo (goal / order)
🔄 executeInstantActions
⏸️ pause, resume, cancel
📊 getRobotPose"] + style Interface fill:#FFF3E0,stroke:#E65100,stroke-width:4px,color:#000 + style BaseNav fill:#FFE0B2,stroke:#E65100,stroke-width:3px,font-size:14px + end + + %% ========== MOVE BASE CORE ========== + subgraph MoveBaseCore["⚙️ Move Base Core"] + direction TB + MoveBase["🚀 MoveBase
━━━━━━━━━━━━━━━━
📦 move_base::MoveBase
🔄 State Machine
━━━━━━━━━━━━━━━━
📊 PLANNING
🎮 CONTROLLING
🧹 CLEARING
━━━━━━━━━━━━━━━━
🎛️ Control Loop
🔄 executeCycle"] + style MoveBaseCore fill:#E8F5E9,stroke:#2E7D32,stroke-width:4px,color:#000 + style MoveBase fill:#C8E6C9,stroke:#2E7D32,stroke-width:3px,font-size:14px + end + + %% ========== PLANNING LAYER ========== + subgraph Planning["🗺️ Planning Layer - Plugin System"] + direction LR + GP["🌍 Global Planner
━━━━━━━━━━━━━━━━
📋 nav_core::BaseGlobalPlanner
🔌 Dynamic Plugin
━━━━━━━━━━━━━━━━
🎯 A*, D*, Hybrid A*
📐 Long-range Planning
🗺️ Global Path"] + LP["📍 Local Planner
━━━━━━━━━━━━━━━━
📋 nav_core::BaseLocalPlanner
🔌 Dynamic Plugin
━━━━━━━━━━━━━━━━
🎯 DWA, TEB, MKT
🚗 Velocity Commands
🛡️ Obstacle Avoidance"] + RB["🔄 Recovery Behaviors
━━━━━━━━━━━━━━━━
📋 nav_core::RecoveryBehavior
🔌 Dynamic Plugin
━━━━━━━━━━━━━━━━
🧹 Clear Costmap
🔄 Rotate Recovery
🚨 Emergency Stop"] + style Planning fill:#E1F5FE,stroke:#0277BD,stroke-width:4px,color:#000 + style GP fill:#B3E5FC,stroke:#0277BD,stroke-width:3px,font-size:13px + style LP fill:#B3E5FC,stroke:#0277BD,stroke-width:3px,font-size:13px + style RB fill:#B3E5FC,stroke:#0277BD,stroke-width:3px,font-size:13px + end + + %% ========== COSTMAP LAYER ========== + subgraph Costmap["🗺️ Costmap Layer"] + direction LR + GC["🌍 Global Costmap
━━━━━━━━━━━━━━━━
📦 robot_costmap_2d::Costmap2DROBOT
🌍 frame: map
━━━━━━━━━━━━━━━━
🗺️ Static Map
🚫 Obstacles
💰 Inflation Layer"] + LC["📍 Local Costmap
━━━━━━━━━━━━━━━━
📦 robot_costmap_2d::Costmap2DROBOT
📍 frame: odom
━━━━━━━━━━━━━━━━
🔍 Dynamic Obstacles
📡 Sensor Fusion
⚡ Real-time Updates"] + style Costmap fill:#F1F8E9,stroke:#558B2F,stroke-width:4px,color:#000 + style GC fill:#DCEDC8,stroke:#558B2F,stroke-width:3px,font-size:13px + style LC fill:#DCEDC8,stroke:#558B2F,stroke-width:3px,font-size:13px + end + + %% ========== ALGORITHMS LAYER ========== + subgraph Algorithms["🧮 Algorithms Layer"] + direction LR + MKTAlgo["🚗 MKT Algorithm
━━━━━━━━━━━━━━━━
⚙️ Diff Drive Kinematics
🚲 Bicycle Kinematics
📐 Trajectory Generation"] + ScoreAlgo["📊 Score Algorithm
━━━━━━━━━━━━━━━━
📈 Trajectory Scoring
✅ Goal Checking
🎯 Path Evaluation"] + KalmanAlgo["🔍 Kalman Filter
━━━━━━━━━━━━━━━━
📊 State Estimation
🔮 Sensor Fusion
📉 Noise Filtering"] + style Algorithms fill:#FCE4EC,stroke:#C2185B,stroke-width:4px,color:#000 + style MKTAlgo fill:#F8BBD0,stroke:#C2185B,stroke-width:3px,font-size:13px + style ScoreAlgo fill:#F8BBD0,stroke:#C2185B,stroke-width:3px,font-size:13px + style KalmanAlgo fill:#F8BBD0,stroke:#C2185B,stroke-width:3px,font-size:13px + end + + %% ========== DATA SOURCES ========== + subgraph DataSources["📡 Data Sources"] + direction TB + Goal["🎯 Goal Input
━━━━━━━━━━━━━━━━
📍 robot_geometry_msgs::PoseStamped
📨 move_base_simple/goal"] + Loc["🌍 Localization
━━━━━━━━━━━━━━━━
📍 Pnkx Loc
🗺️ Global Pose
🔄 Pose Updates"] + TF["🔄 Transform System
━━━━━━━━━━━━━━━━
📐 tf3::BufferCore
🌐 Coordinate Frames
⏱️ Time Synchronization"] + Odom["🚗 Odometry
━━━━━━━━━━━━━━━━
📍 robot_geometry_msgs::Odometry
⚡ Robot Velocity
📊 Position Tracking"] + Laser["📡 Laser Sensors
━━━━━━━━━━━━━━━━
🔍 robot_sensor_msgs::LaserScan
🚫 Obstacle Detection
📏 Distance Measurement"] + Map["🗺️ Map Server
━━━━━━━━━━━━━━━━
📋 robot_nav_msgs::OccupancyGrid
🏗️ Static Map
📐 Map Metadata"] + style DataSources fill:#FFF9C4,stroke:#F57F17,stroke-width:4px,color:#000 + style Goal fill:#FFF59D,stroke:#F57F17,stroke-width:3px,font-size:12px + style Loc fill:#FFF59D,stroke:#F57F17,stroke-width:3px,font-size:12px + style TF fill:#FFF59D,stroke:#F57F17,stroke-width:3px,font-size:12px + style Odom fill:#FFF59D,stroke:#F57F17,stroke-width:3px,font-size:12px + style Laser fill:#FFF59D,stroke:#F57F17,stroke-width:3px,font-size:12px + style Map fill:#FFF59D,stroke:#F57F17,stroke-width:3px,font-size:12px + end + + %% ========== CONTROL LOOP ========== + subgraph ControlLoop["🔄 Control Loop"] + direction LR + CmdVel["⚡ Velocity Command
━━━━━━━━━━━━━━━━
📤 robot_geometry_msgs::Twist
📨 cmd_vel
━━━━━━━━━━━━━━━━
➡️ Linear Velocity
🔄 Angular Velocity"] + BaseCtrl["🎮 Base Controller
━━━━━━━━━━━━━━━━
🚗 diff_driver_controller
🚲 steer_drive_controller
━━━━━━━━━━━━━━━━
⚙️ Kinematics
🔧 Hardware Interface"] + style ControlLoop fill:#FFEBEE,stroke:#C62828,stroke-width:4px,color:#000 + style CmdVel fill:#FFCDD2,stroke:#C62828,stroke-width:3px,font-size:13px + style BaseCtrl fill:#FFCDD2,stroke:#C62828,stroke-width:3px,font-size:13px + end + + %% ========== CONNECTIONS ========== + %% API to User Controller + CAPI -->|"🔗 P/Invoke"| UserCtrl + + %% User Controller to Interface + UserCtrl -->|"🎯 Uses"| BaseNav + + %% Interface to MoveBase + BaseNav -->|"⚙️ Implements"| MoveBase + + %% MoveBase to Planning + MoveBase -->|"🎛️ Manages"| GP + MoveBase -->|"🎛️ Manages"| LP + MoveBase -->|"🎛️ Manages"| RB + + %% MoveBase to Costmap + MoveBase -->|"🎛️ Manages"| GC + MoveBase -->|"🎛️ Manages"| LC + + %% Data Sources to Components + Goal -->|"📥 Input"| UserCtrl + Goal -->|"📥 Input"| BaseNav + Loc -->|"📍 Pose"| MoveBase + TF -->|"🔄 Transforms"| MoveBase + Laser -->|"📡 Scan Data"| LC + Map -->|"🗺️ Static Map"| GC + Odom -->|"⚡ Velocity"| LP + Odom -->|"📍 Pose"| MoveBase + + %% Planning Flow + GC -->|"🗺️ Costmap"| GP + GP -->|"🛤️ Global Path"| LP + LC -->|"🗺️ Costmap"| LP + LC -->|"🗺️ Costmap"| RB + GC -->|"🗺️ Costmap"| RB + + %% Algorithm Integration + MKTAlgo -->|"🚗 Kinematics"| LP + ScoreAlgo -->|"📊 Scoring"| LP + KalmanAlgo -.->|"🔍 Filtering"| Loc + + %% Control Flow + LP -->|"⚡ Velocity Cmd"| CmdVel + CmdVel -->|"▶️ Execute"| BaseCtrl + BaseCtrl -->|"📊 Feedback"| Odom + + %% Styling Classes + classDef implemented fill:#C8E6C9,stroke:#2E7D32,stroke-width:4px,color:#000 + classDef partial fill:#FFF9C4,stroke:#F57F17,stroke-width:3px,color:#000 + classDef todo fill:#FFCDD2,stroke:#C62828,stroke-width:3px,color:#000 + + class BaseNav,MoveBase,GP,LP,RB,GC,LC,CAPI,MKTAlgo,ScoreAlgo,KalmanAlgo,UserCtrl implemented + class BaseCtrl,Loc,Odom,Map,Laser,TF partial +``` + +## Đề xuất giải pháp kiến trúc + +### 1. Xác định phạm vi & yêu cầu vận hành + +Cần làm rõ: +- **Kịch bản sử dụng chính**: go-to-goal trong môi trường indoor/outdoor? Tốc độ di chuyển? Độ chính xác yêu cầu? +- **Cảm biến có sẵn**: encoder, IMU, lidar, camera? Dữ liệu nào đã có? +- **Yêu cầu real-time**: chu kỳ điều khiển (control loop frequency), độ trễ tối đa cho phép? + +### 2. Kiến trúc tổng thể + +**Các layer chính:** + +1. **API Layer** ✅ + - C API (`nav_c_api`) cho P/Invoke với .NET/C# + - Wrapper functions cho tất cả BaseNavigation methods + +2. **User Controller Layer** ✅ + - **User Controller Plugin**: Dynamically allocated từ loader controller plugin + - Sử dụng `boost::dll` để load plugins động + - Cho phép user định nghĩa controller riêng để điều khiển navigation behavior + - Kết nối với `BaseNavigation` interface + +3. **Interface Layer** ✅ + - `move_base_core::BaseNavigation`: Abstract interface cho navigation + - Định nghĩa các operations: moveTo (goal / order), executeInstantActions, pause, resume, cancel + - Là lớp trung gian định nghĩa các phương thức và thuộc tính liên quan đến navigation + +4. **Move Base Core** ✅ + - `move_base::MoveBase`: Core implementation của BaseNavigation + - Quản lý state machine (PLANNING, CONTROLLING, CLEARING) + - Điều phối global/local planner và recovery behaviors + - Quản lý costmaps (global và local) + - Thực thi control loop (executeCycle) + +4. **Planning Layer** ✅ + - `robot_nav_core::BaseGlobalPlanner`: Interface cho global planners + - **Global Planner Implementations**: + - `custom_planner` - Custom path planner với curve support và merge path calculation + - `dock_planner` - Docking-specific planner với dock calculation utilities + - `two_points_planner` - Simple planner cho two-point navigation + - `robot_nav_core::BaseLocalPlanner`: Interface cho local planners + - **Local Planner Implementation**: + - `pnkx_local_planner` - Main local planner với multiple behaviors: + - Position planning (MKT algorithm) + - Docking planning + - Go straight planning + - Rotate planning + - `robot_nav_core::RecoveryBehavior`: Interface cho recovery behaviors + - Plugin system sử dụng `boost::dll` và `robot::PluginLoaderHelper` để dynamic loading + +5. **Costmap Layer** ✅ + - `robot_costmap_2d::Costmap2DROBOT`: Global và local costmap wrapper + - `robot_costmap_2d::LayeredCostmap`: Layered costmap system + - **Costmap Layers** (8 implementations): + - `StaticLayer` - Static map từ OccupancyGrid + - `ObstacleLayer` - Dynamic obstacles từ sensors + - `InflationLayer` - Cost inflation cho robot footprint + - `VoxelLayer` - 3D voxel grid cho obstacles + - `CriticalLayer` - Critical zones marking + - `DirectionalLayer` - Directional cost preferences + - `PreferredLayer` - Preferred path zones + - `UnpreferredLayer` - Unpreferred zones + - Frame management: map (global), odom (local) + - Thread-safe access với mutex + - Observation buffer cho sensor data + +6. **Algorithms Layer** ✅ + - **MKT Algorithm** (`mkt_algorithm`): + - Differential drive kinematics: + - `diff_go_straight` - Go straight behavior + - `diff_predictive_trajectory` - Predictive trajectory following + - `diff_rotate_to_goal` - Rotate to goal + - Bicycle model kinematics: + - `bicycle_go_straight` - Go straight với bicycle model + - `bicycle_pure_pursuit` - Pure pursuit control + - `bicycle_rotate_to_goal` - Rotate behavior + - **MKT Plugins** (`mkt_plugins`): + - `goal_checker` - Goal checking algorithms + - `simple_goal_checker` - Simple goal checking + - `standard_traj_generator` - Standard trajectory generation + - `limited_accel_generator` - Acceleration-limited trajectory generation + - `kinematic_parameters` - Kinematics parameter management + - `xy_theta_iterator` - Trajectory iteration utilities + - `velocity_iterator` - Velocity space iteration + - `one_d_velocity_iterator` - 1D velocity iteration + - **Score Algorithm** (`score_algorithm`): + - Trajectory scoring và evaluation + - Goal checking utilities + - Trajectory generator interface + - **Kalman Filter** (`kalman`): + - State estimation + - Sensor fusion + - Noise filtering + +7. **Data Sources** ⚠️ (Interface cần định nghĩa) + - Localization source (Pnkx Loc) + - Odometry source + - Sensor transforms (tf3) + - Map server + - Laser sensors + +8. **Control Layer** ⚠️ (Cần implementation) + - Base Controller interface (Diff/Steer drive) + - Velocity command execution + +**Định dạng dữ liệu:** +- `robot_geometry_msgs::Pose2D` / `robot_geometry_msgs::PoseStamped` (vị trí + hướng) +- `robot_geometry_msgs::Twist` (vận tốc linear/angular) +- `std::vector` (đường đi) +- `robot_costmap_2d::Costmap2D` (bản đồ chi phí) + +### 3. Thiết kế từng module (interface level) + +**Các interface đã có:** ✅ + +- `move_base_core::BaseNavigation` ✅ + - `initialize(TFListenerPtr)` - Khởi tạo với TF listener + - `moveTo(goal, xy_tol, yaw_tol)` - Di chuyển đến goal + - `moveTo(order, goal, ...)` - Một order VDA5050, cắt thành từng chặng + - `executeInstantActions(actions)` - Một message `instantActions`, nở theo bảng compound + +> **2026-08-10:** `dockTo` ×2, `rotateTo`, `moveStraightTo` đã bị **gỡ khỏi interface**. Chúng đẩy +> goal thẳng vào lõi, bỏ qua mission layer, nên một goal đến giữa chừng thay thế chặng mà hàng đợi +> đang chạy. Docking / xoay tại chỗ / đi thẳng giờ là khoá `profile:` của từng chặng trong order +> (`compound_actions_params.yaml`), nên vẫn dùng được nguyên vẹn qua hai entry point còn lại. + - `pause()`, `resume()`, `cancel()` - Điều khiển trạng thái + - `getRobotPose(...)` - Lấy vị trí robot + +- `robot_nav_core::BaseGlobalPlanner` ✅ + - `makePlan(start, goal, plan)` - Tạo global path + - `initialize(name, costmap_robot)` - Khởi tạo với costmap + - **Implementations**: `custom_planner`, `dock_planner`, `two_points_planner` + +- `robot_nav_core::BaseLocalPlanner` ✅ + - `computeVelocityCommands(odom, cmd_vel)` - Tính toán velocity command + - `setPlan(plan)` - Set global path để follow + - `isGoalReached()` - Kiểm tra đã đến goal chưa + - `swapPlanner(name)` - Thay đổi planner động (position, docking, go_straight, rotate) + - `setTwistLinear/Angular(...)` - Set velocity limits + - `getTwistLinear/Angular(...)` - Get velocity limits + - **Implementation**: `pnkx_local_planner` với multiple behaviors + +- `robot_nav_core::RecoveryBehavior` ✅ + - `runBehavior()` - Thực thi recovery behavior + - `initialize(name, tf, global_costmap, local_costmap)` - Khởi tạo + +- `robot_costmap_2d::Costmap2DROBOT` ✅ + - Wrapper cho costmap với robot footprint + - Thread-safe access với mutex + +**Các interface cần bổ sung:** ⚠️ + +- `ILocalizationSource` ⚠️ + - `getCurrentPose()` - Lấy vị trí hiện tại từ localization + - `isAvailable()` - Kiểm tra localization có sẵn không + +- `IOdometrySource` ⚠️ + - `getCurrentPose()` - Lấy vị trí từ odometry + - `getCurrentVelocity()` - Lấy vận tốc hiện tại + - `isAvailable()` - Kiểm tra odometry có sẵn không + +- `IBaseController` ⚠️ + - `executeVelocity(cmd_vel)` - Thực thi velocity command + - `stop()` - Dừng robot ngay lập tức + - `getCurrentVelocity()` - Lấy vận tốc thực tế + +- `IMapProvider` ⚠️ + - `getMap()` - Lấy static map + - `isMapAvailable()` - Kiểm tra map có sẵn không + +**Plugin mechanism:** ✅ +- Sử dụng `boost::dll` để dynamic loading plugins +- Factory pattern với `boost::function` và `boost::dll::import_alias` +- `robot::PluginLoaderHelper` để tìm library path từ plugin name +- Config file YAML để specify plugin names +- Plugin interfaces: + - `robot_nav_core::BaseGlobalPlanner` - Global planners + - `robot_nav_core::BaseLocalPlanner` - Local planners + - `robot_nav_core::RecoveryBehavior` - Recovery behaviors + - `robot_costmap_2d::Layer` - Costmap layers +- Plugin registration với `BOOST_DLL_ALIAS` macro + +### 4. Cơ chế giao tiếp & đồng bộ + +**Lựa chọn transport:** +- Shared memory + mutex (cho real-time nhẹ) +- Message queue (ZeroMQ, nanomsg) +- Event loop với callback thread-safe + +**Time synchronization:** +- Sử dụng `std::chrono` cho timestamp +- Buffer dữ liệu để xử lý dữ liệu không đồng bộ + +**Threading strategy:** +- Mỗi module một thread riêng, hoặc +- Scheduler chung quản lý tất cả + +### 5. Chiến lược an toàn & recovery + +**Monitoring:** +- Heartbeat mechanism +- Watchdog timer + +**Recovery behaviors:** +- Không tìm được đường đi +- Mất localization +- Obstacle chặn đường +- Emergency stop mechanism +- Giới hạn vận tốc theo trạng thái + +### 6. Config & Logging/Diagnostics + +**Configuration:** +- File YAML/JSON cho: + - Kinematics parameters + - Velocity limits + - Planner parameters + - Sensor configurations + +**Logging & Debugging:** +- Logging framework (spdlog?) +- Telemetry interface +- Visualizer tool (SDL/ImGui) để debug map/path + +### 7. Trạng thái triển khai & lộ trình + +**Đã hoàn thành:** ✅ + +1. ✅ **Interface Layer**: + - `move_base_core::BaseNavigation` - Abstract interface hoàn chỉnh + - `move_base_core::common.h` - Common types và utilities + +2. ✅ **Implementation Layer**: + - `move_base::MoveBase` - Core implementation với state machine + - `executeCycle()` - Control loop implementation + - State management (PLANNING, CONTROLLING, CLEARING, PAUSED) + - Threading với planner thread và control loop + +3. ✅ **Planning Layer - Plugin System**: + - **Global Planners** (3 implementations): + - `custom_planner` - Custom path planning với curve support + - `dock_planner` - Docking-specific planner + - `two_points_planner` - Simple two-point planner + - **Local Planners** (1 implementation): + - `pnkx_local_planner` - Main local planner với: + - `pnkx_docking_local_planner` - Docking behavior + - `pnkx_go_straight_local_planner` - Go straight behavior + - `pnkx_rotate_local_planner` - Rotate behavior + - **Recovery Behaviors**: Interface đã định nghĩa + - Plugin loading với `boost::dll` và `robot::PluginLoaderHelper` + +4. ✅ **Costmap Layer**: + - `robot_costmap_2d::Costmap2DROBOT` - Global và local costmap + - **Costmap Layers** (8 implementations): + - `static_layer` - Static map layer + - `obstacle_layer` - Dynamic obstacles + - `inflation_layer` - Cost inflation + - `voxel_layer` - 3D voxel grid + - `critical_layer` - Critical zones + - `directional_layer` - Directional costs + - `preferred_layer` - Preferred paths + - `unpreferred_layer` - Unpreferred zones + - Layered costmap system với plugin support + +5. ✅ **Algorithms Layer**: + - **MKT Algorithm**: + - Differential drive kinematics (go_straight, rotate, predictive) + - Bicycle model kinematics (go_straight, rotate, pure pursuit) + - **MKT Plugins**: + - `goal_checker` - Goal checking algorithms + - `standard_traj_generator` - Standard trajectory generation + - `kinematic_parameters` - Kinematics parameter management + - `xy_theta_iterator` - Trajectory iteration + - `limited_accel_generator` - Acceleration-limited trajectories + - **Score Algorithm**: Trajectory scoring và goal checking + - **Kalman Filter**: State estimation và filtering + +6. ✅ **API Layer**: + - `nav_c_api` - C API wrapper cho .NET/C# P/Invoke + - Wrapper functions cho BaseNavigation methods + +7. ✅ **Supporting Libraries**: + - `tf3` - Transform system (buffer_core, transforms) + - `robot_time` - Time management (Time, Duration, Timer, Rate) + - `robot_cpp` - Core utilities: + - `robot::init()` - Initialization + - `robot::NodeHandle` - YAML config loading + - `robot::PluginLoaderHelper` - Plugin discovery + - `robot_nav_2d_utils` - 2D navigation utilities (conversions, path_ops, polygons, bounds, tf_help) + - `robot_nav_2d_msgs` - 2D navigation messages + - `geometry_msgs` - Geometry message types (29 types) + - `robot_nav_msgs` - Navigation messages (24 types) + - `robot_sensor_msgs` - Sensor messages (30 types) + - `laser_geometry` - Laser scan geometry utilities + - `voxel_grid` - Voxel grid implementation + - `data_convert` - Data conversion utilities + - `nav_grid` - Navigation grid utilities + +**Đang triển khai / Cần bổ sung:** ⚠️ + +1. ⚠️ **Data Sources Interfaces**: + - `ILocalizationSource` interface - Cần định nghĩa + - `IOdometrySource` interface - Cần định nghĩa + - `IMapProvider` interface - Cần định nghĩa + - Integration với Pnkx Loc, odometry sources - Hiện tại dùng trực tiếp qua MoveBase methods + +2. ⚠️ **Base Controller**: + - `IBaseController` interface - Cần định nghĩa + - Diff drive controller implementation - Cần implement + - Steer drive controller implementation - Cần implement + - Velocity command execution - Hiện tại chỉ có `setTwistLinear/Angular` trong local planner + +3. ⚠️ **User Controller Plugin System**: + - Factory để load user controller plugins - Cần implement + - Interface cho User Controller - Cần định nghĩa + - Integration với BaseNavigation - Cần implement + +4. ⚠️ **Testing & Documentation**: + - Unit tests cho các modules - Một số đã có (costmap, bounds, etc.) + - Integration tests - Cần bổ sung + - Simulation environment - TODO + +**Lộ trình tiếp theo:** + +**Phase 1: Data Sources & Base Controller** (Ưu tiên cao) +- Định nghĩa interfaces cho data sources +- Implement Base Controller interface và diff drive controller +- Integration với MoveBase + +**Phase 2: Control Loop & State Management** (Ưu tiên cao) +- Hoàn thiện executeCycle trong MoveBase +- State machine management +- Threading strategy + +**Phase 3: User Controller Plugin System** (Ưu tiên trung bình) +- Factory pattern cho user controllers +- Plugin loading mechanism +- Integration testing + +**Phase 4: Testing & Optimization** (Ưu tiên trung bình) +- Unit tests cho các module +- Integration tests +- Performance optimization + +**Testing strategy:** +- Unit tests cho các module độc lập (gtest?) +- Integration tests cho full navigation stack +- Simulation environment (2D simulator) - TODO +- Hardware-in-the-loop testing - TODO + +## Cấu trúc thư mục + +``` +pnkx_nav_core/ +├── src/ +│ ├── Navigations/ +│ │ ├── Cores/ +│ │ │ ├── move_base_core/ # BaseNavigation interface ✅ +│ │ │ │ ├── include/move_base_core/ +│ │ │ │ │ ├── navigation.h # BaseNavigation abstract class +│ │ │ │ │ └── common.h # Common types (TFListenerPtr, etc.) +│ │ │ ├── robot_nav_core/ # Planner interfaces ✅ +│ │ │ │ ├── include/robot_nav_core/ +│ │ │ │ │ ├── base_global_planner.h +│ │ │ │ │ ├── base_local_planner.h +│ │ │ │ │ └── recovery_behavior.h +│ │ │ ├── robot_nav_core_adapter/ # Adapter utilities ✅ +│ │ │ │ ├── include/robot_nav_core_adapter/ +│ │ │ │ │ ├── global_planner_adapter.h +│ │ │ │ │ ├── local_planner_adapter.h +│ │ │ │ │ └── costmap_adapter.h +│ │ │ └── robot_nav_core2/ # Additional nav utilities ✅ +│ │ │ ├── include/robot_nav_core2/ +│ │ │ │ ├── global_planner.h +│ │ │ │ ├── local_planner.h +│ │ │ │ └── costmap.h +│ │ ├── Libraries/ +│ │ │ ├── nav_grid/ # Navigation grid utilities ✅ +│ │ │ └── (costmap, tf3, robot_time ở Libraries/) +│ │ └── Packages/ +│ │ └── move_base/ # MoveBase implementation ✅ +│ │ ├── include/move_base/ +│ │ │ └── move_base.h +│ │ └── src/ +│ │ ├── move_base.cpp +│ │ └── move_base_main.cpp +│ │ +│ ├── Algorithms/ +│ │ ├── Cores/ +│ │ │ └── score_algorithm/ # Trajectory scoring ✅ +│ │ │ ├── include/score_algorithm/ +│ │ │ │ ├── score_algorithm.h +│ │ │ │ ├── goal_checker.h +│ │ │ │ └── trajectory_generator.h +│ │ ├── Libraries/ +│ │ │ ├── mkt_algorithm/ # MKT kinematics algorithms ✅ +│ │ │ │ ├── include/mkt_algorithm/ +│ │ │ │ │ ├── diff/ # Differential drive +│ │ │ │ │ │ ├── diff_go_straight.h +│ │ │ │ │ │ ├── diff_predictive_trajectory.h +│ │ │ │ │ │ └── diff_rotate_to_goal.h +│ │ │ │ │ └── bicycle/ # Bicycle model +│ │ │ │ │ ├── bicycle.h +│ │ │ │ │ ├── go_straight.h +│ │ │ │ │ └── rotate_to_goal.h +│ │ │ ├── mkt_plugins/ # MKT plugin components ✅ +│ │ │ │ ├── include/mkt_plugins/ +│ │ │ │ │ ├── goal_checker.h +│ │ │ │ │ ├── standard_traj_generator.h +│ │ │ │ │ ├── kinematic_parameters.h +│ │ │ │ │ └── xy_theta_iterator.h +│ │ │ ├── mkt_msgs/ # MKT message types ✅ +│ │ │ ├── kalman/ # Kalman filtering ✅ +│ │ │ └── angles/ # Angle utilities ✅ +│ │ └── Packages/ +│ │ ├── global_planners/ +│ │ │ ├── custom_planner/ # Custom global planner ✅ +│ │ │ ├── dock_planner/ # Docking planner ✅ +│ │ │ └── two_points_planner/ # Two points planner ✅ +│ │ └── local_planners/ +│ │ └── pnkx_local_planner/ # PNKX local planner ✅ +│ │ ├── include/pnkx_local_planner/ +│ │ │ ├── pnkx_local_planner.h +│ │ │ ├── pnkx_docking_local_planner.h +│ │ │ ├── pnkx_go_straight_local_planner.h +│ │ │ └── pnkx_rotate_local_planner.h +│ │ +│ ├── Libraries/ +│ │ ├── costmap_2d/ # Costmap system ✅ +│ │ │ ├── include/robot_costmap_2d/ +│ │ │ │ ├── costmap_2d_robot.h +│ │ │ │ ├── layered_costmap.h +│ │ │ │ └── layer.h +│ │ │ ├── plugins/ # Costmap layers ✅ +│ │ │ │ ├── static_layer.cpp +│ │ │ │ ├── obstacle_layer.cpp +│ │ │ │ ├── inflation_layer.cpp +│ │ │ │ ├── voxel_layer.cpp +│ │ │ │ ├── critical_layer.cpp +│ │ │ │ ├── directional_layer.cpp +│ │ │ │ ├── preferred_layer.cpp +│ │ │ │ └── unpreferred_layer.cpp +│ │ │ └── config/ # Costmap configs +│ │ ├── tf3/ # Transform system ✅ +│ │ ├── robot_time/ # Time management ✅ +│ │ ├── robot_cpp/ # Core utilities ✅ +│ │ │ ├── include/robot/ +│ │ │ │ ├── init.h # Initialization +│ │ │ │ ├── node_handle.h # NodeHandle (YAML config) +│ │ │ │ └── plugin_loader_helper.h # Plugin loader +│ │ ├── robot_nav_2d_utils/ # 2D nav utilities ✅ +│ │ ├── robot_nav_2d_msgs/ # 2D nav messages ✅ +│ │ ├── geometry2/ # Geometry utilities ✅ +│ │ │ ├── robot_tf3_geometry_msgs/ +│ │ │ └── robot_tf3_sensor_msgs/ +│ │ ├── common_msgs/ # Message types ✅ +│ │ │ ├── robot_geometry_msgs/ +│ │ │ ├── robot_nav_msgs/ +│ │ │ ├── robot_sensor_msgs/ +│ │ │ ├── robot_std_msgs/ +│ │ │ ├── robot_protocol_msgs/ +│ │ │ └── robot_visualization_msgs/ +│ │ ├── laser_geometry/ # Laser geometry ✅ +│ │ ├── voxel_grid/ # Voxel grid ✅ +│ │ ├── data_convert/ # Data conversion ✅ +│ │ └── xmlrpcpp/ # XML-RPC utilities ✅ +│ │ +│ └── APIs/ +│ └── c_api/ # C API wrapper ✅ +│ ├── include/nav_c_api.h +│ └── src/nav_c_api.cpp +│ +├── build/ # Build artifacts +├── config/ # Configuration files +├── examples/ # Example code +└── doc/ # Documentation + ├── architecture_discussion.md + ├── implementation_plan.md + └── folders.md +``` + +## Ghi chú + +- ✅ Kiến trúc cốt lõi đã được triển khai với plugin system linh hoạt +- ✅ **3 Global Planners** đã triển khai: custom_planner, dock_planner, two_points_planner +- ✅ **1 Local Planner** đã triển khai: pnkx_local_planner với 4 behaviors (position, docking, go_straight, rotate) +- ✅ **8 Costmap Layers** đã triển khai: static, obstacle, inflation, voxel, critical, directional, preferred, unpreferred +- ✅ **MKT Algorithms** hỗ trợ cả differential drive và bicycle model +- ✅ **Plugin System** hoàn chỉnh với `boost::dll` và `robot::PluginLoaderHelper` +- ⚠️ Cần bổ sung data sources interfaces và base controller +- 🔄 Kiến trúc được thiết kế để dễ dàng thay đổi thuật toán và mô hình kinematics thông qua plugin system +- 📦 Tất cả components được build bằng CMake, hỗ trợ cả Catkin và Standalone CMake +- 🔌 Plugin system sử dụng `boost::dll` cho dynamic loading +- 🎯 MoveBase đã có control loop (`executeCycle`) và state machine hoàn chỉnh +- 📚 Có đầy đủ message types: geometry_msgs (29), nav_msgs (24), sensor_msgs (30), std_msgs (32) + + + + + + diff --git a/doc/diff_drive_c.drawio b/doc/diff_drive_c.drawio new file mode 100755 index 0000000..72204be --- /dev/null +++ b/doc/diff_drive_c.drawio @@ -0,0 +1,1282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/folders.md b/doc/folders.md new file mode 100644 index 0000000..c0eedec --- /dev/null +++ b/doc/folders.md @@ -0,0 +1,99 @@ +# Cấu trúc thư mục pnkx_nav_core + +Mô tả cấu trúc thư mục thực tế của dự án: + +``` +pnkx_nav_core/ +├── src/ +│ ├── Navigations/ +│ │ ├── Cores/ +│ │ │ ├── move_base_core/ # BaseNavigation interface +│ │ │ ├── robot_nav_core/ # Planner interfaces (BaseGlobalPlanner, BaseLocalPlanner, RecoveryBehavior) +│ │ │ ├── robot_nav_core_adapter/ # Adapter utilities (global_planner_adapter, local_planner_adapter, costmap_adapter) +│ │ │ └── robot_nav_core2/ # Additional nav utilities (global_planner, local_planner, costmap) +│ │ ├── Libraries/ +│ │ │ └── nav_grid/ # Navigation grid utilities +│ │ └── Packages/ +│ │ └── move_base/ # MoveBase implementation +│ │ +│ ├── Algorithms/ +│ │ ├── Cores/ +│ │ │ └── score_algorithm/ # Trajectory scoring và goal checking +│ │ ├── Libraries/ +│ │ │ ├── mkt_algorithm/ # MKT kinematics (diff drive & bicycle) +│ │ │ ├── mkt_plugins/ # MKT plugin components +│ │ │ ├── mkt_msgs/ # MKT message types +│ │ │ ├── kalman/ # Kalman filtering +│ │ │ └── angles/ # Angle utilities +│ │ └── Packages/ +│ │ ├── global_planners/ +│ │ │ ├── custom_planner/ # Custom global planner +│ │ │ ├── dock_planner/ # Docking planner +│ │ │ └── two_points_planner/ # Two points planner +│ │ └── local_planners/ +│ │ └── pnkx_local_planner/ # PNKX local planner +│ │ +│ ├── Libraries/ +│ │ ├── costmap_2d/ # Costmap system với 8 layers +│ │ ├── tf3/ # Transform system +│ │ ├── robot_time/ # Time management +│ │ ├── robot_cpp/ # Core utilities (init, NodeHandle, PluginLoaderHelper) +│ │ ├── robot_nav_2d_utils/ # 2D navigation utilities +│ │ ├── robot_nav_2d_msgs/ # 2D navigation messages +│ │ ├── geometry2/ # Geometry utilities (tf3_geometry_msgs, tf3_sensor_msgs) +│ │ ├── common_msgs/ # Message types +│ │ │ ├── robot_geometry_msgs/ # Geometry messages (29 types) +│ │ │ ├── robot_nav_msgs/ # Navigation messages (24 types) +│ │ │ ├── robot_sensor_msgs/ # Sensor messages (30 types) +│ │ │ ├── robot_std_msgs/ # Standard messages (32 types) +│ │ │ ├── robot_protocol_msgs/ # Protocol messages +│ │ │ ├── robot_visualization_msgs/ # Visualization messages +│ │ │ └── utils/ # Message utilities +│ │ ├── laser_geometry/ # Laser geometry utilities +│ │ ├── voxel_grid/ # Voxel grid +│ │ ├── data_convert/ # Data conversion +│ │ └── xmlrpcpp/ # XML-RPC utilities +│ │ +│ └── APIs/ +│ └── c_api/ # C API wrapper cho .NET/C# +│ +├── build/ # Build artifacts +├── config/ # Configuration files +├── examples/ # Example code +└── doc/ # Documentation + ├── architecture_discussion.md + ├── implementation_plan.md + ├── folders.md + └── readme.md +``` + +## Chi tiết các thư mục chính + +### Navigations/ +- **Cores/**: Interfaces và core utilities + - `move_base_core`: BaseNavigation interface + - `robot_nav_core`: Planner interfaces + - `robot_nav_core_adapter`: Adapter layer + - `robot_nav_core2`: Additional utilities +- **Libraries/**: Navigation libraries + - `nav_grid`: Grid utilities +- **Packages/**: Implementations + - `move_base`: MoveBase implementation + +### Algorithms/ +- **Cores/**: Core algorithms + - `score_algorithm`: Trajectory scoring +- **Libraries/**: Algorithm libraries + - `mkt_algorithm`: Kinematics algorithms + - `mkt_plugins`: Plugin components + - `kalman`: Filtering +- **Packages/**: Algorithm implementations + - `global_planners/`: 3 planners + - `local_planners/`: 1 planner với multiple behaviors + +### Libraries/ +- **costmap_2d/**: Costmap system với 8 layers +- **tf3/**: Transform system +- **robot_cpp/**: Core utilities (init, NodeHandle, PluginLoaderHelper) +- **common_msgs/**: Message type definitions +- Các utilities khác: time, geometry, sensors, etc. \ No newline at end of file diff --git a/doc/implementation_plan.md b/doc/implementation_plan.md new file mode 100644 index 0000000..846e79e --- /dev/null +++ b/doc/implementation_plan.md @@ -0,0 +1,230 @@ +# Kế hoạch Implementation Navigation System + +## Phân tích Kiến trúc Hiện tại + +### ✅ Đã có sẵn: + +1. **Interface Layer:** + - `move_base_core::BaseNavigation` - Interface chính + - `move_base::MoveBase` - Implementation + +2. **Core Components:** + - `nav_core::BaseGlobalPlanner` - Interface cho global planner + - `nav_core::BaseLocalPlanner` - Interface cho local planner + - `nav_core::RecoveryBehavior` - Interface cho recovery behaviors + - Plugin system với `boost::dll` để load dynamic plugins + +3. **Costmap System:** + - `robot_costmap_2d::Costmap2DROBOT` - Global và local costmap + - Costmap layers (static, obstacle, inflation, etc.) + +4. **Supporting Libraries:** + - `tf3` - Transform system + - `robot_time` - Time management + - `geometry_msgs` - Message types + - `robot_nav_2d_msgs`, `robot_nav_2d_utils` - 2D navigation utilities + +### ❌ Cần bổ sung/hoàn thiện: + +1. **User Controller Plugin System:** + - Factory để tạo User Controller từ plugin + - Interface cho User Controller + - Integration với BaseNavigation + +2. **Data Sources Integration:** + - Pnkx Loc interface + - Odometry Source interface + - Sensor Transform management + - Map Server interface + - Laser Sensor Sources interface + +3. **Base Controller:** + - Diff drive controller + - Steer drive controller + - Velocity command execution + +4. **Hoàn thiện MoveBase:** + - Control loop implementation + - State machine management + - Recovery behavior execution + +## Kế hoạch Implementation + +### Phase 1: Data Sources & Interfaces (Ưu tiên cao) + +#### 1.1 Odometry Source Interface +**File:** `src/Navigations/Cores/move_base_core/include/move_base_core/odometry_source.h` +```cpp +class IOdometrySource { + virtual robot_geometry_msgs::PoseStamped getCurrentPose() = 0; + virtual robot_geometry_msgs::Twist getCurrentVelocity() = 0; + virtual bool isAvailable() = 0; +}; +``` + +#### 1.2 Localization Source Interface (Pnkx Loc) +**File:** `src/Navigations/Cores/move_base_core/include/move_base_core/localization_source.h` +```cpp +class ILocalizationSource { + virtual robot_geometry_msgs::PoseStamped getRobotPose() = 0; + virtual std::string getGlobalFrame() = 0; + virtual bool isLocalized() = 0; +}; +``` + +#### 1.3 Map Provider Interface +**File:** `src/Navigations/Cores/move_base_core/include/move_base_core/map_provider.h` +```cpp +class IMapProvider { + virtual robot_nav_msgs::OccupancyGrid getMap() = 0; + virtual bool isMapAvailable() = 0; +}; +``` + +#### 1.4 Sensor Data Interface +**File:** `src/Navigations/Cores/move_base_core/include/move_base_core/sensor_source.h` +```cpp +class ISensorSource { + virtual robot_sensor_msgs::LaserScan getLatestScan() = 0; + virtual bool hasNewData() = 0; +}; +``` + +### Phase 2: Base Controller (Ưu tiên cao) + +#### 2.1 Base Controller Interface +**File:** `src/Navigations/Cores/move_base_core/include/move_base_core/base_controller.h` +```cpp +class IBaseController { + virtual bool setVelocity(const robot_geometry_msgs::Twist& cmd_vel) = 0; + virtual bool stop() = 0; + virtual robot_geometry_msgs::Twist getCurrentVelocity() = 0; +}; +``` + +#### 2.2 Diff Drive Controller +**File:** `src/Navigations/Packages/base_controllers/include/base_controllers/diff_drive_controller.h` +- Implement IBaseController +- Convert Twist to wheel velocities +- Handle kinematics cho differential drive + +#### 2.3 Steer Drive Controller +**File:** `src/Navigations/Packages/base_controllers/include/base_controllers/steer_drive_controller.h` +- Implement IBaseController +- Convert Twist to steering angles và wheel velocities +- Handle kinematics cho bicycle/steering model + +### Phase 3: User Controller Plugin System (Ưu tiên trung bình) + +#### 3.1 User Controller Interface +**File:** `src/Navigations/Cores/move_base_core/include/move_base_core/user_controller.h` +```cpp +class IUserController { + virtual void onGoalReceived(const robot_geometry_msgs::PoseStamped& goal) = 0; + virtual void onNavigationStateChanged(move_base_core::State state) = 0; + virtual void onFeedback(const NavFeedback& feedback) = 0; +}; +``` + +#### 3.2 User Controller Factory +**File:** `src/Navigations/Cores/move_base_core/src/user_controller_factory.cpp` +- Load plugin từ config +- Create instance với boost::dll +- Manage lifecycle + +### Phase 4: Control Loop & State Machine (Ưu tiên cao) + +#### 4.1 Control Loop Implementation +**File:** `src/Navigations/Packages/move_base/src/move_base_control_loop.cpp` +- Main control loop thread +- Planner thread management +- Controller execution +- Frequency control + +#### 4.2 State Machine +**File:** `src/Navigations/Packages/move_base/src/move_base_state_machine.cpp` +- State transitions +- Recovery behavior triggers +- Goal management + +### Phase 5: Integration & Testing (Ưu tiên trung bình) + +#### 5.1 Integration Layer +- Connect tất cả components +- Data flow management +- Error handling + +#### 5.2 Testing +- Unit tests +- Integration tests +- Simulation tests + +## Cấu trúc Thư mục Đề xuất + +``` +src/Navigations/ +├── Cores/ +│ ├── move_base_core/ ✅ Đã có +│ │ ├── interfaces/ +│ │ │ ├── odometry_source.h ⚠️ Cần tạo +│ │ │ ├── localization_source.h ⚠️ Cần tạo +│ │ │ ├── map_provider.h ⚠️ Cần tạo +│ │ │ ├── sensor_source.h ⚠️ Cần tạo +│ │ │ ├── base_controller.h ⚠️ Cần tạo +│ │ │ └── user_controller.h ⚠️ Cần tạo +│ │ └── src/ +│ │ └── user_controller_factory.cpp ⚠️ Cần tạo +│ ├── nav_core/ ✅ Đã có +│ └── nav_core2/ ✅ Đã có +│ +├── Packages/ +│ ├── move_base/ ✅ Đã có (cần hoàn thiện) +│ │ └── src/ +│ │ ├── move_base_control_loop.cpp ⚠️ Cần tạo +│ │ └── move_base_state_machine.cpp ⚠️ Cần tạo +│ │ +│ └── base_controllers/ ⚠️ Cần tạo +│ ├── include/ +│ │ └── base_controllers/ +│ │ ├── diff_drive_controller.h +│ │ └── steer_drive_controller.h +│ └── src/ +│ ├── diff_drive_controller.cpp +│ └── steer_drive_controller.cpp +│ +└── Libraries/ + └── (các libraries hiện có) ✅ +``` + +## Thứ tự Implementation + +### Sprint 1: Foundation (1-2 tuần) +1. ✅ Tạo interfaces cho data sources +2. ✅ Tạo base controller interface +3. ✅ Implement diff drive controller cơ bản + +### Sprint 2: Integration (1-2 tuần) +1. ✅ Integrate data sources vào MoveBase +2. ✅ Implement control loop +3. ✅ Connect base controller + +### Sprint 3: Plugin System (1 tuần) +1. ✅ User controller plugin system +2. ✅ Factory pattern implementation + +### Sprint 4: State Machine & Recovery (1 tuần) +1. ✅ State machine implementation +2. ✅ Recovery behavior integration + +### Sprint 5: Testing & Polish (1 tuần) +1. ✅ Unit tests +2. ✅ Integration tests +3. ✅ Documentation + +## Notes + +- Tất cả interfaces nên follow pattern của `BaseNavigation` +- Sử dụng `boost::dll` cho plugin system (đã có sẵn) +- Thread safety: sử dụng `boost::mutex` và `boost::recursive_mutex` +- Error handling: throw exceptions, return bool cho simple operations + diff --git a/doc/readme.md b/doc/readme.md new file mode 100644 index 0000000..09ed57e --- /dev/null +++ b/doc/readme.md @@ -0,0 +1,15 @@ +Mô tả dựng án : + Tôi đang nghiên cứu viết chương di chuyển bám quỹ đạo (navigation) cho robot amr dạng hai bánh vi sai. Tôi muốn bỏ ROS chuyển sang viết + thuần trên Cmake. + +Các chức năng cần có: +- Có khả năng thay đổi mô hình kinematics như dạng hai bánh vi sai, dạng steering bicycle, ... +- Có chức năng di chuyển từ điểủ khởi đầu đến điểm đích +- Có chức năng xoay tròn +- Có chức năng đi thẳng +- Có chức năng thay đổi vận tốc + + + + + diff --git a/examples/NavigationExample/NavigationAPI.cs b/examples/NavigationExample/NavigationAPI.cs new file mode 100644 index 0000000..4a46136 --- /dev/null +++ b/examples/NavigationExample/NavigationAPI.cs @@ -0,0 +1,287 @@ +using System; +using System.Runtime.InteropServices; +using NavigationExample; + +namespace NavigationExample +{ + /// + /// C# P/Invoke wrapper for Navigation C API + /// + public class NavigationAPI + { + private const string DllName = "/usr/local/lib/libnav_c_api.so"; // Linux + // For Windows: "nav_c_api.dll" + // For macOS: "libnav_c_api.dylib" + + // ============================================================================ + // Enums + // ============================================================================ + public enum NavigationState + { + Pending = 0, + Active = 1, + Preempted = 2, + Succeeded = 3, + Aborted = 4, + Rejected = 5, + Preempting = 6, + Recalling = 7, + Recalled = 8, + Lost = 9, + Planning = 10, + Controlling = 11, + Clearing = 12, + Paused = 13 + } + + [StructLayout(LayoutKind.Sequential)] + public struct NavFeedback + { + public NavigationState navigation_state; + public IntPtr feed_back_str; // char*; free with nav_c_api_free_string + public Pose2D current_pose; + [MarshalAs(UnmanagedType.I1)] + public bool goal_checked; + [MarshalAs(UnmanagedType.I1)] + public bool is_ready; + } + + + /// Planner data output (plan, costmap, footprint). + [StructLayout(LayoutKind.Sequential)] + public struct PlannerDataOutput + { + public Path2D plan; + public OccupancyGrid costmap; + public OccupancyGridUpdate costmap_update; + [MarshalAs(UnmanagedType.I1)] + public bool is_costmap_updated; + public PolygonStamped footprint; + } + + [StructLayout(LayoutKind.Sequential)] + public struct NavigationHandle + { + public IntPtr ptr; + } + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + public static extern Header header_create(string frame_id); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + public static extern Header header_set_data( + uint seq, + uint sec, + uint nsec, + string frame_id); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern Time time_create(); + + /// Free a string allocated by the API (strdup). + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern void nav_c_api_free_string(IntPtr str); + + /// Convert NavigationState to string; caller must free with nav_c_api_free_string. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + public static extern IntPtr navigation_state_to_string(NavigationState state); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_feedback(NavigationHandle handle, ref NavFeedback out_feedback); + + + /// Helper: copy unmanaged char* to managed string; does not free the pointer. + public static string MarshalString(IntPtr p) + { + if (p == IntPtr.Zero) return string.Empty; + return Marshal.PtrToStringAnsi(p) ?? string.Empty; + } + + /// Free strings inside NavFeedback (feed_back_str). Call after navigation_get_feedback when done. + public static void navigation_free_feedback(ref NavFeedback feedback) + { + if (feedback.feed_back_str != IntPtr.Zero) + { + nav_c_api_free_string(feedback.feed_back_str); + feedback.feed_back_str = IntPtr.Zero; + } + } + + // ============================================================================ + // Navigation Handle Management + // ============================================================================ + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern NavigationHandle navigation_create(); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern void navigation_destroy(NavigationHandle handle); + + /// Initialize navigation using an existing tf3 buffer (from libtf3). Caller owns the buffer and must call tf3_buffer_destroy after navigation_destroy. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_initialize(NavigationHandle handle, IntPtr tf3_buffer); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_set_robot_footprint(NavigationHandle handle, Point[] points, UIntPtr point_count); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_robot_footprint(NavigationHandle handle, ref Point[] out_points, ref UIntPtr out_count); + + /// Send a goal for the robot to navigate to (global frame). + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_move_to(NavigationHandle handle, PoseStamped goal); + + /// Navigate using an Order message (graph nodes/edges). Order must be built or obtained from native side; call order_free when done if it was allocated by native. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_move_to_order(NavigationHandle handle, Order order, PoseStamped goal); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_move_to_nodes_edges(NavigationHandle handle, IntPtr nodes, UIntPtr node_count, IntPtr edges, UIntPtr edge_count, PoseStamped goal); + + // navigation_dock_to, navigation_dock_to_order, navigation_dock_to_nodes_edges, + // navigation_move_straight_to and navigation_rotate_to no longer exist in the native + // library. They pushed a goal past the mission layer, so one of them arriving mid-route + // replaced the leg the mission queue was running without the queue noticing. + // + // Docking, go-straight and rotate are per-leg properties of an order now: set `profile:` + // on the leg (`docking | go_straight | rotate`) plus `marker` for docking, then send it + // through navigation_move_to_order or navigation_move_to_nodes_edges. + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_pause(NavigationHandle handle); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_resume(NavigationHandle handle); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_cancel(NavigationHandle handle); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_set_twist_linear(NavigationHandle handle, double linear_x, double linear_y, double linear_z); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_set_twist_angular(NavigationHandle handle, double angular_x, double angular_y, double angular_z); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_robot_pose_stamped(NavigationHandle handle, ref PoseStamped out_pose); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_robot_pose_2d(NavigationHandle handle, ref Pose2D out_pose); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_twist(NavigationHandle handle, ref Twist2DStamped out_twist); + + // ============================================================================ + // Navigation Data Management + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_add_laser_scan(NavigationHandle handle, string laser_scan_name, LaserScan laser_scan); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_add_odometry(NavigationHandle handle, string odometry_name, Odometry odometry); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_add_static_map(NavigationHandle handle, string map_name, OccupancyGrid occupancy_grid); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_static_map(NavigationHandle handle, string map_name, ref OccupancyGrid occupancy_grid); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_add_point_cloud(NavigationHandle handle, string point_cloud_name, PointCloud point_cloud); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_add_point_cloud2(NavigationHandle handle, string point_cloud2_name, PointCloud2 point_cloud2); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_laser_scan(NavigationHandle handle, string laser_scan_name, ref LaserScan out_scan); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_point_cloud(NavigationHandle handle, string point_cloud_name, ref PointCloud out_cloud); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_point_cloud2(NavigationHandle handle, string point_cloud2_name, ref PointCloud2 out_cloud); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_static_map(NavigationHandle handle, string map_name); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_laser_scan(NavigationHandle handle, string laser_scan_name); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_point_cloud(NavigationHandle handle, string point_cloud_name); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_point_cloud2(NavigationHandle handle, string point_cloud2_name); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_all_static_maps(NavigationHandle handle); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_all_laser_scans(NavigationHandle handle); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_all_point_clouds(NavigationHandle handle); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_all_point_cloud2s(NavigationHandle handle); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_remove_all_data(NavigationHandle handle); + + /// Get all static maps. out_maps must be pre-allocated; use navigation_get_all_static_maps_count or similar to get count first if needed. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_all_static_maps(NavigationHandle handle, [Out] NamedOccupancyGrid[] out_maps, ref UIntPtr out_count); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_all_laser_scans(NavigationHandle handle, [Out] NamedLaserScan[] out_scans, ref UIntPtr out_count); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_all_point_clouds(NavigationHandle handle, [Out] NamedPointCloud[] out_clouds, ref UIntPtr out_count); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_all_point_cloud2s(NavigationHandle handle, [Out] NamedPointCloud2[] out_clouds, ref UIntPtr out_count); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_global_data(NavigationHandle handle, ref PlannerDataOutput out_data); + + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool navigation_get_local_data(NavigationHandle handle, ref PlannerDataOutput out_data); + } +} \ No newline at end of file diff --git a/examples/NavigationExample/NavigationExample.csproj b/examples/NavigationExample/NavigationExample.csproj new file mode 100644 index 0000000..9ec6097 --- /dev/null +++ b/examples/NavigationExample/NavigationExample.csproj @@ -0,0 +1,15 @@ + + + Exe + net10.0 + true + + + + + + + Always + + + diff --git a/examples/NavigationExample/Program.cs b/examples/NavigationExample/Program.cs new file mode 100644 index 0000000..f364470 --- /dev/null +++ b/examples/NavigationExample/Program.cs @@ -0,0 +1,498 @@ +using System; +using System.Globalization; +using System.IO; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.PixelFormats; +using NavigationExample; + + +namespace NavigationExample +{ + /// Thông tin map đọc từ file YAML (maze.yaml). + public struct MazeMapConfig + { + public string ImagePath; // đường dẫn đầy đủ tới file ảnh + public float Resolution; + public double OriginX, OriginY, OriginZ; + public int Negate; // 0 hoặc 1 + public double OccupiedThresh; + public double FreeThresh; + } + + // ============================================================================ + // Example Usage + // ============================================================================ + class Program + { + /// + /// Đọc file maze.yaml (image, resolution, origin, negate, occupied_thresh, free_thresh). + /// ImagePath được resolve tuyệt đối theo thư mục chứa file yaml. + /// + static bool TryLoadMazeYaml(string yamlPath, out MazeMapConfig config) + { + config = default; + if (string.IsNullOrEmpty(yamlPath) || !File.Exists(yamlPath)) + return false; + string dir = Path.GetDirectoryName(Path.GetFullPath(yamlPath)) ?? ""; + try + { + string[] lines = File.ReadAllLines(yamlPath); + foreach (string line in lines) + { + string trimmed = line.Trim(); + if (trimmed.Length == 0 || trimmed.StartsWith("#")) continue; + int colon = trimmed.IndexOf(':'); + if (colon <= 0) continue; + string key = trimmed.Substring(0, colon).Trim(); + string value = trimmed.Substring(colon + 1).Trim(); + if (key == "image") + config.ImagePath = Path.Combine(dir, value); + else if (key == "resolution" && float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out float res)) + config.Resolution = res; + else if (key == "origin") + { + var m = Regex.Match(value, @"\[\s*([-\d.]+\s*),\s*([-\d.]+\s*),\s*([-\d.]+)\s*\]"); + if (m.Success) + { + config.OriginX = double.Parse(m.Groups[1].Value, CultureInfo.InvariantCulture); + config.OriginY = double.Parse(m.Groups[2].Value, CultureInfo.InvariantCulture); + config.OriginZ = double.Parse(m.Groups[3].Value, CultureInfo.InvariantCulture); + } + } + else if (key == "negate" && int.TryParse(value, out int neg)) + config.Negate = neg; + else if (key == "occupied_thresh" && double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out double ot)) + config.OccupiedThresh = ot; + else if (key == "free_thresh" && double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out double ft)) + config.FreeThresh = ft; + } + return !string.IsNullOrEmpty(config.ImagePath); + } + catch + { + return false; + } + } + + /// + /// Đọc file ảnh PNG và chuyển pixel sang byte[] occupancy (0=free, 100=occupied, 255=unknown). + /// Dùng negate, occupied_thresh, free_thresh từ maze.yaml nếu cung cấp. + /// + static byte[] LoadMazePixelsAsOccupancy(string imagePath, out int width, out int height, + int negate = 0, double occupiedThresh = 0.65, double freeThresh = 0.196) + { + width = 0; + height = 0; + if (string.IsNullOrEmpty(imagePath) || !File.Exists(imagePath)) + { + LogError($"File not found: {imagePath}"); + return null; + } + try + { + using var image = Image.Load(imagePath); + int w = image.Width; + int h = image.Height; + width = w; + height = h; + byte[] data = new byte[w * h]; + image.ProcessPixelRows(accessor => + { + for (int y = 0; y < accessor.Height; y++) + { + Span row = accessor.GetRowSpan(y); + for (int x = 0; x < row.Length; x++) + { + ref readonly Rgba32 p = ref row[x]; + double gray = (p.R + p.G + p.B) / 255.0 / 3.0; + if (negate != 0) gray = 1.0 - gray; + byte occ; + if (gray <= freeThresh) occ = 0; + else if (gray >= occupiedThresh) occ = 100; + else occ = 255; // unknown + data[y * w + x] = occ; + } + } + }); + return data; + } + catch (Exception ex) + { + LogError($"Load image failed: {ex.Message}"); + return null; + } + } + + // Helper method để hiển thị file và line number tự động + static void LogError(string message, + [CallerFilePath] string filePath = "", + [CallerLineNumber] int lineNumber = 0, + [CallerMemberName] string memberName = "") + { + // Lấy tên file từ đường dẫn đầy đủ + string fileName = System.IO.Path.GetFileName(filePath); + Console.WriteLine($"[{fileName}:{lineNumber}] {memberName}: {message}"); + } + + static void Main(string[] args) + { + // Create tf3 buffer (replaces TF listener; used for all static transforms and navigation init) + IntPtr tf3Buffer = TF3API.tf3_buffer_create(10); + if (tf3Buffer == IntPtr.Zero) + { + LogError("Failed to create tf3 buffer (libtf3.so may be missing)"); + return; + } + Console.WriteLine($"[NavigationExample] TF3 buffer created, handle = 0x{tf3Buffer.ToInt64():X16}"); + string version = Marshal.PtrToStringAnsi(TF3API.tf3_get_version()) ?? "?"; + Console.WriteLine($"[TF3] {version}"); + + // Inject static transforms: map -> odom -> base_footprint -> base_link + var tMapOdom = TF3API.CreateStaticTransform("map", "odom", 0, 0, 0, 0, 0, 0, 1); + var tOdomFoot = TF3API.CreateStaticTransform("odom", "base_footprint", 0, 0, 0, 0, 0, 0, 1); + var tFootLink = TF3API.CreateStaticTransform("base_footprint", "base_link", 0, 0, 0, 0, 0, 0, 1); + if (!TF3API.tf3_set_transform(tf3Buffer, ref tMapOdom, "NavigationExample", true) || + !TF3API.tf3_set_transform(tf3Buffer, ref tOdomFoot, "NavigationExample", true) || + !TF3API.tf3_set_transform(tf3Buffer, ref tFootLink, "NavigationExample", true)) + { + LogError("Failed to set static TF"); + TF3API.tf3_buffer_destroy(tf3Buffer); + return; + } + + // Create navigation instance and initialize with tf3 buffer + NavigationAPI.NavigationHandle navHandle = NavigationAPI.navigation_create(); + if (navHandle.ptr == IntPtr.Zero) + { + LogError("Failed to create navigation instance"); + TF3API.tf3_buffer_destroy(tf3Buffer); + return; + } + + if (!NavigationAPI.navigation_initialize(navHandle, tf3Buffer)) + { + LogError("Failed to initialize navigation with tf3 buffer"); + NavigationAPI.navigation_destroy(navHandle); + TF3API.tf3_buffer_destroy(tf3Buffer); + return; + } + + while (true) + { + NavigationAPI.NavFeedback feedback = new NavigationAPI.NavFeedback(); + if (NavigationAPI.navigation_get_feedback(navHandle, ref feedback)) + { + if (feedback.is_ready) + { + Console.WriteLine("Navigation is ready"); + break; + } + else + { + Console.WriteLine("Navigation is not ready"); + } + } + System.Threading.Thread.Sleep(100); + } + Console.WriteLine("[NavigationExample] Navigation initialized successfully"); + + + // Set robot footprint + Point[] footprint = new Point[] + { + new Point { x = 0.3, y = -0.2, z = 0.0 }, + new Point { x = 0.3, y = 0.2, z = 0.0 }, + new Point { x = -0.3, y = 0.2, z = 0.0 }, + new Point { x = -0.3, y = -0.2, z = 0.0 } + }; + NavigationAPI.navigation_set_robot_footprint(navHandle, footprint, new UIntPtr((uint)footprint.Length)); + + + IntPtr fFrameId = Marshal.StringToHGlobalAnsi("fscan"); + Header fscanHeader = NavigationAPI.header_create(Marshal.PtrToStringAnsi(fFrameId)); + LaserScan fscanHandle; + fscanHandle.header = fscanHeader; + fscanHandle.angle_min = -1.57f; + fscanHandle.angle_max = 1.57f; + fscanHandle.angle_increment = 0.785f; + fscanHandle.time_increment = 0.0f; + fscanHandle.scan_time = 0.1f; + fscanHandle.range_min = 0.05f; + fscanHandle.range_max = 10.0f; + fscanHandle.ranges = Marshal.AllocHGlobal(sizeof(float) * 5); + Marshal.Copy(new float[] { 1.0f, 1.2f, 1.1f, 0.9f, 1.3f }, 0, fscanHandle.ranges, 5); + fscanHandle.ranges_count = new UIntPtr(5); + fscanHandle.intensities = Marshal.AllocHGlobal(sizeof(float) * 5); + Marshal.Copy(new float[] { 100.0f, 120.0f, 110.0f, 90.0f, 130.0f }, 0, fscanHandle.intensities, 5); + fscanHandle.intensities_count = new UIntPtr(5); + NavigationAPI.navigation_add_laser_scan(navHandle, "/fscan", fscanHandle); + + IntPtr bFrameId = Marshal.StringToHGlobalAnsi("bscan"); + Header bscanHeader = NavigationAPI.header_create(Marshal.PtrToStringAnsi(bFrameId)); + LaserScan bscanHandle; + bscanHandle.header = bscanHeader; + bscanHandle.angle_min = 1.57f; + bscanHandle.angle_max = -1.57f; + bscanHandle.angle_increment = -0.785f; + bscanHandle.time_increment = 0.0f; + bscanHandle.scan_time = 0.1f; + bscanHandle.range_min = 0.05f; + bscanHandle.range_max = 10.0f; + bscanHandle.ranges = Marshal.AllocHGlobal(sizeof(float) * 5); + Marshal.Copy(new float[] { 1.0f, 1.2f, 1.1f, 0.9f, 1.3f }, 0, bscanHandle.ranges, 5); + bscanHandle.ranges_count = new UIntPtr(5); + bscanHandle.intensities = Marshal.AllocHGlobal(sizeof(float) * 5); + Marshal.Copy(new float[] { 100.0f, 120.0f, 110.0f, 90.0f, 130.0f }, 0, bscanHandle.intensities, 5); + bscanHandle.intensities_count = new UIntPtr(5); + NavigationAPI.navigation_add_laser_scan(navHandle, "/bscan", bscanHandle); + + IntPtr oFrameId = Marshal.StringToHGlobalAnsi("odom"); + Header odometryHeader = NavigationAPI.header_create(Marshal.PtrToStringAnsi(oFrameId)); + Odometry odometryHandle = new Odometry(); + odometryHandle.header = odometryHeader; + IntPtr childFrameId = Marshal.StringToHGlobalAnsi("base_footprint"); + odometryHandle.child_frame_id = childFrameId; + odometryHandle.pose.pose.position.x = 0.0; + odometryHandle.pose.pose.position.y = 0.0; + odometryHandle.pose.pose.position.z = 0.0; + odometryHandle.pose.pose.orientation.x = 0.0; + odometryHandle.pose.pose.orientation.y = 0.0; + odometryHandle.pose.pose.orientation.z = 0.0; + odometryHandle.pose.pose.orientation.w = 1.0; + + double[] pose_covariance = new double[36]; + for(int i = 0; i < pose_covariance.Length; i++) { + pose_covariance[i] = 0.0; + } + odometryHandle.pose.covariance = Marshal.AllocHGlobal(sizeof(double) * pose_covariance.Length); + Marshal.Copy(pose_covariance, 0, odometryHandle.pose.covariance, pose_covariance.Length); + odometryHandle.pose.covariance_count = new UIntPtr((uint)pose_covariance.Length); + + odometryHandle.twist.twist.linear.x = 0.0; + odometryHandle.twist.twist.linear.y = 0.0; + odometryHandle.twist.twist.linear.z = 0.0; + odometryHandle.twist.twist.angular.x = 0.0; + odometryHandle.twist.twist.angular.y = 0.0; + odometryHandle.twist.twist.angular.z = 0.0; + double[] twist_covariance = new double[36]; + for(int i = 0; i < twist_covariance.Length; i++) { + twist_covariance[i] = 0.0; + } + odometryHandle.twist.covariance = Marshal.AllocHGlobal(sizeof(double) * twist_covariance.Length); + Marshal.Copy(twist_covariance, 0, odometryHandle.twist.covariance, twist_covariance.Length); + odometryHandle.twist.covariance_count = new UIntPtr((uint)twist_covariance.Length); + NavigationAPI.navigation_add_odometry(navHandle, "odometry", odometryHandle); + + // Add static map: đọc maze.yaml rồi load ảnh và cập nhật mapMetaData + string mapYamlPath = "maze.yaml"; + int mapWidth, mapHeight; + byte[] data; + MazeMapConfig mapConfig; + if (TryLoadMazeYaml(mapYamlPath, out mapConfig)) + { + data = LoadMazePixelsAsOccupancy(mapConfig.ImagePath, out mapWidth, out mapHeight, + mapConfig.Negate, mapConfig.OccupiedThresh, mapConfig.FreeThresh); + if (data == null) + { + mapWidth = 3; + mapHeight = 10; + data = new byte[30]; + for (int i = 0; i < data.Length; i++) data[i] = 100; + Console.WriteLine("YAML loaded but image failed; using default map 3x10"); + } + else + { + Console.WriteLine("Loaded map from {0}: {1}x{2}, resolution={3}, origin=({4},{5},{6})", + mapConfig.ImagePath, mapWidth, mapHeight, mapConfig.Resolution, + mapConfig.OriginX, mapConfig.OriginY, mapConfig.OriginZ); + } + } + else + { + mapWidth = 3; + mapHeight = 10; + data = new byte[30]; + for (int i = 0; i < data.Length; i++) data[i] = 100; + mapConfig = default; + mapConfig.Resolution = 0.05f; + mapConfig.OriginX = mapConfig.OriginY = mapConfig.OriginZ = 0.0; + Console.WriteLine("maze.yaml not found, using default map 3x10"); + } + + Time mapLoadTime = NavigationAPI.time_create(); + MapMetaData mapMetaData = new MapMetaData(); + mapMetaData.map_load_time = mapLoadTime; + mapMetaData.resolution = mapConfig.Resolution; + mapMetaData.width = (uint)mapWidth; + mapMetaData.height = (uint)mapHeight; + mapMetaData.origin = new Pose(); + mapMetaData.origin.position.x = mapConfig.OriginX; + mapMetaData.origin.position.y = mapConfig.OriginY; + mapMetaData.origin.position.z = mapConfig.OriginZ; + mapMetaData.origin.orientation.x = 0.0; + mapMetaData.origin.orientation.y = 0.0; + mapMetaData.origin.orientation.z = 0.0; + mapMetaData.origin.orientation.w = 1.0; + OccupancyGrid occupancyGrid = new OccupancyGrid(); + IntPtr mapFrameId = Marshal.StringToHGlobalAnsi("map"); + occupancyGrid.header = NavigationAPI.header_create(Marshal.PtrToStringAnsi(mapFrameId)); + occupancyGrid.info = mapMetaData; + occupancyGrid.data = Marshal.AllocHGlobal(sizeof(byte) * data.Length); + Marshal.Copy(data, 0, occupancyGrid.data, data.Length); + occupancyGrid.data_count = new UIntPtr((uint)data.Length); + Console.WriteLine("data length: {0} {1}", data.Length, occupancyGrid.data_count); + Console.WriteLine("C# OccupancyGrid sizeof={0} data_off={1} data_count_off={2}", + Marshal.SizeOf(), + Marshal.OffsetOf("data"), + Marshal.OffsetOf("data_count")); + + NavigationAPI.navigation_add_static_map(navHandle, "/map", occupancyGrid); + + Twist2DStamped twist = new Twist2DStamped(); + if (NavigationAPI.navigation_get_twist(navHandle, ref twist)) + { + Console.WriteLine( + "Twist: {0}, {1}, {2}, {3}", + NavigationAPI.MarshalString(twist.header.frame_id), twist.velocity.x, twist.velocity.y, twist.velocity.theta); + } + + // Build order (thao cách bom order): header + nodes + edges giống C++ + Order order = new Order(); + order.headerId = 1; + order.timestamp = Marshal.StringToHGlobalAnsi("2026-02-28 10:00:00"); + order.version = Marshal.StringToHGlobalAnsi("1.0.0"); + order.manufacturer = Marshal.StringToHGlobalAnsi("Manufacturer"); + order.serialNumber = Marshal.StringToHGlobalAnsi("Serial Number"); + order.orderId = Marshal.StringToHGlobalAnsi("Order ID"); + order.orderUpdateId = 1; + + // Nodes: giống for (auto node : order.nodes) { node_msg.nodeId = ...; node_msg.nodePosition.x = ...; order_msg.nodes.push_back(node_msg); } + int nodeCount = 1; + order.nodes = Marshal.AllocHGlobal(Marshal.SizeOf() * nodeCount); + order.nodes_count = new UIntPtr((uint)nodeCount); + Node node1 = new Node(); + node1.nodeId = Marshal.StringToHGlobalAnsi("node-1"); + node1.sequenceId = 0; + node1.nodeDescription = Marshal.StringToHGlobalAnsi("Goal node"); + node1.released = 0; + node1.nodePosition.x = 1.0; + node1.nodePosition.y = 1.0; + node1.nodePosition.theta = 0.0; + node1.nodePosition.allowedDeviationXY = 0.1f; + node1.nodePosition.allowedDeviationTheta = 0.05f; + node1.nodePosition.mapId = Marshal.StringToHGlobalAnsi("map"); + node1.nodePosition.mapDescription = Marshal.StringToHGlobalAnsi(""); + node1.actions = IntPtr.Zero; + node1.actions_count = UIntPtr.Zero; + Marshal.StructureToPtr(node1, order.nodes, false); + + // Edges: rỗng trong ví dụ này; nếu cần thì alloc và fill tương tự (edge_msg.edgeId, trajectory.controlPoints, ...) + order.edges = IntPtr.Zero; + order.edges_count = UIntPtr.Zero; + order.zoneSetId = Marshal.StringToHGlobalAnsi(""); + + PoseStamped goal = new PoseStamped(); + goal.header = NavigationAPI.header_create(Marshal.PtrToStringAnsi(mapFrameId)); + goal.pose.position.x = 0.01; + goal.pose.position.y = 0.01; + goal.pose.position.z = 0.0; + goal.pose.orientation.x = 0.0; + goal.pose.orientation.y = 0.0; + goal.pose.orientation.z = 0.0; + goal.pose.orientation.w = 1.0; + + + // Docking used to be its own call, navigation_dock_to(navHandle, "charger", goal). + // It is a per-leg property of the order now: put `profile: docking` and `marker: + // charger` on the leg and send the order, so the leg gets the same mission id, + // lifecycle and cancel path as every other leg. + NavigationAPI.navigation_move_to(navHandle, goal); + + // NavigationAPI.navigation_move_to_nodes_edges(navHandle, order.nodes, order.nodes_count, order.edges, order.edges_count, goal); + + // NavigationAPI.navigation_move_to_order(navHandle, order, goal); + NavigationAPI.navigation_set_twist_linear(navHandle, 0.1, 0.0, 0.0); + NavigationAPI.navigation_set_twist_angular(navHandle, 0.0, 0.0, 0.2); + + while (true) + { + System.Threading.Thread.Sleep(100); + // NavigationAPI.NavFeedback feedback = new NavigationAPI.NavFeedback(); + // if (NavigationAPI.navigation_get_feedback(navHandle, ref feedback)) + // { + // if (feedback.navigation_state == NavigationAPI.NavigationState.Succeeded) + // { + // Console.WriteLine("Navigation is Succeeded"); + // break; + // } + // } + + // NavigationAPI.PlannerDataOutput globalData = new NavigationAPI.PlannerDataOutput(); + // if (NavigationAPI.navigation_get_global_data(navHandle, ref globalData)) + // { + // int n = (int)(uint)globalData.plan.poses_count; + // int poseSize = Marshal.SizeOf(); + // for (int i = 0; i < n; i++) + // { + // IntPtr posePtr = IntPtr.Add(globalData.plan.poses, i * poseSize); + // Pose2DStamped p = Marshal.PtrToStructure(posePtr); + // double p_x = p.pose.x; + // double p_y = p.pose.y; + // double p_theta = p.pose.theta; + // Console.WriteLine("Plan: {0}, {1}, {2}", p_x, p_y, p_theta); + // } + // if(globalData.is_costmap_updated) { + // for(int i = 0; i < (int)(uint)globalData.costmap.data_count; i++) { + // byte cellValue = Marshal.ReadByte(globalData.costmap.data, i); + // Console.WriteLine("Costmap: {0} {1}", i, cellValue); + // } + // } + // else { + // Console.WriteLine("Global Costmap is not updated"); + // } + // } + + // NavigationAPI.PlannerDataOutput localData = new NavigationAPI.PlannerDataOutput(); + // if(NavigationAPI.navigation_get_local_data(navHandle, ref localData)) + // { + // int n = (int)(uint)localData.plan.poses_count; + // int poseSize = Marshal.SizeOf(); + // for (int i = 0; i < n; i++) + // { + // IntPtr posePtr = IntPtr.Add(localData.plan.poses, i * poseSize); + // Pose2DStamped p = Marshal.PtrToStructure(posePtr); + // double p_x = p.pose.x; + // double p_y = p.pose.y; + // double p_theta = p.pose.theta; + // Console.WriteLine("Plan: {0}, {1}, {2}", p_x, p_y, p_theta); + // } + // if(localData.is_costmap_updated) { + // for(int i = 0; i < (int)(uint)localData.costmap.data_count; i++) { + // byte cellValue = Marshal.ReadByte(localData.costmap.data, i); + // Console.WriteLine("Costmap: {0} {1}", i, cellValue); + // } + // } + // else { + // Console.WriteLine("Local Costmap is not updated"); + // } + // } + } + // Cleanup (destroy nav first, then tf3 buffer) + + NavigationAPI.navigation_destroy(navHandle); + TF3API.tf3_buffer_destroy(tf3Buffer); + Console.WriteLine("Press any key to exit..."); + try + { + Console.ReadKey(intercept: true); + } + catch (InvalidOperationException) + { + // Running without a real console (e.g. redirected/automated run). + } + } + } +} diff --git a/examples/NavigationExample/TF3API.cs b/examples/NavigationExample/TF3API.cs new file mode 100644 index 0000000..c059fa4 --- /dev/null +++ b/examples/NavigationExample/TF3API.cs @@ -0,0 +1,133 @@ +using System; +using System.Runtime.InteropServices; + +namespace NavigationExample +{ + + // ============================================================================ + // TF3 C API - P/Invoke wrapper for libtf3 (tf3 BufferCore) + // ============================================================================ + public static class TF3API + { + private const string Tf3DllName = "/usr/local/lib/libtf3.so"; // Linux; Windows: tf3.dll, macOS: libtf3.dylib + + public enum TF3_ErrorCode + { + TF3_OK = 0, + TF3_ERROR_LOOKUP = 1, + TF3_ERROR_CONNECTIVITY = 2, + TF3_ERROR_EXTRAPOLATION = 3, + TF3_ERROR_INVALID_ARGUMENT = 4, + TF3_ERROR_TIMEOUT = 5, + TF3_ERROR_UNKNOWN = 99 + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct TF3_Transform + { + public long timestamp_sec; + public long timestamp_nsec; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string frame_id; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string child_frame_id; + public double translation_x; + public double translation_y; + public double translation_z; + public double rotation_x; + public double rotation_y; + public double rotation_z; + public double rotation_w; + } + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tf3_buffer_create(int cache_time_sec); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern void tf3_buffer_destroy(IntPtr buffer); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool tf3_set_transform( + IntPtr buffer, + ref TF3_Transform transform, + string authority, + [MarshalAs(UnmanagedType.I1)] bool is_static); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool tf3_lookup_transform( + IntPtr buffer, + string target_frame, + string source_frame, + long time_sec, + long time_nsec, + out TF3_Transform transform, + out TF3_ErrorCode error_code); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool tf3_lookup_transform_full( + IntPtr buffer, + string target_frame, + long target_time_sec, + long target_time_nsec, + string source_frame, + long source_time_sec, + long source_time_nsec, + string fixed_frame, + out TF3_Transform transform, + out TF3_ErrorCode error_code); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool tf3_can_transform( + IntPtr buffer, + string target_frame, + string source_frame, + long time_sec, + long time_nsec, + System.Text.StringBuilder error_msg, + int error_msg_len); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern int tf3_get_all_frame_names(IntPtr buffer, System.Text.StringBuilder frames, int frames_len); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool tf3_get_frame_tree(IntPtr buffer, System.Text.StringBuilder output, int output_len); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern void tf3_clear(IntPtr buffer); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern void tf3_get_current_time(out long sec, out long nsec); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool tf3_get_last_error(IntPtr buffer, System.Text.StringBuilder error_msg, int error_msg_len); + + [DllImport(Tf3DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tf3_get_version(); + + /// Helper: create TF3_Transform for static transform (identity or given pose). + public static TF3_Transform CreateStaticTransform(string parentFrame, string childFrame, + double tx = 0, double ty = 0, double tz = 0, + double qx = 0, double qy = 0, double qz = 0, double qw = 1) + { + var t = new TF3_Transform(); + t.timestamp_sec = 0; + t.timestamp_nsec = 0; + t.frame_id = parentFrame ?? ""; + t.child_frame_id = childFrame ?? ""; + t.translation_x = tx; + t.translation_y = ty; + t.translation_z = tz; + t.rotation_x = qx; + t.rotation_y = qy; + t.rotation_z = qz; + t.rotation_w = qw; + return t; + } + } +} \ No newline at end of file diff --git a/examples/NavigationExample/libnav_c_api.so b/examples/NavigationExample/libnav_c_api.so new file mode 100755 index 0000000000000000000000000000000000000000..626ec969b61a4e4e2f310098d7a656c7dd6f16a8 GIT binary patch literal 309296 zcmeFa31AdO_CMZ%08xP%6g48QgGLRD!c4dl6`c?UdSt+n07elfAqgasV@M_tyml}F z8OOMB)fLxc<9BuCyXqR(3-3V)hwBkk6j#xxt9CXb5j^67{6DX%x>HlkDDLX-e{E~0 z`+e%wt5>gHU9T(THy+>AJ}D`EHF5RT&eBrw-m#4XZh<>nQ^lL6xwUNVF#L3A$1~pE z6pN+zQGWyYLjDFyXv7grS&RdB?)6AzPg`9mwkvkZ4R z?n`hl#%*4e;-yMFgLu~B4&h#kdl~L}+?V2(uPZ=Yi93wD0e2(rRk&BGZC-bamwUu>t$6+g&wItY`M6KK+>hs9 z#rp%|`8V-=7|+LWKaTrJ+)v}C>skKLVt76$-ZzLR`PXLg{yd&9;(kfcVo23q74&vI zUl;Fh;JE|$o4DT*7(L#_{Q>TO;{FIXU7fhQaDR$>H*UJRaev0%G;ObV(&G!q=QntMi+i7-_tO&{E(LcV+;pYl*&lZr?n7`NhTDdlE<2t>aUX^I7~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FN*{$}%q%0A5}S1de2 z`!v(iW{EB9BNeiP1I1eu-Az#|;%?@*bRB6fzm(;BOlb?xV8F}W*R9ZX+tEJ(JPCkA literal 0 HcmV?d00001 diff --git a/examples/NavigationExample/maze.yaml b/examples/NavigationExample/maze.yaml new file mode 100644 index 0000000..79220e7 --- /dev/null +++ b/examples/NavigationExample/maze.yaml @@ -0,0 +1,6 @@ +image: maze.png +resolution: 0.05 +origin: [0.0, 0.0, 0.0] +negate: 0 +occupied_thresh: 0.65 +free_thresh: 0.196 diff --git a/examples/NavigationExample/msgs/CommonMsgs.cs b/examples/NavigationExample/msgs/CommonMsgs.cs new file mode 100644 index 0000000..00c1311 --- /dev/null +++ b/examples/NavigationExample/msgs/CommonMsgs.cs @@ -0,0 +1,274 @@ +using System; +using System.Runtime.InteropServices; + +namespace NavigationExample +{ + // ============================================================================ + // Structures + // ============================================================================ + [StructLayout(LayoutKind.Sequential)] + public struct Point + { + public double x; + public double y; + public double z; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Pose2D + { + public double x; + public double y; + public double theta; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Twist2D + { + public double x; + public double y; + public double theta; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Quaternion + { + public double x; + public double y; + public double z; + public double w; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Position + { + public double x; + public double y; + public double z; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Pose + { + public Point position; + public Quaternion orientation; + } + + + [StructLayout(LayoutKind.Sequential)] + public struct Vector3 + { + public double x; + public double y; + public double z; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Twist + { + public Vector3 linear; + public Vector3 angular; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Header + { + public uint seq; + public uint sec; + public uint nsec; + public IntPtr frame_id; // char* + } + + [StructLayout(LayoutKind.Sequential)] + public struct PoseStamped + { + public Header header; + public Pose pose; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Twist2DStamped + { + public Header header; + public Twist2D velocity; + } + + [StructLayout(LayoutKind.Sequential)] + public struct LaserScan + { + public Header header; + public float angle_min; + public float angle_max; + public float angle_increment; + public float time_increment; + public float scan_time; + public float range_min; + public float range_max; + public IntPtr ranges; + public UIntPtr ranges_count; + public IntPtr intensities; + public UIntPtr intensities_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct PointCloud + { + public Header header; + public IntPtr points; + public UIntPtr points_count; + public IntPtr channels; + public UIntPtr channels_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct PointCloud2 + { + public Header header; + public uint height; + public uint width; + public IntPtr fields; + public UIntPtr fields_count; + [MarshalAs(UnmanagedType.I1)] + public bool is_bigendian; + public uint point_step; + public uint row_step; + public IntPtr data; + public UIntPtr data_count; + [MarshalAs(UnmanagedType.I1)] + public bool is_dense; + } + + [StructLayout(LayoutKind.Sequential)] + public struct PoseWithCovariance + { + public Pose pose; + public IntPtr covariance; + public UIntPtr covariance_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct TwistWithCovariance { + public Twist twist; + public IntPtr covariance; + public UIntPtr covariance_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Odometry + { + public Header header; + public IntPtr child_frame_id; + public PoseWithCovariance pose; + public TwistWithCovariance twist; + } + + [StructLayout(LayoutKind.Sequential)] + public struct OccupancyGrid + { + public Header header; + public MapMetaData info; + public IntPtr data; + public UIntPtr data_count; + } + + + [StructLayout(LayoutKind.Sequential)] + public struct MapMetaData + { + public Time map_load_time; + public float resolution; + public uint width; + public uint height; + public Pose origin; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Time + { + public uint sec; + public uint nsec; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Point32 + { + public float x; + public float y; + public float z; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Pose2DStamped + { + public Header header; + public Pose2D pose; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Polygon + { + public IntPtr points; + public UIntPtr points_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct PolygonStamped + { + public Header header; + public Polygon polygon; + } + + [StructLayout(LayoutKind.Sequential)] + public struct OccupancyGridUpdate + { + public Header header; + public int x; + public int y; + public uint width; + public uint height; + public IntPtr data; + public UIntPtr data_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Path2D + { + public Header header; + public IntPtr poses; + public UIntPtr poses_count; + } + + /// Name (char*) + OccupancyGrid for static map list API. + [StructLayout(LayoutKind.Sequential)] + public struct NamedOccupancyGrid + { + public IntPtr name; + public OccupancyGrid grid; + } + + /// Name (char*) + LaserScan for laser scan list API. + [StructLayout(LayoutKind.Sequential)] + public struct NamedLaserScan + { + public IntPtr name; + public LaserScan scan; + } + + /// Name (char*) + PointCloud for point cloud list API. + [StructLayout(LayoutKind.Sequential)] + public struct NamedPointCloud + { + public IntPtr name; + public PointCloud cloud; + } + + /// Name (char*) + PointCloud2 for point cloud2 list API. + [StructLayout(LayoutKind.Sequential)] + public struct NamedPointCloud2 + { + public IntPtr name; + public PointCloud2 cloud; + } + + +} \ No newline at end of file diff --git a/examples/NavigationExample/msgs/ProtocolMsgsTypes.cs b/examples/NavigationExample/msgs/ProtocolMsgsTypes.cs new file mode 100644 index 0000000..4ff3bec --- /dev/null +++ b/examples/NavigationExample/msgs/ProtocolMsgsTypes.cs @@ -0,0 +1,109 @@ +using System; +using System.Runtime.InteropServices; + +namespace NavigationExample +{ + /// + /// C# struct layout cho protocol_msgs (robot_protocol_msgs C API). + /// Khớp với pnkx_nav_core/src/APIs/c_api/include/protocol_msgs/*.h + /// + [StructLayout(LayoutKind.Sequential)] + public struct ControlPoint + { + public double x; + public double y; + public double weight; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ActionParameter + { + public IntPtr key; // char* + public IntPtr value; // char* + } + + [StructLayout(LayoutKind.Sequential)] + public struct NodePosition + { + public double x; + public double y; + public double theta; + public float allowedDeviationXY; + public float allowedDeviationTheta; + public IntPtr mapId; // char* + public IntPtr mapDescription; // char* + } + + [StructLayout(LayoutKind.Sequential)] + public struct Trajectory + { + public uint degree; + public IntPtr knotVector; // double* + public UIntPtr knotVector_count; + public IntPtr controlPoints; // ControlPoint* + public UIntPtr controlPoints_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Action + { + public IntPtr actionType; // char* + public IntPtr actionId; // char* + public IntPtr actionDescription;// char* + public IntPtr blockingType; // char* + public IntPtr actionParameters; // ActionParameter* + public UIntPtr actionParameters_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Node + { + public IntPtr nodeId; // char* + public int sequenceId; + public IntPtr nodeDescription; // char* + public byte released; + public NodePosition nodePosition; + public IntPtr actions; // Action* + public UIntPtr actions_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Edge + { + public IntPtr edgeId; // char* + public int sequenceId; + public IntPtr edgeDescription; // char* + public byte released; + public IntPtr startNodeId; // char* + public IntPtr endNodeId; // char* + public double maxSpeed; + public double maxHeight; + public double minHeight; + public double orientation; + public IntPtr orientationType; // char* + public IntPtr direction; // char* + public byte rotationAllowed; + public double maxRotationSpeed; + public Trajectory trajectory; + public double length; + public IntPtr actions; // Action* + public UIntPtr actions_count; + } + + [StructLayout(LayoutKind.Sequential)] + public struct Order + { + public int headerId; + public IntPtr timestamp; // char* + public IntPtr version; // char* + public IntPtr manufacturer; // char* + public IntPtr serialNumber; // char* + public IntPtr orderId; // char* + public uint orderUpdateId; + public IntPtr nodes; // Node* + public UIntPtr nodes_count; + public IntPtr edges; // Edge* + public UIntPtr edges_count; + public IntPtr zoneSetId; // char* + } +} diff --git a/examples/NavigationExample/msgs/SensorMsgs.cs b/examples/NavigationExample/msgs/SensorMsgs.cs new file mode 100644 index 0000000..e69de29 diff --git a/examples/QUICK_START.md b/examples/QUICK_START.md new file mode 100644 index 0000000..5e8b6cb --- /dev/null +++ b/examples/QUICK_START.md @@ -0,0 +1,148 @@ +# Quick Start - Chạy C# Example + +## Bước 1: Cài đặt .NET SDK (nếu chưa có) + +### Ubuntu/Debian: +```bash +# Cài đặt .NET 6.0 hoặc mới hơn +wget https://dot.net/v1/dotnet-install.sh +chmod +x dotnet-install.sh +./dotnet-install.sh --channel 6.0 + +# Thêm vào PATH +export PATH=$PATH:$HOME/.dotnet +export DOTNET_ROOT=$HOME/.dotnet + +# Hoặc cài qua apt (nếu có) +sudo apt-get update +sudo apt-get install -y dotnet-sdk-6.0 +``` + +### Kiểm tra: +```bash +dotnet --version +``` + +## Bước 2: Build C API Library + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core +mkdir -p build +cd build +cmake .. +make nav_c_api +``` + +Library sẽ ở: `build/src/APIs/c_api/libnav_c_api.so` + +## Bước 3: Chạy C# Example + +### Cách 1: Dùng script tự động (Khuyến nghị) + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/examples +chmod +x run_example.sh +./run_example.sh +``` + +Script sẽ tự động: +- ✅ Build library nếu chưa có +- ✅ Tạo C# project +- ✅ Copy library và source code +- ✅ Set LD_LIBRARY_PATH cho tất cả dependencies +- ✅ Build và chạy example + +### Cách 2: Chạy thủ công + +```bash +# 1. Tạo project +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/examples +dotnet new console -n NavigationExample +cd NavigationExample + +# 2. Copy source code +cp ../CSharpExample.cs Program.cs + +# 3. Tạo .csproj +cat > NavigationExample.csproj << 'EOF' + + + Exe + net6.0 + linux-x64 + true + + + + PreserveNewest + + + +EOF + +# 4. Copy library +cp ../../build/src/APIs/c_api/libnav_c_api.so . + +# 5. Set library path (quan trọng!) +export LD_LIBRARY_PATH=../../build/src/APIs/c_api:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/robot_costmap_2d:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/geometry2/robot_tf3_geometry_msgs:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/geometry2/robot_tf3_sensor_msgs:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Packages/move_base:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Cores/move_base_core:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/tf3:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/robot_time:$LD_LIBRARY_PATH + +# 6. Build và chạy +dotnet build +dotnet run +``` + +## Bước 4: Kiểm tra kết quả + +Nếu chạy thành công, bạn sẽ thấy output như: +``` +Robot pose: x=0.0, y=0.0, theta=0.0 +State: PENDING, Feedback: ... +``` + +## Troubleshooting + +### Lỗi: "dotnet: command not found" +→ Cài đặt .NET SDK (xem Bước 1) + +### Lỗi: "Unable to load DLL 'libnav_c_api.so'" +```bash +# Kiểm tra library có tồn tại không +ls -la ../../build/src/APIs/c_api/libnav_c_api.so + +# Set LD_LIBRARY_PATH (bao gồm tất cả dependencies) +export LD_LIBRARY_PATH=../../build/src/APIs/c_api:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/robot_costmap_2d:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/geometry2/robot_tf3_geometry_msgs:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/geometry2/robot_tf3_sensor_msgs:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Packages/move_base:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Cores/move_base_core:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/tf3:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/robot_time:$LD_LIBRARY_PATH + +# Hoặc copy vào system lib +sudo cp libnav_c_api.so /usr/local/lib/ +sudo ldconfig +``` + +### Lỗi: "Missing dependencies" +```bash +# Kiểm tra dependencies +ldd libnav_c_api.so + +# Đảm bảo tất cả dependencies đều có sẵn +``` + +### Lỗi: "Failed to create navigation instance" +→ Đã được sửa! `navigation_create()` bây giờ tạo instance của `move_base::MoveBase`. + Nếu vẫn gặp lỗi, kiểm tra: + - Library đã được build đầy đủ: `make nav_c_api` trong build directory + - Dependencies đã được build: `make move_base robot_costmap_2d` + - LD_LIBRARY_PATH đã được set đúng + diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..9335296 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,142 @@ +# Hướng dẫn chạy C# Example + +## Yêu cầu + +1. **.NET SDK** (version 6.0 trở lên hoặc .NET 10) +2. **C API Library** đã được build (`libnav_c_api.so`) +3. **Linux environment** (hoặc WSL nếu dùng Windows) + +## Bước 1: Build C API Library + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core +mkdir -p build +cd build +cmake .. +make nav_c_api +``` + +Library sẽ được tạo tại: `build/src/APIs/c_api/libnav_c_api.so` + +## Bước 2: Chạy script tự động (Khuyến nghị) + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/examples +chmod +x run_example.sh +./run_example.sh +``` + +Script sẽ tự động: +- Build library nếu chưa có +- Tạo C# project +- Copy library và source code +- Set LD_LIBRARY_PATH cho tất cả dependencies +- Build và chạy example + +## Bước 3: Hoặc chạy thủ công + +### Tạo C# Project + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/examples +dotnet new console -n NavigationExample +cd NavigationExample +``` + +### Copy file và library + +```bash +# Copy C# source code +cp ../CSharpExample.cs Program.cs + +# Copy library vào thư mục project +cp ../../build/src/APIs/c_api/libnav_c_api.so . +``` + +## Bước 4: Cập nhật .csproj (nếu cần) + +Tạo file `NavigationExample.csproj`: + +```xml + + + Exe + net6.0 + linux-x64 + true + + + + PreserveNewest + + + +``` + +## Bước 4: Build và chạy + +```bash +# Set LD_LIBRARY_PATH để tìm được tất cả dependencies +export LD_LIBRARY_PATH=../../build/src/APIs/c_api:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/robot_costmap_2d:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/geometry2/robot_tf3_geometry_msgs:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/geometry2/robot_tf3_sensor_msgs:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Packages/move_base:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Cores/move_base_core:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/tf3:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../../build/src/Navigations/Libraries/robot_time:$LD_LIBRARY_PATH + +# Build +dotnet build + +# Chạy +dotnet run +``` + +## Lưu ý + +1. **Library path**: Đảm bảo `libnav_c_api.so` có thể được tìm thấy: + - Copy vào cùng thư mục với executable + - Hoặc set `LD_LIBRARY_PATH` environment variable + - Hoặc copy vào `/usr/local/lib` và chạy `ldconfig` + +2. **Dependencies**: Library cần các dependencies khác: + ```bash + # Kiểm tra dependencies + ldd libnav_c_api.so + + # Đảm bảo tất cả dependencies đều có sẵn + ``` + +3. **Permissions**: Đảm bảo file có quyền execute: + ```bash + chmod +x libnav_c_api.so + ``` + +## Troubleshooting + +### Lỗi: "Unable to load DLL 'libnav_c_api.so'" + +**Giải pháp:** +```bash +# Set LD_LIBRARY_PATH +export LD_LIBRARY_PATH=/home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/build/src/APIs/c_api:$LD_LIBRARY_PATH + +# Hoặc copy library vào system path +sudo cp libnav_c_api.so /usr/local/lib/ +sudo ldconfig +``` + +### Lỗi: "DllNotFoundException" + +**Giải pháp:** +- Kiểm tra tên file library có đúng không +- Kiểm tra architecture (x64 vs x86) +- Kiểm tra dependencies: `ldd libnav_c_api.so` + +### Lỗi: "Symbol not found" + +**Giải pháp:** +- Đảm bảo library đã được build đầy đủ +- Kiểm tra tên hàm trong C# có khớp với C API không + diff --git a/examples/START_HERE.md b/examples/START_HERE.md new file mode 100644 index 0000000..de518cb --- /dev/null +++ b/examples/START_HERE.md @@ -0,0 +1,83 @@ +# 🚀 Hướng dẫn chạy thử C API Navigation + +## Cách nhanh nhất (1 lệnh) + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/examples +chmod +x run_example.sh +./run_example.sh +``` + +## Chi tiết các bước + +### Bước 1: Build C API Library + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/build +cmake .. +make nav_c_api +``` + +Library sẽ được tạo tại: `build/src/APIs/c_api/libnav_c_api.so` + +### Bước 2: Chạy C# Example + +Script `run_example.sh` sẽ tự động: +- ✅ Kiểm tra và build library nếu cần +- ✅ Tạo C# project +- ✅ Copy library và source code +- ✅ Set LD_LIBRARY_PATH cho tất cả dependencies +- ✅ Build và chạy example + +```bash +cd /home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/examples +./run_example.sh +``` + +## Kết quả mong đợi + +Nếu chạy thành công, bạn sẽ thấy: + +``` +========================================== +Building and Running C# Navigation Example +========================================== +Library already exists: .../build/src/APIs/c_api/libnav_c_api.so +C# project already exists +Copying library... +Building C# project... + +Running example... +========================================== +Robot pose: x=0, y=0, theta=0 +State: PENDING, Feedback: +========================================== +Done! +``` + +## Yêu cầu + +1. **.NET SDK 6.0+** (script sẽ kiểm tra và hướng dẫn nếu thiếu) +2. **Library đã được build** (script sẽ tự động build nếu thiếu) +3. **Linux environment** + +## Troubleshooting + +### Lỗi: "dotnet: command not found" +→ Script sẽ hiển thị hướng dẫn cài đặt .NET SDK + +### Lỗi: "Failed to create navigation instance" +→ Đảm bảo `move_base` đã được build: +```bash +cd build && make move_base +``` + +### Lỗi: "Cannot load library" +→ Kiểm tra LD_LIBRARY_PATH đã được set đúng (script tự động set) + +## Xem thêm + +- `README.md` - Hướng dẫn chi tiết +- `QUICK_START.md` - Quick start guide +- `run_example.sh` - Script tự động + diff --git a/examples/dotnet-install.sh b/examples/dotnet-install.sh new file mode 100755 index 0000000..c442946 --- /dev/null +++ b/examples/dotnet-install.sh @@ -0,0 +1,1887 @@ +#!/usr/bin/env bash +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +# Stop script on NZEC +set -e +# Stop script if unbound variable found (use ${var:-} if intentional) +set -u +# By default cmd1 | cmd2 returns exit code of cmd2 regardless of cmd1 success +# This is causing it to fail +set -o pipefail + +# Use in the the functions: eval $invocation +invocation='say_verbose "Calling: ${yellow:-}${FUNCNAME[0]} ${green:-}$*${normal:-}"' + +# standard output may be used as a return value in the functions +# we need a way to write text on the screen in the functions so that +# it won't interfere with the return value. +# Exposing stream 3 as a pipe to standard output of the script itself +exec 3>&1 + +# Setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors. +# See if stdout is a terminal +if [ -t 1 ] && command -v tput > /dev/null; then + # see if it supports colors + ncolors=$(tput colors || echo 0) + if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then + bold="$(tput bold || echo)" + normal="$(tput sgr0 || echo)" + black="$(tput setaf 0 || echo)" + red="$(tput setaf 1 || echo)" + green="$(tput setaf 2 || echo)" + yellow="$(tput setaf 3 || echo)" + blue="$(tput setaf 4 || echo)" + magenta="$(tput setaf 5 || echo)" + cyan="$(tput setaf 6 || echo)" + white="$(tput setaf 7 || echo)" + fi +fi + +say_warning() { + printf "%b\n" "${yellow:-}dotnet_install: Warning: $1${normal:-}" >&3 +} + +say_err() { + printf "%b\n" "${red:-}dotnet_install: Error: $1${normal:-}" >&2 +} + +say() { + # using stream 3 (defined in the beginning) to not interfere with stdout of functions + # which may be used as return value + printf "%b\n" "${cyan:-}dotnet-install:${normal:-} $1" >&3 +} + +say_verbose() { + if [ "$verbose" = true ]; then + say "$1" + fi +} + +# This platform list is finite - if the SDK/Runtime has supported Linux distribution-specific assets, +# then and only then should the Linux distribution appear in this list. +# Adding a Linux distribution to this list does not imply distribution-specific support. +get_legacy_os_name_from_platform() { + eval $invocation + + platform="$1" + case "$platform" in + "centos.7") + echo "centos" + return 0 + ;; + "debian.8") + echo "debian" + return 0 + ;; + "debian.9") + echo "debian.9" + return 0 + ;; + "fedora.23") + echo "fedora.23" + return 0 + ;; + "fedora.24") + echo "fedora.24" + return 0 + ;; + "fedora.27") + echo "fedora.27" + return 0 + ;; + "fedora.28") + echo "fedora.28" + return 0 + ;; + "opensuse.13.2") + echo "opensuse.13.2" + return 0 + ;; + "opensuse.42.1") + echo "opensuse.42.1" + return 0 + ;; + "opensuse.42.3") + echo "opensuse.42.3" + return 0 + ;; + "rhel.7"*) + echo "rhel" + return 0 + ;; + "ubuntu.14.04") + echo "ubuntu" + return 0 + ;; + "ubuntu.16.04") + echo "ubuntu.16.04" + return 0 + ;; + "ubuntu.16.10") + echo "ubuntu.16.10" + return 0 + ;; + "ubuntu.18.04") + echo "ubuntu.18.04" + return 0 + ;; + "alpine.3.4.3") + echo "alpine" + return 0 + ;; + esac + return 1 +} + +get_legacy_os_name() { + eval $invocation + + local uname=$(uname) + if [ "$uname" = "Darwin" ]; then + echo "osx" + return 0 + elif [ -n "$runtime_id" ]; then + echo $(get_legacy_os_name_from_platform "${runtime_id%-*}" || echo "${runtime_id%-*}") + return 0 + else + if [ -e /etc/os-release ]; then + . /etc/os-release + os=$(get_legacy_os_name_from_platform "$ID${VERSION_ID:+.${VERSION_ID}}" || echo "") + if [ -n "$os" ]; then + echo "$os" + return 0 + fi + fi + fi + + say_verbose "Distribution specific OS name and version could not be detected: UName = $uname" + return 1 +} + +get_linux_platform_name() { + eval $invocation + + if [ -n "$runtime_id" ]; then + echo "${runtime_id%-*}" + return 0 + else + if [ -e /etc/os-release ]; then + . /etc/os-release + echo "$ID${VERSION_ID:+.${VERSION_ID}}" + return 0 + elif [ -e /etc/redhat-release ]; then + local redhatRelease=$(&1 || true) | grep -q musl +} + +get_current_os_name() { + eval $invocation + + local uname=$(uname) + if [ "$uname" = "Darwin" ]; then + echo "osx" + return 0 + elif [ "$uname" = "FreeBSD" ]; then + echo "freebsd" + return 0 + elif [ "$uname" = "Linux" ]; then + local linux_platform_name="" + linux_platform_name="$(get_linux_platform_name)" || true + + if [ "$linux_platform_name" = "rhel.6" ]; then + echo $linux_platform_name + return 0 + elif is_musl_based_distro; then + echo "linux-musl" + return 0 + elif [ "$linux_platform_name" = "linux-musl" ]; then + echo "linux-musl" + return 0 + else + echo "linux" + return 0 + fi + fi + + say_err "OS name could not be detected: UName = $uname" + return 1 +} + +machine_has() { + eval $invocation + + command -v "$1" > /dev/null 2>&1 + return $? +} + +check_min_reqs() { + local hasMinimum=false + if machine_has "curl"; then + hasMinimum=true + elif machine_has "wget"; then + hasMinimum=true + fi + + if [ "$hasMinimum" = "false" ]; then + say_err "curl (recommended) or wget are required to download dotnet. Install missing prerequisite to proceed." + return 1 + fi + return 0 +} + +# args: +# input - $1 +to_lowercase() { + #eval $invocation + + echo "$1" | tr '[:upper:]' '[:lower:]' + return 0 +} + +# args: +# input - $1 +remove_trailing_slash() { + #eval $invocation + + local input="${1:-}" + echo "${input%/}" + return 0 +} + +# args: +# input - $1 +remove_beginning_slash() { + #eval $invocation + + local input="${1:-}" + echo "${input#/}" + return 0 +} + +# args: +# root_path - $1 +# child_path - $2 - this parameter can be empty +combine_paths() { + eval $invocation + + # TODO: Consider making it work with any number of paths. For now: + if [ ! -z "${3:-}" ]; then + say_err "combine_paths: Function takes two parameters." + return 1 + fi + + local root_path="$(remove_trailing_slash "$1")" + local child_path="$(remove_beginning_slash "${2:-}")" + say_verbose "combine_paths: root_path=$root_path" + say_verbose "combine_paths: child_path=$child_path" + echo "$root_path/$child_path" + return 0 +} + +get_machine_architecture() { + eval $invocation + + if command -v uname > /dev/null; then + CPUName=$(uname -m) + case $CPUName in + armv1*|armv2*|armv3*|armv4*|armv5*|armv6*) + echo "armv6-or-below" + return 0 + ;; + armv*l) + echo "arm" + return 0 + ;; + aarch64|arm64) + if [ "$(getconf LONG_BIT)" -lt 64 ]; then + # This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS) + echo "arm" + return 0 + fi + echo "arm64" + return 0 + ;; + s390x) + echo "s390x" + return 0 + ;; + ppc64le) + echo "ppc64le" + return 0 + ;; + loongarch64) + echo "loongarch64" + return 0 + ;; + riscv64) + echo "riscv64" + return 0 + ;; + powerpc|ppc) + echo "ppc" + return 0 + ;; + esac + fi + + # Always default to 'x64' + echo "x64" + return 0 +} + +# args: +# architecture - $1 +get_normalized_architecture_from_architecture() { + eval $invocation + + local architecture="$(to_lowercase "$1")" + + if [[ $architecture == \ ]]; then + machine_architecture="$(get_machine_architecture)" + if [[ "$machine_architecture" == "armv6-or-below" ]]; then + say_err "Architecture \`$machine_architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues" + return 1 + fi + + echo $machine_architecture + return 0 + fi + + case "$architecture" in + amd64|x64) + echo "x64" + return 0 + ;; + arm) + echo "arm" + return 0 + ;; + arm64) + echo "arm64" + return 0 + ;; + s390x) + echo "s390x" + return 0 + ;; + ppc64le) + echo "ppc64le" + return 0 + ;; + loongarch64) + echo "loongarch64" + return 0 + ;; + esac + + say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues" + return 1 +} + +# args: +# version - $1 +# channel - $2 +# architecture - $3 +get_normalized_architecture_for_specific_sdk_version() { + eval $invocation + + local is_version_support_arm64="$(is_arm64_supported "$1")" + local is_channel_support_arm64="$(is_arm64_supported "$2")" + local architecture="$3"; + local osname="$(get_current_os_name)" + + if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then + #check if rosetta is installed + if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then + say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." + echo "x64" + return 0; + else + say_err "Architecture \`$architecture\` is not supported for .NET SDK version \`$version\`. Please install Rosetta to allow emulation of the \`$architecture\` .NET SDK on this platform" + return 1 + fi + fi + + echo "$architecture" + return 0 +} + +# args: +# version or channel - $1 +is_arm64_supported() { + # Extract the major version by splitting on the dot + major_version="${1%%.*}" + + # Check if the major version is a valid number and less than 6 + case "$major_version" in + [0-9]*) + if [ "$major_version" -lt 6 ]; then + echo false + return 0 + fi + ;; + esac + + echo true + return 0 +} + +# args: +# user_defined_os - $1 +get_normalized_os() { + eval $invocation + + local osname="$(to_lowercase "$1")" + if [ ! -z "$osname" ]; then + case "$osname" in + osx | freebsd | rhel.6 | linux-musl | linux) + echo "$osname" + return 0 + ;; + macos) + osname='osx' + echo "$osname" + return 0 + ;; + *) + say_err "'$user_defined_os' is not a supported value for --os option, supported values are: osx, macos, linux, linux-musl, freebsd, rhel.6. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues." + return 1 + ;; + esac + else + osname="$(get_current_os_name)" || return 1 + fi + echo "$osname" + return 0 +} + +# args: +# quality - $1 +get_normalized_quality() { + eval $invocation + + local quality="$(to_lowercase "$1")" + if [ ! -z "$quality" ]; then + case "$quality" in + daily | preview) + echo "$quality" + return 0 + ;; + ga) + #ga quality is available without specifying quality, so normalizing it to empty + return 0 + ;; + *) + say_err "'$quality' is not a supported value for --quality option. Supported values are: daily, preview, ga. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues." + return 1 + ;; + esac + fi + return 0 +} + +# args: +# channel - $1 +get_normalized_channel() { + eval $invocation + + local channel="$(to_lowercase "$1")" + + if [[ $channel == current ]]; then + say_warning 'Value "Current" is deprecated for -Channel option. Use "STS" instead.' + fi + + if [[ $channel == release/* ]]; then + say_warning 'Using branch name with -Channel option is no longer supported with newer releases. Use -Quality option with a channel in X.Y format instead.'; + fi + + if [ ! -z "$channel" ]; then + case "$channel" in + lts) + echo "LTS" + return 0 + ;; + sts) + echo "STS" + return 0 + ;; + current) + echo "STS" + return 0 + ;; + *) + echo "$channel" + return 0 + ;; + esac + fi + + return 0 +} + +# args: +# runtime - $1 +get_normalized_product() { + eval $invocation + + local product="" + local runtime="$(to_lowercase "$1")" + if [[ "$runtime" == "dotnet" ]]; then + product="dotnet-runtime" + elif [[ "$runtime" == "aspnetcore" ]]; then + product="aspnetcore-runtime" + elif [ -z "$runtime" ]; then + product="dotnet-sdk" + fi + echo "$product" + return 0 +} + +# The version text returned from the feeds is a 1-line or 2-line string: +# For the SDK and the dotnet runtime (2 lines): +# Line 1: # commit_hash +# Line 2: # 4-part version +# For the aspnetcore runtime (1 line): +# Line 1: # 4-part version + +# args: +# version_text - stdin +get_version_from_latestversion_file_content() { + eval $invocation + + cat | tail -n 1 | sed 's/\r$//' + return 0 +} + +# args: +# install_root - $1 +# relative_path_to_package - $2 +# specific_version - $3 +is_dotnet_package_installed() { + eval $invocation + + local install_root="$1" + local relative_path_to_package="$2" + local specific_version="${3//[$'\t\r\n']}" + + local dotnet_package_path="$(combine_paths "$(combine_paths "$install_root" "$relative_path_to_package")" "$specific_version")" + say_verbose "is_dotnet_package_installed: dotnet_package_path=$dotnet_package_path" + + if [ -d "$dotnet_package_path" ]; then + return 0 + else + return 1 + fi +} + +# args: +# downloaded file - $1 +# remote_file_size - $2 +validate_remote_local_file_sizes() +{ + eval $invocation + + local downloaded_file="$1" + local remote_file_size="$2" + local file_size='' + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + file_size="$(stat -c '%s' "$downloaded_file")" + elif [[ "$OSTYPE" == "darwin"* ]]; then + # hardcode in order to avoid conflicts with GNU stat + file_size="$(/usr/bin/stat -f '%z' "$downloaded_file")" + fi + + if [ -n "$file_size" ]; then + say "Downloaded file size is $file_size bytes." + + if [ -n "$remote_file_size" ] && [ -n "$file_size" ]; then + if [ "$remote_file_size" -ne "$file_size" ]; then + say "The remote and local file sizes are not equal. The remote file size is $remote_file_size bytes and the local size is $file_size bytes. The local package may be corrupted." + else + say "The remote and local file sizes are equal." + fi + fi + + else + say "Either downloaded or local package size can not be measured. One of them may be corrupted." + fi +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +get_version_from_latestversion_file() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + + local version_file_url=null + if [[ "$runtime" == "dotnet" ]]; then + version_file_url="$azure_feed/Runtime/$channel/latest.version" + elif [[ "$runtime" == "aspnetcore" ]]; then + version_file_url="$azure_feed/aspnetcore/Runtime/$channel/latest.version" + elif [ -z "$runtime" ]; then + version_file_url="$azure_feed/Sdk/$channel/latest.version" + else + say_err "Invalid value for \$runtime" + return 1 + fi + say_verbose "get_version_from_latestversion_file: latest url: $version_file_url" + + download "$version_file_url" || return $? + return 0 +} + +# args: +# json_file - $1 +parse_globaljson_file_for_version() { + eval $invocation + + local json_file="$1" + if [ ! -f "$json_file" ]; then + say_err "Unable to find \`$json_file\`" + return 1 + fi + + sdk_section=$(cat "$json_file" | tr -d "\r" | awk '/"sdk"/,/}/') + if [ -z "$sdk_section" ]; then + say_err "Unable to parse the SDK node in \`$json_file\`" + return 1 + fi + + sdk_list=$(echo $sdk_section | awk -F"[{}]" '{print $2}') + sdk_list=${sdk_list//[\" ]/} + sdk_list=${sdk_list//,/$'\n'} + + local version_info="" + while read -r line; do + IFS=: + while read -r key value; do + if [[ "$key" == "version" ]]; then + version_info=$value + fi + done <<< "$line" + done <<< "$sdk_list" + if [ -z "$version_info" ]; then + say_err "Unable to find the SDK:version node in \`$json_file\`" + return 1 + fi + + unset IFS; + echo "$version_info" + return 0 +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +# version - $4 +# json_file - $5 +get_specific_version_from_version() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local version="$(to_lowercase "$4")" + local json_file="$5" + + if [ -z "$json_file" ]; then + if [[ "$version" == "latest" ]]; then + local version_info + version_info="$(get_version_from_latestversion_file "$azure_feed" "$channel" "$normalized_architecture" false)" || return 1 + say_verbose "get_specific_version_from_version: version_info=$version_info" + echo "$version_info" | get_version_from_latestversion_file_content + return 0 + else + echo "$version" + return 0 + fi + else + local version_info + version_info="$(parse_globaljson_file_for_version "$json_file")" || return 1 + echo "$version_info" + return 0 + fi +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +# specific_version - $4 +# normalized_os - $5 +construct_download_link() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local specific_version="${4//[$'\t\r\n']}" + local specific_product_version="$(get_specific_product_version "$1" "$4")" + local osname="$5" + + local download_link=null + if [[ "$runtime" == "dotnet" ]]; then + download_link="$azure_feed/Runtime/$specific_version/dotnet-runtime-$specific_product_version-$osname-$normalized_architecture.tar.gz" + elif [[ "$runtime" == "aspnetcore" ]]; then + download_link="$azure_feed/aspnetcore/Runtime/$specific_version/aspnetcore-runtime-$specific_product_version-$osname-$normalized_architecture.tar.gz" + elif [ -z "$runtime" ]; then + download_link="$azure_feed/Sdk/$specific_version/dotnet-sdk-$specific_product_version-$osname-$normalized_architecture.tar.gz" + else + return 1 + fi + + echo "$download_link" + return 0 +} + +# args: +# azure_feed - $1 +# specific_version - $2 +# download link - $3 (optional) +get_specific_product_version() { + # If we find a 'productVersion.txt' at the root of any folder, we'll use its contents + # to resolve the version of what's in the folder, superseding the specified version. + # if 'productVersion.txt' is missing but download link is already available, product version will be taken from download link + eval $invocation + + local azure_feed="$1" + local specific_version="${2//[$'\t\r\n']}" + local package_download_link="" + if [ $# -gt 2 ]; then + local package_download_link="$3" + fi + local specific_product_version=null + + # Try to get the version number, using the productVersion.txt file located next to the installer file. + local download_links=($(get_specific_product_version_url "$azure_feed" "$specific_version" true "$package_download_link") + $(get_specific_product_version_url "$azure_feed" "$specific_version" false "$package_download_link")) + + for download_link in "${download_links[@]}" + do + say_verbose "Checking for the existence of $download_link" + + if machine_has "curl" + then + if ! specific_product_version=$(curl -sL --fail "${download_link}${feed_credential}" 2>&1); then + continue + else + echo "${specific_product_version//[$'\t\r\n']}" + return 0 + fi + + elif machine_has "wget" + then + specific_product_version=$(wget -qO- "${download_link}${feed_credential}" 2>&1) + if [ $? = 0 ]; then + echo "${specific_product_version//[$'\t\r\n']}" + return 0 + fi + fi + done + + # Getting the version number with productVersion.txt has failed. Try parsing the download link for a version number. + say_verbose "Failed to get the version using productVersion.txt file. Download link will be parsed instead." + specific_product_version="$(get_product_specific_version_from_download_link "$package_download_link" "$specific_version")" + echo "${specific_product_version//[$'\t\r\n']}" + return 0 +} + +# args: +# azure_feed - $1 +# specific_version - $2 +# is_flattened - $3 +# download link - $4 (optional) +get_specific_product_version_url() { + eval $invocation + + local azure_feed="$1" + local specific_version="$2" + local is_flattened="$3" + local package_download_link="" + if [ $# -gt 3 ]; then + local package_download_link="$4" + fi + + local pvFileName="productVersion.txt" + if [ "$is_flattened" = true ]; then + if [ -z "$runtime" ]; then + pvFileName="sdk-productVersion.txt" + elif [[ "$runtime" == "dotnet" ]]; then + pvFileName="runtime-productVersion.txt" + else + pvFileName="$runtime-productVersion.txt" + fi + fi + + local download_link=null + + if [ -z "$package_download_link" ]; then + if [[ "$runtime" == "dotnet" ]]; then + download_link="$azure_feed/Runtime/$specific_version/${pvFileName}" + elif [[ "$runtime" == "aspnetcore" ]]; then + download_link="$azure_feed/aspnetcore/Runtime/$specific_version/${pvFileName}" + elif [ -z "$runtime" ]; then + download_link="$azure_feed/Sdk/$specific_version/${pvFileName}" + else + return 1 + fi + else + download_link="${package_download_link%/*}/${pvFileName}" + fi + + say_verbose "Constructed productVersion link: $download_link" + echo "$download_link" + return 0 +} + +# args: +# download link - $1 +# specific version - $2 +get_product_specific_version_from_download_link() +{ + eval $invocation + + local download_link="$1" + local specific_version="$2" + local specific_product_version="" + + if [ -z "$download_link" ]; then + echo "$specific_version" + return 0 + fi + + #get filename + filename="${download_link##*/}" + + #product specific version follows the product name + #for filename 'dotnet-sdk-3.1.404-linux-x64.tar.gz': the product version is 3.1.404 + IFS='-' + read -ra filename_elems <<< "$filename" + count=${#filename_elems[@]} + if [[ "$count" -gt 2 ]]; then + specific_product_version="${filename_elems[2]}" + else + specific_product_version=$specific_version + fi + unset IFS; + echo "$specific_product_version" + return 0 +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +# specific_version - $4 +construct_legacy_download_link() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local specific_version="${4//[$'\t\r\n']}" + + local distro_specific_osname + distro_specific_osname="$(get_legacy_os_name)" || return 1 + + local legacy_download_link=null + if [[ "$runtime" == "dotnet" ]]; then + legacy_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz" + elif [ -z "$runtime" ]; then + legacy_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz" + else + return 1 + fi + + echo "$legacy_download_link" + return 0 +} + +get_user_install_path() { + eval $invocation + + if [ ! -z "${DOTNET_INSTALL_DIR:-}" ]; then + echo "$DOTNET_INSTALL_DIR" + else + echo "$HOME/.dotnet" + fi + return 0 +} + +# args: +# install_dir - $1 +resolve_installation_path() { + eval $invocation + + local install_dir=$1 + if [ "$install_dir" = "" ]; then + local user_install_path="$(get_user_install_path)" + say_verbose "resolve_installation_path: user_install_path=$user_install_path" + echo "$user_install_path" + return 0 + fi + + echo "$install_dir" + return 0 +} + +# args: +# relative_or_absolute_path - $1 +get_absolute_path() { + eval $invocation + + local relative_or_absolute_path=$1 + echo "$(cd "$(dirname "$1")" && pwd -P)/$(basename "$1")" + return 0 +} + +# args: +# override - $1 (boolean, true or false) +get_cp_options() { + eval $invocation + + local override="$1" + local override_switch="" + + if [ "$override" = false ]; then + override_switch="-n" + + # create temporary files to check if 'cp -u' is supported + tmp_dir="$(mktemp -d)" + tmp_file="$tmp_dir/testfile" + tmp_file2="$tmp_dir/testfile2" + + touch "$tmp_file" + + # use -u instead of -n if it's available + if cp -u "$tmp_file" "$tmp_file2" 2>/dev/null; then + override_switch="-u" + fi + + # clean up + rm -f "$tmp_file" "$tmp_file2" + rm -rf "$tmp_dir" + fi + + echo "$override_switch" +} + +# args: +# input_files - stdin +# root_path - $1 +# out_path - $2 +# override - $3 +copy_files_or_dirs_from_list() { + eval $invocation + + local root_path="$(remove_trailing_slash "$1")" + local out_path="$(remove_trailing_slash "$2")" + local override="$3" + local override_switch="$(get_cp_options "$override")" + + cat | uniq | while read -r file_path; do + local path="$(remove_beginning_slash "${file_path#$root_path}")" + local target="$out_path/$path" + if [ "$override" = true ] || (! ([ -d "$target" ] || [ -e "$target" ])); then + mkdir -p "$out_path/$(dirname "$path")" + if [ -d "$target" ]; then + rm -rf "$target" + fi + cp -R $override_switch "$root_path/$path" "$target" + fi + done +} + +# args: +# zip_uri - $1 +get_remote_file_size() { + local zip_uri="$1" + + if machine_has "curl"; then + file_size=$(curl -sI "$zip_uri" | grep -i content-length | awk '{ num = $2 + 0; print num }') + elif machine_has "wget"; then + file_size=$(wget --spider --server-response -O /dev/null "$zip_uri" 2>&1 | grep -i 'Content-Length:' | awk '{ num = $2 + 0; print num }') + else + say "Neither curl nor wget is available on this system." + return + fi + + if [ -n "$file_size" ]; then + say "Remote file $zip_uri size is $file_size bytes." + echo "$file_size" + else + say_verbose "Content-Length header was not extracted for $zip_uri." + echo "" + fi +} + +# args: +# zip_path - $1 +# out_path - $2 +# remote_file_size - $3 +extract_dotnet_package() { + eval $invocation + + local zip_path="$1" + local out_path="$2" + local remote_file_size="$3" + + local temp_out_path="$(mktemp -d "$temporary_file_template")" + + local failed=false + tar -xzf "$zip_path" -C "$temp_out_path" > /dev/null || failed=true + + local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' + find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false + find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" + + validate_remote_local_file_sizes "$zip_path" "$remote_file_size" + + rm -rf "$temp_out_path" + if [ -z ${keep_zip+x} ]; then + rm -f "$zip_path" && say_verbose "Temporary archive file $zip_path was removed" + fi + + if [ "$failed" = true ]; then + say_err "Extraction failed" + return 1 + fi + return 0 +} + +# args: +# remote_path - $1 +# disable_feed_credential - $2 +get_http_header() +{ + eval $invocation + local remote_path="$1" + local disable_feed_credential="$2" + + local failed=false + local response + if machine_has "curl"; then + get_http_header_curl $remote_path $disable_feed_credential || failed=true + elif machine_has "wget"; then + get_http_header_wget $remote_path $disable_feed_credential || failed=true + else + failed=true + fi + if [ "$failed" = true ]; then + say_verbose "Failed to get HTTP header: '$remote_path'." + return 1 + fi + return 0 +} + +# args: +# remote_path - $1 +# disable_feed_credential - $2 +get_http_header_curl() { + eval $invocation + local remote_path="$1" + local disable_feed_credential="$2" + + remote_path_with_credential="$remote_path" + if [ "$disable_feed_credential" = false ]; then + remote_path_with_credential+="$feed_credential" + fi + + curl_options="-I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 " + curl $curl_options "$remote_path_with_credential" 2>&1 || return 1 + return 0 +} + +# args: +# remote_path - $1 +# disable_feed_credential - $2 +get_http_header_wget() { + eval $invocation + local remote_path="$1" + local disable_feed_credential="$2" + local wget_options="-q -S --spider --tries 5 " + + local wget_options_extra='' + + # Test for options that aren't supported on all wget implementations. + if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then + wget_options_extra="--waitretry 2 --connect-timeout 15 " + else + say "wget extra options are unavailable for this environment" + fi + + remote_path_with_credential="$remote_path" + if [ "$disable_feed_credential" = false ]; then + remote_path_with_credential+="$feed_credential" + fi + + wget $wget_options $wget_options_extra "$remote_path_with_credential" 2>&1 + + return $? +} + +# args: +# remote_path - $1 +# [out_path] - $2 - stdout if not provided +download() { + eval $invocation + + local remote_path="$1" + local out_path="${2:-}" + + if [[ "$remote_path" != "http"* ]]; then + cp "$remote_path" "$out_path" + return $? + fi + + local failed=false + local attempts=0 + while [ $attempts -lt 3 ]; do + attempts=$((attempts+1)) + failed=false + if machine_has "curl"; then + downloadcurl "$remote_path" "$out_path" || failed=true + elif machine_has "wget"; then + downloadwget "$remote_path" "$out_path" || failed=true + else + say_err "Missing dependency: neither curl nor wget was found." + exit 1 + fi + + if [ "$failed" = false ] || [ $attempts -ge 3 ] || { [ -n "${http_code-}" ] && [ "${http_code}" = "404" ]; }; then + break + fi + + say "Download attempt #$attempts has failed: ${http_code-} ${download_error_msg-}" + say "Attempt #$((attempts+1)) will start in $((attempts*10)) seconds." + sleep $((attempts*10)) + done + + if [ "$failed" = true ]; then + say_verbose "Download failed: $remote_path" + return 1 + fi + return 0 +} + +# Updates global variables $http_code and $download_error_msg +downloadcurl() { + eval $invocation + unset http_code + unset download_error_msg + local remote_path="$1" + local out_path="${2:-}" + # Append feed_credential as late as possible before calling curl to avoid logging feed_credential + # Avoid passing URI with credentials to functions: note, most of them echoing parameters of invocation in verbose output. + local remote_path_with_credential="${remote_path}${feed_credential}" + local curl_options="--retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs " + local curl_exit_code=0; + if [ -z "$out_path" ]; then + curl_output=$(curl $curl_options "$remote_path_with_credential" 2>&1) + curl_exit_code=$? + echo "$curl_output" + else + curl_output=$(curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1) + curl_exit_code=$? + fi + + # Regression in curl causes curl with --retry to return a 0 exit code even when it fails to download a file - https://github.com/curl/curl/issues/17554 + if [ $curl_exit_code -eq 0 ] && echo "$curl_output" | grep -q "^curl: ([0-9]*) "; then + curl_exit_code=$(echo "$curl_output" | sed 's/curl: (\([0-9]*\)).*/\1/') + fi + + if [ $curl_exit_code -gt 0 ]; then + download_error_msg="Unable to download $remote_path." + # Check for curl timeout codes + if [[ $curl_exit_code == 7 || $curl_exit_code == 28 ]]; then + download_error_msg+=" Failed to reach the server: connection timeout." + else + local disable_feed_credential=false + local response=$(get_http_header_curl $remote_path $disable_feed_credential) + http_code=$( echo "$response" | awk '/^HTTP/{print $2}' | tail -1 ) + if [[ ! -z $http_code && $http_code != 2* ]]; then + download_error_msg+=" Returned HTTP status code: $http_code." + fi + fi + say_verbose "$download_error_msg" + return 1 + fi + return 0 +} + + +# Updates global variables $http_code and $download_error_msg +downloadwget() { + eval $invocation + unset http_code + unset download_error_msg + local remote_path="$1" + local out_path="${2:-}" + # Append feed_credential as late as possible before calling wget to avoid logging feed_credential + local remote_path_with_credential="${remote_path}${feed_credential}" + local wget_options="--tries 20 " + + local wget_options_extra='' + local wget_result='' + + # Test for options that aren't supported on all wget implementations. + if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then + wget_options_extra="--waitretry 2 --connect-timeout 15 " + else + say "wget extra options are unavailable for this environment" + fi + + if [ -z "$out_path" ]; then + wget -q $wget_options $wget_options_extra -O - "$remote_path_with_credential" 2>&1 + wget_result=$? + else + wget $wget_options $wget_options_extra -O "$out_path" "$remote_path_with_credential" 2>&1 + wget_result=$? + fi + + if [[ $wget_result != 0 ]]; then + local disable_feed_credential=false + local response=$(get_http_header_wget $remote_path $disable_feed_credential) + http_code=$( echo "$response" | awk '/^ HTTP/{print $2}' | tail -1 ) + download_error_msg="Unable to download $remote_path." + if [[ ! -z $http_code && $http_code != 2* ]]; then + download_error_msg+=" Returned HTTP status code: $http_code." + # wget exit code 4 stands for network-issue + elif [[ $wget_result == 4 ]]; then + download_error_msg+=" Failed to reach the server: connection timeout." + fi + say_verbose "$download_error_msg" + return 1 + fi + + return 0 +} + +get_download_link_from_aka_ms() { + eval $invocation + + #quality is not supported for LTS or STS channel + #STS maps to current + if [[ ! -z "$normalized_quality" && ("$normalized_channel" == "LTS" || "$normalized_channel" == "STS") ]]; then + normalized_quality="" + say_warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored." + fi + + say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + + #construct aka.ms link + aka_ms_link="https://aka.ms/dotnet" + if [ "$internal" = true ]; then + aka_ms_link="$aka_ms_link/internal" + fi + aka_ms_link="$aka_ms_link/$normalized_channel" + if [[ ! -z "$normalized_quality" ]]; then + aka_ms_link="$aka_ms_link/$normalized_quality" + fi + aka_ms_link="$aka_ms_link/$normalized_product-$normalized_os-$normalized_architecture.tar.gz" + say_verbose "Constructed aka.ms link: '$aka_ms_link'." + + #get HTTP response + #do not pass credentials as a part of the $aka_ms_link and do not apply credentials in the get_http_header function + #otherwise the redirect link would have credentials as well + #it would result in applying credentials twice to the resulting link and thus breaking it, and in echoing credentials to the output as a part of redirect link + disable_feed_credential=true + response="$(get_http_header $aka_ms_link $disable_feed_credential)" + + say_verbose "Received response: $response" + # Get results of all the redirects. + http_codes=$( echo "$response" | awk '$1 ~ /^HTTP/ {print $2}' ) + # Allow intermediate 301 redirects and tolerate proxy-injected 200s + broken_redirects=$( echo "$http_codes" | sed '$d' | grep -vE '^(301|200)$' ) + # The response may end without final code 2xx/4xx/5xx somehow, e.g. network restrictions on www.bing.com causes redirecting to bing.com fails with connection refused. + # In this case it should not exclude the last. + last_http_code=$( echo "$http_codes" | tail -n 1 ) + if ! [[ $last_http_code =~ ^(2|4|5)[0-9][0-9]$ ]]; then + broken_redirects=$( echo "$http_codes" | grep -vE '^(301|200)$' ) + fi + + # All HTTP codes are 301 (Moved Permanently), the redirect link exists. + if [[ -z "$broken_redirects" ]]; then + aka_ms_download_link=$( echo "$response" | awk '$1 ~ /^Location/{print $2}' | tail -1 | tr -d '\r') + + if [[ -z "$aka_ms_download_link" ]]; then + say_verbose "The aka.ms link '$aka_ms_link' is not valid: failed to get redirect location." + return 1 + fi + + say_verbose "The redirect location retrieved: '$aka_ms_download_link'." + return 0 + else + say_verbose "The aka.ms link '$aka_ms_link' is not valid: received HTTP code: $(echo "$broken_redirects" | paste -sd "," -)." + return 1 + fi +} + +get_feeds_to_use() +{ + feeds=( + "https://builds.dotnet.microsoft.com/dotnet" + "https://ci.dot.net/public" + ) + + if [[ -n "$azure_feed" ]]; then + feeds=("$azure_feed") + fi + + if [[ -n "$uncached_feed" ]]; then + feeds=("$uncached_feed") + fi +} + +# THIS FUNCTION MAY EXIT (if the determined version is already installed). +generate_download_links() { + + download_links=() + specific_versions=() + effective_versions=() + link_types=() + + # If generate_akams_links returns false, no fallback to old links. Just terminate. + # This function may also 'exit' (if the determined version is already installed). + generate_akams_links || return + + # Check other feeds only if we haven't been able to find an aka.ms link. + if [[ "${#download_links[@]}" -lt 1 ]]; then + for feed in ${feeds[@]} + do + # generate_regular_links may also 'exit' (if the determined version is already installed). + generate_regular_links $feed || return + done + fi + + if [[ "${#download_links[@]}" -eq 0 ]]; then + say_err "Failed to resolve the exact version number." + return 1 + fi + + say_verbose "Generated ${#download_links[@]} links." + for link_index in ${!download_links[@]} + do + say_verbose "Link $link_index: ${link_types[$link_index]}, ${effective_versions[$link_index]}, ${download_links[$link_index]}" + done +} + +# THIS FUNCTION MAY EXIT (if the determined version is already installed). +generate_akams_links() { + local valid_aka_ms_link=true; + + normalized_version="$(to_lowercase "$version")" + if [[ "$normalized_version" != "latest" ]] && [ -n "$normalized_quality" ]; then + say_err "Quality and Version options are not allowed to be specified simultaneously. See https://learn.microsoft.com/dotnet/core/tools/dotnet-install-script#options for details." + return 1 + fi + + if [[ -n "$json_file" || "$normalized_version" != "latest" ]]; then + # aka.ms links are not needed when exact version is specified via command or json file + return + fi + + get_download_link_from_aka_ms || valid_aka_ms_link=false + + if [[ "$valid_aka_ms_link" == true ]]; then + say_verbose "Retrieved primary payload URL from aka.ms link: '$aka_ms_download_link'." + say_verbose "Downloading using legacy url will not be attempted." + + download_link=$aka_ms_download_link + + #get version from the path + IFS='/' + read -ra pathElems <<< "$download_link" + count=${#pathElems[@]} + specific_version="${pathElems[count-2]}" + unset IFS; + say_verbose "Version: '$specific_version'." + + #Retrieve effective version + effective_version="$(get_specific_product_version "$azure_feed" "$specific_version" "$download_link")" + + # Add link info to arrays + download_links+=($download_link) + specific_versions+=($specific_version) + effective_versions+=($effective_version) + link_types+=("aka.ms") + + # Check if the SDK version is already installed. + if [[ "$dry_run" != true ]] && is_dotnet_package_installed "$install_root" "$asset_relative_path" "$effective_version"; then + say "$asset_name with version '$effective_version' is already installed." + exit 0 + fi + + return 0 + fi + + # if quality is specified - exit with error - there is no fallback approach + if [ ! -z "$normalized_quality" ]; then + say_err "Failed to locate the latest version in the channel '$normalized_channel' with '$normalized_quality' quality for '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + say_err "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support." + return 1 + fi + say_verbose "Falling back to latest.version file approach." +} + +# THIS FUNCTION MAY EXIT (if the determined version is already installed) +# args: +# feed - $1 +generate_regular_links() { + local feed="$1" + local valid_legacy_download_link=true + + specific_version=$(get_specific_version_from_version "$feed" "$channel" "$normalized_architecture" "$version" "$json_file") || specific_version='0' + + if [[ "$specific_version" == '0' ]]; then + say_verbose "Failed to resolve the specific version number using feed '$feed'" + return + fi + + effective_version="$(get_specific_product_version "$feed" "$specific_version")" + say_verbose "specific_version=$specific_version" + + download_link="$(construct_download_link "$feed" "$channel" "$normalized_architecture" "$specific_version" "$normalized_os")" + say_verbose "Constructed primary named payload URL: $download_link" + + # Add link info to arrays + download_links+=($download_link) + specific_versions+=($specific_version) + effective_versions+=($effective_version) + link_types+=("primary") + + legacy_download_link="$(construct_legacy_download_link "$feed" "$channel" "$normalized_architecture" "$specific_version")" || valid_legacy_download_link=false + + if [ "$valid_legacy_download_link" = true ]; then + say_verbose "Constructed legacy named payload URL: $legacy_download_link" + + download_links+=($legacy_download_link) + specific_versions+=($specific_version) + effective_versions+=($effective_version) + link_types+=("legacy") + else + legacy_download_link="" + say_verbose "Could not construct a legacy_download_link; omitting..." + fi + + # Check if the SDK version is already installed. + if [[ "$dry_run" != true ]] && is_dotnet_package_installed "$install_root" "$asset_relative_path" "$effective_version"; then + say "$asset_name with version '$effective_version' is already installed." + exit 0 + fi +} + +print_dry_run() { + + say "Payload URLs:" + + for link_index in "${!download_links[@]}" + do + say "URL #$link_index - ${link_types[$link_index]}: ${download_links[$link_index]}" + done + + resolved_version=${specific_versions[0]} + repeatable_command="./$script_name --version "\""$resolved_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\""" + + if [ ! -z "$normalized_quality" ]; then + repeatable_command+=" --quality "\""$normalized_quality"\""" + fi + + if [[ "$runtime" == "dotnet" ]]; then + repeatable_command+=" --runtime "\""dotnet"\""" + elif [[ "$runtime" == "aspnetcore" ]]; then + repeatable_command+=" --runtime "\""aspnetcore"\""" + fi + + repeatable_command+="$non_dynamic_parameters" + + if [ -n "$feed_credential" ]; then + repeatable_command+=" --feed-credential "\"""\""" + fi + + say "Repeatable invocation: $repeatable_command" +} + +calculate_vars() { + eval $invocation + + script_name=$(basename "$0") + normalized_architecture="$(get_normalized_architecture_from_architecture "$architecture")" + say_verbose "Normalized architecture: '$normalized_architecture'." + normalized_os="$(get_normalized_os "$user_defined_os")" + say_verbose "Normalized OS: '$normalized_os'." + normalized_quality="$(get_normalized_quality "$quality")" + say_verbose "Normalized quality: '$normalized_quality'." + normalized_channel="$(get_normalized_channel "$channel")" + say_verbose "Normalized channel: '$normalized_channel'." + normalized_product="$(get_normalized_product "$runtime")" + say_verbose "Normalized product: '$normalized_product'." + install_root="$(resolve_installation_path "$install_dir")" + say_verbose "InstallRoot: '$install_root'." + + normalized_architecture="$(get_normalized_architecture_for_specific_sdk_version "$version" "$normalized_channel" "$normalized_architecture")" + + if [[ "$runtime" == "dotnet" ]]; then + asset_relative_path="shared/Microsoft.NETCore.App" + asset_name=".NET Core Runtime" + elif [[ "$runtime" == "aspnetcore" ]]; then + asset_relative_path="shared/Microsoft.AspNetCore.App" + asset_name="ASP.NET Core Runtime" + elif [ -z "$runtime" ]; then + asset_relative_path="sdk" + asset_name=".NET Core SDK" + fi + + get_feeds_to_use +} + +install_dotnet() { + eval $invocation + local download_failed=false + local download_completed=false + local remote_file_size=0 + + mkdir -p "$install_root" + zip_path="${zip_path:-$(mktemp "$temporary_file_template")}" + say_verbose "Archive path: $zip_path" + + for link_index in "${!download_links[@]}" + do + download_link="${download_links[$link_index]}" + specific_version="${specific_versions[$link_index]}" + effective_version="${effective_versions[$link_index]}" + link_type="${link_types[$link_index]}" + + say "Attempting to download using $link_type link $download_link" + + # The download function will set variables $http_code and $download_error_msg in case of failure. + download_failed=false + download "$download_link" "$zip_path" 2>&1 || download_failed=true + + if [ "$download_failed" = true ]; then + case ${http_code-} in + 404) + say "The resource at $link_type link '$download_link' is not available." + ;; + *) + say "Failed to download $link_type link '$download_link': ${http_code-} ${download_error_msg-}" + ;; + esac + rm -f "$zip_path" 2>&1 && say_verbose "Temporary archive file $zip_path was removed" + else + download_completed=true + break + fi + done + + if [[ "$download_completed" == false ]]; then + say_err "Could not find \`$asset_name\` with version = $specific_version" + say_err "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support" + return 1 + fi + + remote_file_size="$(get_remote_file_size "$download_link")" + + say "Extracting archive from $download_link" + extract_dotnet_package "$zip_path" "$install_root" "$remote_file_size" || return 1 + + # Check if the SDK version is installed; if not, fail the installation. + # if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed. + if [[ $specific_version == *"rtm"* || $specific_version == *"servicing"* ]]; then + IFS='-' + read -ra verArr <<< "$specific_version" + release_version="${verArr[0]}" + unset IFS; + say_verbose "Checking installation: version = $release_version" + if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$release_version"; then + say "Installed version is $effective_version" + return 0 + fi + fi + + # Check if the standard SDK version is installed. + say_verbose "Checking installation: version = $effective_version" + if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$effective_version"; then + say "Installed version is $effective_version" + return 0 + fi + + # Version verification failed. More likely something is wrong either with the downloaded content or with the verification algorithm. + say_err "Failed to verify the version of installed \`$asset_name\`.\nInstallation source: $download_link.\nInstallation location: $install_root.\nReport the bug at https://github.com/dotnet/install-scripts/issues." + say_err "\`$asset_name\` with version = $effective_version failed to install with an error." + return 1 +} + +args=("$@") + +local_version_file_relative_path="/.version" +bin_folder_relative_path="" +temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX" + +channel="LTS" +version="Latest" +json_file="" +install_dir="" +architecture="" +dry_run=false +no_path=false +azure_feed="" +uncached_feed="" +feed_credential="" +verbose=false +runtime="" +runtime_id="" +quality="" +internal=false +override_non_versioned_files=true +non_dynamic_parameters="" +user_defined_os="" + +while [ $# -ne 0 ] +do + name="$1" + case "$name" in + -c|--channel|-[Cc]hannel) + shift + channel="$1" + ;; + -v|--version|-[Vv]ersion) + shift + version="$1" + ;; + -q|--quality|-[Qq]uality) + shift + quality="$1" + ;; + --internal|-[Ii]nternal) + internal=true + non_dynamic_parameters+=" $name" + ;; + -i|--install-dir|-[Ii]nstall[Dd]ir) + shift + install_dir="$1" + ;; + --arch|--architecture|-[Aa]rch|-[Aa]rchitecture) + shift + architecture="$1" + ;; + --os|-[Oo][SS]) + shift + user_defined_os="$1" + ;; + --shared-runtime|-[Ss]hared[Rr]untime) + say_warning "The --shared-runtime flag is obsolete and may be removed in a future version of this script. The recommended usage is to specify '--runtime dotnet'." + if [ -z "$runtime" ]; then + runtime="dotnet" + fi + ;; + --runtime|-[Rr]untime) + shift + runtime="$1" + if [[ "$runtime" != "dotnet" ]] && [[ "$runtime" != "aspnetcore" ]]; then + say_err "Unsupported value for --runtime: '$1'. Valid values are 'dotnet' and 'aspnetcore'." + if [[ "$runtime" == "windowsdesktop" ]]; then + say_err "WindowsDesktop archives are manufactured for Windows platforms only." + fi + exit 1 + fi + ;; + --dry-run|-[Dd]ry[Rr]un) + dry_run=true + ;; + --no-path|-[Nn]o[Pp]ath) + no_path=true + non_dynamic_parameters+=" $name" + ;; + --verbose|-[Vv]erbose) + verbose=true + non_dynamic_parameters+=" $name" + ;; + --azure-feed|-[Aa]zure[Ff]eed) + shift + azure_feed="$1" + non_dynamic_parameters+=" $name "\""$1"\""" + ;; + --uncached-feed|-[Uu]ncached[Ff]eed) + shift + uncached_feed="$1" + non_dynamic_parameters+=" $name "\""$1"\""" + ;; + --feed-credential|-[Ff]eed[Cc]redential) + shift + feed_credential="$1" + #feed_credential should start with "?", for it to be added to the end of the link. + #adding "?" at the beginning of the feed_credential if needed. + [[ -z "$(echo $feed_credential)" ]] || [[ $feed_credential == \?* ]] || feed_credential="?$feed_credential" + ;; + --runtime-id|-[Rr]untime[Ii]d) + shift + runtime_id="$1" + non_dynamic_parameters+=" $name "\""$1"\""" + say_warning "Use of --runtime-id is obsolete and should be limited to the versions below 2.1. To override architecture, use --architecture option instead. To override OS, use --os option instead." + ;; + --jsonfile|-[Jj][Ss]on[Ff]ile) + shift + json_file="$1" + ;; + --skip-non-versioned-files|-[Ss]kip[Nn]on[Vv]ersioned[Ff]iles) + override_non_versioned_files=false + non_dynamic_parameters+=" $name" + ;; + --keep-zip|-[Kk]eep[Zz]ip) + keep_zip=true + non_dynamic_parameters+=" $name" + ;; + --zip-path|-[Zz]ip[Pp]ath) + shift + zip_path="$1" + ;; + -?|--?|-h|--help|-[Hh]elp) + script_name="dotnet-install.sh" + echo ".NET Tools Installer" + echo "Usage:" + echo " # Install a .NET SDK of a given Quality from a given Channel" + echo " $script_name [-c|--channel ] [-q|--quality ]" + echo " # Install a .NET SDK of a specific public version" + echo " $script_name [-v|--version ]" + echo " $script_name -h|-?|--help" + echo "" + echo "$script_name is a simple command line interface for obtaining dotnet cli." + echo " Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" + echo " - The SDK needs to be installed without user interaction and without admin rights." + echo " - The SDK installation doesn't need to persist across multiple CI runs." + echo " To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer." + echo "" + echo "Options:" + echo " -c,--channel Download from the channel specified, Defaults to \`$channel\`." + echo " -Channel" + echo " Possible values:" + echo " - STS - the most recent Standard Term Support release" + echo " - LTS - the most recent Long Term Support release" + echo " - 2-part version in a format A.B - represents a specific release" + echo " examples: 2.0; 1.0" + echo " - 3-part version in a format A.B.Cxx - represents a specific SDK release" + echo " examples: 5.0.1xx, 5.0.2xx." + echo " Supported since 5.0 release" + echo " Warning: Value 'Current' is deprecated for the Channel parameter. Use 'STS' instead." + echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used." + echo " -v,--version Use specific VERSION, Defaults to \`$version\`." + echo " -Version" + echo " Possible values:" + echo " - latest - the latest build on specific channel" + echo " - 3-part version in a format A.B.C - represents specific version of build" + echo " examples: 2.0.0-preview2-006120; 1.1.0" + echo " -q,--quality Download the latest build of specified quality in the channel." + echo " -Quality" + echo " The possible values are: daily, preview, GA." + echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." + echo " Supported since 5.0 release." + echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality." + echo " --internal,-Internal Download internal builds. Requires providing credentials via --feed-credential parameter." + echo " --feed-credential Token to access Azure feed. Used as a query string to append to the Azure feed." + echo " -FeedCredential This parameter typically is not specified." + echo " -i,--install-dir Install under specified location (see Install Location below)" + echo " -InstallDir" + echo " --architecture Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`." + echo " --arch,-Architecture,-Arch" + echo " Possible values: x64, arm, arm64, s390x, ppc64le and loongarch64" + echo " --os Specifies operating system to be used when selecting the installer." + echo " Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6." + echo " In case any other value is provided, the platform will be determined by the script based on machine configuration." + echo " Not supported for legacy links. Use --runtime-id to specify platform for legacy links." + echo " Refer to: https://aka.ms/dotnet-os-lifecycle for more information." + echo " --runtime Installs a shared runtime only, without the SDK." + echo " -Runtime" + echo " Possible values:" + echo " - dotnet - the Microsoft.NETCore.App shared runtime" + echo " - aspnetcore - the Microsoft.AspNetCore.App shared runtime" + echo " --dry-run,-DryRun Do not perform installation. Display download link." + echo " --no-path, -NoPath Do not set PATH for the current process." + echo " --verbose,-Verbose Display diagnostics information." + echo " --azure-feed,-AzureFeed For internal use only." + echo " Allows using a different storage to download SDK archives from." + echo " --uncached-feed,-UncachedFeed For internal use only." + echo " Allows using a different storage to download SDK archives from." + echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable." + echo " -SkipNonVersionedFiles" + echo " --jsonfile Determines the SDK version from a user specified global.json file." + echo " Note: global.json must have a value for 'SDK:Version'" + echo " --keep-zip,-KeepZip If set, downloaded file is kept." + echo " --zip-path, -ZipPath If set, downloaded file is stored at the specified path." + echo " -?,--?,-h,--help,-Help Shows this help message" + echo "" + echo "Install Location:" + echo " Location is chosen in following order:" + echo " - --install-dir option" + echo " - Environmental variable DOTNET_INSTALL_DIR" + echo " - $HOME/.dotnet" + exit 0 + ;; + *) + say_err "Unknown argument \`$name\`" + exit 1 + ;; + esac + + shift +done + +say_verbose "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" +say_verbose "- The SDK needs to be installed without user interaction and without admin rights." +say_verbose "- The SDK installation doesn't need to persist across multiple CI runs." +say_verbose "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n" + +if [ "$internal" = true ] && [ -z "$(echo $feed_credential)" ]; then + message="Provide credentials via --feed-credential parameter." + if [ "$dry_run" = true ]; then + say_warning "$message" + else + say_err "$message" + exit 1 + fi +fi + +check_min_reqs +calculate_vars +# generate_regular_links call below will 'exit' if the determined version is already installed. +generate_download_links + +if [[ "$dry_run" = true ]]; then + print_dry_run + exit 0 +fi + +install_dotnet + +bin_path="$(get_absolute_path "$(combine_paths "$install_root" "$bin_folder_relative_path")")" +if [ "$no_path" = false ]; then + say "Adding to current process PATH: \`$bin_path\`. Note: This change will be visible only when sourcing script." + export PATH="$bin_path":"$PATH" +else + say "Binaries of dotnet can be found in $bin_path" +fi + +say "Note that the script does not resolve dependencies during installation." +say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." +say "Installation finished successfully." diff --git a/examples/run_example.sh b/examples/run_example.sh new file mode 100755 index 0000000..0a9d3be --- /dev/null +++ b/examples/run_example.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +# Script để build và chạy C# example + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_DIR="$PROJECT_ROOT/build" +LIB_DIR="$BUILD_DIR" +EXAMPLE_DIR="$SCRIPT_DIR" + +echo "==========================================" +echo "Building and Running C# Navigation Example" +echo "==========================================" +echo "" +echo "📁 Paths:" +echo " SCRIPT_DIR: $SCRIPT_DIR" +echo " PROJECT_ROOT: $PROJECT_ROOT" +echo " BUILD_DIR: $BUILD_DIR" +echo " LIB_DIR: $LIB_DIR" +echo " EXAMPLE_DIR: $EXAMPLE_DIR" +echo "" + + +echo "Building C API library..." +cd "$BUILD_DIR" +cmake .. +make +sudo make install +echo "Library built successfully!" + + +# Kiểm tra dotnet có được cài đặt không +if ! command -v dotnet &> /dev/null; then + echo "==========================================" + echo "WARNING: .NET SDK not found!" + echo "==========================================" + echo "To run the C# example, please install .NET SDK:" + echo "" + echo " Ubuntu/Debian:" + echo " wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh" + echo " chmod +x dotnet-install.sh" + echo " ./dotnet-install.sh --channel 6.0" + echo " export PATH=\$PATH:\$HOME/.dotnet" + echo "" + echo " Or visit: https://dotnet.microsoft.com/download" + echo "" + echo "Skipping C# example. Library is available at:" + echo " $LIB_DIR/libnav_c_api.so" + echo "==========================================" + exit 0 +fi + +# Bước 2: Tạo C# project nếu chưa có +if [ ! -d "$EXAMPLE_DIR/NavigationExample" ]; then + echo "Creating C# project..." + cd "$EXAMPLE_DIR" + dotnet new console -n NavigationExample + cd NavigationExample + + # Tạo .csproj file + cat > NavigationExample.csproj << 'EOF' + + + Exe + net6.0 + linux-x64 + true + + + + PreserveNewest + + + +EOF + + echo "C# project created!" +else + echo "C# project already exists" +fi + +# Luôn copy source code mới nhất (cập nhật file nếu đã có) +cd "$EXAMPLE_DIR/NavigationExample" + +# # Bước 3: Copy library +# echo "Copying library..." +# cp "$LIB_DIR/libnav_c_api.so" . + +# Bước 4: Set LD_LIBRARY_PATH để tìm được tất cả dependencies +# Main build directory (contains libtf3.so, librobot_cpp.so, etc.) +export LD_LIBRARY_PATH="$BUILD_DIR:$LD_LIBRARY_PATH" +# Library directories for dependencies +export LD_LIBRARY_PATH="$BUILD_DIR/src/Libraries/robot_time:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BUILD_DIR/src/Libraries/xmlrpcpp:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BUILD_DIR/src/Libraries/robot_costmap_2d:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BUILD_DIR/src/Libraries/geometry2/robot_tf3_geometry_msgs:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BUILD_DIR/src/Libraries/geometry2/robot_tf3_sensor_msgs:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BUILD_DIR/src/Navigations/Packages/move_base:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BUILD_DIR/src/Navigations/Cores/move_base_core:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$BUILD_DIR/src/Navigations/Libraries/tf3:$LD_LIBRARY_PATH" +# Also add the example directory where the library is copied +export LD_LIBRARY_PATH="$EXAMPLE_DIR/NavigationExample:$LD_LIBRARY_PATH" +# Add the output directory where .NET places the library +export LD_LIBRARY_PATH="$EXAMPLE_DIR/NavigationExample/bin/Debug/net6.0/linux-x64:$LD_LIBRARY_PATH" + +# Bước 5: Build và chạy +echo "Building C# project..." +dotnet build + +echo "" +echo "Running example..." +echo "==========================================" +echo "LD_LIBRARY_PATH includes:" +echo "$LD_LIBRARY_PATH" | tr ':' '\n' | head -5 +echo "..." +echo "==========================================" +dotnet run + +echo "==========================================" +echo "Done!" + diff --git a/pnkx_nav_core.sln b/pnkx_nav_core.sln new file mode 100644 index 0000000..76b51c8 --- /dev/null +++ b/pnkx_nav_core.sln @@ -0,0 +1,29 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{B36A84DF-456D-A817-6EDD-3EC3E7F6E11F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NavigationExample", "examples\NavigationExample\NavigationExample.csproj", "{995839D6-1E72-F444-6587-97EF24F93814}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {995839D6-1E72-F444-6587-97EF24F93814}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {995839D6-1E72-F444-6587-97EF24F93814}.Debug|Any CPU.Build.0 = Debug|Any CPU + {995839D6-1E72-F444-6587-97EF24F93814}.Release|Any CPU.ActiveCfg = Release|Any CPU + {995839D6-1E72-F444-6587-97EF24F93814}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {995839D6-1E72-F444-6587-97EF24F93814} = {B36A84DF-456D-A817-6EDD-3EC3E7F6E11F} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1A56EED1-5E6A-48A6-9AEE-F39361B34305} + EndGlobalSection +EndGlobal diff --git a/robotapp.db b/robotapp.db new file mode 100644 index 0000000..e69de29 diff --git a/setup_catkin_workspace.sh b/setup_catkin_workspace.sh new file mode 100755 index 0000000..ce229e0 --- /dev/null +++ b/setup_catkin_workspace.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# ======================================================== +# Script to setup Catkin workspace for pnkx_nav_core +# ======================================================== + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +WORKSPACE_NAME="pnkx_nav_catkin_ws" +WORKSPACE_DIR="${SCRIPT_DIR}/../${WORKSPACE_NAME}" + +echo "==========================================" +echo "Setting up Catkin workspace for pnkx_nav_core" +echo "==========================================" +echo "" + +# Create workspace directory +echo "Creating workspace directory: ${WORKSPACE_DIR}" +mkdir -p "${WORKSPACE_DIR}/src" + +# Check if src directory already has packages +if [ -d "${WORKSPACE_DIR}/src" ] && [ "$(ls -A ${WORKSPACE_DIR}/src 2>/dev/null)" ]; then + echo "Warning: ${WORKSPACE_DIR}/src already contains packages" + read -p "Do you want to continue? (y/n) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Aborted." + exit 1 + fi +fi + +# Create symlinks to packages that have package.xml +echo "" +echo "Creating symlinks to packages with package.xml..." + +# Find all packages with package.xml in the source tree +PACKAGES=( + "src/Libraries/tf3" + "src/Libraries/robot_nav_2d_utils" + "src/Navigations/Libraries/nav_grid" + "src/Navigations/Cores/nav_core" + "src/Navigations/Cores/nav_core2" + "src/Navigations/Cores/nav_core_adapter" + "src/Navigations/Cores/move_base_core" + "src/Navigations/Cores/nav_core_adapter" + "src/Packages/move_base" + "src/Navigations/Packages/move_base" +) + +for PKG_PATH in "${PACKAGES[@]}"; do + FULL_PATH="${SCRIPT_DIR}/${PKG_PATH}" + if [ -f "${FULL_PATH}/package.xml" ]; then + PKG_NAME=$(basename "${PKG_PATH}") + TARGET="${WORKSPACE_DIR}/src/${PKG_NAME}" + + if [ -e "${TARGET}" ]; then + echo " Warning: ${TARGET} already exists, skipping..." + else + echo " Linking: ${PKG_NAME} -> ${PKG_PATH}" + ln -s "${FULL_PATH}" "${TARGET}" + fi + else + echo " Warning: ${PKG_PATH}/package.xml not found, skipping..." + fi +done + +# Create a README in the workspace +cat > "${WORKSPACE_DIR}/README.md" << EOF +# Catkin Workspace for pnkx_nav_core + +This is a Catkin workspace containing ROS-compatible packages from pnkx_nav_core. + +## Structure + +\`\`\` +${WORKSPACE_NAME}/ +├── src/ # Source packages (symlinked from pnkx_nav_core) +└── build/ # Build directory (created by catkin_make) +\`\`\` + +## Building + +\`\`\`bash +cd ${WORKSPACE_DIR} +catkin_make +\`\`\` + +## Source the workspace + +After building, source the setup file: + +\`\`\`bash +source devel/setup.bash +\`\`\` + +## Note + +Packages in \`src/\` are symlinked from the main pnkx_nav_core project. +To add more packages, create symlinks in \`src/\` pointing to packages +that have both \`CMakeLists.txt\` and \`package.xml\`. +EOF + +echo "" +echo "==========================================" +echo "Workspace setup complete!" +echo "==========================================" +echo "" +echo "Next steps:" +echo " 1. cd ${WORKSPACE_DIR}" +echo " 2. catkin_make" +echo " 3. source devel/setup.bash" +echo "" +echo "Note: Make sure all dependencies are built in the main project first" +echo " using standalone CMake before building with catkin." +echo "" + diff --git a/src/APIs/c_api/CMakeLists.txt b/src/APIs/c_api/CMakeLists.txt new file mode 100644 index 0000000..89f14d4 --- /dev/null +++ b/src/APIs/c_api/CMakeLists.txt @@ -0,0 +1,161 @@ +cmake_minimum_required(VERSION 3.10) +project(nav_c_api VERSION 1.0.0 LANGUAGES CXX) + +# Chuẩn C++ +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# Find Boost (filesystem needed for plugin path / boost::dll usage) +find_package(Boost REQUIRED COMPONENTS filesystem system) + +# Dependencies (robot_nav_2d_utils_conversions provides poseStampedToPose2D used by move_base_core/navigation.h) +set(PACKAGES_DIR + move_base_core + robot_nav_2d_utils + tf3 + robot_time + robot_cpp + geometry_msgs + angles + data_convert + robot_protocol_msgs +) + +# Thư mục include +include_directories( + ${PROJECT_SOURCE_DIR}/include +) + +# Tìm tất cả file source +file(GLOB SOURCES + "src/*.cpp" + "src/std_msgs/*.cpp" + "src/sensor_msgs/*.cpp" + "src/geometry_msgs/*.cpp" + "src/nav_msgs/*.cpp" + "src/nav_2d_msgs/*.cpp" + "src/robot_nav_msgs/*.cpp" + "src/robot_geometry_msgs/*.cpp" + "src/map_msgs/*.cpp" +) +file(GLOB HEADERS + "include/*.h" + "include/std_msgs/*.h" + "include/sensor_msgs/*.h" + "include/geometry_msgs/*.h" + "include/nav_msgs/*.h" + "include/nav_2d_msgs/*.h" + "include/robot_nav_msgs/*.h" + "include/robot_geometry_msgs/*.h" + "include/map_msgs/*.h" +) + +# Tạo thư viện shared (.so) +add_library(nav_c_api SHARED ${SOURCES} ${HEADERS}) + +# Link libraries +target_link_libraries(nav_c_api + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::boost + Boost::filesystem + Boost::system + dl +) + +set_target_properties(nav_c_api PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" +) + +# Set include directories +target_include_directories(nav_c_api + PUBLIC + $ + $ +) + +# Cài đặt header files +install(DIRECTORY include/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" +) + +# Cài đặt library +install(TARGETS nav_c_api + EXPORT nav_c_api-targets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) + +# Export targets +install(EXPORT nav_c_api-targets + FILE nav_c_api-targets.cmake + DESTINATION lib/cmake/nav_c_api +) + +# Tùy chọn build +option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(BUILD_TESTS "Build test programs" OFF) + +# Test cho lớp chuyển đổi. Không cần dựng navigation thật: mọi thứ ở đây là chuyển đổi thuần và +# quản lý bộ nhớ, đúng chỗ tập trung rủi ro của gói này. +# +# Bật bằng: cmake -DBUILD_C_API_TESTS=ON, rồi chạy ./devel/lib/nav_c_api/test_convertor +option(BUILD_C_API_TESTS "Build the C API converter tests" OFF) + +if(BUILD_C_API_TESTS OR BUILD_TESTS) + find_package(GTest QUIET) + if(GTest_FOUND OR GTEST_FOUND) + add_executable(test_convertor test/test_convertor.cpp) + + target_link_libraries(test_convertor + PRIVATE + nav_c_api + ${GTEST_BOTH_LIBRARIES} + pthread + ) + + target_include_directories(test_convertor + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${GTEST_INCLUDE_DIRS} + ) + + # Test phải build với cảnh báo bật: -w của thư viện che đúng nhóm lỗi mà test này đi tìm. + target_compile_options(test_convertor PRIVATE -Wall -Wextra) + + set_target_properties(test_convertor PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + ) + + enable_testing() + add_test(NAME test_convertor COMMAND test_convertor) + message(STATUS "nav_c_api: converter tests enabled") + else() + message(WARNING "nav_c_api: GTest not found, converter tests skipped") + endif() +endif() + +# Flags biên dịch +# Warning flags - disabled to suppress warnings during build +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") # -w suppresses all warnings +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") + +# In thông tin cấu hình +message(STATUS "=================================") +message(STATUS "Project: ${PROJECT_NAME}") +message(STATUS "Version: ${PROJECT_VERSION}") +message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") +message(STATUS "=================================") + diff --git a/src/APIs/c_api/C_API_AUDIT.md b/src/APIs/c_api/C_API_AUDIT.md new file mode 100644 index 0000000..af67fb1 --- /dev/null +++ b/src/APIs/c_api/C_API_AUDIT.md @@ -0,0 +1,500 @@ +# Rà soát gói `c_api` — những chỗ chưa hoàn thiện + +Phạm vi: `pnkx_nav_core/src/APIs/c_api`. Đọc toàn bộ `src/nav_c_api.cpp` (1396 dòng), +`src/convertor.cpp` (831), `src/std_msgs/Header.cpp`, `src/std_msgs/Time.cpp`, đối chiếu với +`include/nav_c_api.h` và với `Test/move_base2` ở phía sau. + +Ràng buộc: **không đổi chữ ký hàm, không đổi chức năng chính**. + +Ngày rà soát: 2026-08-08. **Đã sửa cùng ngày** — xem cột trạng thái ở mỗi mục và mục "Đã làm gì" +ở cuối. Một điểm nữa (**F25**) lộ ra trong lúc sửa, do chính bộ test mới bắt được. + +--- + +## Tóm tắt + +24 điểm, chia bốn mức. Ba điểm P0 là lỗi hành vi thật, không phải chuyện style: + +| Mức | Số điểm | Bản chất | +|---|---|---| +| **P0** | 3 | Sai hành vi hoặc UB — ảnh hưởng trực tiếp tới robot | +| **P1** | 3 | Hợp đồng lỏng: host không phân biệt được lỗi với dữ liệu rỗng | +| **P2** | 6 | Rác debug, log sai cấp, format sai | +| **P3** | 5 | Khai báo và tài liệu lệch với hiện thực | +| **P4** | 7 | Nhỏ, nhất quán, hạ tầng | + +Trong 24 điểm, **20 điểm sửa được mà không đụng chữ ký lẫn chức năng chính**. Bốn điểm còn lại +(F4, F5, F6 một phần, và phần capacity của F5) buộc phải hoặc đổi hợp đồng trả về, hoặc thêm hàm mới +song song — ghi rõ ở mục cuối. + +--- + +## P0 — sai hành vi thật + +### F1. `navigation_set_twist_linear` bỏ qua tham số `linear_x` + +**Vị trí:** `src/nav_c_api.cpp:574-584` + +```cpp +robot_geometry_msgs::Vector3 linear; +linear.x = 0.1; // <-- linear_x KHÔNG hề được dùng +linear.y = linear_y; +linear.z = linear_z; +bool result = nav_ptr->setTwistLinear(linear); +robot::log_info("setTwistLinear Forward %f", linear.x); + +linear.x = -0.1; // <-- cũng hard-code +result &= result && nav_ptr->setTwistLinear(linear); +robot::log_info("setTwistLinear Backward %f", linear.x); +return result; +``` + +**Vấn đề.** Tham số `linear_x` của hàm không bao giờ được đọc. Trần vận tốc gửi xuống lõi luôn là +`+0.1 m/s` cho chiều tiến và `-0.1 m/s` cho chiều lùi, bất kể host truyền giá trị nào. Hai tham số +`linear_y` và `linear_z` thì lại được truyền đúng — đây là dấu hiệu code viết dở rồi bỏ quên, không +phải quyết định thiết kế. + +**Ảnh hưởng lên hành vi robot.** Hai chiều, đều xấu: + +1. Đường hạ tốc của tầng an toàn không tới được lõi. Host tính ra "chỉ được chạy 0.3 m/s vì đang vào + vùng hẹp" rồi gọi hàm này — lõi nhận 0.1 m/s. Ngược lại host muốn nâng lên 1.0 m/s cũng chỉ nhận + được 0.1. +2. Ngay khi host gọi hàm này lần đầu, robot bị khoá ở 0.1 m/s cho tới hết phiên chạy. Nếu host chỉ + gọi khi cần giảm tốc thì robot sẽ không bao giờ về lại tốc độ bình thường. + +**Lỗi thứ hai trong cùng hàm.** `result &= result && nav_ptr->setTwistLinear(linear)` — toán tử `&&` +short-circuit: nếu lời gọi đầu trả `false` thì lời gọi thứ hai **không chạy**, nên trần chiều lùi +không được đặt. Ý định rõ ràng là gọi cả hai rồi AND kết quả lại. + +**Đã sửa.** Hợp đồng đúng: giá trị đi xuống lõi **nguyên dạng, giữ dấu**. Dấu của `linear_x` là thứ +chọn chiều mà trần áp vào — âm đặt trần lùi, dương đặt trần tiến; local planner giữ hai trần riêng +(`navigation_server.cpp:921-944`). Lấy trị tuyệt đối là vứt bỏ nửa thông tin của lời gọi. + +Một lời gọi vì thế đặt **một** chiều. Host muốn chặn cả hai thì gọi hai lần — đúng như host ROS đang +làm (`amr_control.cpp:707-709`, `amr_vda_5050_client_api.cpp:410-414`). + +```c +navigation_set_twist_linear(h, 0.6, 0.0, 0.0); // tiến <= 0.6 m/s +navigation_set_twist_linear(h, -0.3, 0.0, 0.0); // lùi <= 0.3 m/s +``` + +--- + +### F2. Gán `char*` có thể NULL vào `std::string` + +**Vị trí:** `src/convertor.cpp:13` (LaserScan), `:44` (OccupancyGrid), `:115` (PoseStamped) + +```cpp +robot_laser_scan.header.frame_id = laser_scan.header.frame_id; // char* có thể NULL +``` + +**Vấn đề.** Dựng `std::string` từ con trỏ NULL là hành vi không xác định — thực tế là segfault trong +`strlen`. Các converter khác trong **chính file này** đều đã guard: + +| Đã guard | Chưa guard | +|---|---| +| `convert2CppOdometry:73,75` | `convert2CppLaserScan:13` | +| `convert2CppPointCloud:383` | `convert2CppOccupancyGrid:44` | +| `convert2CppPointCloud2:408` | `convert2CppPoseStamped:115` | +| `convert2CppOrder:731-745` | | +| `convert2CppNode`, `convert2CppEdge`, `convert2CppAction`, `convert2CppNodePosition` | | + +Nghĩa là quy ước "guard NULL" đã có sẵn và được áp dụng ở 7 chỗ; ba chỗ này bị bỏ sót. + +**Ảnh hưởng.** `frame_id = NULL` hoàn toàn hợp lệ trong C, và **chính thư viện này sinh ra NULL**: +`convert2COccupancyGrid:181` viết `frame_id.empty() ? nullptr : strdup(...)`. Nên vòng +`navigation_get_static_map()` rồi `navigation_add_static_map()` — hoặc bất kỳ đường round-trip nào +qua một message có `frame_id` rỗng — là segfault chắc chắn. + +**Hướng sửa.** Thêm `? :` đúng như 7 chỗ còn lại. Không đụng chữ ký, không đổi chức năng. + +--- + +### F3. `strdup(frame_id)` không kiểm NULL + +**Vị trí:** `src/std_msgs/Header.cpp:8` (`header_create`) và `:18` (`header_set_data`) + +```cpp +extern "C" Header header_create(const char *frame_id) { + Header header{}; + header.frame_id = strdup(frame_id); // NULL -> segfault +``` + +**Vấn đề.** `strdup(NULL)` là UB. Hai hàm này nằm trong bề mặt công khai và C# gọi trực tiếp +(`NavigationAPI.cs:69,72`). + +**Hướng sửa.** `frame_id ? strdup(frame_id) : nullptr`. + +--- + +## P1 — hợp đồng lỏng, host không phân biệt được lỗi + +### F4. Bốn getter sensor luôn trả `true` kể cả khi tên không tồn tại + +**Vị trí:** `src/nav_c_api.cpp:858` (`get_static_map`), `:882` (`get_laser_scan`), `:906` +(`get_point_cloud`), `:930` (`get_point_cloud2`) + +**Vấn đề.** `move_base2::NavigationServer::getStaticMap` dùng `lookupOrDefault` +(`navigation_server.cpp:607-611`): tên không có trong map thì trả về object mặc định, không báo lỗi. +`c_api` chuyển thẳng object rỗng đó ra rồi `return true`. + +**Ảnh hưởng.** Host nhận `OccupancyGrid` với `width = 0`, `data = NULL` và một giá trị trả về `true`. +Không có cách nào phân biệt "bản đồ tồn tại nhưng rỗng" với "gõ sai tên bản đồ". Sai tên là lỗi cấu +hình phổ biến nhất ở đường sensor (tên phải khớp `topic` trong YAML costmap) — mà nó lại đúng là +trường hợp API im lặng nhất. + +**Hướng sửa.** Không sửa được nếu giữ nguyên chữ ký lẫn ngữ nghĩa: contract `BaseNavigation` không có +đường báo "không tìm thấy". Ba lựa chọn, đều nằm ngoài ràng buộc đợt này: +(a) tài liệu hoá rõ trong header rằng `true` không có nghĩa là tìm thấy; +(b) đổi quy ước: trả `false` khi kết quả rỗng — **đổi hành vi**, có thể vỡ host đang chạy; +(c) thêm hàm `navigation_has_static_map(handle, name)` bên `nav_c_api_2` để hỏi trước. + +Khuyến nghị: (a) ngay, (c) khi có dịp. + +--- + +### F5. Bốn hàm `get_all_*` và `get_robot_footprint` ghi vào mảng caller mà không biết dung lượng + +**Vị trí:** `src/nav_c_api.cpp:954`, `:985`, `:1021`, `:1057`, và `:203` +(`navigation_get_robot_footprint`) + +```cpp +auto maps = nav_ptr->getAllStaticMaps(); +out_count = maps.size(); +size_t i = 0; +for (const auto &p : maps) +{ + out_maps[i].name = strdup(p.first.c_str()); // ghi mù, không biết mảng dài bao nhiêu + convert2COccupancyGrid(p.second, out_maps[i].grid); + ++i; +} +``` + +**Vấn đề.** Chữ ký chỉ có con trỏ ra và `size_t &out_count` (là tham số **ra**, không phải vào). Hàm +không có cách nào biết mảng host cấp đủ chỗ hay không, và ghi đúng bằng số phần tử nó có. + +**Ảnh hưởng.** Host cấp mảng 4 phần tử, lõi đang giữ 6 point cloud → ghi tràn 2 phần tử. Với +`NamedOccupancyGrid` mỗi phần tử là một struct lớn, nên tràn không phải một byte mà hàng chục byte +ra ngoài vùng — hỏng stack hoặc heap của host, và triệu chứng sẽ hiện ra ở chỗ hoàn toàn khác. + +**Hướng sửa.** Không sửa được mà giữ chữ ký. Hai lựa chọn: +(a) ghi cảnh báo trong header, nói rõ host phải cấp dư và bao nhiêu là đủ; +(b) thêm biến thể có `size_t capacity` bên `nav_c_api_2`, giữ nguyên hàm cũ. + +--- + +### F6. `navigation_initialize` luôn trả `true` + +**Vị trí:** `src/nav_c_api.cpp:127` + +**Vấn đề.** `BaseNavigation::initialize()` trả `void`, nên `c_api` `return true` ngay sau khi gọi. +`move_base2` có năm đường thất bại trong `initialize()` (dựng costmap, cấu hình sensor, nạp plugin, +cấu hình control loop, start control thread — `navigation_server.cpp:340-479`), mỗi đường chỉ đặt +`nav_feedback_->is_ready = false` kèm lý do rồi return bình thường. + +**Ảnh hưởng.** Host tưởng lõi đã sẵn sàng, gửi goal vào một lõi không có control thread. Goal nằm im +vĩnh viễn: không cycle nào chạy, không state nào đổi, **không log gì**. + +**Hướng sửa.** Đã có sẵn: `navigation_initialize_checked()` trong `nav_c_api_2` làm đúng việc này mà +không đụng hàm cũ. Còn lại là chuyện host đổi sang gọi hàm mới. + +--- + +## P2 — rác debug, log sai cấp, format sai + +| # | Vị trí | Vấn đề | Ảnh hưởng | +|---|---|---|---| +| **F7** | `convertor.cpp:36-39` | `log_info` in `sizeof(OccupancyGrid)`, `offsetof(data)`, `offsetof(data_count)` **mỗi lần** convert map | Leftover của một lần dò lệch ABI. Chạy trên mọi `add_static_map` | +| **F8** | `nav_c_api.cpp:190` | `printf("footprint x: %f, y: %f")` **trong vòng lặp từng điểm** | Footprint 8 điểm = 8 dòng mỗi lần đặt footprint | +| **F9** | `nav_c_api.cpp:284, 319` (call site `move_straight_to` đã bị xoá cùng hàm) | `log_error` dùng để in giá trị bình thường: goal của `move_to_order`, goal của `move_to_nodes_edges` | Sai cấp log. Ai lọc log theo mức ERROR sẽ thấy toàn dữ liệu bình thường, lỗi thật bị chìm | +| **F10** | `nav_c_api.cpp:86` | `log_warning("%s", path_file_so.c_str())` in đường dẫn `.so` mỗi lần `navigation_create` | Sai cấp; nên là `log_info` hoặc `log_debug` | +| **F11** | `nav_c_api.cpp:748` | `log_info("occupancy_grid.data_count: %d", occupancy_grid.data_count)` — `%d` cho `size_t` | Format không khớp kiểu: UB, in ra số sai trên 64-bit. Bị `-w` che nên không có warning | +| **F12** | 9 chỗ trong `nav_c_api.cpp` | `printf` trộn lẫn với `robot::log_*` | Hai hệ log song song. `printf` đi thẳng stdout, không vào file log, không có timestamp, không lọc theo mức được | + +Tất cả P2 sửa được mà không đụng chữ ký lẫn chức năng. + +--- + +## P3 — khai báo và tài liệu lệch với hiện thực + +### F13. Ba symbol export nhưng không khai báo trong header + +`navigation_state_to_string` (`nav_c_api.cpp:38`), `navigation_offset_goal_2d` (`:51`), +`navigation_offset_goal_stamped` (`:66`). + +Binding theo tên symbol (P/Invoke) vẫn gọi được, nhưng bên gọi C/C++ include `nav_c_api.h` thì không +thấy. `NavigationAPI.cs:87` đang khai báo tay `navigation_state_to_string` — đúng, nhưng là đoán. + +### F14. Header nhắc tới một hàm không tồn tại + +`include/nav_c_api.h:119`: + +> `@param out_points Output array of points (allocated by library, free with navigation_free_points)` + +`navigation_free_points` **không tồn tại ở đâu cả** — không khai báo, không hiện thực, không export. +Ngoài ra câu này còn sai thêm một tầng: `out_points` **không** do thư viện cấp phát, nó là mảng của +caller (xem F5). + +### F15. Doc của `navigation_rotate_to` mô tả một chữ ký khác + +> **Không còn áp dụng, 2026-08-10.** `navigation_rotate_to` đã bị **xoá khỏi API** cùng nhóm +> `navigation_dock_to*` và `navigation_move_straight_to` — chúng đi thẳng xuống lõi, bỏ qua mission +> layer. Binding C# sai chữ ký nói ở đây vì thế cũng đã được gỡ. Giữ lại mục này làm ghi chép: bug +> gốc là **binding đọc doc thay vì đọc chữ ký**, và rủi ro đó không mất đi cùng hàm. + +`include/nav_c_api.h:196-202`: + +```c +/** + * @brief Rotate in place to align with target orientation + * @param handle Navigation handle + * @param goal_yaw Desired heading (radians) <-- không có tham số nào tên goal_yaw + * @return true if rotation command was sent successfully + */ +bool navigation_rotate_to(NavigationHandle handle, const PoseStamped goal); +``` + +**Đây gần như chắc chắn là nguồn của một bug đang tồn tại phía C#.** +`examples/NavigationExample/NavigationAPI.cs:165` khai báo: + +```csharp +public static extern bool navigation_rotate_to(NavigationHandle handle, double goal_yaw); +``` + +Người viết binding đọc doc chứ không đọc chữ ký. Hậu quả ở tầng ABI: C# đẩy một `double` vào `xmm0`, +C đọc một `PoseStamped` (struct lớn) từ stack — goal nhận được là rác, `isQuaternionValid` sẽ chặn +hoặc `frame_id` là con trỏ rác. + +### F16. Header khai `extern "C"` nhưng dùng tham chiếu C++ + +`size_t &out_count`, `PoseStamped &out_pose`, `OccupancyGrid &out_map`… Trình biên dịch C thuần không +dịch được file này. ABI thì vẫn là con trỏ nên P/Invoke không bị ảnh hưởng. Không sửa được mà giữ chữ +ký — chỉ ghi nhận. + +### F17. Ghi chú giải phóng bộ nhớ không đầy đủ + +`nav_c_api.h:265` có nhắc `out_twist->header.frame_id` phải free; `:274` nhắc `feed_back_str`. Nhưng +`navigation_get_robot_pose_stamped` (`:250`) cũng `strdup` `frame_id` (`convertor.cpp:134`) mà doc +không nhắc gì. Bốn getter sensor và hai getter planner data cũng cấp phát mà doc không nói (nay đã có +`navigation_free_*` bên `nav_c_api_2`, nhưng doc của header cũ chưa trỏ sang). + +--- + +## P4 — nhỏ, nhất quán, hạ tầng + +### F18. `resize()` trước khi kiểm con trỏ NULL + +`convertor.cpp:384` (`convert2CppPointCloud`) và `:423` (`convert2CppPointCloud2`): + +```cpp +cpp.points.resize(c.points_count); // resize trước +for (size_t i = 0; i < c.points_count && c.points; ++i) // kiểm NULL sau +``` + +Nếu host truyền `points = NULL` nhưng `points_count` lớn thì `resize` vẫn cấp phát đủ chỗ rồi vòng +lặp không chạy. Không crash, nhưng cấp phát vô ích có thể rất lớn. `convert2CppLaserScan:21-22` làm +đúng: tính size đã guard trước rồi mới resize. + +### F19. `get_all_static_maps` lệch với ba hàm cùng nhóm + +`nav_c_api.cpp:954` không có nhánh `if (empty()) { out_count = 0; return true; }` mà `:1000`, `:1036`, +`:1072` đều có. Kết quả cuối giống nhau (vòng lặp không chạy, `out_count = 0`), chỉ là lệch hình thức. + +### F20. `header_create` đọc đồng hồ hai lần + +`std_msgs/Header.cpp:9-10`: + +```cpp +header.sec = robot::Time::now().sec; +header.nsec = robot::Time::now().nsec; +``` + +Hai lời gọi riêng biệt. Nếu rơi đúng lúc `nsec` vòng qua giây thì `sec` lấy từ lần đọc trước còn +`nsec` từ lần sau — timestamp lệch tới một giây. Xác suất thấp nhưng hậu quả nằm ở TF lookup. + +### F21. `catch (...)` nuốt lỗi không log + +Phần lớn hàm kết thúc bằng `catch (...) { return false; }` trần. Host chỉ nhận `false`, không có cách +nào biết vì sao. `navigation_create` (`:100-107`) còn nuốt cả `std::exception &e` mà không in `e.what()` +— trong khi đây đúng là chỗ hay hỏng nhất (không tìm thấy `.so`, sai `library_path`). + +### F22. CMake guard không bao giờ khớp + +`pnkx_nav_core/CMakeLists.txt:237`: `if (NOT TARGET navigation_c_api)` — nhưng target thật tên +`nav_c_api` (`src/APIs/c_api/CMakeLists.txt:61`). Guard vô tác dụng; `.so` sinh ra là +`libnav_c_api.so`, không phải `libnavigation_c_api.so` như tài liệu ở nơi khác ghi. + +### F23. Không có test nào + +`src/APIs/c_api/` không có thư mục `test/`. Không có test đơn vị cho lớp converter — nơi tập trung +gần hết các lỗi P0 ở trên và là nơi test rẻ nhất (không cần dựng navigation thật). + +### F24. Năng lực contract chưa phơi ra ở bề mặt cũ + +`BaseNavigation` có `addDepthCameraData()` (thuần ảo) và `shutdown()` mà `nav_c_api.h` không có hàm +tương ứng. Đã bù bằng `navigation_add_depth_camera_data()` và `navigation_shutdown()` trong +`nav_c_api_2`; ghi lại ở đây để bảng rà soát đầy đủ. + +--- + +## Sửa được gì trong ràng buộc "không đổi chữ ký, không đổi chức năng chính" + +**Sửa được ngay — 20 điểm:** F1, F2, F3, F7, F8, F9, F10, F11, F12, F13, F14, F15, F17, F18, F19, +F20, F21, F22, F23, và phần tài liệu của F5. + +- F1 là làm cho hàm **thực hiện đúng chức năng nó đã khai** — dùng tham số thay vì hằng số. Chữ ký + không đổi, mục đích không đổi. +- F2, F3, F18, F20, F21 là bổ sung guard và sửa lỗi nhỏ, không chạm hợp đồng. +- F7–F12 là dọn log. +- F13–F15, F17 là sửa khai báo và doc cho khớp hiện thực — F15 quan trọng vì nó đang dẫn người viết + binding đi sai. + +**Không sửa được mà giữ nguyên chữ ký — 3 điểm:** + +| # | Vì sao | Lối ra | +|---|---|---| +| **F4** | Cần một đường báo "không tìm thấy" mà chữ ký hiện tại không có | Tài liệu hoá ngay; thêm `navigation_has_*` bên `nav_c_api_2` khi có dịp | +| **F5** | Cần tham số `capacity` | Tài liệu hoá ngay; thêm biến thể có `capacity` bên `nav_c_api_2` | +| **F16** | Bỏ tham chiếu C++ khỏi header là đổi chữ ký toàn bộ | Ghi nhận; chỉ đổi nếu có đợt phá vỡ ABI | + +Riêng **F6** đã có lối ra không phá vỡ gì: `navigation_initialize_checked()` đã tồn tại. + +--- + +## Thứ tự đề nghị + +1. **F1** — một mình nó đủ khiến trần vận tốc không hoạt động. Cần chốt ý định trước (xem dưới). +2. **F2, F3** — ba dòng guard, chặn ba đường segfault. +3. **F15, F14, F13** — sửa doc và khai báo, vì chúng đang tạo ra bug ở phía binding. +4. **F7–F12** — dọn log, gộp một lần. +5. **F23** — một binary GTest cho riêng lớp converter: `frame_id` NULL, mảng NULL với count > 0, + `Order` với mọi trường NULL, round-trip C++ → C → C++. Không cần dựng navigation thật. +6. **F4, F5** — chốt hướng rồi mới làm. + +--- + +## Câu hỏi mở — cần xác nhận trước khi sửa + +1. ~~**F1 — ý định của `navigation_set_twist_linear` là gì?**~~ **Đã chốt:** truyền nguyên dạng, dấu + chọn chiều, một lời gọi đặt một chiều. Xem F1. +2. **Giá trị `0.1` cũ có phải trần an toàn cố ý của một lần thử nghiệm không?** Nếu đúng là có chủ ý + thì nó phải nằm trong YAML chứ không phải hard-code trong lớp binding — và sau bản sửa này robot + sẽ chạy đúng tốc độ host yêu cầu, không còn bị kẹp ở 0.1 m/s. **Cần biết trước khi chạy thật.** +3. **F4 — có host nào đang dựa vào việc getter luôn trả `true` không?** Nếu không, đổi sang trả + `false` khi rỗng là hợp lý hơn nhiều — nhưng đó là đổi hành vi. +4. **Phía C# hiện có đang gọi `header_create` với `frame_id` NULL không** (F3), và có gọi + `navigation_get_all_*` với mảng cấp sẵn bao nhiêu phần tử (F5)? + +--- + +## F25 — hàm được khai báo và được gọi nhưng chưa bao giờ hiện thực + +**Vị trí:** `include/convertor.h:137` khai báo, `src/nav_c_api.cpp:61` gọi, **không có định nghĩa ở +đâu cả**. + +```cpp +robot_geometry_msgs::Pose2D convert2CppPose2D(const Pose2D& pose_2d); // chỉ có khai báo +``` + +**Vì sao không ai phát hiện.** Thư viện chia sẻ được phép link với symbol chưa phân giải: `.so` build +sạch, không một cảnh báo nào. Symbol nằm im trong bảng undefined: + +``` +$ nm -D --undefined-only libnav_c_api.so | grep convert2CppPose2D + U _Z17convert2CppPose2DRK6Pose2D +``` + +**Ảnh hưởng.** `navigation_offset_goal_2d()` — hàm duy nhất gọi nó — chết ngay ở lời gọi đầu tiên với +`symbol lookup error`, hoặc làm `dlopen` thất bại tuỳ cách nạp. Hàm này chưa bao giờ chạy được. + +**Cách nó lộ ra.** Không phải do đọc mã. Bộ test mới (F23) link một **executable** vào thư viện, và +executable thì không được phép có symbol chưa phân giải — trình liên kết báo ngay. Đây đúng là lý do +bộ test tồn tại. + +**Trạng thái: đã sửa** — hiện thực trong `convertor.cpp` ngay cạnh `convert2CPose2D`. + +--- + +## Đã làm gì + +Sửa **21/25 điểm**, giữ nguyên chữ ký và chức năng chính của mọi hàm. + +| Nhóm | Điểm | Trạng thái | +|---|---|---| +| P0 | F1, F2, F3 | Đã sửa | +| P1 | F6 | Đã có `navigation_initialize_checked` từ trước; header nay trỏ sang nó | +| P1 | F4, F5 | Không sửa được mà giữ chữ ký — **đã ghi cảnh báo rõ trong header** | +| P2 | F7–F12 | Đã sửa | +| P3 | F13, F14, F15, F17 | Đã sửa | +| P3 | F16 | Không sửa — cần phá vỡ ABI | +| P4 | F18, F19, F20, F21, F22, F23 | Đã sửa | +| P4 | F24 | Đã bù từ trước bằng `nav_c_api_2` | +| — | **F25** | Đã sửa | + +### File đã chạm + +| File | Thay đổi | +|---|---| +| `src/nav_c_api.cpp` | F1 (dùng `linear_x` thật, bỏ short-circuit), F8–F12 (bỏ 9 `printf`, chuyển sang `robot::log_*`, hạ cấp log debug), F19, F21 (log lý do trong `catch`) | +| `src/convertor.cpp` | F2 (`safe_cstr` cho 3 chỗ), F7 (bỏ log ABI), F18 (lấy kích thước từ con trỏ), **F25** | +| `src/std_msgs/Header.cpp` | F3 (`strdup` chấp nhận NULL), F20 (đọc đồng hồ một lần) | +| `include/nav_c_api.h` | F13 (3 khai báo thiếu), F14, F15, F17, cảnh báo F4/F5/F6, đơn vị `[m/s]`/`[rad/s]` | +| `CMakeLists.txt` (gói) | F22 sửa tên target trong guard; thêm nhánh build test | +| `../../../CMakeLists.txt` | F22 | +| `test/test_convertor.cpp` | **Mới** — F23 | + +### Hai thay đổi cần chú ý khi đọc diff + +**F1 — `navigation_set_twist_linear` giờ truyền `linear_x` nguyên dạng, giữ dấu.** Dấu chọn chiều: +âm đặt trần lùi, dương đặt trần tiến; một lời gọi đặt một chiều. **Đây là thay đổi hành vi thật** — +trước đó trần luôn là ±0.1 m/s bất kể host truyền gì. Host nào từng "quen" với việc robot chạy +0.1 m/s sẽ thấy robot chạy đúng tốc độ nó yêu cầu kể từ bản này. + +**F5 — vẫn còn ghi mù.** Cảnh báo đã vào header nhưng bản chất không đổi: `get_all_*` và +`get_robot_footprint` vẫn ghi theo số phần tử lõi đang giữ. Nếu muốn chặn thật thì phải thêm biến thể +có `capacity` bên `nav_c_api_2`. + +--- + +## Đã kiểm chứng tới đâu + +**Lệnh đã chạy và kết quả thật:** + +``` +$ cmake -S . -B build -DBUILD_C_API_TESTS=ON +-- nav_c_api: converter tests enabled + +$ cmake --build build --target nav_c_api test_convertor -j4 +[100%] Built target nav_c_api +[100%] Built target test_convertor + +$ ./build/test_convertor +[==========] 20 tests from 6 test cases ran. (0 ms total) +[ PASSED ] 20 tests. + +$ nm -D --undefined-only build/libnav_c_api.so | grep -E "convert2|isQuaternion|order_free|header_" +(không còn) + +$ g++ -std=c++17 -Wall -Wextra -fsyntax-only # cả 5 file nguồn +nav_c_api OK (0 warning) +convertor OK (0 warning) +nav_c_api_2 OK (0 warning) +convertor_2 OK (0 warning) +Header.cpp OK +``` + +20 test phủ: `frame_id` NULL trên 4 loại message, mảng NULL kèm bộ đếm khác 0 trên 3 loại, round-trip +C++ → C → C++ cho OccupancyGrid và LaserScan, `Order` zero-init và `Order` có node/edge với chuỗi +NULL, chuyển đổi depth camera (gồm kiểm tra copy chứ không alias), 5 hàm `navigation_free_*` (gọi với +NULL, gọi hai lần, giải phóng buffer lồng nhau), và `isQuaternionValid`. + +**Chưa kiểm chứng:** + +- Chưa chạy trên robot hay Gazebo. Không có test tích hợp nào dựng navigation thật. +- **F1 chưa được xác nhận trên phần cứng.** Trần vận tốc giờ đi đúng giá trị host truyền — cần một + lần chạy thật để xác nhận robot không vọt quá tốc độ mong đợi, vì trước đây nó luôn bị kẹp ở + 0.1 m/s. Đây là thay đổi cần chú ý nhất khi triển khai. +- `valgrind` chưa cài trên máy này, nên phần rò bộ nhớ của các hàm `free` mới chỉ được kiểm bằng + kiểm tra con trỏ sau khi giải phóng, không bằng công cụ. +- Bốn câu hỏi mở ở mục trên vẫn còn nguyên; F1 đã tự trả lời được bằng cách đọc host ROS, ba câu còn + lại vẫn cần phía host xác nhận. diff --git a/src/APIs/c_api/NAV_C_API_2_GUIDE.md b/src/APIs/c_api/NAV_C_API_2_GUIDE.md new file mode 100644 index 0000000..8248d16 --- /dev/null +++ b/src/APIs/c_api/NAV_C_API_2_GUIDE.md @@ -0,0 +1,1951 @@ +# `nav_c_api_2` — hướng dẫn cho khung C# + +Tài liệu cho phía host .NET/C# khi chuyển nền navigation từ `libmove_base.so` sang +`libmove_base2.so`. + +Bám sát mã nguồn tại thời điểm viết: +`pnkx_nav_core/src/APIs/c_api`, `Test/move_base2`, `pnkx_nav_core/src/Navigations/Packages/move_base` +(bản cũ, dùng để đối chiếu). + +--- + +## 0. Đọc nhanh — 9 việc phải làm ở phía C# + +| # | Việc | Vì sao | +|---|---|---| +| 1 | Gọi `navigation_add_static_map` **trước** `navigation_initialize` | Planner lattice chặn tới khi costmap có kích thước khác 0, và tự `exit(1)` khi chờ quá lâu — giết cả tiến trình | +| 2 | Gọi `navigation_set_robot_footprint` **trước** `navigation_initialize` | Bản cũ gọi trước là rơi mất; bản mới cache lại và áp đúng lúc dựng costmap | +| 3 | Thay `navigation_initialize` bằng `navigation_initialize_checked` | Hàm cũ luôn trả `true`, kể cả khi lõi dựng hỏng | +| 4 | Thêm `navigation_shutdown` vào đường tắt, **trước** `navigation_destroy` | Bản mới có control thread + thread costmap + thread mission đang chạy | +| 5 | Bỏ mọi suy đoán từ giá trị trả về của `navigation_set_twist_linear/_angular` | Giờ luôn trả `true` nếu số hợp lệ; tín hiệu "đang cancel" của bản cũ không còn | +| 6 | Bỏ mọi so sánh chuỗi `feed_back_str`, chuyển sang so enum | Nội dung chuỗi do lõi mới đặt, khác hoàn toàn bản cũ | +| 7 | Không coi `navigation_pause` trả về là robot đã dừng | Lệnh chỉ được ghi nhận, có hiệu lực ở cycle sau (≤ 33 ms @ 30 Hz) | +| 8 | Gọi các hàm `navigation_free_*` mới sau mỗi getter cấp bộ nhớ | Trước đây không có hàm giải phóng nào cho grid/scan/cloud/plan — mỗi lời gọi rò một lần | +| 9 | **Gỡ khai báo và call site của 5 hàm đã bị xoá** — `navigation_dock_to`, `_dock_to_order`, `_dock_to_nodes_edges`, `navigation_move_straight_to`, `navigation_rotate_to` | Symbol không còn trong `.so`; gọi là `EntryPointNotFoundException`. Thay bằng compound action + `navigation_execute_instant_actions` — xem mục 6.4 | + +Ba việc **nên** làm thêm: dùng `navigation_get_state` thay cho `navigation_get_feedback` ở vòng poll +(không cấp phát chuỗi); dùng `navigation_add_depth_camera_data` để bật clear theo frustum; dùng +`navigation_move_to_order_v2` nếu fleet master có gửi order update. + +> **Thay đổi phá vỡ tương thích, 2026-08-10.** Năm hàm bị **xoá khỏi API**: `navigation_dock_to`, +> `navigation_dock_to_order`, `navigation_dock_to_nodes_edges`, `navigation_move_straight_to`, +> `navigation_rotate_to`. Docking / đi thẳng / quay tại chỗ giờ là `profile` của từng chặng trong +> `compound_actions_params.yaml`, gửi bằng `navigation_move_to_order_v2` hoặc hàm mới +> `navigation_execute_instant_actions`. Chi tiết ở **mục 6.4**, hàm mới ở **mục 11.8**. + +**Đọc gì tiếp:** mục 3 (trình tự khởi tạo) và mục 5 (trình tự tắt) là hai chỗ dễ sai nhất. Mục 6 là +tham chiếu toàn bộ API theo nhóm. **Mục 11 là bản chi tiết của 13 hàm mới** — chức năng, từng tham +số, bẫy, ví dụ C#. Phụ lục B là đúng phần khai báo C# phải thêm. + +**Nếu bạn đang ghép một khung C# vào từ đầu**, đọc theo thứ tự: mục 2 (điều kiện vận hành) → **mục 12 +(kiến trúc host)** → **mục 12b (TF — thư viện thứ hai)** → mục 3 và 5 (khởi tạo, tắt) → +**mục 13 (ánh xạ VDA5050)** → **mục 14 (triển khai +lên robot)** → **mục 15 (checklist nghiệm thu)**. Mục 6 và 11 tra khi cần từng hàm. + +> **Tài liệu này là bản bền vững.** Nó mô tả API và cách ghép, không gắn với trạng thái hiện tại của +> một khung C# cụ thể. Bản kiểm điểm một thời điểm cho `RobotNet12` nằm ở +> `nav-c-api-2-csharp-integration-report.md` — file đó liệt kê lỗi đang có ở một repo tại một ngày cụ +> thể và sẽ cũ đi; file này thì không. + +--- + +## 1. Bố cục — và các hàm cũ nằm ở đâu + +**Một thư viện `.so` duy nhất.** `nav_c_api_2` không phải một thư viện khác, không phải một handle +khác, không phải một tầng bọc. Nó là thêm file nguồn vào **cùng** thư viện đó. + +``` +libnav_c_api.so +├── nav_c_api.cpp → 50 hàm cũ (không sửa, không dịch lại, không bọc) +├── convertor.cpp → order_free +├── nav_c_api_2.cpp → 13 hàm mới +└── convertor_2.cpp → converter cho depth camera +``` + +64 symbol, cùng một `.so`, không hàm nào trùng tên hàm nào. + +**Vậy các hàm không đổi thì C# gọi thế nào? Y hệt hôm nay, không sửa một dòng.** Cùng +`DllImport("nav_c_api")`, cùng tên symbol, cùng chữ ký, cùng struct. C# không dùng file header — +P/Invoke nối theo **tên symbol** trong `.so`, mà tên đó không đổi. Lớp binding hiện có tiếp tục chạy +nguyên trạng. + +Cái C# phải thêm chỉ là **13 `DllImport` mới + 4 struct mới** (phụ lục B). Cái C# phải *sửa* là hành +vi, không phải khai báo — đúng 8 việc ở mục 0. + +Hai header chỉ dành cho bên gọi C/C++: + +| File | Nội dung | +|---|---| +| `include/nav_c_api.h` | Bề mặt cũ. Không đổi chữ ký hàm nào. | +| `include/nav_c_api_2.h` | Phần thêm. `#include` luôn `nav_c_api.h`, nên bên gọi C/C++ chỉ cần include file này. | + +Tên thư viện sinh ra là `libnav_c_api.so` (target `nav_c_api`), nên phía C# là +`[DllImport("nav_c_api")]`. Tài liệu cũ có chỗ ghi `libnavigation_c_api.so` — kiểm tra lại chuỗi +khung hiện tại đang dùng. + +Mọi hàm dùng `CallingConvention.Cdecl`. `bool` của C++ là 1 byte, phải khai +`[return: MarshalAs(UnmanagedType.I1)]`. `size_t` trên Linux x64 là 8 byte — dùng `UIntPtr`. + +--- + +## 2. Điều kiện vận hành trước khi chạy + +| Việc | Giá trị | +|---|---| +| `PNKX_NAV_CORE_CONFIG_DIR` | Trỏ vào `Test/move_base2/config/runtime` — **không** phải `pnkx_nav_core/config` | +| YAML chọn plugin | `MoveBase: library_path: libmove_base2` (đã có sẵn trong `move_base_common_params.yaml`) | +| Đường tìm `.so` | `libmove_base2.so` và toàn bộ plugin planner/recovery/costmap phải nằm trong `PNKX_NAV_CORE_LIBRARY_PATH`, `devel/lib` hoặc `LD_LIBRARY_PATH` | +| Nhịp control loop | `controller_frequency: 30.0` — mọi độ trễ "một cycle" nói trong tài liệu này là ~33 ms | + +`navigation_create()` tra symbol `"MoveBase"`. `move_base2` export cả `MoveBase` lẫn `MoveBase2`, nên +đổi runtime chỉ tốn một dòng YAML, không phải sửa C#. + +--- + +## 3. Trình tự khởi tạo + +Thứ tự này **bắt buộc**, không phải khuyến nghị. Sai thứ tự ở bước 3 làm chết cả tiến trình. + +``` +1. tf3_buffer_create() → có buffer TF +2. navigation_create() → nạp libmove_base2.so, chưa chạy gì +3. bơm TF liên tục vào buffer → bắt đầu NGAY, chạy suốt vòng đời +4. navigation_set_robot_footprint() → trước initialize +5. navigation_add_static_map("/map", ...) → BẮT BUỘC trước initialize +6. navigation_initialize_checked() → nặng, chặn, tự start control thread +7. kiểm tra kết quả trả về → false thì đọc navigation_get_status_text() +8. bắt đầu vòng bơm sensor định kỳ +9. từ đây mới gửi goal +``` + +```csharp +// ---- 1..2 ------------------------------------------------------------------------------- +tfHandle = tf3_buffer_create(10); // cache 10 s +navHandle = navigation_create(); +if (navHandle == IntPtr.Zero) + throw new InvalidOperationException("navigation_create failed — kiểm tra library_path của MoveBase"); + +// ---- 3 ---------------------------------------------------------------------------------- +// TF phải chảy TRƯỚC initialize: costmap lấy pose robot ngay trong chu kỳ cập nhật đầu tiên. +StartTfPump(); + +// ---- 4 ---------------------------------------------------------------------------------- +// Footprint theo chiều ngược kim đồng hồ, toạ độ trong frame base_link, đơn vị mét. +var footprint = new[] +{ + new Point { x = 0.3, y = -0.2, z = 0.0 }, + new Point { x = 0.3, y = 0.2, z = 0.0 }, + new Point { x = -0.3, y = 0.2, z = 0.0 }, + new Point { x = -0.3, y = -0.2, z = 0.0 }, +}; +navigation_set_robot_footprint(navHandle, footprint, (UIntPtr)footprint.Length); + +// ---- 5 ---------------------------------------------------------------------------------- +// Tên "/map" phải khớp map_topic trong costmap_common_params.yaml. +navigation_add_static_map(navHandle, "/map", occupancyGrid); + +// ---- 6..7 ------------------------------------------------------------------------------- +// Chặn hàng giây: dựng 2 costmap, nạp planner/controller/recovery, dựng mission layer, +// start control thread. Không gọi từ UI thread. +if (!navigation_initialize_checked(navHandle, tfHandle)) +{ + IntPtr reason = navigation_get_status_text(navHandle); + string text = Marshal.PtrToStringAnsi(reason) ?? "unknown"; + nav_c_api_free_string(reason); + throw new InvalidOperationException($"navigation core not ready: {text}"); +} + +// ---- 8..9 ------------------------------------------------------------------------------- +StartSensorPumps(); +``` + +**Vì sao static map phải đi trước.** `initialize()` nạp planner ở pha hai. +`SBPLLatticePlanner::initialize` chặn tới khi costmap báo kích thước khác 0, mà kích thước đó chỉ có +khi một static map đã tới `StaticLayer`. Nạp planner trước khi map vào được là khoá chết: planner chờ +map, map chờ planner xong. SBPL `exit(1)` sau 2 giây. `move_base2` xử lý bằng cách cất static map đã +nhận rồi **phát lại** ngay trước khi nạp planner — nhưng nó chỉ phát lại được cái host đã gửi. + +**Về `map_save_` / `map_name_save_`.** Hai biến public đó là cách bản cũ bù cho đúng vấn đề trên. Với +`move_base2` host **không cần** đụng tới chúng. + +--- + +## 4. Bơm dữ liệu: cái gì, tên gì, tần số nào + +Tên truyền vào các hàm `navigation_add_*` phải khớp **giá trị `topic`** khai trong +`Test/move_base2/config/runtime/costmap_common_params.yaml`, không phải khoá của observation source. +Sai tên thì dữ liệu được nhận rồi bị bỏ ở tầng layer, im lặng. + +| Dữ liệu | Hàm | Tên (`topic` trong YAML) | Tần số | Bắt buộc | +|---|---|---|---|---| +| Bản đồ tĩnh | `navigation_add_static_map` | `/map` | Khi bản đồ đổi | **Có** — và trước `initialize` | +| Laser sau | `navigation_add_laser_scan` | `/b_scan` | Theo nguồn (~10–40 Hz) | Có, nếu dùng laser | +| Point cloud depth | `navigation_add_point_cloud2` | `/camera/depth/points_proc` | Theo camera | Tuỳ cấu hình | +| Point cloud depth phải | `navigation_add_point_cloud2` | `/camera_right/depth/points_proc` | Theo camera | Tuỳ cấu hình | +| Depth camera (clear frustum) | `navigation_add_depth_camera_data` | `/camera/depth/data` | Theo camera (~10–15 Hz) | Cần nếu muốn clear ghost | +| Depth camera phải | `navigation_add_depth_camera_data` | `/camera_right/depth/data` | Theo camera | Cần nếu muốn clear ghost | +| Odometry | `navigation_add_odometry` | tên tự do | Theo nguồn odometry | **Có** | +| TF | qua `tf3` buffer, không qua API này | — | Liên tục | **Có** | + +Ghi chú quan trọng: + +- **Odometry giờ là dữ liệu điều khiển, không phải dữ liệu hiển thị.** `move_base2` lấy vận tốc đo + được từ đó và đẩy xuống controller mỗi cycle. Bơm thưa hoặc bỏ qua là controller mất feedback vận + tốc. +- **Nguồn `/camera/depth/data` khai `data_type: DepthCameraData` và `frustum_clearing_enabled: true`.** + Chỉ `navigation_add_depth_camera_data` đẩy vào được nguồn này. Point cloud không thay thế được — + không có intrinsics thì không dựng được frustum, không clear được. +- **Không bơm nhanh hơn nguồn thật.** Đường depth tốn CPU nhất trong các đường sensor. +- **Toàn bộ đường sensor không thread-safe.** Xem mục 8. + +--- + +## 5. Trình tự tắt + +```csharp +public void Dispose() +{ + // 1. Dừng MỌI thread C# đang gọi navigation_add_* và đợi chúng thoát hẳn. + sensorCts.Cancel(); + Task.WaitAll(sensorTasks, TimeSpan.FromSeconds(2)); + + // 2. Quiesce lõi khi tiến trình còn sống đầy đủ. Trả về trong khoảng 1 giây. + // Sau bước này lõi không phát lệnh vận tốc nữa, nhưng getter vẫn gọi được. + navigation_shutdown(navHandle); + + // 3. Thả instance. + navigation_destroy(navHandle); + navHandle = IntPtr.Zero; + + // 4. Buffer TF sau cùng — lõi còn tham chiếu nó cho tới hết bước 3. + tf3_buffer_destroy(tfHandle); + tfHandle = IntPtr.Zero; +} +``` + +Không được đảo bước 1 và 2, và không được để `navigation_destroy` chạy trong finalizer/GC: thời điểm +đó do runtime .NET quyết định, có thể rơi vào lúc nó đã tháo dỡ một phần trong khi control thread vẫn +đang chạy. + +--- + +## 6. Tham chiếu từng hàm + +Ký hiệu cột "Đổi so với bản cũ": **=** giữ nguyên · **~** cùng chữ ký, khác hành vi · **+** hàm mới. + +> Mục này bao quát **toàn bộ** bề mặt API theo nhóm chức năng. Riêng 13 hàm mới có bản chi tiết hơn ở +> **mục 11** — chữ ký đầy đủ, từng tham số, bẫy, và ví dụ C# dùng được ngay. + +### 6.1. Vòng đời + +| | Hàm | Đổi | +|---|---|---| +| | `NavigationHandle navigation_create(void)` | = | + +Nạp `libmove_base2.so` qua symbol `MoveBase` và tạo một instance. Trả `NULL` khi không tìm được +library (sai `library_path`, sai `PNKX_NAV_CORE_CONFIG_DIR`, hoặc `.so` không nằm trong đường tìm). +Chưa chạy thread nào. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_initialize(NavigationHandle, TFListenerHandle)` | ~ | + +Dựng costmap, nạp planner/controller/recovery, dựng mission layer, start control thread. **Chặn**, +tốn hàng giây. **Luôn trả `true`** — contract bên dưới trả `void` nên không có gì để trả về. Dùng +`navigation_initialize_checked` thay thế. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_initialize_checked(NavigationHandle, TFListenerHandle)` | + | + +Như trên, nhưng đọc lại cờ sẵn sàng của lõi và trả về đúng kết quả thật. Trả `false` khi bất kỳ pha +nào hỏng: dựng costmap, cấu hình sensor, nạp plugin, cấu hình control loop, start control thread. +Lý do cụ thể lấy bằng `navigation_get_status_text`. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_is_ready(NavigationHandle)` | + | + +Lõi đã sẵn sàng nhận goal chưa. Rẻ, poll được. Không cấp phát gì. + +| | Hàm | Đổi | +|---|---|---| +| | `void navigation_shutdown(NavigationHandle)` | + | + +Dừng control thread, thread cập nhật costmap và thread mission — **không huỷ instance**. Sau lời gọi +này mọi getter vẫn an toàn. Idempotent. Không ném exception ra ngoài biên C. + +| | Hàm | Đổi | +|---|---|---| +| | `void navigation_destroy(NavigationHandle)` | ~ | + +Thả instance. Bản cũ gọi thẳng là chấp nhận được vì nó không override `shutdown()`. Bản mới **phải** +gọi `navigation_shutdown` trước. + +### 6.2. Trạng thái và phản hồi + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_get_feedback(NavigationHandle, NavFeedback &out)` | ~ | + +Trả trạng thái, chuỗi mô tả, pose 2D hiện tại, cờ `goal_checked`, cờ `is_ready`. + +- `feed_back_str` được `strdup`, **phải** giải phóng bằng `nav_c_api_free_string`. +- **Nội dung `feed_back_str` khác bản cũ** — là chuỗi lý do của control loop mới. Chỉ dùng để log. +- `navigation_state` là nguồn duy nhất nên rẽ nhánh. +- Giữa hai chặng của một order nhiều node, lõi ở `SUCCEEDED`/`PENDING` nhưng API **cố ý báo `ACTIVE`**. + Nhờ vậy suy "order xong" từ `SUCCEEDED` vẫn đúng — đừng tìm cách đi vòng qua lớp che này. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_get_state(NavigationHandle, NavigationState *out)` | + | + +Chỉ lấy enum trạng thái, không cấp phát chuỗi. Dùng cho vòng poll. `navigation_get_feedback` gọi ở +10 Hz nghĩa là 10 lần `strdup` + 10 lần `free` mỗi giây, và một lần quên `free` là một lần rò. + +| | Hàm | Đổi | +|---|---|---| +| | `char *navigation_get_status_text(NavigationHandle)` | + | + +Chuỗi mô tả của lõi, hoặc `NULL`. Giải phóng bằng `nav_c_api_free_string`. Chỉ để log — nội dung +không phải hợp đồng. + +| | Hàm | Đổi | +|---|---|---| +| | `char *navigation_state_to_string(NavigationState)` | = | + +Tên trạng thái dạng chuỗi. Giải phóng bằng `nav_c_api_free_string`. (Hàm này có export nhưng chưa +được khai báo trong `nav_c_api.h` — khai báo thủ công phía C# nếu cần.) + +### 6.3. Footprint + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_set_robot_footprint(NavigationHandle, const Point *pts, size_t n)` | ~ | + +Đặt hình robot, toạ độ trong frame `base_link`, đơn vị mét, thứ tự ngược kim đồng hồ. + +- **Bản cũ:** áp ngay vào hai costmap; gọi trước `initialize` thì **rơi mất im lặng**. +- **Bản mới:** ghi nhận rồi áp trong `initialize` và ở cycle sau nếu đổi. **Nên gọi trước + `initialize`** để planner đầu tiên thấy đúng hình robot. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_get_robot_footprint(NavigationHandle, Point *out, size_t &out_count)` | ~ | + +- **Bản cũ:** trả footprint của costmap — có giá trị (từ YAML) kể cả khi host chưa từng set. +- **Bản mới:** trả đúng cái host đã set. **Rỗng nếu host chưa gọi `set_robot_footprint`.** + +Cảnh báo về chữ ký: mảng do bên gọi cấp mà **không có tham số dung lượng** — hàm không biết mảng có +đủ chỗ không. Cấp dư (ví dụ 64 điểm) khi gọi. + +### 6.4. Lệnh di chuyển + +Tất cả trả `true` khi lệnh được nhận, không phải khi robot tới nơi. Theo dõi kết quả bằng +`navigation_get_state`. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_move_to(NavigationHandle, PoseStamped goal)` | ~ | + +Đi tới một pose. Quaternion không hợp lệ bị từ chối ngay tại API. Trong `move_base2` goal này đi qua +mission layer như một mission một chặng, để dùng chung đường huỷ và vòng đời với order VDA5050; mission +layer tắt thì rơi xuống đường trực tiếp. + +Dung sai `xy`/`yaw` đến từ profile trong YAML, không đặt được theo từng goal (bản cũ có tham số dung +sai trong contract nhưng `c_api` chưa bao giờ truyền). + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_move_to_order(NavigationHandle, Order order, PoseStamped goal)` | ~ | + +Gửi order VDA5050 đầy đủ. Trong `move_base2` order được **cắt thành từng chặng** tại các node có +action, lọc theo cờ `released`, và nối tiếp được khi fleet master release thêm horizon. `orderId` và +`orderUpdateId` là định danh order ở tầng mission — điền đúng. + +Nếu `Order` lấy từ `convert2COrder()` thì gọi `order_free()` khi xong. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_move_to_nodes_edges(NavigationHandle, const Node*, size_t, const Edge*, size_t, PoseStamped)` | ~ | + +Tiện ích: gửi order chỉ từ mảng node/edge. **Không đặt được `orderId`/`orderUpdateId`** — cả hai để +rỗng/0, nên mission layer không phân biệt được order update với order mới. Dùng +`navigation_move_to_order_v2` nếu cần order update. + +> Bản trước của hàm này dựng `Order` **không khởi tạo**, khiến bộ chuyển đổi đọc con trỏ rác trên +> stack. Đã sửa. Nếu khung C# đang chạy với `.so` cũ và thấy crash ngẫu nhiên hoặc chuỗi vô nghĩa ở +> đường order, đây là nguyên nhân. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_move_to_order_v2(NavigationHandle, const char *order_id, uint32_t order_update_id, const Node*, size_t, const Edge*, size_t, PoseStamped)` | + | + +Như trên nhưng có định danh thật. Quy ước: cùng `order_id` + `order_update_id` tăng dần = cập nhật +tuyến đang chạy; đổi `order_id` = order mới thay thế hoàn toàn. `order_id` rỗng bị từ chối. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_execute_instant_actions(NavigationHandle, const Action *actions, size_t count)` | + | + +Chạy trọn một message `instantActions` của VDA5050. Xem chi tiết ở **mục 11.8**. + +#### Năm hàm đã bị XOÁ khỏi API + +| Hàm | Trạng thái | +|---|---| +| `navigation_dock_to` | **Đã xoá** | +| `navigation_dock_to_order` | **Đã xoá** | +| `navigation_dock_to_nodes_edges` | **Đã xoá** | +| `navigation_move_straight_to` | **Đã xoá** | +| `navigation_rotate_to` | **Đã xoá** | + +Cả năm đã bị gỡ khỏi contract `BaseNavigation` (`move_base_core/navigation.h`), khỏi `move_base`, +`move_base2`, `nav_c_api`, `nav_c_api_2` và khỏi host ROS (`amr_control`). **Symbol không còn trong +`.so`** — mọi khai báo P/Invoke còn sót lại sẽ ném `EntryPointNotFoundException` ở lời gọi đầu tiên. + +**Năng lực không mất, nó chuyển chỗ.** Docking, đi thẳng và quay tại chỗ giờ là **thuộc tính của +từng chặng bên trong một action**, khai trong `compound_actions_params.yaml`: + +```yaml +PickUp: + steps: + - {action: detect} # dò mốc + - {move_to: dock_target, profile: docking, marker: trolley} # tiến vào bằng profile docking + - {action: LiftFork} + - {move: -0.5, profile: go_straight} # lùi ra 0.5 m + +UnDockFromStation: + steps: + - {move: -1.0, profile: go_straight} + - {move: 0.0, profile: rotate} +``` + +`profile` nhận `position | docking | go_straight | rotate`; `marker` **chỉ hợp lệ với +`profile: docking`** và chọn override trong `maker_sources.yaml`. Tolerance thuộc YAML của local +planner mà profile đó chọn, không khai ở đây. + +Host không còn gọi ba động tác này trực tiếp. Nó gửi **tên action** — `PickUp`, `charge`, +`UnDockFromStation` — theo một trong hai đường: + +| Đường | Hàm | Khi nào | +|---|---|---| +| Action nằm trong node của order | `navigation_move_to_order_v2` | Fleet master giao tuyến có action ở giữa đường | +| `instantActions` ngoài luồng order | `navigation_execute_instant_actions` | Fleet master hoặc HMI yêu cầu ngay | + +Cùng một bảng compound action, cùng một bộ handler, nên `PickUp` gửi kiểu nào cũng sinh ra đúng chuỗi +chặng như nhau. + +**Vì sao đổi.** Ba hàm cũ đi **thẳng xuống lõi**, không qua mission layer — nên chúng cướp quyền của +order đang chạy mà mission layer không hề biết. `UnDockFromStation` gọi `moveStraightTo` là một ví dụ +đã gặp: nó preempt order đang chạy trong im lặng. Đưa chúng vào compound action là đưa mọi chuyển +động về chung một hàng đợi, chung một đường huỷ, chung một đường báo kết quả. + +### 6.5. Vòng đời nhiệm vụ + +| | Hàm | Đổi | +|---|---|---| +| | `void navigation_pause(NavigationHandle)` | ~ | +| | `void navigation_resume(NavigationHandle)` | ~ | +| | `void navigation_cancel(NavigationHandle)` | ~ | + +- **Bản cũ:** đồng bộ, có hiệu lực ngay trong lời gọi; ném `std::runtime_error` nếu lõi chưa dựng + xong (C API nuốt, C# thấy im lặng). +- **Bản mới:** chỉ ghi nhận yêu cầu; control thread áp ở cycle kế tiếp (≤ 33 ms @ 30 Hz). Không bao + giờ ném. + +Hệ quả: **trả về ≠ robot đã dừng.** Muốn biết đã dừng, chờ `navigation_get_state` báo `PAUSED`, hoặc +theo dõi `navigation_get_twist`. Nếu C# có tầng an toàn giả định dừng tức thì thì phải sửa ở phía C#. + +`cancel` từ host huỷ **cả order** (gồm hàng đợi mission), khác với huỷ nội bộ do chính mission layer +phát ra chỉ dừng chặng đang chạy. + +### 6.6. Trần vận tốc + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_set_twist_linear(NavigationHandle, double x, double y, double z)` | ~ | +| | `bool navigation_set_twist_angular(NavigationHandle, double x, double y, double z)` | ~ | + +**Đây là trần vận tốc, không phải lệnh jog.** Đường này để tầng an toàn hạ tốc độ robot. + +- **Dấu của `x` tuyến tính chọn chiều**: `x < 0` đặt trần **lùi**, `x >= 0` đặt trần **tiến**. Hai + trần được giữ riêng ở local planner, nên **một lời gọi chỉ đặt một chiều**. Muốn chặn cả hai thì + gọi hai lần: + + ```csharp + navigation_set_twist_linear(h, 0.6, 0.0, 0.0); // tiến <= 0.6 m/s + navigation_set_twist_linear(h, -0.3, 0.0, 0.0); // lùi <= 0.3 m/s + ``` + +- Đơn vị: tuyến tính `[m/s]`, góc `[rad/s]`. +- `NaN`/`Inf` bị từ chối, trả `false`. +- Có hiệu lực ở cycle kế tiếp. +- **Bản cũ** đẩy thẳng xuống controller và trả `false` khi đang có cancel (kèm `unlock()` nội bộ). + **Bản mới** chỉ kiểm tra số: giá trị hợp lệ luôn trả `true`. Tín hiệu "đang cancel" **không còn tồn + tại** — C# nào dựa vào nó phải chuyển sang đọc trạng thái. + +> **Cảnh báo triển khai.** Trước bản sửa 2026-08-08, hàm này **bỏ qua tham số `linear_x`** và luôn +> đặt trần ±0.1 m/s bất kể host truyền gì. Nếu khung C# đang chạy với `.so` cũ thì robot đang bị hãm +> ở 0.1 m/s; sau khi cập nhật thư viện nó sẽ chạy đúng tốc độ host yêu cầu. Lần deploy đầu phải quan +> sát tốc độ thật trước khi cho chạy tự động. + +### 6.7. Truy vấn pose và vận tốc + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_get_robot_pose_stamped(NavigationHandle, PoseStamped &out)` | = | +| | `bool navigation_get_robot_pose_2d(NavigationHandle, Pose2D &out)` | = | + +Pose robot trong global frame. Trả `false` khi TF chưa đủ. Bản `PoseStamped` cấp `frame_id` bằng +`strdup` — giải phóng bằng `nav_c_api_free_string`. + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_get_twist(NavigationHandle, Twist2DStamped &out)` | ~ | + +**Lệnh vận tốc đang phát**, không phải vận tốc đo được. Đây là thứ host publish ra `cmd_vel`. + +Bản mới có cửa ân hạn: khi không có yêu cầu nào chạy, **stamp đứng yên**; stamp bằng 0 nghĩa là lõi +chưa từng điều khiển. C# nên kiểm tra stamp trước khi publish, tránh đè lên teleop. + +`out.header.frame_id` được `strdup` — giải phóng bằng `nav_c_api_free_string`. + +### 6.8. Bơm dữ liệu sensor vào + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_add_static_map(NavigationHandle, const char *name, OccupancyGrid)` | ~ | +| | `bool navigation_add_laser_scan(NavigationHandle, const char *name, LaserScan)` | = | +| | `bool navigation_add_point_cloud(NavigationHandle, const char *name, PointCloud)` | = | +| | `bool navigation_add_point_cloud2(NavigationHandle, const char *name, PointCloud2)` | = | +| | `bool navigation_add_odometry(NavigationHandle, const char *name, Odometry)` | ~ | +| | `bool navigation_add_depth_camera_data(NavigationHandle, const char *topic, DepthCameraData)` | + | + +Chung cho cả nhóm: dữ liệu được **copy** ngay trong lời gọi, buffer C# giải phóng được ngay sau khi +hàm trả về. `name` phải khớp `topic` trong YAML costmap. + +- `navigation_add_static_map`: gọi được **trước** `initialize`, và bắt buộc phải thế (mục 3). +- `navigation_add_odometry`: giờ là nguồn vận tốc đo được của controller, không còn chỉ để hiển thị. +- `navigation_add_depth_camera_data` (mới): đường duy nhất tới `VoxelLayer` để **clear theo frustum** + — xoá vật cản ma nằm trong tầm nhìn camera. Yêu cầu: + - `header.frame_id` là **optical frame** của camera, và TF từ frame đó tới base frame phải có trong + buffer tf3 tại đúng `header.stamp`; + - `depth.encoding` đúng thật (`"16UC1"` hoặc `"32FC1"`), `step` là số byte mỗi hàng; + - `camera_info` là intrinsics của **đúng độ phân giải đang gửi**, không phải của stream màu; + - ảnh depth và camera info **cùng một thời điểm** — ghép lệch hai luồng là clear sai vùng. + +### 6.9. Đọc lại và xoá dữ liệu sensor + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_get_static_map(NavigationHandle, const char *name, OccupancyGrid &out)` | = | +| | `bool navigation_get_laser_scan(NavigationHandle, const char *name, LaserScan &out)` | = | +| | `bool navigation_get_point_cloud(NavigationHandle, const char *name, PointCloud &out)` | = | +| | `bool navigation_get_point_cloud2(NavigationHandle, const char *name, PointCloud2 &out)` | = | +| | `bool navigation_get_all_static_maps(NavigationHandle, NamedOccupancyGrid *out, size_t &n)` | = | +| | `bool navigation_get_all_laser_scans(...)`, `..._point_clouds(...)`, `..._point_cloud2s(...)` | = | +| | `bool navigation_remove_static_map / _laser_scan / _point_cloud / _point_cloud2` | = | +| | `bool navigation_remove_all_static_maps / _laser_scans / _point_clouds / _point_cloud2s` | = | +| | `bool navigation_remove_all_data(NavigationHandle)` | = | + +Các getter **cấp bộ nhớ** — dùng `navigation_free_*` (mục 6.11) sau khi xong. + +Bản mới cất **bản đã lọc** của laser scan, đúng bản mà costmap nhìn thấy, nên getter và costmap không +còn lệch nguồn. + +Cảnh báo về chữ ký `get_all_*`: mảng do bên gọi cấp, **không có tham số dung lượng**. Cấp dư. + +### 6.10. Dữ liệu hiển thị + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_get_global_data(NavigationHandle, PlannerDataOutput *out)` | ~ | +| | `bool navigation_get_local_data(NavigationHandle, PlannerDataOutput *out)` | ~ | + +Trả plan, lưới costmap (hoặc bản update), cờ `is_costmap_updated`, và footprint. Hàm **tự giải phóng +nội dung cũ** của struct được truyền vào, nên tái sử dụng một struct qua nhiều lần poll là đúng cách +và không rò. Lần điền cuối cùng thì giải phóng bằng `navigation_free_planner_data`. + +Ba khác biệt so với bản cũ: + +1. **`plan` của `get_local_data` giờ có dữ liệu.** Bản cũ không bao giờ điền trường này cho local. +2. **`costmap` vẫn được điền đầy đủ** qua bộ xuất costmap — không rỗng. +3. **`footprint` đổi ý nghĩa.** Bản cũ: polygon **đã pad và đã transform tới pose robot**, `frame_id` + là global frame — vẽ thẳng lên bản đồ là đúng chỗ. Bản mới: polygon **thô** host đã set, chưa + transform, `frame_id` là `base_link`, và **rỗng nếu host chưa set footprint**. + +> Điểm 3 làm vỡ hiển thị footprint. Chỗ sửa đúng nằm ở `move_base2` (lấy footprint từ costmap thay vì +> từ bản thô) chứ không phải bắt C# tự transform. Xem `C_API_MOVE_BASE2_PLAN.md` mục 8.4. Cho tới khi +> sửa, C# muốn vẽ đúng thì phải tự xoay/tịnh tiến footprint theo pose lấy từ +> `navigation_get_robot_pose_2d` — chấp nhận lệch thời gian giữa hai lời gọi. + +### 6.11. Bộ nhớ + +| | Hàm | Đổi | +|---|---|---| +| | `void nav_c_api_free_string(char *)` | = | +| | `void order_free(Order *)` | = | +| | `void navigation_free_occupancy_grid(OccupancyGrid *)` | + | +| | `void navigation_free_laser_scan(LaserScan *)` | + | +| | `void navigation_free_point_cloud(PointCloud *)` | + | +| | `void navigation_free_point_cloud2(PointCloud2 *)` | + | +| | `void navigation_free_planner_data(PlannerDataOutput *)` | + | + +Trước đây chỉ có hai hàm đầu, nên grid/scan/cloud/plan **không có hàm giải phóng nào** — mỗi lời gọi +getter rò một lần. Năm hàm mới đóng lỗ đó. Tất cả đều an toàn với `NULL`, xoá luôn con trỏ và bộ đếm, +gọi hai lần không sao. + +Nguyên tắc: cấp phát ở trong thư viện thì **phải** giải phóng bằng hàm của thư viện. Đừng gọi `free()` +của libc từ C#. + +### 6.12. Tiện ích hình học + +| | Hàm | Đổi | +|---|---|---| +| | `bool navigation_offset_goal_2d(const Pose2D&, const char *frame_id, double d, PoseStamped &out)` | = | +| | `bool navigation_offset_goal_stamped(const PoseStamped&, double d, PoseStamped &out)` | = | + +Dịch một pose đi `d` mét dọc theo hướng của chính nó (âm là lùi). Thuần tính toán, không đụng lõi. +(Hai hàm này có export nhưng chưa được khai báo trong `nav_c_api.h`.) + +--- + +## 7. Quy tắc bộ nhớ — ai giải phóng cái gì + +| Nguồn | Giải phóng bằng | +|---|---| +| `NavFeedback.feed_back_str` | `nav_c_api_free_string` | +| `navigation_get_status_text` | `nav_c_api_free_string` | +| `navigation_state_to_string` | `nav_c_api_free_string` | +| `PoseStamped.header.frame_id`, `Twist2DStamped.header.frame_id` từ getter | `nav_c_api_free_string` | +| `OccupancyGrid` từ `navigation_get_static_map` | `navigation_free_occupancy_grid` | +| `LaserScan` từ `navigation_get_laser_scan` | `navigation_free_laser_scan` | +| `PointCloud` / `PointCloud2` từ getter | `navigation_free_point_cloud` / `_point_cloud2` | +| `PlannerDataOutput` từ `get_global_data` / `get_local_data` | `navigation_free_planner_data` | +| `Order` từ `convert2COrder` | `order_free` | +| Mảng truyền **vào** các hàm `add_*` / `move_to_*` | C# tự giữ; thư viện đã copy xong khi hàm trả về | + +--- + +## 8. Thread safety + +| Nhóm | Gọi được từ thread nào | +|---|---| +| `navigation_add_*` (mọi đường sensor) | **Một thread duy nhất.** Đường sensor không thread-safe. Nếu C# có nhiều nguồn chạy song song, dồn qua một hàng đợi rồi bơm từ một thread. | +| `navigation_set_robot_footprint` | Thread bất kỳ (ghi dưới mutex, áp ở cycle sau) | +| `pause` / `resume` / `cancel` / `set_twist_*` | Thread bất kỳ (ghi dưới mutex, áp ở cycle sau) | +| `move_to*` / `execute_instant_actions` | Thread bất kỳ | +| `get_feedback` / `get_state` / `get_twist` / `get_robot_pose_*` | Thread bất kỳ | +| `get_global_data` / `get_local_data` | Thread bất kỳ; mỗi consumer nên có **struct riêng**, không dùng chung một `PlannerDataOutput` giữa nhiều timer | +| `navigation_initialize*` / `navigation_shutdown` / `navigation_destroy` | Thread khởi tạo/thread tắt, **không** song song với nhóm sensor | + +--- + +## 9. Chẩn đoán nhanh + +| Hiện tượng | Nguyên nhân thường gặp | +|---|---| +| `navigation_create` trả `NULL` | Sai `PNKX_NAV_CORE_CONFIG_DIR`, thiếu khoá `MoveBase: library_path`, hoặc `libmove_base2.so` không nằm trong đường tìm | +| Tiến trình chết ngay trong `initialize` | Chưa bơm static map trước `initialize` — SBPL chờ costmap rồi `exit(1)` | +| `initialize_checked` trả `false` | Đọc `navigation_get_status_text` — chuỗi nói rõ pha nào hỏng | +| Gửi goal xong không có gì xảy ra, không log | Control thread chưa chạy: `initialize` đã hỏng nhưng code cũ không kiểm tra kết quả | +| Robot không tránh vật cản từ camera | Sai tên `topic` khi bơm, hoặc thiếu TF của optical frame, hoặc chưa dùng `navigation_add_depth_camera_data` | +| Vật cản ma không bao giờ biến mất | Chưa bơm `DepthCameraData` — point cloud không clear được theo frustum | +| Footprint vẽ sai chỗ trên bản đồ | Mục 6.10 điểm 3 | +| Bộ nhớ tăng dần | Thiếu `navigation_free_*` ở đường getter, hoặc thiếu `nav_c_api_free_string` cho `feed_back_str` | +| Tắt chương trình bị treo hoặc crash | Thiếu `navigation_shutdown`, hoặc còn thread bơm sensor chạy khi tắt | +| Đổi tham số planner mãi không có tác dụng | Sửa nhầm cây config — `move_base2` đọc `Test/move_base2/config/runtime`, không đọc `pnkx_nav_core/config` | + +--- + +## 10. Chưa xác nhận + +- Chưa đọc được mã C# hiện tại, nên chưa biết chỗ nào đang thật sự dựa vào các hành vi cũ ở mục 6.5, + 6.6 và 6.10. +- Trường `footprint` trong dữ liệu hiển thị: đã đối chiếu cả hai bản và khác biệt là chắc chắn, nhưng + chưa xác nhận phía C# có đang vẽ nó lên bản đồ hay không. +- Các hàm mới trong `nav_c_api_2` mới chỉ được kiểm tra biên dịch, **chưa chạy trên robot hay + Gazebo**. Đường depth camera cần kiểm tra thực tế bằng bộ đếm chẩn đoán của cổng sensor. +- Đường **instant action** (mục 11.8) mới thêm, chưa chạy thử trên robot: cần xác nhận `PickUp` gửi + dạng instantAction sinh ra đúng chuỗi chặng như khi nó nằm trong order, và `blockingType` bị hạ từ + `NONE` xuống xếp hàng có ghi log đúng không. +- Chặng `profile: go_straight` với khoảng cách âm (lùi) — đường thay thế cho + `navigation_move_straight_to` cũ — chưa được kiểm tra. + +--- + +## 11. Chi tiết 13 hàm mới + +Mục 6 mô tả toàn bộ bề mặt API theo nhóm. Mục này đi sâu vào **13 hàm chỉ có trong `nav_c_api_2.h`**: +mỗi hàm gồm chữ ký, nó làm gì, gọi lúc nào, các bẫy, và một đoạn C# dùng được ngay. + +Bảng khai báo `DllImport` cho cả 13 hàm nằm ở **Phụ lục B.2**. + +--- + +### 11.1. `navigation_initialize_checked` — khởi tạo và biết được kết quả thật + +```c +bool navigation_initialize_checked(NavigationHandle handle, TFListenerHandle tf3_buffer); +``` + +**Làm gì.** Gọi `navigation_initialize()` rồi **đọc lại cờ sẵn sàng của lõi** và trả về đúng kết quả +đó. Đây là toàn bộ giá trị nó thêm vào. + +**Vì sao cần.** Contract phía sau khai `void initialize(...)` — không có chỗ nào để báo lỗi. Khi lõi +`move_base2` hỏng ở bất kỳ pha nào (dựng costmap, cấu hình sensor, nạp plugin, cấu hình control loop, +khởi động control thread), nó đặt cờ `is_ready = false` kèm lý do rồi **return bình thường**. Hàm +`navigation_initialize()` vì thế luôn trả `true`. Host tưởng đã sẵn sàng, gửi goal vào một lõi không +có control thread, và goal nằm im vĩnh viễn — không cycle nào chạy, không state nào đổi, không log +gì. + +**Tham số.** + +| Tham số | Ý nghĩa | +|---|---| +| `handle` | Từ `navigation_create()` | +| `tf3_buffer` | `tf3::BufferCore` do host sở hữu; phải sống lâu hơn instance navigation | + +**Trả về.** `true` chỉ khi lõi thật sự sẵn sàng nhận goal. + +**Điều kiện trước khi gọi.** +1. Đã bơm ít nhất một static map (`navigation_add_static_map`) — **bắt buộc**, xem mục 3. +2. Đã đặt footprint nếu host muốn dùng footprint riêng thay vì của YAML. +3. TF đã bắt đầu chảy vào buffer. + +**Bẫy.** Hàm này **chặn** hàng giây: dựng hai costmap, nạp mọi plugin khai trong YAML, khởi động +thread cập nhật costmap, thread mission và control thread. Không gọi từ UI thread. + +```csharp +if (!navigation_initialize_checked(navHandle, tfHandle)) +{ + IntPtr reason = navigation_get_status_text(navHandle); + string text = Marshal.PtrToStringAnsi(reason) ?? "unknown"; + nav_c_api_free_string(reason); + throw new InvalidOperationException($"navigation core not ready: {text}"); +} +``` + +--- + +### 11.2. `navigation_is_ready` — hỏi lại bất cứ lúc nào + +```c +bool navigation_is_ready(NavigationHandle handle); +``` + +**Làm gì.** Trả `true` khi lõi đã initialize xong và đang nhận goal. + +**Khác gì `navigation_initialize_checked`.** Hàm kia trả lời **một lần**, ngay sau khi khởi tạo. Hàm +này hỏi được **bất cứ lúc nào** — dùng cho health check định kỳ, hoặc để chặn ở đầu mỗi lệnh gửi +goal. + +**Trả về.** `false` nếu handle null, lõi chưa initialize, hoặc initialize đã thất bại. + +**Bẫy.** Không cấp phát gì, poll thoải mái. Nhưng nó **không** cho biết lý do — muốn lý do thì dùng +`navigation_get_status_text`. + +```csharp +public bool CanAcceptGoal() => navHandle != IntPtr.Zero && navigation_is_ready(navHandle); +``` + +--- + +### 11.3. `navigation_shutdown` — dừng lõi có kiểm soát + +```c +void navigation_shutdown(NavigationHandle handle); +``` + +**Làm gì.** Dừng control thread, thread cập nhật costmap và các thread mission của lõi — +**không huỷ instance**. Sau lời gọi này lõi không phát lệnh vận tốc nữa, nhưng mọi getter +(`navigation_get_feedback`, `navigation_get_twist`, `navigation_get_robot_pose_*`) vẫn gọi được an +toàn. + +**Vì sao cần.** `navigation_destroy` chạy vào thời điểm GC/finalizer của .NET quyết định — có thể là +sau khi runtime đã tháo dỡ một phần, trong khi control thread vẫn đang chạm vào các thành viên đang +bị huỷ. Hàm này cho host một điểm dừng **chủ động**, ở giữa trình tự tắt của chính nó, khi tiến trình +còn sống đầy đủ. Host ROS làm đúng thế (`amr_control.cpp:178`). + +**Trả về.** Không có. Không ném exception ra ngoài biên C — lỗi được log rồi nuốt, vì ném exception +qua biên C trong lúc tiến trình đang tắt sẽ giết tiến trình. + +**Đặc tính.** Idempotent — gọi nhiều lần không sao. Thường trả về trong khoảng 1 giây. + +**Bẫy — quan trọng.** Không thread C# nào được gọi `navigation_add_*` trong hoặc sau lời gọi này. +Đường sensor không thread-safe, và sau shutdown cũng không còn control thread để tiêu thụ dữ liệu. +Dừng mọi thread bơm sensor **trước**, và đợi chúng thoát hẳn. + +```csharp +public void Dispose() +{ + sensorCts.Cancel(); // 1. dừng thread bơm sensor + Task.WaitAll(sensorTasks, TimeSpan.FromSeconds(2)); + navigation_shutdown(navHandle); // 2. quiesce lõi + navigation_destroy(navHandle); // 3. thả instance + tf3_buffer_destroy(tfHandle); // 4. buffer TF sau cùng +} +``` + +--- + +### 11.4. `navigation_get_state` — poll trạng thái không cấp phát + +```c +bool navigation_get_state(NavigationHandle handle, NavigationState *out_state); +``` + +**Làm gì.** Lấy đúng enum trạng thái hiện tại: `PENDING`, `ACTIVE`, `PLANNING`, `CONTROLLING`, +`SUCCEEDED`, `ABORTED`, `PAUSED`… + +**Vì sao cần.** `navigation_get_feedback` **`strdup` một chuỗi mỗi lần gọi**. Poll ở 10 Hz nghĩa là +10 lần cấp phát cộng 10 lần giải phóng mỗi giây, và **một lần quên `nav_c_api_free_string` là một lần +rò**. Vòng poll của UI hay của máy trạng thái chỉ cần enum — dùng hàm này. + +**Trả về.** `false` nếu handle null hoặc lõi chưa có feedback; `*out_state` không bị chạm khi thất +bại. + +**Bẫy.** Nhớ lớp che của mission layer: giữa hai chặng của một order nhiều node, lõi ở `SUCCEEDED` +hoặc `PENDING` nhưng API **cố ý báo `ACTIVE`**. Nhờ vậy suy "order xong" từ `SUCCEEDED` vẫn đúng — +đừng tìm cách đi vòng qua nó. + +```csharp +// Vòng poll trạng thái — không cấp phát, không cần free. +private void OnStatusTimer() +{ + if (!navigation_get_state(navHandle, out var state)) return; + + switch (state) + { + case NavigationState.SUCCEEDED: OnGoalReached(); break; + case NavigationState.ABORTED: + case NavigationState.REJECTED: OnGoalFailed(); break; + case NavigationState.PAUSED: OnPaused(); break; + } +} +``` + +--- + +### 11.5. `navigation_get_status_text` — lý do, để ghi log + +```c +char *navigation_get_status_text(NavigationHandle handle); +``` + +**Làm gì.** Trả chuỗi mô tả của lõi: đang làm gì, hoặc vì sao vừa từ chối. Cùng nội dung với +`NavFeedback.feed_back_str` nhưng lấy riêng, không phải dựng cả struct. + +**Khi nào gọi.** Khi có **sự kiện**: initialize thất bại, goal bị từ chối, state chuyển sang +`ABORTED`. Không gọi trong vòng poll — đó là việc của `navigation_get_state`. + +**Trả về.** Chuỗi mới cấp phát, hoặc `NULL` nếu lõi không có gì để nói. **Phải giải phóng bằng +`nav_c_api_free_string`.** + +**Bẫy.** Nội dung chuỗi do lõi đặt và **thay đổi giữa các bản** — chỉ để log và hiển thị. +**Không bao giờ rẽ nhánh theo nó.** Rẽ nhánh thì dùng `navigation_get_state`. + +```csharp +private string ReadStatusText() +{ + IntPtr ptr = navigation_get_status_text(navHandle); + if (ptr == IntPtr.Zero) return string.Empty; + try { return Marshal.PtrToStringAnsi(ptr) ?? string.Empty; } + finally { nav_c_api_free_string(ptr); } +} +``` + +--- + +### 11.6. `navigation_add_depth_camera_data` — đường duy nhất tới clear theo frustum + +```c +bool navigation_add_depth_camera_data(NavigationHandle handle, const char *topic, + const DepthCameraData data); +``` + +**Làm gì.** Đẩy **một mẫu depth camera nhất quán** — ảnh depth cộng intrinsics khớp đúng ảnh đó — vào +lõi. + +**Vì sao cần.** `VoxelLayer` chiếu từng pixel depth qua intrinsics để dựng **frustum** của camera, và +frustum là thứ cho phép nó **xoá** vật cản ma nằm trong tầm nhìn. Point cloud **không thay thế được**: +nó không mang intrinsics, nên không dựng lại được frustum và không xoá được gì. Đây là năng lực chưa +bao giờ dùng được từ C# — không phải bù cho thứ bị mất. + +**Tham số.** + +| Tham số | Yêu cầu | +|---|---| +| `topic` | Phải **trùng đúng** giá trị `topic` của một observation source khai `data_type: DepthCameraData` trong `costmap_common_params.yaml` (hiện là `/camera/depth/data` và `/camera_right/depth/data`). Sai tên thì mẫu được nhận rồi bị bỏ im lặng ở tầng layer | +| `data.header.frame_id` | **Optical frame** của camera, và TF từ frame đó tới base frame phải có trong buffer tf3 tại đúng `header.stamp` | +| `data.depth.encoding` | Đúng thật: `"16UC1"` hoặc `"32FC1"` | +| `data.depth.step` | Số **byte** mỗi hàng, không phải số pixel | +| `data.camera_info.K/P` | Intrinsics của **đúng độ phân giải đang gửi**, không phải của stream màu | +| `stamp` | Ảnh depth và camera info phải cùng một thời điểm | + +**Trả về.** `true` nếu mẫu được nhận. Dữ liệu được **copy** ngay trong lời gọi — buffer C# giải phóng +được ngay sau khi hàm trả về. + +**Bẫy.** Bơm đúng tần số camera thật (thường 10–15 Hz). Đây là đường tốn CPU nhất trong các đường +sensor; bơm nhanh hơn nguồn chỉ đốt CPU. Ghép lệch hai luồng depth và camera_info là **clear sai +vùng** — nguy hiểm hơn không clear. + +Ví dụ đầy đủ có ghim mảng: **Phụ lục B.3**. + +--- + +### 11.7. `navigation_move_to_order_v2` — order có định danh thật + +```c +bool navigation_move_to_order_v2(NavigationHandle handle, + const char *order_id, uint32_t order_update_id, + const Node *nodes, size_t node_count, + const Edge *edges, size_t edge_count, + const PoseStamped goal); +``` + +**Làm gì.** Gửi một order nhiều node kèm `orderId` và `orderUpdateId` thật. + +**Vì sao cần.** Trong `move_base2`, order đi qua mission layer — nơi nó được cắt thành từng chặng tại +các node có action, lọc theo cờ `released`, và nối tiếp được khi fleet master release thêm horizon. +Cặp `orderId` + `orderUpdateId` chính là **định danh của order** ở tầng đó. + +`navigation_move_to_nodes_edges` không có chỗ nào để đặt hai trường ấy, nên **mọi lời gọi đều trông +như một order khác nhau** và không bao giờ gửi được order update. + +**Quy ước.** + +| Tình huống | Cách gửi | +|---|---| +| Order mới, thay thế hoàn toàn cái đang chạy | `order_id` khác | +| Cập nhật tuyến đang chạy / release thêm horizon | **cùng** `order_id`, `order_update_id` tăng dần | + +**Trả về.** `true` nếu order được nhận. `order_id` rỗng hoặc `NULL` bị từ chối ngay; quaternion của +`goal` không hợp lệ cũng bị từ chối. + +**Bẫy.** Mảng `nodes`/`edges` vẫn thuộc quyền sở hữu của C# — thư viện copy xong trước khi trả về. +Nếu order chỉ gửi một lần rồi chạy tới hết thì `navigation_move_to_nodes_edges` là đủ; chỉ cần bản +`_v2` khi có order update. + +```csharp +// Order mới +navigation_move_to_order_v2(navHandle, "order-4711", 0, nodes, (UIntPtr)nodes.Length, + edges, (UIntPtr)edges.Length, goal); + +// Fleet master release thêm horizon cho CHÍNH order đó +navigation_move_to_order_v2(navHandle, "order-4711", 1, nodesExtended, + (UIntPtr)nodesExtended.Length, edgesExtended, + (UIntPtr)edgesExtended.Length, goal); +``` + +--- + +### 11.8. `navigation_execute_instant_actions` — chạy một message `instantActions` + +```c +bool navigation_execute_instant_actions(NavigationHandle handle, const Action *actions, + size_t count); +``` + +**Làm gì.** Chạy **trọn một message `instantActions` của VDA5050 — cả danh sách, như một lô**. Mỗi +action được khai triển qua **đúng bảng compound action mà node action dùng**, nên `PickUp` gửi dạng +instantAction sinh ra đúng chuỗi detect / tiến vào / nâng / lùi ra như khi nó nằm trong order. Một bộ +từ vựng, một bộ handler, một ý nghĩa cho mỗi `actionType` bất kể nó đến bằng đường nào. + +**Vì sao cần.** Đây là hàm thay thế cho `navigation_dock_to*`, `navigation_move_straight_to` và +`navigation_rotate_to` đã bị xoá. Ba hàm cũ đi thẳng xuống lõi, cướp quyền của order đang chạy mà +mission layer không biết. Đường mới đi qua mission layer nên dùng chung hàng đợi, chung đường huỷ, +chung đường báo kết quả. + +**Tham số.** + +| Tham số | Ý nghĩa | +|---|---| +| `actions` | Mảng action **theo đúng thứ tự nhận được**. Host giữ quyền sở hữu; thư viện copy trước khi trả về | +| `count` | Số action. Phải `> 0` | + +**Trả về.** `true` nếu message được nhận. `false` nghĩa là **bị từ chối thẳng** — báo failed ngay, +đừng chờ một kết quả sẽ không bao giờ tới. + +**Bẫy 1 — gửi cả lô, đừng gọi từng action.** Một action `HARD` gửi riêng sẽ preempt và xoá sạch các +chặng của action trước. Hai action trong cùng một message mà gọi hai lần thì chúng ăn nhau. Truyền cả +mảng trong một lời gọi. + +**Bẫy 2 — `blockingType` quyết định cách lô gặp order đang chạy.** + +| `blockingType` | Hành vi | +|---|---| +| `HARD` (bất kỳ action nào trong lô) | Cả message **preempt** order đang chạy | +| `SOFT` | Xếp hàng sau order | +| `NONE` | Yêu cầu chạy **song song** với việc di chuyển — runtime này **không làm được**, nên nó bị xếp hàng và việc thu hẹp đó được ghi log | +| không khai / không hiểu | Coi như `HARD` — hướng an toàn | + +**Bẫy 3 — không route ba action điều khiển hàng đợi qua đây.** `cancelOrder`, `startPause`, +`stopPause` là lệnh **lái hàng đợi**, không phải việc nằm trong hàng đợi. Gọi +`navigation_cancel()`, `navigation_pause()`, `navigation_resume()`. + +**Bẫy 4 — dừng ở chặng lỗi đầu tiên.** Message dừng tại chặng đầu tiên thất bại và phần còn lại bị bỏ +theo. Host báo **một** kết quả cho cả message — đúng bằng những gì VDA5050 yêu cầu. + +**Theo dõi tiến độ.** Không có báo cáo theo từng action; dùng trạng thái chung: + +| `navigation_get_state` | Báo về fleet | +|---|---| +| `ACTIVE` / `CONTROLLING` | `RUNNING` | +| `SUCCEEDED` | `FINISHED` | +| `ABORTED` / `PREEMPTED` | `FAILED` | + +Ánh xạ này chỉ **không nhập nhằng khi message đang là việc duy nhất trong hàng đợi** — đúng chừng nào +fleet master gửi mỗi lần một message và không gửi trong lúc order đang chạy. + +```csharp +[DllImport(Lib, CallingConvention = Cdecl)] [return: MarshalAs(UnmanagedType.I1)] +public static extern bool navigation_execute_instant_actions( + IntPtr handle, [In] Action[] actions, UIntPtr count); + +// Nhận nguyên message instantActions từ MQTT rồi đẩy CẢ LÔ xuống một lần. +public bool RunInstantActions(IReadOnlyList incoming) +{ + var actions = new Action[incoming.Count]; + var pinned = new List(); + try + { + for (int i = 0; i < incoming.Count; i++) + actions[i] = BuildNativeAction(incoming[i], pinned); // strdup các chuỗi + + if (!navigation_execute_instant_actions(navHandle, actions, (UIntPtr)actions.Length)) + { + ReportFailed(incoming, "rejected by navigation core"); + return false; + } + return true; // theo dõi tiếp bằng navigation_get_state + } + finally + { + foreach (var p in pinned) Marshal.FreeHGlobal(p); + } +} +``` + +`Action` là struct C đã có sẵn (`protocol_msgs/Action.h`): `actionType`, `actionId`, +`actionDescription`, `blockingType`, `actionParameters` + `actionParameters_count`. Không có struct +mới nào cần khai thêm cho hàm này. + +--- + +### 11.9 – 11.13. Năm hàm `navigation_free_*` — trả lại bộ nhớ getter đã cấp + +```c +void navigation_free_occupancy_grid(OccupancyGrid *grid); +void navigation_free_laser_scan(LaserScan *scan); +void navigation_free_point_cloud(PointCloud *cloud); +void navigation_free_point_cloud2(PointCloud2 *cloud); +void navigation_free_planner_data(PlannerDataOutput *data); +``` + +**Vấn đề chúng giải quyết.** Mọi `navigation_get_*` trả về grid/scan/cloud/plan đều `malloc` và +`strdup` **bên trong thư viện** rồi giao con trỏ thô cho C#. Trước đây thư viện chỉ export hai hàm +giải phóng — `nav_c_api_free_string` và `order_free` — nên phần còn lại **không có đường trả**, và +mỗi lời gọi getter rò một lần. + +Độ lớn thực tế: bản đồ 50 × 50 m ở `resolution: 0.05` là 1000 × 1000 ô = **1 MB mỗi lần điền**. Một +timer poll 1 Hz mà không trả là 1 MB/s, tức 3,6 GB sau một giờ. + +**Cặp với getter nào, giải phóng chính xác cái gì.** + +| Hàm | Cặp với | Giải phóng | +|---|---|---| +| `navigation_free_occupancy_grid` | `navigation_get_static_map` | `header.frame_id` + mảng `data` | +| `navigation_free_laser_scan` | `navigation_get_laser_scan` | `header.frame_id` + `ranges` + `intensities` | +| `navigation_free_point_cloud` | `navigation_get_point_cloud` | `header.frame_id`, `points`, **và từng channel**: mỗi channel có `name` và mảng `values` riêng | +| `navigation_free_point_cloud2` | `navigation_get_point_cloud2` | `header.frame_id`, `data`, **và `name` của từng `PointField`** | +| `navigation_free_planner_data` | `navigation_get_global_data` / `_local_data` | `plan` (**mỗi pose có `frame_id` riêng**), lưới `costmap`, `costmap_update`, `footprint` | + +**Ba chỗ lồng nhau là lý do phải có hàm riêng.** Nếu C# tự gọi `free()` của libc thì gần như chắc +chắn chỉ giải phóng được mảng ngoài cùng: + +- `PointCloud.channels` — free mảng `channels` thôi là rò hai lớp: `name` và `values` của **từng** + channel. +- `PointCloud2.fields` — mỗi `PointField` mang một `name` riêng. +- `PlannerDataOutput.plan.poses` — **mỗi pose một `frame_id`**; một plan 500 điểm là 500 chuỗi. + +**Đặc tính chung.** Cả năm hàm an toàn với `NULL`, xoá luôn con trỏ và bộ đếm sau khi giải phóng, và +gọi hai lần không sao. + +**Hai mẫu dùng khác nhau.** + +`PlannerDataOutput` — **tái dùng một struct, không free mỗi vòng.** Hai getter tự giải phóng nội dung +cũ trước khi điền mới, nên poll bao nhiêu lần cũng không rò; chỉ lần điền **cuối cùng** mới cần free +tay: + +```csharp +private PlannerDataOutput globalData; // giữ lại giữa các lần poll + +void OnTimer() +{ + if (navigation_get_global_data(navHandle, ref globalData)) + Draw(globalData); +} + +void StopTimer() +{ + timer.Stop(); + navigation_free_planner_data(ref globalData); +} +``` + +Các getter còn lại — **free ngay sau khi dùng xong:** + +```csharp +var grid = new OccupancyGrid(); +if (navigation_get_static_map(navHandle, "/map", ref grid)) +{ + try { Use(grid); } + finally { navigation_free_occupancy_grid(ref grid); } +} +``` + +**Bẫy.** Mỗi consumer phải có `PlannerDataOutput` **riêng**. Dùng chung một struct giữa nhiều timer +là hai thread cùng ghi vào một chỗ — đúng nhóm lỗi đã từng gây hỏng heap. + +**Nguyên tắc.** Cấp phát trong `.so` thì trả bằng hàm của `.so`. Đừng gọi `free()` của libc từ C#: +vừa không đi hết các tầng lồng nhau, vừa không đảm bảo cùng một C runtime. + +--- + +## Phụ lục A — bảng symbol đầy đủ trong `libnav_c_api.so` + +Lấy bằng `nm --defined-only` trên các object file. Cột "Nguồn" cho biết symbol nằm trong file nguồn +nào — chỉ để tra cứu, C# không cần biết: mọi symbol đều nằm chung một `.so`. + +**Tổng: 62 symbol** = 45 cũ + 4 trợ giúp + 13 mới. Lấy bằng +`nm -D --defined-only build/libnav_c_api.so | grep " T "`. + +### 45 symbol cũ — `nav_c_api.cpp`, C# **không đổi gì** + +``` +nav_c_api_free_string navigation_get_robot_pose_stamped +navigation_add_laser_scan navigation_get_static_map +navigation_add_odometry navigation_get_twist +navigation_add_point_cloud navigation_initialize +navigation_add_point_cloud2 navigation_move_to +navigation_add_static_map navigation_move_to_nodes_edges +navigation_cancel navigation_move_to_order +navigation_create navigation_offset_goal_2d +navigation_destroy navigation_offset_goal_stamped +navigation_get_all_laser_scans navigation_pause +navigation_get_all_point_cloud2s navigation_remove_all_data +navigation_get_all_point_clouds navigation_remove_all_laser_scans +navigation_get_all_static_maps navigation_remove_all_point_cloud2s +navigation_get_feedback navigation_remove_all_point_clouds +navigation_get_global_data navigation_remove_all_static_maps +navigation_get_laser_scan navigation_remove_laser_scan +navigation_get_local_data navigation_remove_point_cloud +navigation_get_point_cloud navigation_remove_point_cloud2 +navigation_get_point_cloud2 navigation_remove_static_map +navigation_get_robot_footprint navigation_resume +navigation_get_robot_pose_2d navigation_set_robot_footprint +navigation_set_twist_angular navigation_set_twist_linear +navigation_state_to_string +``` + +### 5 symbol ĐÃ BỊ XOÁ — C# phải gỡ khai báo + +``` +navigation_dock_to +navigation_dock_to_order +navigation_dock_to_nodes_edges +navigation_move_straight_to +navigation_rotate_to +``` + +Không còn trong `.so`. Khai báo P/Invoke còn sót lại sẽ ném `EntryPointNotFoundException` ở lời gọi +đầu tiên. Năng lực thay thế: `profile` + `marker` trong `compound_actions_params.yaml`, gửi qua +`navigation_move_to_order_v2` hoặc `navigation_execute_instant_actions` — xem mục 6.4. + +Cộng bốn symbol nữa, không nằm trong `nav_c_api.cpp`: + +``` +order_free ← convertor.cpp +header_create ← std_msgs/Header.cpp +header_set_data ← std_msgs/Header.cpp +time_create ← std_msgs/Time.cpp +``` + +`header_create(frame_id)` đóng dấu thời gian hiện tại vào một `Header` mới; `header_set_data` dựng +`Header` từ giá trị cho sẵn; `time_create()` trả thời điểm hiện tại. Cả ba `strdup`/cấp phát +`frame_id`, nên giải phóng bằng `nav_c_api_free_string`. Truyền `frame_id = NULL` là hợp lệ (trả về +`frame_id` NULL). + +### 13 symbol mới — `nav_c_api_2.cpp` + +``` +navigation_initialize_checked navigation_add_depth_camera_data +navigation_is_ready navigation_move_to_order_v2 +navigation_shutdown navigation_execute_instant_actions +navigation_get_state navigation_free_occupancy_grid +navigation_get_status_text navigation_free_laser_scan +navigation_free_point_cloud navigation_free_point_cloud2 +navigation_free_planner_data +``` + +`navigation_dock_to_order_v2` từng nằm trong danh sách này nhưng **đã bị xoá cùng nhóm docking**; +`navigation_execute_instant_actions` là hàm thay thế. + +--- + +## Phụ lục B — phần C# phải thêm + +Đây là **toàn bộ** phần khai báo mới. Mọi thứ khác trong lớp binding hiện tại giữ nguyên. + +### B.1. Bốn struct mới + +Ba struct đầu chưa từng xuất hiện trong bề mặt cũ vì đường depth camera chưa bao giờ được phơi ra. + +```csharp +[StructLayout(LayoutKind.Sequential)] +public struct RegionOfInterest +{ + public uint x_offset; + public uint y_offset; + public uint height; + public uint width; + [MarshalAs(UnmanagedType.I1)] public bool do_rectify; +} + +[StructLayout(LayoutKind.Sequential)] +public struct Image +{ + public Header header; + public uint height; + public uint width; + public IntPtr encoding; // char* — "16UC1" hoặc "32FC1" + public byte is_bigendian; + public uint step; // số byte mỗi hàng + public IntPtr data; // uint8_t* + public UIntPtr data_count; +} + +[StructLayout(LayoutKind.Sequential)] +public struct CameraInfo +{ + public Header header; + public uint height; + public uint width; + public IntPtr distortion_model; // char* + public IntPtr D; // double* + public UIntPtr D_count; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public double[] K; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public double[] R; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public double[] P; + public uint binning_x; + public uint binning_y; + public RegionOfInterest roi; +} + +[StructLayout(LayoutKind.Sequential)] +public struct DepthCameraData +{ + public Header header; // stamp + optical frame của mẫu + public Image depth; + public CameraInfo camera_info; // intrinsics của ĐÚNG ảnh trên +} +``` + +### B.1b. Enum `NavigationState` — giá trị phải khớp đúng thứ tự + +C không đánh số tường minh cho enum này, nên **thứ tự khai báo là hợp đồng**. Lệch một vị trí là báo +sai trạng thái về fleet mà không có lỗi nào. + +```csharp +public enum NavigationState +{ + PENDING = 0, + ACTIVE = 1, + PREEMPTED = 2, + SUCCEEDED = 3, + ABORTED = 4, + REJECTED = 5, + PREEMPTING = 6, + RECALLING = 7, + RECALLED = 8, + LOST = 9, + PLANNING = 10, + CONTROLLING = 11, + CLEARING = 12, + PAUSED = 13, +} +``` + +Nguồn: `nav_c_api.h`, khớp `robot::move_base_core::State` trong `move_base_core/navigation.h`. Ánh xạ +sang `actionStatus` của VDA5050 ở mục 13.3. + +### B.1c. Các struct còn lại — tra ở đâu + +Phụ lục B.1 chỉ liệt kê **4 struct mới**. Nếu bạn ghép từ đầu thì cần đủ bộ; tất cả đều là +`[StructLayout(LayoutKind.Sequential)]`, dịch 1-1 theo header C tương ứng: + +| Nhóm | Struct | Header C | +|---|---|---| +| Cơ bản | `Header`, `Time` | `std_msgs/Header.h`, `std_msgs/Time.h` | +| Hình học | `Point`, `Point32`, `Quaternion`, `Pose`, `Pose2D`, `PoseStamped`, `Vector3`, `Polygon`, `PolygonStamped` | `geometry_msgs/*.h` | +| Bản đồ | `OccupancyGrid`, `MapMetaData`, `OccupancyGridUpdate` | `nav_msgs/OccupancyGrid.h`, `map_msgs/OccupancyGridUpdate.h` | +| Sensor | `LaserScan`, `PointCloud`, `PointCloud2`, `PointField`, `ChannelFloat32`, `Odometry` | `sensor_msgs/*.h`, `nav_msgs/Odometry.h` | +| Nav 2D | `Twist2D`, `Twist2DStamped`, `Pose2DStamped`, `Path2D` | `nav_2d_msgs/*.h` | +| VDA5050 | `Order`, `Node`, `Edge`, `Action`, `ActionParameter`, `NodePosition`, `Trajectory`, `ControlPoint` | `protocol_msgs/*.h` | +| API | `NavFeedback`, `PlannerDataOutput`, `NamedOccupancyGrid`, `NamedLaserScan`, `NamedPointCloud`, `NamedPointCloud2` | `nav_c_api.h` | + +Bốn quy tắc dịch, đúng cho mọi struct trong bảng: + +1. `char*` → `IntPtr`. **Không** dùng `string` cho field trong struct: marshaller sẽ cấp phát và giải + phóng theo cách khác với thư viện. Đọc bằng `Marshal.PtrToStringAnsi`, giải phóng bằng + `nav_c_api_free_string` khi field đó do thư viện cấp. +2. `size_t` → `UIntPtr` (8 byte trên Linux x64). Cặp `T* ptr` + `size_t count` luôn đi liền nhau. +3. `bool` C++ là **1 byte** → `[MarshalAs(UnmanagedType.I1)]`, cả ở field lẫn ở giá trị trả về. Dùng + `UnmanagedType.Bool` (4 byte) là đọc rác ở 3 byte cao. +4. Mảng cố định (`double K[9]`, `R[9]`, `P[12]`, `covariance[36]`) → + `[MarshalAs(UnmanagedType.ByValArray, SizeConst = N)]`. + +### B.2. Mười ba `DllImport` mới + +```csharp +private const string Lib = "nav_c_api"; +private const CallingConvention Cdecl = CallingConvention.Cdecl; + +// ---- vòng đời --------------------------------------------------------------------------- +[DllImport(Lib, CallingConvention = Cdecl)] [return: MarshalAs(UnmanagedType.I1)] +public static extern bool navigation_initialize_checked(IntPtr handle, IntPtr tf3Buffer); + +[DllImport(Lib, CallingConvention = Cdecl)] [return: MarshalAs(UnmanagedType.I1)] +public static extern bool navigation_is_ready(IntPtr handle); + +[DllImport(Lib, CallingConvention = Cdecl)] +public static extern void navigation_shutdown(IntPtr handle); + +// ---- trạng thái ------------------------------------------------------------------------- +[DllImport(Lib, CallingConvention = Cdecl)] [return: MarshalAs(UnmanagedType.I1)] +public static extern bool navigation_get_state(IntPtr handle, out NavigationState state); + +[DllImport(Lib, CallingConvention = Cdecl)] +public static extern IntPtr navigation_get_status_text(IntPtr handle); // free: nav_c_api_free_string + +// ---- sensor ----------------------------------------------------------------------------- +[DllImport(Lib, CallingConvention = Cdecl)] [return: MarshalAs(UnmanagedType.I1)] +public static extern bool navigation_add_depth_camera_data( + IntPtr handle, [MarshalAs(UnmanagedType.LPStr)] string topic, DepthCameraData data); + +// ---- order ------------------------------------------------------------------------------ +[DllImport(Lib, CallingConvention = Cdecl)] [return: MarshalAs(UnmanagedType.I1)] +public static extern bool navigation_move_to_order_v2( + IntPtr handle, + [MarshalAs(UnmanagedType.LPStr)] string orderId, uint orderUpdateId, + [In] Node[] nodes, UIntPtr nodeCount, + [In] Edge[] edges, UIntPtr edgeCount, + PoseStamped goal); + +// ---- instant actions -------------------------------------------------------------------- +[DllImport(Lib, CallingConvention = Cdecl)] [return: MarshalAs(UnmanagedType.I1)] +public static extern bool navigation_execute_instant_actions( + IntPtr handle, [In] Action[] actions, UIntPtr count); + +// ---- giải phóng bộ nhớ ------------------------------------------------------------------ +[DllImport(Lib, CallingConvention = Cdecl)] +public static extern void navigation_free_occupancy_grid(ref OccupancyGrid grid); + +[DllImport(Lib, CallingConvention = Cdecl)] +public static extern void navigation_free_laser_scan(ref LaserScan scan); + +[DllImport(Lib, CallingConvention = Cdecl)] +public static extern void navigation_free_point_cloud(ref PointCloud cloud); + +[DllImport(Lib, CallingConvention = Cdecl)] +public static extern void navigation_free_point_cloud2(ref PointCloud2 cloud); + +[DllImport(Lib, CallingConvention = Cdecl)] +public static extern void navigation_free_planner_data(ref PlannerDataOutput data); +``` + +### B.3. Ví dụ bơm một mẫu depth camera + +Ảnh depth thường vài MB. Ghim mảng lại thay vì để bộ marshaller sao chép thêm một lần — thư viện đã +copy sang phía C++ ngay trong lời gọi, nên gỡ ghim ngay sau khi trả về là an toàn. + +```csharp +public bool PushDepthSample(string topic, string opticalFrame, + uint sec, uint nsec, + byte[] depthBytes, uint height, uint width, uint step, + double[] k, double[] p) +{ + var frameId = Marshal.StringToHGlobalAnsi(opticalFrame); + var encoding = Marshal.StringToHGlobalAnsi("16UC1"); + var distModel = Marshal.StringToHGlobalAnsi("plumb_bob"); + var pinned = GCHandle.Alloc(depthBytes, GCHandleType.Pinned); + try + { + var header = new Header { seq = 0, sec = sec, nsec = nsec, frame_id = frameId }; + + var data = new DepthCameraData + { + header = header, + depth = new Image + { + header = header, + height = height, + width = width, + encoding = encoding, + is_bigendian = 0, + step = step, + data = pinned.AddrOfPinnedObject(), + data_count = (UIntPtr)depthBytes.Length, + }, + camera_info = new CameraInfo + { + header = header, + height = height, + width = width, + distortion_model = distModel, + D = IntPtr.Zero, + D_count = UIntPtr.Zero, + K = k, // 9 phần tử + R = new double[9], + P = p, // 12 phần tử + binning_x = 0, + binning_y = 0, + roi = default, + }, + }; + + return navigation_add_depth_camera_data(navHandle, topic, data); + } + finally + { + pinned.Free(); + Marshal.FreeHGlobal(distModel); + Marshal.FreeHGlobal(encoding); + Marshal.FreeHGlobal(frameId); + } +} +``` + +### B.4. Ví dụ đọc dữ liệu hiển thị mà không rò bộ nhớ + +```csharp +// MỘT struct cho MỖI consumer, giữ lại giữa các lần poll: hàm tự giải phóng nội dung cũ. +// Đừng dùng chung một struct giữa nhiều timer. +private PlannerDataOutput globalData; + +private void OnGlobalTimer() +{ + if (!navigation_get_global_data(navHandle, ref globalData)) + return; + + DrawPlan(globalData.plan); + DrawCostmap(globalData.costmap, globalData.is_costmap_updated, globalData.costmap_update); +} + +// Khi dừng consumer — nếu không, lần điền cuối cùng sẽ rò. +private void StopGlobalTimer() +{ + timer.Stop(); + navigation_free_planner_data(ref globalData); +} +``` + +--- + +## 12. Ghép vào khung C# — kiến trúc host + +Mục này mô tả **hình dạng** của phần C# bọc quanh API, độc lập với bất kỳ repo cụ thể nào. Ba mục +6, 11 và Phụ lục B nói *hàm nào làm gì*; mục này nói *xếp chúng vào đâu*. + +### 12.1. Bốn tầng, không hơn + +``` +┌──────────────────────────────────────────────────────────────┐ +│ Tầng nghiệp vụ (MQTT/VDA5050, HMI, fleet) │ +│ dịch order & instantActions ──► mục 13 │ +├──────────────────────────────────────────────────────────────┤ +│ NavigationHost — vòng đời + hàng đợi lệnh + poll trạng thái │ +│ sở hữu handle, sở hữu thread, là nơi DUY NHẤT gọi add_* │ +├──────────────────────────────────────────────────────────────┤ +│ Lớp binding — struct [StructLayout] + DllImport │ +│ dịch thuần, không logic ──► Phụ lục B │ +├──────────────────────────────────────────────────────────────┤ +│ libnav_c_api.so → libmove_base2.so → planner/costmap │ +└──────────────────────────────────────────────────────────────┘ +``` + +Ranh giới quan trọng nhất là giữa tầng 2 và 3: **lớp binding không được có logic**. Mọi quyết định +(thứ tự khởi tạo, ai gọi từ thread nào, khi nào free) thuộc `NavigationHost`. Trộn hai tầng là cách +nhanh nhất để có một lời gọi `navigation_add_*` chạy từ thread lạ. + +### 12.2. Mô hình thread + +Đường sensor của lõi **không thread-safe**. Quy tắc: + +| Nhóm | Thread | +|---|---| +| `navigation_add_*` (map, laser, cloud, depth, odometry) | **Một thread duy nhất.** Nhiều nguồn thì dồn qua một hàng đợi rồi bơm từ một thread | +| `navigation_create` / `_initialize_checked` / `_shutdown` / `_destroy` | Thread khởi tạo/tắt, **không** song song với nhóm trên | +| `move_to*`, `execute_instant_actions`, `pause`/`resume`/`cancel`, `set_twist_*`, `set_robot_footprint` | Thread bất kỳ | +| `get_state`, `get_feedback`, `get_twist`, `get_robot_pose_*` | Thread bất kỳ | +| `get_global_data` / `_local_data` | Thread bất kỳ, nhưng **mỗi consumer một struct riêng** | + +Tối thiểu ba thread ở phía C#: **sensor pump** (một), **state poll** (một), và thread nghiệp vụ gọi +lệnh. Đừng gộp sensor pump vào timer UI — một lần UI đứng là một lần costmap đói dữ liệu. + +### 12.3. Khung `NavigationHost` + +```csharp +public sealed class NavigationHost : IAsyncDisposable +{ + private IntPtr _nav; + private IntPtr _tf; + private CancellationTokenSource? _cts; + private Task? _sensorPump; + private Task? _statePoll; + + // ── Khởi tạo — thứ tự BẮT BUỘC, xem mục 3 ──────────────────────────────────────────── + public async Task StartAsync(NavConfig cfg, CancellationToken ct) + { + _tf = TF3.tf3_buffer_create(10); + StartTfPump(); // 1. TF chảy TRƯỚC mọi thứ khác + + _nav = navigation_create(); // 2. nạp libmove_base2.so theo YAML + if (_nav == IntPtr.Zero) + throw new InvalidOperationException( + "navigation_create failed — kiểm tra PNKX_NAV_CORE_CONFIG_DIR và library_path"); + + navigation_set_robot_footprint(_nav, cfg.Footprint, (UIntPtr)cfg.Footprint.Length); // 3. + + var map = await WaitForMapAsync(ct); // 4. BẮT BUỘC trước initialize + navigation_add_static_map(_nav, "/map", map); + + // 5. Nặng và chặn hàng giây — chạy nền, không gọi từ UI thread. + bool ready = await Task.Run(() => navigation_initialize_checked(_nav, _tf), ct); + if (!ready) + throw new InvalidOperationException($"navigation core not ready: {ReadStatusText()}"); + + _cts = CancellationTokenSource.CreateLinkedTokenSource(ct); + _sensorPump = Task.Run(() => SensorPumpLoop(_cts.Token), _cts.Token); // 6. + _statePoll = Task.Run(() => StatePollLoop(_cts.Token), _cts.Token); + } + + // ── Bơm sensor — MỘT thread cho tất cả, xem mục 4 ──────────────────────────────────── + private async Task SensorPumpLoop(CancellationToken ct) + { + await foreach (var sample in _sensorQueue.ReadAllAsync(ct)) + { + switch (sample) + { + case LaserSample s: navigation_add_laser_scan(_nav, s.Topic, s.Scan); break; + case CloudSample c: navigation_add_point_cloud2(_nav, c.Topic, c.Cloud); break; + case DepthSample d: navigation_add_depth_camera_data(_nav, d.Topic, d.Data); break; + case OdomSample o: navigation_add_odometry(_nav, "odom", o.Odom); break; + case MapSample m: navigation_add_static_map(_nav, "/map", m.Grid); break; + } + } + } + + // ── Poll trạng thái — dùng get_state, KHÔNG dùng get_feedback ──────────────────────── + private async Task StatePollLoop(CancellationToken ct) + { + var last = NavigationState.PENDING; + while (!ct.IsCancellationRequested) + { + if (navigation_get_state(_nav, out var now) && now != last) + { + OnStateChanged(last, now); // đổi state mới đọc status text + last = now; + } + await Task.Delay(100, ct); + } + } + + // ── Tắt — thứ tự BẮT BUỘC, xem mục 5 ──────────────────────────────────────────────── + public async ValueTask DisposeAsync() + { + _cts?.Cancel(); // 1. dừng mọi thread gọi add_* + if (_sensorPump is not null) await _sensorPump.ConfigureAwait(false); + if (_statePoll is not null) await _statePoll.ConfigureAwait(false); + + if (_nav != IntPtr.Zero) + { + navigation_shutdown(_nav); // 2. quiesce, ~1 s + navigation_destroy(_nav); // 3. thả instance + _nav = IntPtr.Zero; + } + if (_tf != IntPtr.Zero) + { + TF3.tf3_buffer_destroy(_tf); // 4. buffer TF sau cùng + _tf = IntPtr.Zero; + } + } +} +``` + +### 12.4. Năm quy tắc rút gọn + +1. **Handle là tài nguyên có chủ.** Một `NavigationHost` sở hữu một handle; không truyền `IntPtr` ra + ngoài lớp đó. +2. **Không bao giờ để `navigation_destroy` rơi vào finalizer/GC.** Luôn đi qua `DisposeAsync` với + `navigation_shutdown` đứng trước. +3. **`get_state` cho vòng poll, `get_feedback`/`get_status_text` cho sự kiện.** Hai hàm sau cấp phát + chuỗi, quên free là rò. +4. **Rẽ nhánh theo enum, không theo chuỗi.** Nội dung `feed_back_str` đổi giữa các bản. +5. **Mọi getter cấp bộ nhớ đều có hàm `navigation_free_*` đi kèm** — xem mục 7. + +--- + +## 12b. TF — thư viện thứ hai host phải nuôi + +`libnav_c_api.so` **không tự lấy được pose robot**. Nó nhận một `tf3::BufferCore` do host tạo và host +bơm, rồi mọi thứ bên trong — costmap lấy pose, laser transform về base frame, depth camera dựng +frustum — đều tra qua buffer đó. Buffer rỗng nghĩa là costmap không cập nhật và không có lỗi nào rõ +ràng để lần ra. + +Đây là một `.so` **riêng biệt**: `/usr/local/lib/libtf3.so`, không phải `libnav_c_api.so`. + +### 12b.1. Bề mặt C API của tf3 + +```csharp +private const string Tf3Lib = "/usr/local/lib/libtf3.so"; + +[DllImport(Tf3Lib, CallingConvention = CallingConvention.Cdecl)] +public static extern IntPtr tf3_buffer_create(int cacheTimeSec); // 10 s là mặc định hợp lý + +[DllImport(Tf3Lib, CallingConvention = CallingConvention.Cdecl)] +public static extern void tf3_buffer_destroy(IntPtr buffer); + +[DllImport(Tf3Lib, CallingConvention = CallingConvention.Cdecl)] +[return: MarshalAs(UnmanagedType.I1)] +public static extern bool tf3_set_transform(IntPtr buffer, ref TF3_Transform transform, + [MarshalAs(UnmanagedType.LPStr)] string authority, + [MarshalAs(UnmanagedType.I1)] bool isStatic); + +[DllImport(Tf3Lib, CallingConvention = CallingConvention.Cdecl)] +[return: MarshalAs(UnmanagedType.I1)] +public static extern bool tf3_lookup_transform(IntPtr buffer, string targetFrame, string sourceFrame, + long timeSec, long timeNsec, + ref TF3_Transform transform, ref TF3_ErrorCode error); + +[DllImport(Tf3Lib, CallingConvention = CallingConvention.Cdecl)] +[return: MarshalAs(UnmanagedType.I1)] +public static extern bool tf3_can_transform(IntPtr buffer, string targetFrame, string sourceFrame, + long timeSec, long timeNsec, + IntPtr errorMsg, int errorMsgLen); +``` + +Còn `tf3_clear`, `tf3_get_current_time`, `tf3_get_version`, `tf3_get_all_frame_names`, +`tf3_get_frame_tree`, `tf3_get_last_error` — dùng để chẩn đoán, không nằm trên đường chạy. + +### 12b.2. Cây frame tối thiểu + +| Transform | Loại | Ai bơm | Nhịp | +|---|---|---|---| +| `map` → `odom` | động | localization (SLAM / AMCL / XLOC) | theo nguồn định vị | +| `odom` → `base_link` | động | odometry bánh xe | theo nhịp odometry, thường 20–50 Hz | +| `base_link` → `` | **tĩnh** | host, bơm một lần lúc khởi động | một lần | +| `base_link` → `` | **tĩnh** | host, bơm một lần lúc khởi động | một lần | + +Transform tĩnh bơm với `isStatic = true` — nó không hết hạn theo thời gian, nên không cần bơm lại. +Transform động bơm với `isStatic = false` và **phải có stamp đúng**: costmap tra transform tại đúng +stamp của mẫu sensor, không phải tại "bây giờ". + +### 12b.3. Thứ tự — TF trước, luôn luôn + +```csharp +_tf = tf3_buffer_create(10); // 1. tạo buffer, cache 10 s +PublishStaticTransforms(); // 2. base_link → laser/camera, isStatic = true +StartOdomTfPump(); // 3. odom → base_link, chạy liên tục +StartLocalizationTfPump(); // 4. map → odom, chạy liên tục +// ... chờ cây frame đủ ... +_nav = navigation_create(); // 5. rồi mới tới navigation +``` + +`navigation_initialize_checked` dựng costmap, và costmap **lấy pose robot ngay trong chu kỳ cập nhật +đầu tiên**. Cây frame chưa đủ tại thời điểm đó thì costmap khởi tạo với pose sai hoặc đứng im. + +Chờ cho chắc trước khi initialize: + +```csharp +private async Task WaitForTfAsync(CancellationToken ct, int timeoutMs = 10000) +{ + var sw = Stopwatch.StartNew(); + var t = new TF3_Transform(); + var err = TF3_ErrorCode.NoError; + while (sw.ElapsedMilliseconds < timeoutMs) + { + tf3_get_current_time(ref var sec, ref var nsec); + if (tf3_lookup_transform(_tf, "map", "base_link", sec, nsec, ref t, ref err)) + return; + await Task.Delay(100, ct); + } + throw new InvalidOperationException("cây TF map→base_link chưa sẵn sàng sau 10 s"); +} +``` + +### 12b.4. Bốn lỗi TF hay gặp + +| Triệu chứng | Nguyên nhân | +|---|---| +| Costmap không cập nhật, không log lỗi rõ | Thiếu `map` → `odom` hoặc `odom` → `base_link` | +| Laser vẽ lệch, vật cản trôi | Sai transform tĩnh `base_link` → `laser_frame`, hoặc bơm nhầm `isStatic = false` rồi để hết hạn | +| Depth camera không clear được | Thiếu transform tới **optical frame**, hoặc stamp của mẫu nằm ngoài cache | +| Pose nhảy / robot lệch dần | Hai nguồn cùng bơm một transform, hoặc `cacheTimeSec` quá ngắn so với độ trễ sensor | + +### 12b.5. Vòng đời + +`tf3_buffer_destroy` gọi **sau cùng**, sau `navigation_destroy` — lõi còn tham chiếu buffer cho tới +lúc đó. Thứ tự đầy đủ ở mục 5. + +--- + +## 13. Ánh xạ VDA5050 → C API + +Sau đợt refactor 2026-08-10, ranh giới rất gọn: **lõi hiểu order và action; host chỉ dịch, không diễn +giải**. Bảng dưới là toàn bộ đường đi. + +### 13.1. Bảng ánh xạ + +| Message / action VDA5050 | Gọi gì | Ghi chú | +|---|---|---| +| `order` mới | `navigation_move_to_order_v2(orderId, orderUpdateId, nodes, edges, goal)` | `orderUpdateId` = 0 cho order đầu | +| `order` cập nhật (release thêm horizon) | `navigation_move_to_order_v2` — **cùng `orderId`**, `orderUpdateId` tăng | Mission layer nối tiếp, không dựng lại tuyến | +| Node action (`PickUp`, `charge`, `wait`, …) | *không gọi gì thêm* — nằm trong `nodes[i].actions` | Lõi tự khai triển qua compound action | +| `instantActions` (mọi action **không** thuộc ba dòng dưới) | `navigation_execute_instant_actions(actions, count)` | **Gửi cả lô một lần**, xem mục 11.8 | +| `instantActions` → `cancelOrder` | `navigation_cancel()` | Lái hàng đợi, **không** route qua `execute_instant_actions` | +| `instantActions` → `startPause` | `navigation_pause()` | như trên | +| `instantActions` → `stopPause` | `navigation_resume()` | như trên | +| Giới hạn tốc độ từ fleet / tầng an toàn | `navigation_set_twist_linear` ×2 (dấu chọn chiều) + `_angular` | Xem mục 6.6 | +| `state` báo về fleet | `navigation_get_state` + `navigation_get_twist` + `navigation_get_robot_pose_2d` | Xem 13.3 | + +**Ba action lái hàng đợi phải tách riêng.** Chúng không phải việc *nằm trong* hàng đợi mà là lệnh +*điều khiển* hàng đợi. Đẩy chúng qua `execute_instant_actions` là xếp một lệnh huỷ vào sau chính thứ +nó định huỷ. + +### 13.2. Vòng dịch một message `instantActions` + +```csharp +public async Task OnInstantActionsAsync(IReadOnlyList msg) +{ + // 1. Tách ba action lái hàng đợi ra trước. + foreach (var a in msg) + { + switch (a.ActionType) + { + case "cancelOrder": navigation_cancel(_nav); await WaitLeftControllingAsync(); return true; + case "startPause": navigation_pause(_nav); return true; + case "stopPause": navigation_resume(_nav); return true; + } + } + + // 2. Phần còn lại đi CẢ LÔ xuống lõi — không gọi từng cái. + var native = msg.Select(BuildNativeAction).ToArray(); + bool accepted = navigation_execute_instant_actions(_nav, native, (UIntPtr)native.Length); + + // 3. false = từ chối thẳng. Báo FAILED ngay, đừng chờ kết quả sẽ không tới. + if (!accepted) + { + ReportActionsFailed(msg, "rejected by navigation core"); + return false; + } + return true; // theo dõi tiếp bằng vòng poll state +} +``` + +`cancelOrder` cần chờ lõi rời `CONTROLLING` trước khi báo `FINISHED` — lệnh chỉ được ghi nhận, hiệu +lực ở cycle sau (≤ 33 ms @ 30 Hz): + +```csharp +private async Task WaitLeftControllingAsync(int timeoutMs = 5000) +{ + var sw = Stopwatch.StartNew(); + while (sw.ElapsedMilliseconds < timeoutMs) + { + if (!navigation_get_state(_nav, out var s)) return; + if (s != NavigationState.CONTROLLING) return; + await Task.Delay(100); + } +} +``` + +### 13.3. Báo trạng thái ngược lên fleet + +Không có báo cáo theo từng action. Nguồn duy nhất là trạng thái chung: + +| `navigation_get_state` | `actionStatus` VDA5050 | `driving` | +|---|---|---| +| `PENDING` | `WAITING` | false | +| `ACTIVE` | `RUNNING` | false | +| `PLANNING` | `RUNNING` | false | +| `CONTROLLING` | `RUNNING` | **true** | +| `SUCCEEDED` | `FINISHED` | false | +| `ABORTED`, `REJECTED`, `LOST` | `FAILED` | false | +| `PREEMPTED`, `PREEMPTING` | `FAILED` | false | +| `PAUSED` | giữ nguyên trạng thái trước, `paused = true` | false | + +Hai điều phải nhớ: + +- **Giữa hai chặng của một order nhiều node, lõi cố ý báo `ACTIVE`** thay vì `SUCCEEDED`/`PENDING`. + Nhờ vậy suy "order xong" từ `SUCCEEDED` vẫn đúng. Đừng đi vòng qua lớp che này. +- **Ánh xạ này chỉ không nhập nhằng khi hàng đợi có đúng một việc.** Nó đúng chừng nào fleet master + gửi mỗi lần một message và không chen instantActions vào giữa một order đang chạy. + +### 13.4. Vocabulary phải khớp ba nơi + +Một `actionType` chỉ chạy được khi tên của nó khớp ở cả ba chỗ: + +| Nơi | File | Vai trò | +|---|---|---| +| Fleet master | — | Gửi `actionType` | +| Bảng compound action | `compound_actions_params.yaml` | Khai triển thành chuỗi chặng (`profile`, `marker`, `action`) | +| Bảng handler | `action_handlers_params.yaml` | Chạy các action nguyên tử mà chuỗi trên sinh ra | + +Lệch tên là action bị từ chối tại cửa. Lưu ý cái bẫy đã ghi trong chính YAML: **compound action +(`PickUp`, `charge`) KHÔNG được khai trong `action_handlers_params.yaml`** — adapter đã dịch chúng +thành chuỗi chặng và gỡ khỏi danh sách action; thứ tới được `ActionRunner` là các action nguyên tử do +chuỗi đó sinh ra (`LiftFork`, `startCharging`). + +--- + +## 14. Triển khai lên robot + +Mục 2 nói *cần biến môi trường nào*. Mục này nói *đặt chúng ở đâu khi chạy thật*, vì đây là chỗ ghép +hay hỏng nhất và hỏng im lặng. + +### 14.1. `launchSettings.json` không áp dụng cho robot + +`Properties/launchSettings.json` chỉ có tác dụng với `dotnet run` khi phát triển. `dotnet publish` +**không đóng gói nó** và runtime không đọc nó ở môi trường Production. Đặt biến môi trường ở đó rồi +kết luận "đã cấu hình xong" là sai. + +Robot chạy qua systemd, nên biến phải nằm trong unit file: + +```ini +[Service] +Environment=PNKX_NAV_CORE_CONFIG_DIR=/opt/robotnet/navcore/config/runtime +Environment=PNKX_NAV_CORE_LIBRARY_PATH=/opt/robotnet/navcore/lib +``` + +Không đặt thì `robot::NodeHandle` rơi xuống nhánh cuối — dò `../../config`, `../config`, `config` +tương đối với `/proc/self/exe`. Không có cây config nào ở đó, nên `findLibraryPath("MoveBase")` trả +rỗng và `navigation_create()` trả `NULL`. + +### 14.2. `ProtectHome=true` chặn mọi đường dẫn `/home` + +Unit file có hardening thường bật sẵn: + +```ini +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/dev/shm /var/log/robotnet /opt/robotnet/robotapp +``` + +`ProtectHome=true` làm `/home` **không truy cập được** với tiến trình. Mọi đường dẫn `/home/...` — +kể cả đường build của máy dev — đều vô dụng trên robot. `ProtectSystem=strict` giữ phần còn lại ở +chế độ chỉ đọc nhưng **vẫn đọc được**, nên cài ngoài `/home` là đủ. + +### 14.3. Bố cục cài đặt + +``` +/opt/robotnet/navcore/lib/ libnav_c_api.so + libmove_base2.so + toàn bộ plugin planner / recovery / costmap +/opt/robotnet/navcore/config/runtime/ bản chép của Test/move_base2/config/runtime +``` + +Thêm `/opt/robotnet/navcore/lib/libnav_c_api.so` vào danh sách candidate của `DllImportResolver` để +không phụ thuộc hoàn toàn vào `LD_LIBRARY_PATH`. + +### 14.4. Xác minh đang nạp đúng runtime + +`navigation_create()` in đường dẫn `.so` đã resolve. Dòng này ở cấp `debug` nhưng `robot_cpp` +**không lọc theo cấp**, nên nó luôn hiện: + +``` +navigation_create: loading navigation plugin from '/…/libmove_base2.so' +``` + +```bash +journalctl -u | grep "loading navigation plugin" +``` + +Thấy `libmove_base2.so` là đúng runtime mới. Thấy `libmove_base.so` là đang chạy bản cũ — xảy ra khi +`PNKX_NAV_CORE_CONFIG_DIR` trỏ vào cây `pnkx_nav_core/config`, nơi `move_base_common_params.yaml` ghi +`library_path: libmove_base`. + +**Cả hai `.so` đều export alias `MoveBase`, nên nạp nhầm KHÔNG sinh lỗi nào** — host chạy bình thường +với runtime cũ. Đây là lý do phải kiểm bằng dòng log này thay vì suy đoán từ hành vi. + +--- + +## 15. Checklist nghiệm thu + +Chạy theo đúng thứ tự. Mỗi bước là điều kiện của bước sau; đừng nhảy cóc. + +### Tầng 0 — môi trường + +- [ ] `nm -D --defined-only libnav_c_api.so | grep " T " | wc -l` → **62** +- [ ] `.so` và plugin nằm ngoài `/home` nếu chạy dưới systemd có `ProtectHome` +- [ ] `PNKX_NAV_CORE_CONFIG_DIR` trỏ vào cây `move_base2` (`.../config/runtime`) +- [ ] `PNKX_NAV_CORE_LIBRARY_PATH` chứa `libmove_base2.so` + toàn bộ plugin +- [ ] Log khởi động in `loading navigation plugin from '…libmove_base2.so'` (mục 14.4) +- [ ] `libtf3.so` resolve được (mặc định `/usr/local/lib/libtf3.so`, **không** phải đường `/home`) + +### Tầng 0b — cây TF (mục 12b) + +- [ ] `tf3_lookup_transform("map", "base_link", now)` trả `true` **trước** khi gọi `initialize` +- [ ] Transform tĩnh `base_link` → laser / camera bơm với `isStatic = true` +- [ ] `odom` → `base_link` cập nhật đều theo nhịp odometry +- [ ] `tf3_get_all_frame_names` liệt kê đủ frame mà costmap YAML nhắc tới + +### Tầng 1 — vòng đời + +- [ ] `navigation_create` trả handle khác `NULL` +- [ ] Footprint và static map được bơm **trước** `initialize` (mục 3) +- [ ] `navigation_initialize_checked` trả `true`; nếu `false` thì `navigation_get_status_text` nói rõ + pha nào hỏng +- [ ] Log in `control thread running at 30.00 Hz` +- [ ] Tắt: `shutdown` trả về trong ~1 s, `destroy` không treo, không crash khi thoát + +### Tầng 2 — dữ liệu vào + +- [ ] Bộ đếm `SensorGatewayStats` tăng cho từng nguồn đang bơm — **C API không phơi bộ đếm này ra**, + đọc qua log của lõi (`SensorGateway` log throttle khi bỏ mẫu) +- [ ] Không thấy log `dropping ... : no costmap attached` sau khi initialize xong +- [ ] Tên topic khớp `costmap_common_params.yaml` (mục 4) +- [ ] Odometry bơm đều theo nhịp nguồn, không thưa + +### Tầng 3 — điều khiển + +- [ ] Goal đơn qua `navigation_move_to`: state đi `PLANNING` → `CONTROLLING` → `SUCCEEDED` +- [ ] `navigation_get_twist` có stamp tiến và giá trị khác 0 khi đang chạy +- [ ] `navigation_pause` → state `PAUSED` trong ≤ 1 cycle; `resume` chạy tiếp +- [ ] `navigation_cancel` → rời `CONTROLLING`, robot dừng +- [ ] `set_twist_linear(+v)` rồi `(−v)`: tốc độ thật khớp trần đặt ra ở **cả hai chiều** + +### Tầng 4 — order và action + +- [ ] Order nhiều node qua `navigation_move_to_order_v2`: chạy hết các chặng, state báo `ACTIVE` giữa + hai chặng (không phải `SUCCEEDED` sớm) +- [ ] Order update: cùng `orderId`, `orderUpdateId` tăng → nối tiếp, không dựng lại tuyến +- [ ] Node action (`PickUp`) sinh đúng chuỗi chặng theo `compound_actions_params.yaml` +- [ ] `navigation_execute_instant_actions` với **cùng action đó** sinh ra **cùng chuỗi chặng** +- [ ] `cancelOrder` / `startPause` / `stopPause` đi qua `cancel`/`pause`/`resume`, **không** qua + `execute_instant_actions` +- [ ] Action lạ bị từ chối và báo `FAILED` kèm `actionNotSupported`, không im lặng + +### Tầng 5 — bộ nhớ và ổn định + +- [ ] Chạy 1 giờ với đủ 4 timer hiển thị: RSS không tăng đều +- [ ] Mọi `feed_back_str` / `status_text` được free bằng `nav_c_api_free_string` +- [ ] Mọi getter grid/scan/cloud/plan có `navigation_free_*` đi kèm +- [ ] Mỗi consumer `PlannerDataOutput` dùng struct **riêng**, không chia sẻ giữa hai timer + +### Tầng 6 — depth camera (nếu dùng) + +- [ ] `navigation_add_depth_camera_data` bơm vào đúng topic `data_type: DepthCameraData` +- [ ] TF từ optical frame tới base frame có tại đúng `header.stamp` +- [ ] Vật cản ma trong FOV **biến mất** sau vài chu kỳ — đây là thứ point cloud không làm được diff --git a/src/APIs/c_api/include/convertor.h b/src/APIs/c_api/include/convertor.h new file mode 100644 index 0000000..9620338 --- /dev/null +++ b/src/APIs/c_api/include/convertor.h @@ -0,0 +1,217 @@ +#ifndef C_API_CONVERTOR_H +#define C_API_CONVERTOR_H + +// C +#include "sensor_msgs/LaserScan.h" +#include "sensor_msgs/PointCloud.h" +#include "sensor_msgs/PointCloud2.h" +#include "nav_msgs/Odometry.h" +#include "std_msgs/Header.h" +#include "nav_msgs/OccupancyGrid.h" +#include "geometry_msgs/Point.h" +#include "geometry_msgs/PoseStamped.h" +#include "geometry_msgs/Pose2D.h" +#include "nav_2d_msgs/Twist2D.h" +#include "nav_2d_msgs/Twist2DStamped.h" +#include "nav_2d_msgs/Path2D.h" +#include "map_msgs/OccupancyGridUpdate.h" +#include "geometry_msgs/PolygonStamped.h" +#include "protocol_msgs/Order.h" + +// C++ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/** + * @brief Convert C LaserScan to C++ LaserScan + * @param laser_scan C LaserScan + * @return C++ LaserScan + */ +robot_sensor_msgs::LaserScan convert2CppLaserScan(const LaserScan& laser_scan); + +/** + * @brief Convert C OccupancyGrid to C++ OccupancyGrid + * @param occupancy_grid C OccupancyGrid + * @return C++ OccupancyGrid + */ +robot_nav_msgs::OccupancyGrid convert2CppOccupancyGrid(const OccupancyGrid& occupancy_grid); + +/** + * @brief Convert C++ OccupancyGrid to C OccupancyGrid + * @param cpp C++ OccupancyGrid + * @param out C OccupancyGrid + */ +void convert2COccupancyGrid(const robot_nav_msgs::OccupancyGrid& cpp, OccupancyGrid& out); + +/** + * @brief Convert C++ Path2D to C Path2D + */ +void convert2CPath2D(const robot_nav_2d_msgs::Path2D& cpp, Path2D& out); + +/** + * @brief Convert C++ OccupancyGridUpdate to C OccupancyGridUpdate + */ +void convert2COccupancyGridUpdate(const robot_map_msgs::OccupancyGridUpdate& cpp, OccupancyGridUpdate& out); + +/** + * @brief Convert C++ PolygonStamped to C PolygonStamped + */ +void convert2CPolygonStamped(const robot_geometry_msgs::PolygonStamped& cpp, PolygonStamped& out); + +/** + * @brief Convert C++ LaserScan to C LaserScan + * @param cpp C++ LaserScan + * @param out C LaserScan + */ +void convert2CLaserScan(const robot_sensor_msgs::LaserScan& cpp, LaserScan& out); + +/** + * @brief Convert C++ PointCloud to C PointCloud + * @param cpp C++ PointCloud + * @param out C PointCloud + */ +void convert2CPointCloud(const robot_sensor_msgs::PointCloud& cpp, PointCloud& out); + +/** + * @brief Convert C++ PointCloud2 to C PointCloud2 + * @param cpp C++ PointCloud2 + * @param out C PointCloud2 + */ +void convert2CPointCloud2(const robot_sensor_msgs::PointCloud2& cpp, PointCloud2& out); + +/** + * @brief Convert C PointCloud to C++ PointCloud + * @param c C PointCloud + * @return C++ PointCloud + */ +robot_sensor_msgs::PointCloud convert2CppPointCloud(const PointCloud& c); + +/** + * @brief Convert C PointCloud2 to C++ PointCloud2 + * @param c C PointCloud2 + * @return C++ PointCloud2 + */ +robot_sensor_msgs::PointCloud2 convert2CppPointCloud2(const PointCloud2& c); + +/** + * @brief Convert C Odometry to C++ Odometry + * @param odometry C Odometry + * @return C++ Odometry + */ +robot_nav_msgs::Odometry convert2CppOdometry(const Odometry& odometry); + +/** + * @brief Convert C PoseStamped to C++ PoseStamped + * @param pose_stamped C PoseStamped + * @return C++ PoseStamped + */ +robot_geometry_msgs::PoseStamped convert2CppPoseStamped(const PoseStamped& pose_stamped); + +/** + * @brief Convert C++ PoseStamped to C PoseStamped + * @param cpp_pose_stamped C++ PoseStamped + * @return C PoseStamped + */ +PoseStamped convert2CPoseStamped(const robot_geometry_msgs::PoseStamped& cpp_pose_stamped); + + +/** + * @brief Convert C Pose2D to C++ Pose2D + * @param pose_2d C Pose2D + * @return C++ Pose2D + */ +robot_geometry_msgs::Pose2D convert2CppPose2D(const Pose2D& pose_2d); + +/** + * @brief Convert C++ Pose2D to C Pose2D + * @param cpp_pose_2d C++ Pose2D + * @return C Pose2D + */ + Pose2D convert2CPose2D(const robot_geometry_msgs::Pose2D& cpp_pose_2d); + +/** + * @brief Convert C Twist2D to C++ Twist2D + * @param twist_2d C Twist2D + * @return C++ Twist2D + */ +robot_nav_2d_msgs::Twist2D convert2CppTwist2D(const Twist2D& twist_2d); + + +/** + * @brief Convert C++ Twist2D to C Twist2D + * @param cpp_twist_2d C++ Twist2D + * @return C Twist2D + */ +Twist2D convert2CTwist2D(const robot_nav_2d_msgs::Twist2D& cpp_twist_2d); + +/** + * @brief Convert C Twist2DStamped to C++ Twist2DStamped + * @param twist_2d_stamped C Twist2DStamped + * @return C++ Twist2DStamped + */ +robot_nav_2d_msgs::Twist2DStamped convert2CppTwist2DStamped(const Twist2DStamped& twist_2d_stamped); + + +/** + * @brief Convert C++ Twist2DStamped to C Twist2DStamped + * @param cpp_twist_2d_stamped C++ Twist2DStamped + * @return C Twist2DStamped + */ +Twist2DStamped convert2CTwist2DStamped(const robot_nav_2d_msgs::Twist2DStamped& cpp_twist_2d_stamped); + +/** + * @brief Convert C Order to C++ Order + * @param order C Order + * @return C++ Order + */ +robot_protocol_msgs::Order convert2CppOrder(const Order& order); + +/** + * @brief Convert a C Action to a C++ Action. + * + * Null char* fields become empty strings, so a partially filled struct converts without crashing — + * the callee validates content, this only crosses the language boundary. + * + * @param action C Action + * @return C++ Action + */ +robot_protocol_msgs::Action convert2CppAction(const Action& action); + +/** + * @brief Convert C++ Order to C Order + * @param cpp_order C++ Order + * @return C Order (caller must call order_free when done to release memory) + */ +Order convert2COrder(const robot_protocol_msgs::Order& cpp_order); + +/** + * @brief Check if a quaternion is valid + * @param q Quaternion + * @return True if valid, false otherwise + */ +bool isQuaternionValid(const Quaternion& q); + +/** + * @brief Free dynamic memory held by an Order returned from convert2COrder + * @param order Order to free (pointers and counts are zeroed) + */ +#ifdef __cplusplus +extern "C" +#endif +void order_free(Order* order); + +#endif // C_API_CONVERTOR_H \ No newline at end of file diff --git a/src/APIs/c_api/include/convertor_2.h b/src/APIs/c_api/include/convertor_2.h new file mode 100644 index 0000000..47ad8fe --- /dev/null +++ b/src/APIs/c_api/include/convertor_2.h @@ -0,0 +1,51 @@ +#ifndef C_API_CONVERTOR_2_H +#define C_API_CONVERTOR_2_H + +/** + * @file convertor_2.h + * @brief Converters that only the move_base2 entry points need. + * + * Kept apart from convertor.h so the move_base2 surface can be added, reviewed and reverted without + * touching the converters the existing binding already depends on. + */ + +// C +#include "std_msgs/Header.h" +#include "sensor_msgs/Image.h" +#include "sensor_msgs/CameraInfo.h" +#include "sensor_msgs/DepthCameraData.h" + +// C++ +#include +#include +#include +#include + +/** + * @brief Convert C Header to C++ Header. + * @param header C header; `frame_id` may be NULL (becomes an empty string). + */ +robot_std_msgs::Header convert2CppHeader(const Header& header); + +/** + * @brief Convert C Image to C++ Image. + * + * The pixel buffer is copied, so the caller keeps ownership of `image.data` and may free it as + * soon as this call returns. + * + * @param image C image; `data` and `encoding` may be NULL. + */ +robot_sensor_msgs::Image convert2CppImage(const Image& image); + +/** + * @brief Convert C CameraInfo to C++ CameraInfo. + * @param info C camera info; `D` and `distortion_model` may be NULL. K/R/P are fixed size (9/9/12). + */ +robot_sensor_msgs::CameraInfo convert2CppCameraInfo(const CameraInfo& info); + +/** + * @brief Convert C DepthCameraData to C++ DepthCameraData. Everything is deep-copied. + */ +robot_sensor_msgs::DepthCameraData convert2CppDepthCameraData(const DepthCameraData& data); + +#endif // C_API_CONVERTOR_2_H diff --git a/src/APIs/c_api/include/geometry_msgs/Accel.h b/src/APIs/c_api/include/geometry_msgs/Accel.h new file mode 100644 index 0000000..03397f8 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Accel.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_ACCEL_H +#define C_API_GEOMETRY_MSGS_ACCEL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Vector3.h" + +typedef struct +{ + Vector3 linear; + Vector3 angular; +} Accel; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_ACCEL_H diff --git a/src/APIs/c_api/include/geometry_msgs/AccelStamped.h b/src/APIs/c_api/include/geometry_msgs/AccelStamped.h new file mode 100644 index 0000000..5ce2455 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/AccelStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_ACCELSTAMPED_H +#define C_API_GEOMETRY_MSGS_ACCELSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Accel.h" + +typedef struct +{ + Header header; + Accel accel; +} AccelStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_ACCELSTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/AccelWithCovariance.h b/src/APIs/c_api/include/geometry_msgs/AccelWithCovariance.h new file mode 100644 index 0000000..c66b1ac --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/AccelWithCovariance.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCE_H +#define C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Accel.h" + +typedef struct +{ + Accel accel; + double covariance[36]; +} AccelWithCovariance; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCE_H diff --git a/src/APIs/c_api/include/geometry_msgs/AccelWithCovarianceStamped.h b/src/APIs/c_api/include/geometry_msgs/AccelWithCovarianceStamped.h new file mode 100644 index 0000000..5a48066 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/AccelWithCovarianceStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCESTAMPED_H +#define C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCESTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/AccelWithCovariance.h" + +typedef struct +{ + Header header; + AccelWithCovariance accel; +} AccelWithCovarianceStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_ACCELWITHCOVARIANCESTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Inertia.h b/src/APIs/c_api/include/geometry_msgs/Inertia.h new file mode 100644 index 0000000..645d9ae --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Inertia.h @@ -0,0 +1,28 @@ +#ifndef C_API_GEOMETRY_MSGS_INERTIA_H +#define C_API_GEOMETRY_MSGS_INERTIA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Vector3.h" + +typedef struct +{ + double m; + Vector3 com; + double ixx; + double ixy; + double ixz; + double iyy; + double iyz; + double izz; +} Inertia; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_INERTIA_H diff --git a/src/APIs/c_api/include/geometry_msgs/InertiaStamped.h b/src/APIs/c_api/include/geometry_msgs/InertiaStamped.h new file mode 100644 index 0000000..d077204 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/InertiaStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_INERTIASTAMPED_H +#define C_API_GEOMETRY_MSGS_INERTIASTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Inertia.h" + +typedef struct +{ + Header header; + Inertia inertia; +} InertiaStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_INERTIASTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Point.h b/src/APIs/c_api/include/geometry_msgs/Point.h new file mode 100644 index 0000000..12346f5 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Point.h @@ -0,0 +1,21 @@ +#ifndef C_API_GEOMETRY_MSGS_POINT_H +#define C_API_GEOMETRY_MSGS_POINT_H + +#ifdef __cplusplus +extern "C" +{ +#endif +#include +#include + + typedef struct + { + double x; + double y; + double z; + } Point; + +#ifdef __cplusplus +} +#endif +#endif // C_API_GEOMETRY_MSGS_POINT_H \ No newline at end of file diff --git a/src/APIs/c_api/include/geometry_msgs/Point32.h b/src/APIs/c_api/include/geometry_msgs/Point32.h new file mode 100644 index 0000000..9721822 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Point32.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_POINT32_H +#define C_API_GEOMETRY_MSGS_POINT32_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + float x; + float y; + float z; +} Point32; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POINT32_H diff --git a/src/APIs/c_api/include/geometry_msgs/PointStamped.h b/src/APIs/c_api/include/geometry_msgs/PointStamped.h new file mode 100644 index 0000000..81f89bc --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/PointStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_POINTSTAMPED_H +#define C_API_GEOMETRY_MSGS_POINTSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Point.h" + +typedef struct +{ + Header header; + Point point; +} PointStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POINTSTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Polygon.h b/src/APIs/c_api/include/geometry_msgs/Polygon.h new file mode 100644 index 0000000..d34d157 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Polygon.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_POLYGON_H +#define C_API_GEOMETRY_MSGS_POLYGON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Point32.h" + +typedef struct +{ + Point32 *points; + size_t points_count; +} Polygon; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POLYGON_H diff --git a/src/APIs/c_api/include/geometry_msgs/PolygonStamped.h b/src/APIs/c_api/include/geometry_msgs/PolygonStamped.h new file mode 100644 index 0000000..f4957e6 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/PolygonStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_POLYGONSTAMPED_H +#define C_API_GEOMETRY_MSGS_POLYGONSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Polygon.h" + +typedef struct +{ + Header header; + Polygon polygon; +} PolygonStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POLYGONSTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Pose.h b/src/APIs/c_api/include/geometry_msgs/Pose.h new file mode 100644 index 0000000..595ab8c --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Pose.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_POSE_H +#define C_API_GEOMETRY_MSGS_POSE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Point.h" +#include "geometry_msgs/Quaternion.h" + +typedef struct +{ + Point position; + Quaternion orientation; +} Pose; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POSE_H diff --git a/src/APIs/c_api/include/geometry_msgs/Pose2D.h b/src/APIs/c_api/include/geometry_msgs/Pose2D.h new file mode 100644 index 0000000..cc282d3 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Pose2D.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_POSE2D_H +#define C_API_GEOMETRY_MSGS_POSE2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + double x; + double y; + double theta; +} Pose2D; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POSE2D_H diff --git a/src/APIs/c_api/include/geometry_msgs/PoseArray.h b/src/APIs/c_api/include/geometry_msgs/PoseArray.h new file mode 100644 index 0000000..60876a7 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/PoseArray.h @@ -0,0 +1,24 @@ +#ifndef C_API_GEOMETRY_MSGS_POSEARRAY_H +#define C_API_GEOMETRY_MSGS_POSEARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Pose.h" + +typedef struct +{ + Header header; + Pose *poses; + size_t poses_count; +} PoseArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POSEARRAY_H diff --git a/src/APIs/c_api/include/geometry_msgs/PoseStamped.h b/src/APIs/c_api/include/geometry_msgs/PoseStamped.h new file mode 100644 index 0000000..6207d60 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/PoseStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_POSESTAMPED_H +#define C_API_GEOMETRY_MSGS_POSESTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Pose.h" + +typedef struct +{ + Header header; + Pose pose; +} PoseStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POSESTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/PoseWithCovariance.h b/src/APIs/c_api/include/geometry_msgs/PoseWithCovariance.h new file mode 100644 index 0000000..cc1d7e9 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/PoseWithCovariance.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCE_H +#define C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Pose.h" + +typedef struct +{ + Pose pose; + double *covariance; + size_t covariance_count; +} PoseWithCovariance; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCE_H diff --git a/src/APIs/c_api/include/geometry_msgs/PoseWithCovarianceStamped.h b/src/APIs/c_api/include/geometry_msgs/PoseWithCovarianceStamped.h new file mode 100644 index 0000000..e243833 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/PoseWithCovarianceStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCESTAMPED_H +#define C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCESTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/PoseWithCovariance.h" + +typedef struct +{ + Header header; + PoseWithCovariance pose; +} PoseWithCovarianceStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_POSEWITHCOVARIANCESTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Quaternion.h b/src/APIs/c_api/include/geometry_msgs/Quaternion.h new file mode 100644 index 0000000..e843fc1 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Quaternion.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_QUATERNION_H +#define C_API_GEOMETRY_MSGS_QUATERNION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + double x; + double y; + double z; + double w; +} Quaternion; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_QUATERNION_H diff --git a/src/APIs/c_api/include/geometry_msgs/QuaternionStamped.h b/src/APIs/c_api/include/geometry_msgs/QuaternionStamped.h new file mode 100644 index 0000000..89f21d1 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/QuaternionStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_QUATERNIONSTAMPED_H +#define C_API_GEOMETRY_MSGS_QUATERNIONSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Quaternion.h" + +typedef struct +{ + Header header; + Quaternion quaternion; +} QuaternionStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_QUATERNIONSTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Transform.h b/src/APIs/c_api/include/geometry_msgs/Transform.h new file mode 100644 index 0000000..c318393 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Transform.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_TRANSFORM_H +#define C_API_GEOMETRY_MSGS_TRANSFORM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Vector3.h" +#include "geometry_msgs/Quaternion.h" + +typedef struct +{ + Vector3 translation; + Quaternion rotation; +} Transform; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_TRANSFORM_H diff --git a/src/APIs/c_api/include/geometry_msgs/TransformStamped.h b/src/APIs/c_api/include/geometry_msgs/TransformStamped.h new file mode 100644 index 0000000..c983d97 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/TransformStamped.h @@ -0,0 +1,24 @@ +#ifndef C_API_GEOMETRY_MSGS_TRANSFORMSTAMPED_H +#define C_API_GEOMETRY_MSGS_TRANSFORMSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Transform.h" + +typedef struct +{ + Header header; + char *child_frame_id; + Transform transform; +} TransformStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_TRANSFORMSTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Twist.h b/src/APIs/c_api/include/geometry_msgs/Twist.h new file mode 100644 index 0000000..93cc3df --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Twist.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_TWIST_H +#define C_API_GEOMETRY_MSGS_TWIST_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Vector3.h" + +typedef struct +{ + Vector3 linear; + Vector3 angular; +} Twist; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_TWIST_H diff --git a/src/APIs/c_api/include/geometry_msgs/TwistStamped.h b/src/APIs/c_api/include/geometry_msgs/TwistStamped.h new file mode 100644 index 0000000..4161520 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/TwistStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_TWISTSTAMPED_H +#define C_API_GEOMETRY_MSGS_TWISTSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Twist.h" + +typedef struct +{ + Header header; + Twist twist; +} TwistStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_TWISTSTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/TwistWithCovariance.h b/src/APIs/c_api/include/geometry_msgs/TwistWithCovariance.h new file mode 100644 index 0000000..6711fae --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/TwistWithCovariance.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCE_H +#define C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Twist.h" + +typedef struct +{ + Twist twist; + double *covariance; + size_t covariance_count; +} TwistWithCovariance; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCE_H diff --git a/src/APIs/c_api/include/geometry_msgs/TwistWithCovarianceStamped.h b/src/APIs/c_api/include/geometry_msgs/TwistWithCovarianceStamped.h new file mode 100644 index 0000000..c70a1ee --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/TwistWithCovarianceStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCESTAMPED_H +#define C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCESTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/TwistWithCovariance.h" + +typedef struct +{ + Header header; + TwistWithCovariance twist; +} TwistWithCovarianceStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_TWISTWITHCOVARIANCESTAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Vector3.h b/src/APIs/c_api/include/geometry_msgs/Vector3.h new file mode 100644 index 0000000..65e14e9 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Vector3.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_VECTOR3_H +#define C_API_GEOMETRY_MSGS_VECTOR3_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + double x; + double y; + double z; +} Vector3; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_VECTOR3_H diff --git a/src/APIs/c_api/include/geometry_msgs/Vector3Stamped.h b/src/APIs/c_api/include/geometry_msgs/Vector3Stamped.h new file mode 100644 index 0000000..4f3b729 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Vector3Stamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_VECTOR3STAMPED_H +#define C_API_GEOMETRY_MSGS_VECTOR3STAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Vector3.h" + +typedef struct +{ + Header header; + Vector3 vector; +} Vector3Stamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_VECTOR3STAMPED_H diff --git a/src/APIs/c_api/include/geometry_msgs/Wrench.h b/src/APIs/c_api/include/geometry_msgs/Wrench.h new file mode 100644 index 0000000..f8bd8e3 --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/Wrench.h @@ -0,0 +1,22 @@ +#ifndef C_API_GEOMETRY_MSGS_WRENCH_H +#define C_API_GEOMETRY_MSGS_WRENCH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "geometry_msgs/Vector3.h" + +typedef struct +{ + Vector3 force; + Vector3 torque; +} Wrench; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_WRENCH_H diff --git a/src/APIs/c_api/include/geometry_msgs/WrenchStamped.h b/src/APIs/c_api/include/geometry_msgs/WrenchStamped.h new file mode 100644 index 0000000..70bdf1f --- /dev/null +++ b/src/APIs/c_api/include/geometry_msgs/WrenchStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_GEOMETRY_MSGS_WRENCHSTAMPED_H +#define C_API_GEOMETRY_MSGS_WRENCHSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Wrench.h" + +typedef struct +{ + Header header; + Wrench wrench; +} WrenchStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_GEOMETRY_MSGS_WRENCHSTAMPED_H diff --git a/src/APIs/c_api/include/map_msgs/OccupancyGridUpdate.h b/src/APIs/c_api/include/map_msgs/OccupancyGridUpdate.h new file mode 100644 index 0000000..61e0947 --- /dev/null +++ b/src/APIs/c_api/include/map_msgs/OccupancyGridUpdate.h @@ -0,0 +1,33 @@ +#ifndef C_API_ROBOT_MAP_MSGS_OCCUPANCYGRIDUPDATE_C_H +#define C_API_ROBOT_MAP_MSGS_OCCUPANCYGRIDUPDATE_C_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +/** + * C representation of robot_map_msgs::OccupancyGridUpdate. + * Note: This header is intentionally named *_c.h to avoid + * shadowing the C++ header `robot_map_msgs/OccupancyGridUpdate.h`. + */ +typedef struct +{ + Header header; + int32_t x; + int32_t y; + uint32_t width; + uint32_t height; + int8_t *data; + size_t data_count; +} OccupancyGridUpdate; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_ROBOT_MAP_MSGS_OCCUPANCYGRIDUPDATE_C_H + diff --git a/src/APIs/c_api/include/nav_2d_msgs/ComplexPolygon2D.h b/src/APIs/c_api/include/nav_2d_msgs/ComplexPolygon2D.h new file mode 100644 index 0000000..6494317 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/ComplexPolygon2D.h @@ -0,0 +1,23 @@ +#ifndef C_API_NAV_2D_MSGS_COMPLEXPOLYGON2D_H +#define C_API_NAV_2D_MSGS_COMPLEXPOLYGON2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "nav_2d_msgs/Polygon2D.h" + +typedef struct +{ + Polygon2D outer; + Polygon2D *inner; + size_t inner_count; +} ComplexPolygon2D; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_COMPLEXPOLYGON2D_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/NavGridInfo.h b/src/APIs/c_api/include/nav_2d_msgs/NavGridInfo.h new file mode 100644 index 0000000..570a695 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/NavGridInfo.h @@ -0,0 +1,25 @@ +#ifndef C_API_NAV_2D_MSGS_NAVGRIDINFO_H +#define C_API_NAV_2D_MSGS_NAVGRIDINFO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + uint32_t width; + uint32_t height; + double resolution; + char *frame_id; + double origin_x; + double origin_y; +} NavGridInfo; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_NAVGRIDINFO_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/NavGridOfChars.h b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfChars.h new file mode 100644 index 0000000..00b5d4d --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfChars.h @@ -0,0 +1,25 @@ +#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFCHARS_H +#define C_API_NAV_2D_MSGS_NAVGRIDOFCHARS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Time.h" +#include "nav_2d_msgs/NavGridInfo.h" + +typedef struct +{ + Time stamp; + NavGridInfo info; + uint8_t *data; + size_t data_count; +} NavGridOfChars; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_NAVGRIDOFCHARS_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/NavGridOfCharsUpdate.h b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfCharsUpdate.h new file mode 100644 index 0000000..2080ab7 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfCharsUpdate.h @@ -0,0 +1,25 @@ +#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFCHARSUPDATE_H +#define C_API_NAV_2D_MSGS_NAVGRIDOFCHARSUPDATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Time.h" +#include "nav_2d_msgs/UIntBounds.h" + +typedef struct +{ + Time stamp; + UIntBounds bounds; + uint8_t *data; + size_t data_count; +} NavGridOfCharsUpdate; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_NAVGRIDOFCHARSUPDATE_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoubles.h b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoubles.h new file mode 100644 index 0000000..0d46911 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoubles.h @@ -0,0 +1,25 @@ +#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLES_H +#define C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Time.h" +#include "nav_2d_msgs/NavGridInfo.h" + +typedef struct +{ + Time stamp; + NavGridInfo info; + double *data; + size_t data_count; +} NavGridOfDoubles; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLES_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoublesUpdate.h b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoublesUpdate.h new file mode 100644 index 0000000..6b0facc --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/NavGridOfDoublesUpdate.h @@ -0,0 +1,25 @@ +#ifndef C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLESUPDATE_H +#define C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLESUPDATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Time.h" +#include "nav_2d_msgs/UIntBounds.h" + +typedef struct +{ + Time stamp; + UIntBounds bounds; + double *data; + size_t data_count; +} NavGridOfDoublesUpdate; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_NAVGRIDOFDOUBLESUPDATE_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Path2D.h b/src/APIs/c_api/include/nav_2d_msgs/Path2D.h new file mode 100644 index 0000000..57648ba --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Path2D.h @@ -0,0 +1,24 @@ +#ifndef C_API_NAV_2D_MSGS_PATH2D_H +#define C_API_NAV_2D_MSGS_PATH2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "nav_2d_msgs/Pose2DStamped.h" + +typedef struct +{ + Header header; + Pose2DStamped *poses; + size_t poses_count; +} Path2D; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_PATH2D_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Point2D.h b/src/APIs/c_api/include/nav_2d_msgs/Point2D.h new file mode 100644 index 0000000..4359592 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Point2D.h @@ -0,0 +1,21 @@ +#ifndef C_API_NAV_2D_MSGS_POINT2D_H +#define C_API_NAV_2D_MSGS_POINT2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + double x; + double y; +} Point2D; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_POINT2D_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Polygon2D.h b/src/APIs/c_api/include/nav_2d_msgs/Polygon2D.h new file mode 100644 index 0000000..8cb0602 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Polygon2D.h @@ -0,0 +1,22 @@ +#ifndef C_API_NAV_2D_MSGS_POLYGON2D_H +#define C_API_NAV_2D_MSGS_POLYGON2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "nav_2d_msgs/Point2D.h" + +typedef struct +{ + Point2D *points; + size_t points_count; +} Polygon2D; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_POLYGON2D_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Polygon2DCollection.h b/src/APIs/c_api/include/nav_2d_msgs/Polygon2DCollection.h new file mode 100644 index 0000000..d4f0e93 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Polygon2DCollection.h @@ -0,0 +1,27 @@ +#ifndef C_API_NAV_2D_MSGS_POLYGON2DCOLLECTION_H +#define C_API_NAV_2D_MSGS_POLYGON2DCOLLECTION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "std_msgs/ColorRGBA.h" +#include "nav_2d_msgs/ComplexPolygon2D.h" + +typedef struct +{ + Header header; + ComplexPolygon2D *polygons; + size_t polygons_count; + ColorRGBA *colors; + size_t colors_count; +} Polygon2DCollection; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_POLYGON2DCOLLECTION_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Polygon2DStamped.h b/src/APIs/c_api/include/nav_2d_msgs/Polygon2DStamped.h new file mode 100644 index 0000000..de7e011 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Polygon2DStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_NAV_2D_MSGS_POLYGON2DSTAMPED_H +#define C_API_NAV_2D_MSGS_POLYGON2DSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "nav_2d_msgs/Polygon2D.h" + +typedef struct +{ + Header header; + Polygon2D polygon; +} Polygon2DStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_POLYGON2DSTAMPED_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Pose2D32.h b/src/APIs/c_api/include/nav_2d_msgs/Pose2D32.h new file mode 100644 index 0000000..c4b8107 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Pose2D32.h @@ -0,0 +1,22 @@ +#ifndef C_API_NAV_2D_MSGS_POSE2D32_H +#define C_API_NAV_2D_MSGS_POSE2D32_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + float x; + float y; + float theta; +} Pose2D32; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_POSE2D32_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Pose2DStamped.h b/src/APIs/c_api/include/nav_2d_msgs/Pose2DStamped.h new file mode 100644 index 0000000..6ffbef3 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Pose2DStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_NAV_2D_MSGS_POSE2DSTAMPED_H +#define C_API_NAV_2D_MSGS_POSE2DSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Pose2D.h" + +typedef struct +{ + Header header; + Pose2D pose; +} Pose2DStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_POSE2DSTAMPED_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/SwitchPlugin.h b/src/APIs/c_api/include/nav_2d_msgs/SwitchPlugin.h new file mode 100644 index 0000000..69258c4 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/SwitchPlugin.h @@ -0,0 +1,23 @@ +#ifndef C_API_NAV_2D_MSGS_SWITCHPLUGIN_H +#define C_API_NAV_2D_MSGS_SWITCHPLUGIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "nav_2d_msgs/SwitchPluginRequest.h" +#include "nav_2d_msgs/SwitchPluginResponse.h" + +typedef struct +{ + SwitchPluginRequest request; + SwitchPluginResponse response; +} SwitchPlugin; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_SWITCHPLUGIN_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/SwitchPluginRequest.h b/src/APIs/c_api/include/nav_2d_msgs/SwitchPluginRequest.h new file mode 100644 index 0000000..8ac217f --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/SwitchPluginRequest.h @@ -0,0 +1,20 @@ +#ifndef C_API_NAV_2D_MSGS_SWITCHPLUGINREQUEST_H +#define C_API_NAV_2D_MSGS_SWITCHPLUGINREQUEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + char *new_plugin; +} SwitchPluginRequest; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_SWITCHPLUGINREQUEST_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/SwitchPluginResponse.h b/src/APIs/c_api/include/nav_2d_msgs/SwitchPluginResponse.h new file mode 100644 index 0000000..deaace6 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/SwitchPluginResponse.h @@ -0,0 +1,21 @@ +#ifndef C_API_NAV_2D_MSGS_SWITCHPLUGINRESPONSE_H +#define C_API_NAV_2D_MSGS_SWITCHPLUGINRESPONSE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + uint8_t success; + char *message; +} SwitchPluginResponse; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_SWITCHPLUGINRESPONSE_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Twist2D.h b/src/APIs/c_api/include/nav_2d_msgs/Twist2D.h new file mode 100644 index 0000000..9125feb --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Twist2D.h @@ -0,0 +1,22 @@ +#ifndef C_API_NAV_2D_MSGS_TWIST2D_H +#define C_API_NAV_2D_MSGS_TWIST2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + double x; + double y; + double theta; +} Twist2D; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_TWIST2D_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Twist2D32.h b/src/APIs/c_api/include/nav_2d_msgs/Twist2D32.h new file mode 100644 index 0000000..e42a448 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Twist2D32.h @@ -0,0 +1,22 @@ +#ifndef C_API_NAV_2D_MSGS_TWIST2D32_H +#define C_API_NAV_2D_MSGS_TWIST2D32_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + float x; + float y; + float theta; +} Twist2D32; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_TWIST2D32_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/Twist2DStamped.h b/src/APIs/c_api/include/nav_2d_msgs/Twist2DStamped.h new file mode 100644 index 0000000..a74c638 --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/Twist2DStamped.h @@ -0,0 +1,23 @@ +#ifndef C_API_NAV_2D_MSGS_TWIST2DSTAMPED_H +#define C_API_NAV_2D_MSGS_TWIST2DSTAMPED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "nav_2d_msgs/Twist2D.h" + +typedef struct +{ + Header header; + Twist2D velocity; +} Twist2DStamped; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_TWIST2DSTAMPED_H diff --git a/src/APIs/c_api/include/nav_2d_msgs/UIntBounds.h b/src/APIs/c_api/include/nav_2d_msgs/UIntBounds.h new file mode 100644 index 0000000..ea094fd --- /dev/null +++ b/src/APIs/c_api/include/nav_2d_msgs/UIntBounds.h @@ -0,0 +1,23 @@ +#ifndef C_API_NAV_2D_MSGS_UINTBOUNDS_H +#define C_API_NAV_2D_MSGS_UINTBOUNDS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + uint32_t min_x; + uint32_t min_y; + uint32_t max_x; + uint32_t max_y; +} UIntBounds; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_NAV_2D_MSGS_UINTBOUNDS_H diff --git a/src/APIs/c_api/include/nav_c_api.h b/src/APIs/c_api/include/nav_c_api.h new file mode 100644 index 0000000..a812457 --- /dev/null +++ b/src/APIs/c_api/include/nav_c_api.h @@ -0,0 +1,533 @@ +#ifndef NAVIGATION_C_API_H +#define NAVIGATION_C_API_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + #include + #include + #include + /* C struct types only - do not include convertor.h here (it pulls C++ code into extern "C") */ + #include "std_msgs/Header.h" + #include "geometry_msgs/Point.h" + #include "geometry_msgs/Pose2D.h" + #include "geometry_msgs/PoseStamped.h" + #include "nav_msgs/OccupancyGrid.h" + #include "nav_msgs/Odometry.h" + #include "map_msgs/OccupancyGridUpdate.h" + #include "nav_2d_msgs/Twist2D.h" + #include "nav_2d_msgs/Twist2DStamped.h" + #include "nav_2d_msgs/Path2D.h" + #include "sensor_msgs/LaserScan.h" + #include "sensor_msgs/PointCloud.h" + #include "sensor_msgs/PointCloud2.h" + #include "geometry_msgs/PolygonStamped.h" + #include "protocol_msgs/Order.h" + + typedef struct { char *name; OccupancyGrid grid; } NamedOccupancyGrid; + typedef struct { char *name; LaserScan scan; } NamedLaserScan; + typedef struct { char *name; PointCloud cloud; } NamedPointCloud; + typedef struct { char *name; PointCloud2 cloud; } NamedPointCloud2; + typedef void* NavigationHandle; + typedef void* TFListenerHandle; + + typedef enum + { + PENDING = 0, + ACTIVE = 1, + PREEMPTED = 2, + SUCCEEDED = 3, + ABORTED = 4, + REJECTED = 5, + PREEMPTING = 6, + RECALLING = 7, + RECALLED = 8, + LOST = 9, + PLANNING = 10, + CONTROLLING = 11, + CLEARING = 12, + PAUSED = 13 + } NavigationState; + + typedef struct + { + NavigationState navigation_state; + char *feed_back_str; + Pose2D current_pose; + bool goal_checked; + bool is_ready; + } NavFeedback; + + /** + * @brief Planner data output structure (C version). + * Mirrors robot::move_base_core::PlannerDataOutput in `move_base_core/navigation.h`. + */ + typedef struct + { + Path2D plan; + OccupancyGrid costmap; + OccupancyGridUpdate costmap_update; + bool is_costmap_updated; + PolygonStamped footprint; + } PlannerDataOutput; + + /** + * @brief Free a string allocated by the API (e.g. feed_back_str, navigation_state_to_string result). + * @param str Pointer from strdup; no-op if NULL. + */ + void nav_c_api_free_string(char *str); + + /** + * @brief Name of a navigation state, for logging. + * @return Newly allocated string; free with nav_c_api_free_string(). + */ + char *navigation_state_to_string(NavigationState state); + + /** + * @brief Offset a 2D pose along its own heading. + * @param in_pose Source pose. + * @param frame_id Frame the result is expressed in; must not be NULL. + * @param offset_distance [m] Positive moves forward, negative backward. + * @param out_goal Result. `out_goal.header.frame_id` is allocated — free it with + * nav_c_api_free_string(). + * @return false if @p frame_id is NULL. + */ + bool navigation_offset_goal_2d(const Pose2D &in_pose, const char *frame_id, + double offset_distance, PoseStamped &out_goal); + + /** + * @brief Offset a stamped pose along its own heading, keeping its frame. + * @param in_pose Source pose. + * @param offset_distance [m] Positive moves forward, negative backward. + * @param out_goal Result. `out_goal.header.frame_id` is allocated — free it with + * nav_c_api_free_string(). + */ + bool navigation_offset_goal_stamped(const PoseStamped &in_pose, double offset_distance, + PoseStamped &out_goal); + + /** + * @brief Create a new navigation instance + * @return Navigation handle, or NULL on failure + */ + NavigationHandle navigation_create(void); + + /** + * @brief Destroy a navigation instance + * @param handle Navigation handle to destroy + */ + void navigation_destroy(NavigationHandle handle); + + // ============================================================================ + // Navigation Interface Methods + // ============================================================================ + + /** + * @brief Initialize the navigation system using an existing tf3 buffer (from libtf3 tf3_buffer_create). + * Caller retains ownership of the buffer and must call tf3_buffer_destroy when done (after navigation_destroy). + * @param handle Navigation handle + * @param tf3_buffer Pointer to tf3 BufferCore (TF3_BufferCore from libtf3) + * @return true if the arguments were valid and the call did not throw — **not** whether the core + * actually came up. The underlying contract method returns void, so a runtime that fails + * to build its costmaps or load its plugins still returns here normally. + * + * @warning Blocking and expensive: it builds the costmaps, loads every plugin named in the YAML + * and starts the control thread. Do not call it from a UI thread. + * @warning Push at least one static map with navigation_add_static_map() **before** this call. + * The lattice planner blocks until the costmap has a non-zero size, and aborts the whole + * process if it waits too long. + * @see navigation_initialize_checked() in nav_c_api_2.h, which reports the real outcome. + */ + bool navigation_initialize(NavigationHandle handle, TFListenerHandle tf3_buffer); + + /** + * @brief Set the robot's footprint (outline shape) + * @param handle Navigation handle + * @param points Array of points representing the footprint polygon + * @param point_count Number of points in the array + * @return true on success, false on failure + */ + bool navigation_set_robot_footprint(NavigationHandle handle, const Point *points, size_t point_count); + + /** + * @brief Get the robot's footprint (outline shape) + * @param handle Navigation handle + * @param out_points Array **the caller allocates and owns**. Nothing here is allocated by the + * library, and nothing needs freeing. + * @param out_count Output only — the number of points written. It is NOT read as a capacity. + * @return true on success, false if the footprint is empty or the handle is invalid + * + * @warning The signature carries no capacity, so this function writes as many points as the robot + * footprint has, whatever the array can hold. Size @p out_points for the largest + * footprint the deployment can configure (64 points is comfortable) — a short array is + * overrun, and the corruption will surface somewhere unrelated. + */ + bool navigation_get_robot_footprint(NavigationHandle handle, Point *out_points, size_t &out_count); + + + /** + * @brief Send a goal for the robot to navigate to + * @param handle Navigation handle + * @param goal Target pose in the global frame + * @return true if goal was accepted and sent successfully + */ + bool navigation_move_to(NavigationHandle handle, const PoseStamped goal); + + /** + * @brief Send a goal for the robot to navigate to + * @param handle Navigation handle + * @param order Order message + * @param goal Target pose in the global frame + * @return true if goal was accepted and sent successfully + * @note If order was obtained from convert2COrder(), call order_free(&order) when done + */ + bool navigation_move_to_order(NavigationHandle handle, const Order order, const PoseStamped goal); + + /** + * @brief Send a goal for the robot to navigate to + * @param handle Navigation handle + * @param nodes Nodes array + * @param node_count Number of nodes in the array + * @param edges Edges array + * @param edge_count Number of edges in the array + * @param goal Target pose in the global frame + * @return true if goal was accepted and sent successfully + */ + bool navigation_move_to_nodes_edges(NavigationHandle handle, const Node *nodes, size_t node_count, const Edge *edges, size_t edge_count, const PoseStamped goal); + + /* + * navigation_dock_to, navigation_dock_to_order, navigation_dock_to_nodes_edges, + * navigation_move_straight_to and navigation_rotate_to were removed. They pushed a goal past + * the mission layer, which left them free to replace the leg the mission queue was running + * while the queue kept handing out the next leg of a route the robot had already left. + * + * Docking, go-straight and rotate are now ordinary legs of an order: set `profile:` on the leg + * (`docking | go_straight | rotate`) and `marker` for docking, then send the order through + * navigation_move_to_order() or navigation_move_to_nodes_edges(). + */ + + /** + * @brief Pause the robot's movement + * @param handle Navigation handle + */ + void navigation_pause(NavigationHandle handle); + + /** + * @brief Resume motion after a pause + * @param handle Navigation handle + */ + void navigation_resume(NavigationHandle handle); + + /** + * @brief Cancel the current goal and stop the robot + * @param handle Navigation handle + */ + void navigation_cancel(NavigationHandle handle); + + /** + * @brief Set the linear velocity **ceiling** — not a jog command. + * + * This is the path a safety layer uses to slow the robot down. The value is passed to the core + * exactly as given, sign included: the local planner keeps a separate ceiling per direction and + * **the sign of @p linear_x selects which one this call sets** — negative sets the backward + * ceiling, positive the forward one. + * + * One call therefore sets one direction. To bound both, call twice: + * @code + * navigation_set_twist_linear(h, 0.6, 0.0, 0.0); // forward <= 0.6 m/s + * navigation_set_twist_linear(h, -0.3, 0.0, 0.0); // backward <= 0.3 m/s + * @endcode + * + * @param handle Navigation handle + * @param linear_x [m/s] Ceiling, signed. The sign picks the direction; it is not discarded. + * @param linear_y [m/s] Lateral ceiling (holonomic bases only). + * @param linear_z [m/s] Unused by ground bases. + * @return true if the ceiling was accepted. NaN/Inf are rejected. + * + * @note The new ceiling takes effect on the core's next control cycle, not inside this call. + */ + bool navigation_set_twist_linear(NavigationHandle handle, + double linear_x, double linear_y, double linear_z); + + /** + * @brief Set the angular velocity **ceiling** — not a jog command. + * @param handle Navigation handle + * @param angular_x [rad/s] Unused by ground bases. + * @param angular_y [rad/s] Unused by ground bases. + * @param angular_z [rad/s] Yaw rate ceiling. + * @return true if the ceiling was accepted. NaN/Inf are rejected. + * + * @note Takes effect on the core's next control cycle. + */ + bool navigation_set_twist_angular(NavigationHandle handle, + double angular_x, double angular_y, double angular_z); + + /** + * @brief Get the robot's pose as a PoseStamped + * @param handle Navigation handle + * @param out_pose Output parameter with the robot's current pose + * @return true if pose was successfully retrieved + * @note out_pose.header.frame_id is allocated — free it with nav_c_api_free_string(). + */ + bool navigation_get_robot_pose_stamped(NavigationHandle handle, PoseStamped &out_pose); + + /** + * @brief Get the robot's pose as a 2D pose + * @param handle Navigation handle + * @param out_pose Output parameter with the robot's current 2D pose + * @return true if pose was successfully retrieved + */ + bool navigation_get_robot_pose_2d(NavigationHandle handle, Pose2D &out_pose); + + /** + * @brief Get the robot's current twist + * @param handle Navigation handle + * @param out_twist Output parameter with the robot's current twist + * @return true if twist was successfully retrieved + * @note out_twist->header.frame_id must be freed using nav_c_api_free_string + */ + bool navigation_get_twist(NavigationHandle handle, Twist2DStamped &out_twist); + + /** + * @brief Get navigation feedback + * @param handle Navigation handle + * @param out_feedback Output parameter with navigation feedback + * @return true if feedback was successfully retrieved + * @note The feed_back_str field must be freed using nav_c_api_free_string + */ + bool navigation_get_feedback(NavigationHandle handle, NavFeedback &out_feedback); + + /** + * @brief Add a static map to the navigation system + * @param handle Navigation handle + * @param map_name Name of the map + * @param map Occupancy grid handle + * @return true if the map was added successfully + */ + bool navigation_add_static_map(NavigationHandle handle, const char *map_name, const OccupancyGrid occupancy_grid); + + /** + * @brief Add a laser scan to the navigation system + * @param handle Navigation handle + * @param laser_scan_name Name of the laser scan + * @param laser_scan Laser scan handle + * @return true if the laser scan was added successfully + */ + bool navigation_add_laser_scan(NavigationHandle handle, const char *laser_scan_name, const LaserScan laser_scan); + + /** + * @brief Add a point cloud to the navigation system + * @param handle Navigation handle + * @param point_cloud_name Name of the point cloud + * @param point_cloud Point cloud handle + * @return true if the point cloud was added successfully + */ + bool navigation_add_point_cloud(NavigationHandle handle, const char *point_cloud_name, const PointCloud point_cloud); + + /** + * @brief Add a point cloud2 to the navigation system + * @param handle Navigation handle + * @param point_cloud2_name Name of the point cloud2 + * @param point_cloud2 Point cloud2 handle + * @return true if the point cloud2 was added successfully + */ + bool navigation_add_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, const PointCloud2 point_cloud2); + + /** + * @brief Add an odometry to the navigation system + * @param handle Navigation handle + * @param odometry_name Name of the odometry + * @param odometry Odometry handle + * @return true if the odometry was added successfully + */ + bool navigation_add_odometry(NavigationHandle handle, const char *odometry_name, const Odometry odometry); + + // ========================================================================== + // Reading data back + // + // @warning The four navigation_get_() functions below return true for a name the core has + // never seen: the lookup falls back to a default-constructed message, and this API cannot + // tell that apart from a message that is genuinely empty. Check the payload (a grid with + // width 0, a scan with no ranges) rather than trusting the return value. A misspelt name + // is the most common configuration mistake on the sensor path, and it is exactly the case + // this API stays silent about. + // + // Everything these functions fill is allocated by the library. Release it with the + // matching navigation_free_*() in nav_c_api_2.h. + // ========================================================================== + + /** + * @brief Get a static map from the navigation system + * @param handle Navigation handle + * @param map_name Name of the map + * @param out_map Output parameter for the map handle + * @return true if the call succeeded — see the warning above, this is not "the map exists" + */ + bool navigation_get_static_map(NavigationHandle handle, const char *map_name, OccupancyGrid &out_map); + + /** + * @brief Get a laser scan from the navigation system + * @param handle Navigation handle + * @param laser_scan_name Name of the laser scan + * @param out_scan Output parameter for the laser scan handle + * @return true if the laser scan was retrieved successfully + */ + bool navigation_get_laser_scan(NavigationHandle handle, const char *laser_scan_name, LaserScan &out_scan); + + /** + * @brief Get a point cloud from the navigation system + * @param handle Navigation handle + * @param point_cloud_name Name of the point cloud + * @param out_cloud Output parameter for the point cloud handle + * @return true if the point cloud was retrieved successfully + */ + bool navigation_get_point_cloud(NavigationHandle handle, const char *point_cloud_name, PointCloud &out_cloud); + + /** + * @brief Get a point cloud2 from the navigation system + * @param handle Navigation handle + * @param point_cloud2_name Name of the point cloud2 + * @param out_cloud Output parameter for the point cloud2 handle + * @return true if the point cloud2 was retrieved successfully + */ + bool navigation_get_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, PointCloud2 &out_cloud); + + // ========================================================================== + // Reading every entry at once + // + // @warning The four navigation_get_all_*() functions take an array the CALLER allocates, and the + // signature carries no capacity — @c out_count is an output, never read as a limit. Each + // function writes one element per entry the core currently holds, however large the + // array is. Size the array for the largest number of sensor streams the deployment can + // register; a short array is overrun by whole structs, and the damage surfaces far from + // here. + // + // Each element's `name` and payload are allocated by the library: free `name` with + // nav_c_api_free_string() and the payload with the matching navigation_free_*(). + // ========================================================================== + + /** + * @brief Get all static maps from the navigation system + * @param handle Navigation handle + * @param out_maps Caller-allocated array — see the capacity warning above + * @param out_count Output only: how many entries were written + * @return true if the maps were retrieved successfully + */ + bool navigation_get_all_static_maps(NavigationHandle handle, NamedOccupancyGrid *out_maps, size_t &out_count); + + /** + * @brief Get all laser scans from the navigation system + * @param handle Navigation handle + * @param out_scans Output parameter for the scans array + * @param out_count Output parameter for the number of scans + * @return true if the scans were retrieved successfully + */ + bool navigation_get_all_laser_scans(NavigationHandle handle, NamedLaserScan *out_scans, size_t &out_count); + + /** + * @brief Get all point clouds from the navigation system + * @param handle Navigation handle + * @param out_clouds Output parameter for the clouds array + * @param out_count Output parameter for the number of clouds + * @return true if the clouds were retrieved successfully + */ + bool navigation_get_all_point_clouds(NavigationHandle handle, NamedPointCloud *out_clouds, size_t &out_count); + + /** + * @brief Get all point cloud2s from the navigation system + * @param handle Navigation handle + * @param out_clouds Output parameter for the clouds array + * @param out_count Output parameter for the number of clouds + * @return true if the clouds were retrieved successfully + */ + bool navigation_get_all_point_cloud2s(NavigationHandle handle, NamedPointCloud2 *out_clouds, size_t &out_count); + + /** + * @brief Remove a static map from the navigation system + * @param handle Navigation handle + * @param map_name Name of the map + * @return true if the map was removed successfully + */ + bool navigation_remove_static_map(NavigationHandle handle, const char *map_name); + + /** + * @brief Remove a laser scan from the navigation system + * @param handle Navigation handle + * @param laser_scan_name Name of the laser scan + * @return true if the laser scan was removed successfully + */ + bool navigation_remove_laser_scan(NavigationHandle handle, const char *laser_scan_name); + + /** + * @brief Remove a point cloud from the navigation system + * @param handle Navigation handle + * @param point_cloud_name Name of the point cloud + * @return true if the point cloud was removed successfully + */ + bool navigation_remove_point_cloud(NavigationHandle handle, const char *point_cloud_name); + + /** + * @brief Remove a point cloud2 from the navigation system + * @param handle Navigation handle + * @param point_cloud2_name Name of the point cloud2 + * @return true if the point cloud2 was removed successfully + */ + bool navigation_remove_point_cloud2(NavigationHandle handle, const char *point_cloud2_name); + + /** + * @brief Remove all static maps from the navigation system + * @param handle Navigation handle + * @return true if the maps were removed successfully + */ + bool navigation_remove_all_static_maps(NavigationHandle handle); + + /** + * @brief Remove all laser scans from the navigation system + * @param handle Navigation handle + * @return true if the scans were removed successfully + */ + bool navigation_remove_all_laser_scans(NavigationHandle handle); + + /** + * @brief Remove all point clouds from the navigation system + * @param handle Navigation handle + * @return true if the clouds were removed successfully + */ + bool navigation_remove_all_point_clouds(NavigationHandle handle); + + /** + * @brief Remove all point cloud2s from the navigation system + * @param handle Navigation handle + * @return true if the cloud2s were removed successfully + */ + bool navigation_remove_all_point_cloud2s(NavigationHandle handle); + + /** + * @brief Remove all data from the navigation system + * @param handle Navigation handle + * @return true if the data was removed successfully + */ + bool navigation_remove_all_data(NavigationHandle handle); + + /** + * @brief Get the global data from the navigation system + * @param handle Navigation handle + * @param out_data Output parameter for the data + * @return true if the data was retrieved successfully + */ + bool navigation_get_global_data(NavigationHandle handle, PlannerDataOutput *out_data); + + /** + * @brief Get the local data from the navigation system + * @param handle Navigation handle + * @param out_data Output parameter for the data + * @return true if the data was retrieved successfully + */ + bool navigation_get_local_data(NavigationHandle handle, PlannerDataOutput *out_data); + +#ifdef __cplusplus +} +#endif + +#endif // NAVIGATION_C_API_H diff --git a/src/APIs/c_api/include/nav_c_api_2.h b/src/APIs/c_api/include/nav_c_api_2.h new file mode 100644 index 0000000..c55ed6c --- /dev/null +++ b/src/APIs/c_api/include/nav_c_api_2.h @@ -0,0 +1,323 @@ +#ifndef NAVIGATION_C_API_2_H +#define NAVIGATION_C_API_2_H + +/** + * @file nav_c_api_2.h + * @brief Additional C entry points required by the move_base2 navigation runtime. + * + * ## What this file is + * + * `nav_c_api.h` covers the navigation contract as the previous runtime exposed it. Every one of + * those functions keeps working against move_base2 — move_base2 implements + * `robot::move_base_core::BaseNavigation` with the signatures unchanged, so no existing binding + * breaks. This file adds what that contract gained but the C surface never exposed, plus the two + * entry points move_base2 makes newly necessary: + * + * - navigation_shutdown() — quiesce the core before destroying it. + * - navigation_is_ready() — did initialize() actually succeed? + * - navigation_initialize_checked() — initialize + verify, in one call. + * - navigation_get_state() — poll the state without allocating a string. + * - navigation_get_status_text() — the core's own explanation, for logging. + * - navigation_add_depth_camera_data() — the depth-camera input path, never exposed before. + * - navigation_move_to_order_v2() — an order carrying a real orderId / orderUpdateId. + * - navigation_execute_instant_actions() — a VDA5050 instantActions message, expanded like node actions. + * + * Include this header **in addition to** nav_c_api.h. It adds symbols; it replaces none. + * + * ## What changed underneath the functions you already call + * + * These keep their signatures and their meaning, but behave differently enough to matter: + * + * 1. navigation_initialize() is now heavy and blocking — it builds both costmaps, loads the + * planners, the controller, the recovery behaviours and the mission layer, then starts the + * control thread. It still returns `true` unconditionally because the underlying contract + * returns void. Use navigation_initialize_checked(), or call navigation_is_ready() after it. + * + * 2. A static map must be pushed **before** initialize(). The lattice planner blocks until the + * costmap has a non-zero size, and that size only exists once a static map has reached the + * static layer. It aborts the whole process if it waits too long. + * + * 3. navigation_set_robot_footprint() may now be called before initialize() — the footprint is + * cached and applied while the costmaps are built. Under the old runtime the same call was + * dropped silently because the costmaps did not exist yet. + * + * 4. navigation_pause() / _resume() / _cancel() no longer take effect inside the call. They record + * the request; the control thread applies it on its next cycle. Returning from the call does + * not mean the robot stopped — watch the state, or watch the twist. + * + * 5. navigation_set_twist_linear() / _angular() set a velocity **ceiling**, and the sign of the + * linear x component selects which direction the ceiling applies to. They now only reject + * NaN/Inf; the old runtime also returned false while a cancel was in flight, and that signal no + * longer exists. The new ceiling takes effect on the next control cycle. + * + * 6. navigation_get_twist() returns the command being issued, not a measurement. While no request + * is running its stamp stops advancing; a zero stamp means the core has never commanded + * anything. Check the stamp before republishing it as a velocity command. + * + * 7. NavFeedback.feed_back_str now carries the core's own reason strings — different text from the + * old runtime. Branch on NavigationState, never on the string. + * + * 8. NavFeedback.navigation_state deliberately reports ACTIVE between the legs of a multi-leg + * order, where the core itself is momentarily SUCCEEDED or PENDING. Treating SUCCEEDED as "the + * order finished" stays correct only because of that; do not bypass it. + * + * 9. navigation_add_odometry() feeds the controller's measured velocity every cycle, not just a + * stored value. Push it at the rate the odometry source produces it. + * + * 10. The `footprint` field of navigation_get_global_data() / _local_data() is the raw footprint the + * host set, in the robot base frame, and it is empty if the host never set one. The old runtime + * returned the padded footprint already transformed to the robot pose in the global frame. + * + * 11. navigation_destroy() alone is no longer enough — call navigation_shutdown() first, from a + * point in your own shutdown sequence where the process is still fully alive. + * + * See NAV_C_API_2_GUIDE.md in this directory for the per-function walkthrough and the startup and + * shutdown sequences. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include +#include + +#include "nav_c_api.h" +#include "sensor_msgs/DepthCameraData.h" +#include "sensor_msgs/LaserScan.h" +#include "sensor_msgs/PointCloud.h" +#include "sensor_msgs/PointCloud2.h" +#include "nav_msgs/OccupancyGrid.h" +#include "protocol_msgs/Node.h" +#include "protocol_msgs/Edge.h" + + // ============================================================================================ + // Lifecycle + // ============================================================================================ + + /** + * @brief Initialize the navigation core and report whether it actually came up. + * + * Wraps navigation_initialize(). The underlying contract method returns void, so every failure + * path inside the runtime — costmap construction, sensor configuration, plugin loading, control + * loop configuration, control thread startup — returns normally and only records the reason in + * the feedback. This function reads that back and turns it into a return value. + * + * Blocking and expensive: it builds two costmaps, loads every plugin named in the YAML, starts + * the map-update threads, the mission threads and the control thread. Do not call it from a UI + * thread. + * + * @param handle Navigation handle from navigation_create(). + * @param tf3_buffer tf3 BufferCore the host owns; must outlive the navigation instance. + * @return true only when the core is ready to accept goals. + * + * @pre At least one static map has been pushed with navigation_add_static_map(). + * @pre The robot footprint has been set with navigation_set_robot_footprint(), if the host wants + * its own footprint rather than the one in the YAML. + * @see navigation_get_status_text() for the reason behind a false return. + */ + bool navigation_initialize_checked(NavigationHandle handle, TFListenerHandle tf3_buffer); + + /** + * @brief Is the core initialized and accepting goals? + * + * Cheap enough to poll. Reads the same flag navigation_initialize_checked() checks, without + * allocating the feedback string. + * + * @return false if the handle is null, the core never initialized, or initialization failed. + */ + bool navigation_is_ready(NavigationHandle handle); + + /** + * @brief Stop the core's threads without destroying the instance. + * + * Gives the host a point inside its own shutdown sequence — while the process is still fully + * alive — to stop the control thread, the costmap update threads and the mission threads. + * Destroying the instance from a finalizer, after the runtime has already begun tearing down, is + * the race this exists to avoid. + * + * After this call the core issues no further velocity commands, and every getter + * (navigation_get_feedback, navigation_get_twist, navigation_get_robot_pose_*) remains safe to + * call. Safe to call more than once. + * + * @warning No thread may be calling navigation_add_* while this runs, and none may call them + * afterwards. The sensor path is not thread-safe and there is no longer a control thread + * consuming what it produces. + */ + void navigation_shutdown(NavigationHandle handle); + + // ============================================================================================ + // Status + // ============================================================================================ + + /** + * @brief Current navigation state, without allocating anything. + * + * navigation_get_feedback() strdup()s its message on every call, so polling it at control rate + * means one allocation and one free per poll — and one leak per missed free. Use this when only + * the state matters, which is the common case. + * + * @param handle Navigation handle. + * @param out_state Receives the current state; untouched on failure. + * @return false if the handle is null or the core has no feedback yet. + */ + bool navigation_get_state(NavigationHandle handle, NavigationState *out_state); + + /** + * @brief The core's own description of what it is doing, or why it refused. + * + * For logging and diagnostics only. The wording comes from the runtime and changes between + * versions — never branch on it. Branch on navigation_get_state(). + * + * @return Newly allocated string, or NULL. Free with nav_c_api_free_string(). + */ + char *navigation_get_status_text(NavigationHandle handle); + + // ============================================================================================ + // Sensor input + // ============================================================================================ + + /** + * @brief Push one coherent depth-camera sample into the navigation core. + * + * This is the only way to reach the depth-camera path from C. The voxel layer projects the depth + * image through the intrinsics to build the camera frustum, which is what lets it *clear* stale + * obstacles inside the field of view. A point cloud cannot substitute: it carries no intrinsics, + * so no frustum can be reconstructed and nothing gets cleared. + * + * @param handle Navigation handle. + * @param topic Logical name of the stream. Must match an `observation_source` declared for the + * voxel layer in the costmap YAML — a name no layer subscribes to is accepted here + * and then dropped, silently, further down. + * @param data Depth image and its matching intrinsics. Deep-copied; the caller may release its + * buffers as soon as this returns. + * @return true if the sample was accepted. + * + * @pre `data.header.frame_id` is the camera's optical frame, and a transform from it to the robot + * base frame exists in the tf3 buffer at `data.header.stamp`. + * @pre `data.depth.encoding` matches the real encoding ("16UC1" or "32FC1") and `step` is the + * real row stride in bytes. + * @pre `data.camera_info` describes the resolution actually being sent, not the colour stream's. + * @pre The depth image and the camera info come from the same instant. + * + * @note Push at the camera's real rate. This is the most expensive sensor path in the core; + * pushing faster than the source only burns CPU. + */ + bool navigation_add_depth_camera_data(NavigationHandle handle, const char *topic, + const DepthCameraData data); + + // ============================================================================================ + // Orders + // ============================================================================================ + + /** + * @brief Send a multi-node order with a real identity. + * + * Under move_base2 an order goes through the mission layer, which splits it into legs at the + * nodes that carry actions, filters by `released`, and can extend the route when the fleet master + * releases more of the horizon. `orderId` plus `orderUpdateId` is what identifies an order there: + * the same `orderId` with a higher `orderUpdateId` is an update of the route in progress, while a + * different `orderId` is a new order that replaces it. + * + * navigation_move_to_nodes_edges() cannot express that — it has nowhere to put either field — so + * every call looks like a different order and no update can ever be sent. Use this instead + * whenever the fleet master sends order updates or releases the horizon progressively. + * + * @param handle Navigation handle. + * @param order_id VDA5050 orderId. Must not be NULL or empty. + * @param order_update_id VDA5050 orderUpdateId. Must increase within one orderId. + * @param nodes Node array; the host keeps ownership. + * @param node_count Number of nodes. + * @param edges Edge array; the host keeps ownership. + * @param edge_count Number of edges. + * @param goal Final pose, in the global frame. + * @return true if the order was accepted. + */ + bool navigation_move_to_order_v2(NavigationHandle handle, + const char *order_id, uint32_t order_update_id, + const Node *nodes, size_t node_count, + const Edge *edges, size_t edge_count, + const PoseStamped goal); + + /* + * navigation_dock_to_order_v2 was removed. Docking is a per-leg property of the order now: set + * `profile: docking` and `marker` on the leg, then send it through navigation_move_to_order_v2. + */ + + /** + * @brief Run one VDA5050 `instantActions` message — the whole list, as one batch. + * + * Each action is expanded against the same compound-action table that node actions use, so + * `PickUp` sent as an instantAction produces the same detect / approach / lift / back-out + * sequence it produces inside an order. One vocabulary, one set of handlers, one meaning per + * actionType regardless of how it arrived. + * + * Pass the message's actions together rather than calling this once per action: a second `HARD` + * action submitted on its own preempts and wipes the legs of the first, so two actions sent in + * one message would eat each other. + * + * Execution stops at the first leg that fails and the rest of the message is dropped with it, so + * the caller reports ONE outcome for the message — which is all VDA5050 asks for. + * + * `blockingType` decides how the batch meets a running order: any `HARD` action makes the whole + * message preempt it, otherwise it queues behind it. `NONE` requests execution in parallel with + * driving, which this runtime cannot do — it is queued instead and the narrowing is logged. An + * unset or unknown blockingType is treated as `HARD`, the safe direction. + * + * Do NOT route `cancelOrder`, `startPause` or `stopPause` here. Those steer the queue rather + * than being work in it: call navigation_cancel(), navigation_pause() and navigation_resume(). + * + * Progress is reported through the ordinary state, not per action: poll navigation_get_state() + * and map ACTIVE/CONTROLLING to RUNNING, SUCCEEDED to FINISHED, ABORTED/PREEMPTED to FAILED. + * That mapping is only unambiguous while this message is the only work in the queue, which holds + * as long as the fleet master sends one message at a time and none during an order. + * + * @param handle Navigation handle. + * @param actions Array of actions, in the order received. The host keeps ownership. + * @param count Number of actions. Must be > 0. + * @return true if the message was accepted. false means rejected outright — report it failed + * rather than waiting for a result that will not come. + */ + bool navigation_execute_instant_actions(NavigationHandle handle, const Action *actions, + size_t count); + + // ============================================================================================ + // Releasing what the getters allocate + // ============================================================================================ + // + // Every navigation_get_* function that returns a grid, a scan, a cloud or a plan fills it with + // buffers allocated inside the library. Only two release helpers ever shipped — + // nav_c_api_free_string() and order_free() — so the rest had no counterpart and leaked one + // allocation per call. At four display timers polling at 10 Hz that is a steady leak, not a + // rounding error. These close it. + // + // All are null-safe, clear the pointers and counts they release, and are safe to call twice. + + /** @brief Release the buffers inside an OccupancyGrid filled by navigation_get_static_map(). */ + void navigation_free_occupancy_grid(OccupancyGrid *grid); + + /** @brief Release the buffers inside a LaserScan filled by navigation_get_laser_scan(). */ + void navigation_free_laser_scan(LaserScan *scan); + + /** @brief Release the buffers inside a PointCloud filled by navigation_get_point_cloud(). */ + void navigation_free_point_cloud(PointCloud *cloud); + + /** @brief Release the buffers inside a PointCloud2 filled by navigation_get_point_cloud2(). */ + void navigation_free_point_cloud2(PointCloud2 *cloud); + + /** + * @brief Release the buffers inside a PlannerDataOutput. + * + * navigation_get_global_data() / _local_data() already release the previous contents of the + * struct they are handed, so reusing one struct across polls does not leak. What does leak is the + * last fill, once the host stops polling — free it here. + */ + void navigation_free_planner_data(PlannerDataOutput *data); + +#ifdef __cplusplus +} +#endif + +#endif // NAVIGATION_C_API_2_H diff --git a/src/APIs/c_api/include/nav_msgs/ActionTypes.h b/src/APIs/c_api/include/nav_msgs/ActionTypes.h new file mode 100644 index 0000000..325800b --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/ActionTypes.h @@ -0,0 +1,29 @@ + #ifndef C_API_NAV_MSGS_ACTIONTYPES_H + #define C_API_NAV_MSGS_ACTIONTYPES_H + + #ifdef __cplusplus + extern "C" { + #endif + + #include + #include + #include "std_msgs/Time.h" + + typedef struct + { + Time stamp; + char *id; + } GoalID; + + typedef struct + { + GoalID goal_id; + uint8_t status; + char *text; + } GoalStatus; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_ACTIONTYPES_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMap.h b/src/APIs/c_api/include/nav_msgs/GetMap.h new file mode 100644 index 0000000..dc9fc25 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMap.h @@ -0,0 +1,23 @@ + #ifndef C_API_NAV_MSGS_GETMAP_H + #define C_API_NAV_MSGS_GETMAP_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/GetMapRequest.h" +#include "nav_msgs/GetMapResponse.h" + +typedef struct +{ + GetMapRequest request; + GetMapResponse response; +} GetMap; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAP_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapAction.h b/src/APIs/c_api/include/nav_msgs/GetMapAction.h new file mode 100644 index 0000000..8a7321e --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapAction.h @@ -0,0 +1,25 @@ + #ifndef C_API_NAV_MSGS_GETMAPACTION_H + #define C_API_NAV_MSGS_GETMAPACTION_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/GetMapActionGoal.h" +#include "nav_msgs/GetMapActionResult.h" +#include "nav_msgs/GetMapActionFeedback.h" + +typedef struct +{ + GetMapActionGoal action_goal; + GetMapActionResult action_result; + GetMapActionFeedback action_feedback; +} GetMapAction; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPACTION_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapActionFeedback.h b/src/APIs/c_api/include/nav_msgs/GetMapActionFeedback.h new file mode 100644 index 0000000..cfb8091 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapActionFeedback.h @@ -0,0 +1,25 @@ + #ifndef C_API_NAV_MSGS_GETMAPACTIONFEEDBACK_H + #define C_API_NAV_MSGS_GETMAPACTIONFEEDBACK_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "std_msgs/Header.h" +#include "nav_msgs/ActionTypes.h" +#include "nav_msgs/GetMapFeedback.h" + +typedef struct +{ + Header header; + GoalStatus status; + GetMapFeedback feedback; +} GetMapActionFeedback; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPACTIONFEEDBACK_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapActionGoal.h b/src/APIs/c_api/include/nav_msgs/GetMapActionGoal.h new file mode 100644 index 0000000..27e6926 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapActionGoal.h @@ -0,0 +1,25 @@ + #ifndef C_API_NAV_MSGS_GETMAPACTIONGOAL_H + #define C_API_NAV_MSGS_GETMAPACTIONGOAL_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "std_msgs/Header.h" +#include "nav_msgs/ActionTypes.h" +#include "nav_msgs/GetMapGoal.h" + +typedef struct +{ + Header header; + GoalID goal_id; + GetMapGoal goal; +} GetMapActionGoal; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPACTIONGOAL_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapActionResult.h b/src/APIs/c_api/include/nav_msgs/GetMapActionResult.h new file mode 100644 index 0000000..6068a0d --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapActionResult.h @@ -0,0 +1,25 @@ + #ifndef C_API_NAV_MSGS_GETMAPACTIONRESULT_H + #define C_API_NAV_MSGS_GETMAPACTIONRESULT_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "std_msgs/Header.h" +#include "nav_msgs/ActionTypes.h" +#include "nav_msgs/GetMapResult.h" + +typedef struct +{ + Header header; + GoalStatus status; + GetMapResult result; +} GetMapActionResult; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPACTIONRESULT_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapFeedback.h b/src/APIs/c_api/include/nav_msgs/GetMapFeedback.h new file mode 100644 index 0000000..818d346 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapFeedback.h @@ -0,0 +1,20 @@ + #ifndef C_API_NAV_MSGS_GETMAPFEEDBACK_H + #define C_API_NAV_MSGS_GETMAPFEEDBACK_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include + +typedef struct +{ + uint8_t _dummy; +} GetMapFeedback; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPFEEDBACK_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapGoal.h b/src/APIs/c_api/include/nav_msgs/GetMapGoal.h new file mode 100644 index 0000000..4af2dc8 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapGoal.h @@ -0,0 +1,20 @@ + #ifndef C_API_NAV_MSGS_GETMAPGOAL_H + #define C_API_NAV_MSGS_GETMAPGOAL_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include + +typedef struct +{ + uint8_t _dummy; +} GetMapGoal; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPGOAL_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapRequest.h b/src/APIs/c_api/include/nav_msgs/GetMapRequest.h new file mode 100644 index 0000000..cc53cf1 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapRequest.h @@ -0,0 +1,20 @@ + #ifndef C_API_NAV_MSGS_GETMAPREQUEST_H + #define C_API_NAV_MSGS_GETMAPREQUEST_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include + +typedef struct +{ + uint8_t _dummy; +} GetMapRequest; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPREQUEST_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapResponse.h b/src/APIs/c_api/include/nav_msgs/GetMapResponse.h new file mode 100644 index 0000000..e00c11f --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapResponse.h @@ -0,0 +1,21 @@ + #ifndef C_API_NAV_MSGS_GETMAPRESPONSE_H + #define C_API_NAV_MSGS_GETMAPRESPONSE_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/OccupancyGrid.h" + +typedef struct +{ + OccupancyGrid map; +} GetMapResponse; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPRESPONSE_H diff --git a/src/APIs/c_api/include/nav_msgs/GetMapResult.h b/src/APIs/c_api/include/nav_msgs/GetMapResult.h new file mode 100644 index 0000000..011ff51 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetMapResult.h @@ -0,0 +1,21 @@ + #ifndef C_API_NAV_MSGS_GETMAPRESULT_H + #define C_API_NAV_MSGS_GETMAPRESULT_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/OccupancyGrid.h" + +typedef struct +{ + OccupancyGrid map; +} GetMapResult; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETMAPRESULT_H diff --git a/src/APIs/c_api/include/nav_msgs/GetPlan.h b/src/APIs/c_api/include/nav_msgs/GetPlan.h new file mode 100644 index 0000000..a1830c4 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetPlan.h @@ -0,0 +1,23 @@ + #ifndef C_API_NAV_MSGS_GETPLAN_H + #define C_API_NAV_MSGS_GETPLAN_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/GetPlanRequest.h" +#include "nav_msgs/GetPlanResponse.h" + +typedef struct +{ + GetPlanRequest request; + GetPlanResponse response; +} GetPlan; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETPLAN_H diff --git a/src/APIs/c_api/include/nav_msgs/GetPlanRequest.h b/src/APIs/c_api/include/nav_msgs/GetPlanRequest.h new file mode 100644 index 0000000..0ba5658 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetPlanRequest.h @@ -0,0 +1,23 @@ + #ifndef C_API_NAV_MSGS_GETPLANREQUEST_H + #define C_API_NAV_MSGS_GETPLANREQUEST_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "geometry_msgs/PoseStamped.h" + +typedef struct +{ + PoseStamped start; + PoseStamped goal; + float tolerance; +} GetPlanRequest; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETPLANREQUEST_H diff --git a/src/APIs/c_api/include/nav_msgs/GetPlanResponse.h b/src/APIs/c_api/include/nav_msgs/GetPlanResponse.h new file mode 100644 index 0000000..2215632 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GetPlanResponse.h @@ -0,0 +1,21 @@ + #ifndef C_API_NAV_MSGS_GETPLANRESPONSE_H + #define C_API_NAV_MSGS_GETPLANRESPONSE_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/Path.h" + +typedef struct +{ + Path plan; +} GetPlanResponse; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GETPLANRESPONSE_H diff --git a/src/APIs/c_api/include/nav_msgs/GridCells.h b/src/APIs/c_api/include/nav_msgs/GridCells.h new file mode 100644 index 0000000..ed7f331 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/GridCells.h @@ -0,0 +1,26 @@ + #ifndef C_API_NAV_MSGS_GRIDCELLS_H + #define C_API_NAV_MSGS_GRIDCELLS_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Point.h" + +typedef struct +{ + Header header; + float cell_width; + float cell_height; + Point *cells; + size_t cells_count; +} GridCells; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_GRIDCELLS_H diff --git a/src/APIs/c_api/include/nav_msgs/LoadMap.h b/src/APIs/c_api/include/nav_msgs/LoadMap.h new file mode 100644 index 0000000..8cb1b90 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/LoadMap.h @@ -0,0 +1,23 @@ + #ifndef C_API_NAV_MSGS_LOADMAP_H + #define C_API_NAV_MSGS_LOADMAP_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/LoadMapRequest.h" +#include "nav_msgs/LoadMapResponse.h" + +typedef struct +{ + LoadMapRequest request; + LoadMapResponse response; +} LoadMap; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_LOADMAP_H diff --git a/src/APIs/c_api/include/nav_msgs/LoadMapRequest.h b/src/APIs/c_api/include/nav_msgs/LoadMapRequest.h new file mode 100644 index 0000000..f3735c8 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/LoadMapRequest.h @@ -0,0 +1,20 @@ + #ifndef C_API_NAV_MSGS_LOADMAPREQUEST_H + #define C_API_NAV_MSGS_LOADMAPREQUEST_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include + +typedef struct +{ + char *map_url; +} LoadMapRequest; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_LOADMAPREQUEST_H diff --git a/src/APIs/c_api/include/nav_msgs/LoadMapResponse.h b/src/APIs/c_api/include/nav_msgs/LoadMapResponse.h new file mode 100644 index 0000000..699a780 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/LoadMapResponse.h @@ -0,0 +1,23 @@ + #ifndef C_API_NAV_MSGS_LOADMAPRESPONSE_H + #define C_API_NAV_MSGS_LOADMAPRESPONSE_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include +#include "nav_msgs/OccupancyGrid.h" + +typedef struct +{ + OccupancyGrid map; + bool result; +} LoadMapResponse; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_LOADMAPRESPONSE_H diff --git a/src/APIs/c_api/include/nav_msgs/MapMetaData.h b/src/APIs/c_api/include/nav_msgs/MapMetaData.h new file mode 100644 index 0000000..90ba28a --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/MapMetaData.h @@ -0,0 +1,26 @@ + #ifndef C_API_NAV_MSGS_MAPMETADATA_H + #define C_API_NAV_MSGS_MAPMETADATA_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "std_msgs/Time.h" +#include "geometry_msgs/Pose.h" + +typedef struct +{ + Time map_load_time; + float resolution; + uint32_t width; + uint32_t height; + Pose origin; +} MapMetaData; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_MAPMETADATA_H diff --git a/src/APIs/c_api/include/nav_msgs/OccupancyGrid.h b/src/APIs/c_api/include/nav_msgs/OccupancyGrid.h new file mode 100644 index 0000000..eae5454 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/OccupancyGrid.h @@ -0,0 +1,25 @@ + #ifndef C_API_NAV_MSGS_OCCUPANCYGRID_H + #define C_API_NAV_MSGS_OCCUPANCYGRID_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "std_msgs/Header.h" +#include "nav_msgs/MapMetaData.h" + +typedef struct +{ + Header header; + MapMetaData info; + int8_t *data; + size_t data_count; +} OccupancyGrid; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_OCCUPANCYGRID_H diff --git a/src/APIs/c_api/include/nav_msgs/Odometry.h b/src/APIs/c_api/include/nav_msgs/Odometry.h new file mode 100644 index 0000000..972a1d9 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/Odometry.h @@ -0,0 +1,35 @@ + #ifndef C_API_NAV_MSGS_ODOMETRY_H + #define C_API_NAV_MSGS_ODOMETRY_H + + #ifdef __cplusplus + extern "C" { + #endif + + #include + #include + #include "std_msgs/Header.h" + #include "geometry_msgs/PoseWithCovariance.h" + #include "geometry_msgs/TwistWithCovariance.h" + + typedef struct + { + Header header; + char *child_frame_id; + PoseWithCovariance pose; + TwistWithCovariance twist; + } Odometry; + + + extern "C" Odometry odometry_create(void); + + extern "C" Odometry odometry_set_data( + Header header, + char *child_frame_id, + PoseWithCovariance pose, + TwistWithCovariance twist); + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_ODOMETRY_H diff --git a/src/APIs/c_api/include/nav_msgs/Path.h b/src/APIs/c_api/include/nav_msgs/Path.h new file mode 100644 index 0000000..53b6a45 --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/Path.h @@ -0,0 +1,24 @@ + #ifndef C_API_NAV_MSGS_PATH_H + #define C_API_NAV_MSGS_PATH_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/PoseStamped.h" + +typedef struct +{ + Header header; + PoseStamped *poses; + size_t poses_count; +} Path; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_PATH_H diff --git a/src/APIs/c_api/include/nav_msgs/SetMap.h b/src/APIs/c_api/include/nav_msgs/SetMap.h new file mode 100644 index 0000000..aa76a7e --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/SetMap.h @@ -0,0 +1,23 @@ + #ifndef C_API_NAV_MSGS_SETMAP_H + #define C_API_NAV_MSGS_SETMAP_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/SetMapRequest.h" +#include "nav_msgs/SetMapResponse.h" + +typedef struct +{ + SetMapRequest request; + SetMapResponse response; +} SetMap; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_SETMAP_H diff --git a/src/APIs/c_api/include/nav_msgs/SetMapRequest.h b/src/APIs/c_api/include/nav_msgs/SetMapRequest.h new file mode 100644 index 0000000..284372c --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/SetMapRequest.h @@ -0,0 +1,23 @@ + #ifndef C_API_NAV_MSGS_SETMAPREQUEST_H + #define C_API_NAV_MSGS_SETMAPREQUEST_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include "nav_msgs/OccupancyGrid.h" +#include "geometry_msgs/PoseWithCovariance.h" + +typedef struct +{ + OccupancyGrid map; + PoseWithCovariance initial_pose; +} SetMapRequest; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_SETMAPREQUEST_H diff --git a/src/APIs/c_api/include/nav_msgs/SetMapResponse.h b/src/APIs/c_api/include/nav_msgs/SetMapResponse.h new file mode 100644 index 0000000..b5ac1ed --- /dev/null +++ b/src/APIs/c_api/include/nav_msgs/SetMapResponse.h @@ -0,0 +1,21 @@ + #ifndef C_API_NAV_MSGS_SETMAPRESPONSE_H + #define C_API_NAV_MSGS_SETMAPRESPONSE_H + + #ifdef __cplusplus + extern "C" { + #endif + +#include +#include +#include + +typedef struct +{ + bool success; +} SetMapResponse; + + #ifdef __cplusplus + } + #endif + + #endif // C_API_NAV_MSGS_SETMAPRESPONSE_H diff --git a/src/APIs/c_api/include/protocol_msgs/Action.h b/src/APIs/c_api/include/protocol_msgs/Action.h new file mode 100644 index 0000000..08d2650 --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Action.h @@ -0,0 +1,30 @@ +#ifndef C_API_PROTOCOL_MSGS_ACTION_H +#define C_API_PROTOCOL_MSGS_ACTION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/ActionParameter.h" + +#define PROTOCOL_MSGS_ACTION_BLOCKING_NONE "NONE" +#define PROTOCOL_MSGS_ACTION_BLOCKING_SOFT "SOFT" +#define PROTOCOL_MSGS_ACTION_BLOCKING_HARD "HARD" + +typedef struct +{ + char *actionType; + char *actionId; + char *actionDescription; + char *blockingType; + ActionParameter *actionParameters; + size_t actionParameters_count; +} Action; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_ACTION_H diff --git a/src/APIs/c_api/include/protocol_msgs/ActionParameter.h b/src/APIs/c_api/include/protocol_msgs/ActionParameter.h new file mode 100644 index 0000000..423ed79 --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/ActionParameter.h @@ -0,0 +1,21 @@ +#ifndef C_API_PROTOCOL_MSGS_ACTIONPARAMETER_H +#define C_API_PROTOCOL_MSGS_ACTIONPARAMETER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + char *key; + char *value; +} ActionParameter; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_ACTIONPARAMETER_H diff --git a/src/APIs/c_api/include/protocol_msgs/ControlPoint.h b/src/APIs/c_api/include/protocol_msgs/ControlPoint.h new file mode 100644 index 0000000..17ec8dd --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/ControlPoint.h @@ -0,0 +1,22 @@ +#ifndef C_API_PROTOCOL_MSGS_CONTROLPOINT_H +#define C_API_PROTOCOL_MSGS_CONTROLPOINT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + double x; + double y; + double weight; +} ControlPoint; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_CONTROLPOINT_H diff --git a/src/APIs/c_api/include/protocol_msgs/Edge.h b/src/APIs/c_api/include/protocol_msgs/Edge.h new file mode 100644 index 0000000..aeb791c --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Edge.h @@ -0,0 +1,42 @@ +#ifndef C_API_PROTOCOL_MSGS_EDGE_H +#define C_API_PROTOCOL_MSGS_EDGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/Trajectory.h" +#include "protocol_msgs/Action.h" + +#define PROTOCOL_MSGS_EDGE_ORIENTATION_GLOBAL "GLOBAL" +#define PROTOCOL_MSGS_EDGE_ORIENTATION_TANGENTIAL "TANGENTIAL" + +typedef struct +{ + char *edgeId; + int32_t sequenceId; + char *edgeDescription; + uint8_t released; + char *startNodeId; + char *endNodeId; + double maxSpeed; + double maxHeight; + double minHeight; + double orientation; + char *orientationType; + char *direction; + uint8_t rotationAllowed; + double maxRotationSpeed; + Trajectory trajectory; + double length; + Action *actions; + size_t actions_count; +} Edge; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_EDGE_H diff --git a/src/APIs/c_api/include/protocol_msgs/Error.h b/src/APIs/c_api/include/protocol_msgs/Error.h new file mode 100644 index 0000000..2a4b8f5 --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Error.h @@ -0,0 +1,28 @@ +#ifndef C_API_PROTOCOL_MSGS_ERROR_H +#define C_API_PROTOCOL_MSGS_ERROR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/ErrorReference.h" + +#define PROTOCOL_MSGS_ERROR_LEVEL_WARNING "WARNING" +#define PROTOCOL_MSGS_ERROR_LEVEL_FATAL "FATAL" + +typedef struct +{ + char *errorType; + ErrorReference *errorReferences; + size_t errorReferences_count; + char *errorDescription; + char *errorLevel; +} Error; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_ERROR_H diff --git a/src/APIs/c_api/include/protocol_msgs/ErrorReference.h b/src/APIs/c_api/include/protocol_msgs/ErrorReference.h new file mode 100644 index 0000000..5bb3d78 --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/ErrorReference.h @@ -0,0 +1,21 @@ +#ifndef C_API_PROTOCOL_MSGS_ERRORREFERENCE_H +#define C_API_PROTOCOL_MSGS_ERRORREFERENCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + char *referenceKey; + char *referenceValue; +} ErrorReference; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_ERRORREFERENCE_H diff --git a/src/APIs/c_api/include/protocol_msgs/Info.h b/src/APIs/c_api/include/protocol_msgs/Info.h new file mode 100644 index 0000000..2657bd3 --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Info.h @@ -0,0 +1,28 @@ +#ifndef C_API_PROTOCOL_MSGS_INFO_H +#define C_API_PROTOCOL_MSGS_INFO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/InfoReference.h" + +#define PROTOCOL_MSGS_INFO_LEVEL_DEBUG "DEBUG" +#define PROTOCOL_MSGS_INFO_LEVEL_INFO "INFO" + +typedef struct +{ + char *infoType; + InfoReference *infoReferences; + size_t infoReferences_count; + char *infoDescription; + char *infoLevel; +} Info; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_INFO_H diff --git a/src/APIs/c_api/include/protocol_msgs/InfoReference.h b/src/APIs/c_api/include/protocol_msgs/InfoReference.h new file mode 100644 index 0000000..d6cd08b --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/InfoReference.h @@ -0,0 +1,21 @@ +#ifndef C_API_PROTOCOL_MSGS_INFOREFERENCE_H +#define C_API_PROTOCOL_MSGS_INFOREFERENCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + char *referenceKey; + char *referenceValue; +} InfoReference; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_INFOREFERENCE_H diff --git a/src/APIs/c_api/include/protocol_msgs/Information.h b/src/APIs/c_api/include/protocol_msgs/Information.h new file mode 100644 index 0000000..d0e9f4f --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Information.h @@ -0,0 +1,22 @@ +#ifndef C_API_PROTOCOL_MSGS_INFORMATION_H +#define C_API_PROTOCOL_MSGS_INFORMATION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/Info.h" + +typedef struct +{ + Info *information; + size_t information_count; +} Information; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_INFORMATION_H diff --git a/src/APIs/c_api/include/protocol_msgs/Node.h b/src/APIs/c_api/include/protocol_msgs/Node.h new file mode 100644 index 0000000..cede8ba --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Node.h @@ -0,0 +1,28 @@ +#ifndef C_API_PROTOCOL_MSGS_NODE_H +#define C_API_PROTOCOL_MSGS_NODE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/NodePosition.h" +#include "protocol_msgs/Action.h" + +typedef struct +{ + char *nodeId; + int32_t sequenceId; + char *nodeDescription; + uint8_t released; + NodePosition nodePosition; + Action *actions; + size_t actions_count; +} Node; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_NODE_H diff --git a/src/APIs/c_api/include/protocol_msgs/NodePosition.h b/src/APIs/c_api/include/protocol_msgs/NodePosition.h new file mode 100644 index 0000000..986c8b2 --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/NodePosition.h @@ -0,0 +1,26 @@ +#ifndef C_API_PROTOCOL_MSGS_NODEPOSITION_H +#define C_API_PROTOCOL_MSGS_NODEPOSITION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + double x; + double y; + double theta; + float allowedDeviationXY; + float allowedDeviationTheta; + char *mapId; + char *mapDescription; +} NodePosition; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_NODEPOSITION_H diff --git a/src/APIs/c_api/include/protocol_msgs/Order.h b/src/APIs/c_api/include/protocol_msgs/Order.h new file mode 100644 index 0000000..af45fbb --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Order.h @@ -0,0 +1,33 @@ +#ifndef C_API_PROTOCOL_MSGS_ORDER_H +#define C_API_PROTOCOL_MSGS_ORDER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/Node.h" +#include "protocol_msgs/Edge.h" + +typedef struct +{ + int32_t headerId; + char *timestamp; + char *version; + char *manufacturer; + char *serialNumber; + char *orderId; + uint32_t orderUpdateId; + Node *nodes; + size_t nodes_count; + Edge *edges; + size_t edges_count; + char *zoneSetId; +} Order; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_ORDER_H diff --git a/src/APIs/c_api/include/protocol_msgs/Trajectory.h b/src/APIs/c_api/include/protocol_msgs/Trajectory.h new file mode 100644 index 0000000..bc1ec5b --- /dev/null +++ b/src/APIs/c_api/include/protocol_msgs/Trajectory.h @@ -0,0 +1,25 @@ +#ifndef C_API_PROTOCOL_MSGS_TRAJECTORY_H +#define C_API_PROTOCOL_MSGS_TRAJECTORY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "protocol_msgs/ControlPoint.h" + +typedef struct +{ + uint32_t degree; + double *knotVector; + size_t knotVector_count; + ControlPoint *controlPoints; + size_t controlPoints_count; +} Trajectory; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_PROTOCOL_MSGS_TRAJECTORY_H diff --git a/src/APIs/c_api/include/sensor_msgs/BatteryState.h b/src/APIs/c_api/include/sensor_msgs/BatteryState.h new file mode 100644 index 0000000..258b05a --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/BatteryState.h @@ -0,0 +1,38 @@ +#ifndef C_API_SENSOR_MSGS_BATTERYSTATE_H +#define C_API_SENSOR_MSGS_BATTERYSTATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + float voltage; + float current; + float charge; + float capacity; + float design_capacity; + float percentage; + uint8_t power_supply_status; + uint8_t power_supply_health; + uint8_t power_supply_technology; + bool present; + float *cell_voltage; + size_t cell_voltage_count; + float *cell_temperature; + size_t cell_temperature_count; + char *location; + char *serial_number; +} BatteryState; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_BATTERYSTATE_H diff --git a/src/APIs/c_api/include/sensor_msgs/CameraInfo.h b/src/APIs/c_api/include/sensor_msgs/CameraInfo.h new file mode 100644 index 0000000..621e55d --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/CameraInfo.h @@ -0,0 +1,33 @@ +#ifndef C_API_SENSOR_MSGS_CAMERAINFO_H +#define C_API_SENSOR_MSGS_CAMERAINFO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "sensor_msgs/RegionOfInterest.h" + +typedef struct +{ + Header header; + uint32_t height; + uint32_t width; + char *distortion_model; + double *D; + size_t D_count; + double K[9]; + double R[9]; + double P[12]; + uint32_t binning_x; + uint32_t binning_y; + RegionOfInterest roi; +} CameraInfo; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_CAMERAINFO_H diff --git a/src/APIs/c_api/include/sensor_msgs/ChannelFloat32.h b/src/APIs/c_api/include/sensor_msgs/ChannelFloat32.h new file mode 100644 index 0000000..8a8a782 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/ChannelFloat32.h @@ -0,0 +1,22 @@ +#ifndef C_API_SENSOR_MSGS_CHANNELFLOAT32_H +#define C_API_SENSOR_MSGS_CHANNELFLOAT32_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + char *name; + float *values; + size_t values_count; +} ChannelFloat32; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_CHANNELFLOAT32_H diff --git a/src/APIs/c_api/include/sensor_msgs/CompressedImage.h b/src/APIs/c_api/include/sensor_msgs/CompressedImage.h new file mode 100644 index 0000000..897cdff --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/CompressedImage.h @@ -0,0 +1,24 @@ +#ifndef C_API_SENSOR_MSGS_COMPRESSEDIMAGE_H +#define C_API_SENSOR_MSGS_COMPRESSEDIMAGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + char *format; + uint8_t *data; + size_t data_count; +} CompressedImage; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_COMPRESSEDIMAGE_H diff --git a/src/APIs/c_api/include/sensor_msgs/DepthCameraData.h b/src/APIs/c_api/include/sensor_msgs/DepthCameraData.h new file mode 100644 index 0000000..dcd8be6 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/DepthCameraData.h @@ -0,0 +1,36 @@ +#ifndef C_API_SENSOR_MSGS_DEPTHCAMERADATA_H +#define C_API_SENSOR_MSGS_DEPTHCAMERADATA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "sensor_msgs/Image.h" +#include "sensor_msgs/CameraInfo.h" + +/** + * @brief One coherent depth-camera sample: a depth image plus the intrinsics that describe it. + * + * Mirrors robot_sensor_msgs::DepthCameraData. "Coherent" is the whole point of the struct: the + * voxel layer projects every depth pixel through the intrinsics to build a frustum, so a depth + * image paired with intrinsics from a different resolution or a different instant clears the wrong + * volume of space. Pair them at the source, not here. + */ +typedef struct +{ + /** Canonical timestamp and optical frame of this sample. */ + Header header; + /** Depth image. `encoding` must be the true encoding ("16UC1" or "32FC1"). */ + Image depth; + /** Intrinsics of the exact image above — same resolution, same instant. */ + CameraInfo camera_info; +} DepthCameraData; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_DEPTHCAMERADATA_H diff --git a/src/APIs/c_api/include/sensor_msgs/FluidPressure.h b/src/APIs/c_api/include/sensor_msgs/FluidPressure.h new file mode 100644 index 0000000..bbf8d20 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/FluidPressure.h @@ -0,0 +1,23 @@ +#ifndef C_API_SENSOR_MSGS_FLUIDPRESSURE_H +#define C_API_SENSOR_MSGS_FLUIDPRESSURE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + double fluid_pressure; + double variance; +} FluidPressure; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_FLUIDPRESSURE_H diff --git a/src/APIs/c_api/include/sensor_msgs/Illuminance.h b/src/APIs/c_api/include/sensor_msgs/Illuminance.h new file mode 100644 index 0000000..f77f525 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/Illuminance.h @@ -0,0 +1,23 @@ +#ifndef C_API_SENSOR_MSGS_ILLUMINANCE_H +#define C_API_SENSOR_MSGS_ILLUMINANCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + double illuminance; + double variance; +} Illuminance; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_ILLUMINANCE_H diff --git a/src/APIs/c_api/include/sensor_msgs/Image.h b/src/APIs/c_api/include/sensor_msgs/Image.h new file mode 100644 index 0000000..e3f1bc5 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/Image.h @@ -0,0 +1,28 @@ +#ifndef C_API_SENSOR_MSGS_IMAGE_H +#define C_API_SENSOR_MSGS_IMAGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + uint32_t height; + uint32_t width; + char *encoding; + uint8_t is_bigendian; + uint32_t step; + uint8_t *data; + size_t data_count; +} Image; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_IMAGE_H diff --git a/src/APIs/c_api/include/sensor_msgs/Imu.h b/src/APIs/c_api/include/sensor_msgs/Imu.h new file mode 100644 index 0000000..78f6a41 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/Imu.h @@ -0,0 +1,29 @@ +#ifndef C_API_SENSOR_MSGS_IMU_H +#define C_API_SENSOR_MSGS_IMU_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Quaternion.h" +#include "geometry_msgs/Vector3.h" + +typedef struct +{ + Header header; + Quaternion orientation; + double orientation_covariance[9]; + Vector3 angular_velocity; + double angular_velocity_covariance[9]; + Vector3 linear_acceleration; + double linear_acceleration_covariance[9]; +} Imu; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_IMU_H diff --git a/src/APIs/c_api/include/sensor_msgs/JointState.h b/src/APIs/c_api/include/sensor_msgs/JointState.h new file mode 100644 index 0000000..0007c17 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/JointState.h @@ -0,0 +1,29 @@ +#ifndef C_API_SENSOR_MSGS_JOINTSTATE_H +#define C_API_SENSOR_MSGS_JOINTSTATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + char **name; + size_t name_count; + double *position; + size_t position_count; + double *velocity; + size_t velocity_count; + double *effort; + size_t effort_count; +} JointState; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_JOINTSTATE_H diff --git a/src/APIs/c_api/include/sensor_msgs/Joy.h b/src/APIs/c_api/include/sensor_msgs/Joy.h new file mode 100644 index 0000000..d2cf043 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/Joy.h @@ -0,0 +1,25 @@ +#ifndef C_API_SENSOR_MSGS_JOY_H +#define C_API_SENSOR_MSGS_JOY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + float *axes; + size_t axes_count; + int32_t *buttons; + size_t buttons_count; +} Joy; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_JOY_H diff --git a/src/APIs/c_api/include/sensor_msgs/JoyFeedback.h b/src/APIs/c_api/include/sensor_msgs/JoyFeedback.h new file mode 100644 index 0000000..717081c --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/JoyFeedback.h @@ -0,0 +1,22 @@ +#ifndef C_API_SENSOR_MSGS_JOYFEEDBACK_H +#define C_API_SENSOR_MSGS_JOYFEEDBACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + uint8_t type; + uint8_t id; + float intensity; +} JoyFeedback; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_JOYFEEDBACK_H diff --git a/src/APIs/c_api/include/sensor_msgs/JoyFeedbackArray.h b/src/APIs/c_api/include/sensor_msgs/JoyFeedbackArray.h new file mode 100644 index 0000000..6435943 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/JoyFeedbackArray.h @@ -0,0 +1,22 @@ +#ifndef C_API_SENSOR_MSGS_JOYFEEDBACKARRAY_H +#define C_API_SENSOR_MSGS_JOYFEEDBACKARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "sensor_msgs/JoyFeedback.h" + +typedef struct +{ + JoyFeedback *array; + size_t array_count; +} JoyFeedbackArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_JOYFEEDBACKARRAY_H diff --git a/src/APIs/c_api/include/sensor_msgs/LaserEcho.h b/src/APIs/c_api/include/sensor_msgs/LaserEcho.h new file mode 100644 index 0000000..35ce456 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/LaserEcho.h @@ -0,0 +1,21 @@ +#ifndef C_API_SENSOR_MSGS_LASERECHO_H +#define C_API_SENSOR_MSGS_LASERECHO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + float *echoes; + size_t echoes_count; +} LaserEcho; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_LASERECHO_H diff --git a/src/APIs/c_api/include/sensor_msgs/LaserScan.h b/src/APIs/c_api/include/sensor_msgs/LaserScan.h new file mode 100644 index 0000000..71613b1 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/LaserScan.h @@ -0,0 +1,32 @@ +#ifndef C_API_SENSOR_MSGS_LASER_SCAN_H +#define C_API_SENSOR_MSGS_LASER_SCAN_H + +#ifdef __cplusplus +extern "C" +{ +#endif +#include +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + float angle_min; + float angle_max; + float angle_increment; + float time_increment; + float scan_time; + float range_min; + float range_max; + float *ranges; + size_t ranges_count; + float *intensities; + size_t intensities_count; +} LaserScan; + +#ifdef __cplusplus +} +#endif +#endif // C_API_SENSOR_MSGS_LASER_SCAN_H \ No newline at end of file diff --git a/src/APIs/c_api/include/sensor_msgs/MultiEchoLaserScan.h b/src/APIs/c_api/include/sensor_msgs/MultiEchoLaserScan.h new file mode 100644 index 0000000..774e93e --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/MultiEchoLaserScan.h @@ -0,0 +1,33 @@ +#ifndef C_API_SENSOR_MSGS_MULTIECHOLASERSCAN_H +#define C_API_SENSOR_MSGS_MULTIECHOLASERSCAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "sensor_msgs/LaserEcho.h" + +typedef struct +{ + Header header; + float angle_min; + float angle_max; + float angle_increment; + float time_increment; + float scan_time; + float range_min; + float range_max; + LaserEcho *ranges; + size_t ranges_count; + LaserEcho *intensities; + size_t intensities_count; +} MultiEchoLaserScan; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_MULTIECHOLASERSCAN_H diff --git a/src/APIs/c_api/include/sensor_msgs/PointCloud.h b/src/APIs/c_api/include/sensor_msgs/PointCloud.h new file mode 100644 index 0000000..1c2a8d0 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/PointCloud.h @@ -0,0 +1,27 @@ +#ifndef C_API_SENSOR_MSGS_POINTCLOUD_H +#define C_API_SENSOR_MSGS_POINTCLOUD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "geometry_msgs/Point32.h" +#include "sensor_msgs/ChannelFloat32.h" + +typedef struct +{ + Header header; + Point32 *points; + size_t points_count; + ChannelFloat32 *channels; + size_t channels_count; +} PointCloud; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_POINTCLOUD_H diff --git a/src/APIs/c_api/include/sensor_msgs/PointCloud2.h b/src/APIs/c_api/include/sensor_msgs/PointCloud2.h new file mode 100644 index 0000000..f275eae --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/PointCloud2.h @@ -0,0 +1,33 @@ +#ifndef C_API_SENSOR_MSGS_POINTCLOUD2_H +#define C_API_SENSOR_MSGS_POINTCLOUD2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include "std_msgs/Header.h" +#include "sensor_msgs/PointField.h" + +typedef struct +{ + Header header; + uint32_t height; + uint32_t width; + PointField *fields; + size_t fields_count; + bool is_bigendian; + uint32_t point_step; + uint32_t row_step; + uint8_t *data; + size_t data_count; + bool is_dense; +} PointCloud2; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_POINTCLOUD2_H diff --git a/src/APIs/c_api/include/sensor_msgs/PointField.h b/src/APIs/c_api/include/sensor_msgs/PointField.h new file mode 100644 index 0000000..569c8ac --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/PointField.h @@ -0,0 +1,23 @@ +#ifndef C_API_SENSOR_MSGS_POINTFIELD_H +#define C_API_SENSOR_MSGS_POINTFIELD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct +{ + char *name; + uint32_t offset; + uint8_t datatype; + uint32_t count; +} PointField; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_POINTFIELD_H diff --git a/src/APIs/c_api/include/sensor_msgs/Range.h b/src/APIs/c_api/include/sensor_msgs/Range.h new file mode 100644 index 0000000..bfbaa6d --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/Range.h @@ -0,0 +1,26 @@ +#ifndef C_API_SENSOR_MSGS_RANGE_H +#define C_API_SENSOR_MSGS_RANGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + uint8_t radiation_type; + float field_of_view; + float min_range; + float max_range; + float range; +} Range; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_RANGE_H diff --git a/src/APIs/c_api/include/sensor_msgs/RegionOfInterest.h b/src/APIs/c_api/include/sensor_msgs/RegionOfInterest.h new file mode 100644 index 0000000..62cdd67 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/RegionOfInterest.h @@ -0,0 +1,25 @@ +#ifndef C_API_SENSOR_MSGS_REGIONOFINTEREST_H +#define C_API_SENSOR_MSGS_REGIONOFINTEREST_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +typedef struct +{ + uint32_t x_offset; + uint32_t y_offset; + uint32_t height; + uint32_t width; + bool do_rectify; +} RegionOfInterest; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_REGIONOFINTEREST_H diff --git a/src/APIs/c_api/include/sensor_msgs/RelativeHumidity.h b/src/APIs/c_api/include/sensor_msgs/RelativeHumidity.h new file mode 100644 index 0000000..7892098 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/RelativeHumidity.h @@ -0,0 +1,23 @@ +#ifndef C_API_SENSOR_MSGS_RELATIVEHUMIDITY_H +#define C_API_SENSOR_MSGS_RELATIVEHUMIDITY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + double relative_humidity; + double variance; +} RelativeHumidity; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_RELATIVEHUMIDITY_H diff --git a/src/APIs/c_api/include/sensor_msgs/Temperature.h b/src/APIs/c_api/include/sensor_msgs/Temperature.h new file mode 100644 index 0000000..d1120d2 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/Temperature.h @@ -0,0 +1,23 @@ +#ifndef C_API_SENSOR_MSGS_TEMPERATURE_H +#define C_API_SENSOR_MSGS_TEMPERATURE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" + +typedef struct +{ + Header header; + double temperature; + double variance; +} Temperature; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_TEMPERATURE_H diff --git a/src/APIs/c_api/include/sensor_msgs/TimeReference.h b/src/APIs/c_api/include/sensor_msgs/TimeReference.h new file mode 100644 index 0000000..0ca62a0 --- /dev/null +++ b/src/APIs/c_api/include/sensor_msgs/TimeReference.h @@ -0,0 +1,24 @@ +#ifndef C_API_SENSOR_MSGS_TIMEREFERENCE_H +#define C_API_SENSOR_MSGS_TIMEREFERENCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "std_msgs/Header.h" +#include "std_msgs/Time.h" + +typedef struct +{ + Header header; + Time time_ref; + char *source; +} TimeReference; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_SENSOR_MSGS_TIMEREFERENCE_H diff --git a/src/APIs/c_api/include/std_msgs/Bool.h b/src/APIs/c_api/include/std_msgs/Bool.h new file mode 100644 index 0000000..9a0d4dd --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Bool.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_BOOL_H +#define C_API_STD_MSGS_BOOL_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint8_t data; +} Bool; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_BOOL_H diff --git a/src/APIs/c_api/include/std_msgs/Byte.h b/src/APIs/c_api/include/std_msgs/Byte.h new file mode 100644 index 0000000..b7554b1 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Byte.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_BYTE_H +#define C_API_STD_MSGS_BYTE_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + int8_t data; +} Byte; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_BYTE_H diff --git a/src/APIs/c_api/include/std_msgs/ByteMultiArray.h b/src/APIs/c_api/include/std_msgs/ByteMultiArray.h new file mode 100644 index 0000000..7ed0c51 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/ByteMultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_BYTEMULTIARRAY_H +#define C_API_STD_MSGS_BYTEMULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + int8_t *data; + size_t data_count; +} ByteMultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_BYTEMULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/Char.h b/src/APIs/c_api/include/std_msgs/Char.h new file mode 100644 index 0000000..8b4ba99 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Char.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_CHAR_H +#define C_API_STD_MSGS_CHAR_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint8_t data; +} Char; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_CHAR_H diff --git a/src/APIs/c_api/include/std_msgs/ColorRGBA.h b/src/APIs/c_api/include/std_msgs/ColorRGBA.h new file mode 100644 index 0000000..561ae9a --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/ColorRGBA.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_COLORRGBA_H +#define C_API_STD_MSGS_COLORRGBA_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + float r; + float g; + float b; + float a; +} ColorRGBA; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_COLORRGBA_H diff --git a/src/APIs/c_api/include/std_msgs/Duration.h b/src/APIs/c_api/include/std_msgs/Duration.h new file mode 100644 index 0000000..0e7da17 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Duration.h @@ -0,0 +1,21 @@ +#ifndef C_API_STD_MSGS_DURATION_H +#define C_API_STD_MSGS_DURATION_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + int32_t sec; + int32_t nsec; +} Duration; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_DURATION_H diff --git a/src/APIs/c_api/include/std_msgs/Empty.h b/src/APIs/c_api/include/std_msgs/Empty.h new file mode 100644 index 0000000..9e3779f --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Empty.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_EMPTY_H +#define C_API_STD_MSGS_EMPTY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint8_t _dummy; +} Empty; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_EMPTY_H diff --git a/src/APIs/c_api/include/std_msgs/Float32.h b/src/APIs/c_api/include/std_msgs/Float32.h new file mode 100644 index 0000000..e2f72c2 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Float32.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_FLOAT32_H +#define C_API_STD_MSGS_FLOAT32_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + float data; +} Float32; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_FLOAT32_H diff --git a/src/APIs/c_api/include/std_msgs/Float32MultiArray.h b/src/APIs/c_api/include/std_msgs/Float32MultiArray.h new file mode 100644 index 0000000..de400fa --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Float32MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_FLOAT32MULTIARRAY_H +#define C_API_STD_MSGS_FLOAT32MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + float *data; + size_t data_count; +} Float32MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_FLOAT32MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/Float64.h b/src/APIs/c_api/include/std_msgs/Float64.h new file mode 100644 index 0000000..b7ef266 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Float64.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_FLOAT64_H +#define C_API_STD_MSGS_FLOAT64_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + double data; +} Float64; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_FLOAT64_H diff --git a/src/APIs/c_api/include/std_msgs/Float64MultiArray.h b/src/APIs/c_api/include/std_msgs/Float64MultiArray.h new file mode 100644 index 0000000..41272f2 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Float64MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_FLOAT64MULTIARRAY_H +#define C_API_STD_MSGS_FLOAT64MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + double *data; + size_t data_count; +} Float64MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_FLOAT64MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/Header.h b/src/APIs/c_api/include/std_msgs/Header.h new file mode 100644 index 0000000..8f181ff --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Header.h @@ -0,0 +1,45 @@ +#ifndef C_API_STD_MSGS_HEADER_H +#define C_API_STD_MSGS_HEADER_H + +#ifdef __cplusplus +extern "C" +{ +#endif +#include +#include +#include + + typedef struct + { + uint32_t seq; + uint32_t sec; + uint32_t nsec; + char *frame_id; + } Header; + + /** + * @brief Create a new header + * @param frame_id Frame id + * @return Header + */ + Header header_create(const char *frame_id); + + /** + * @brief Set data for a header + * @param header Header + * @param seq Sequence + * @param sec Second + * @param nsec Nanosecond + * @param frame_id Frame id + * @return Header + */ + Header header_set_data( + uint32_t seq, + uint32_t sec, + uint32_t nsec, + char *frame_id); +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_HEADER_H \ No newline at end of file diff --git a/src/APIs/c_api/include/std_msgs/Int16.h b/src/APIs/c_api/include/std_msgs/Int16.h new file mode 100644 index 0000000..6b26619 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int16.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_INT16_H +#define C_API_STD_MSGS_INT16_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + int16_t data; +} Int16; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT16_H diff --git a/src/APIs/c_api/include/std_msgs/Int16MultiArray.h b/src/APIs/c_api/include/std_msgs/Int16MultiArray.h new file mode 100644 index 0000000..53dbf90 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int16MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_INT16MULTIARRAY_H +#define C_API_STD_MSGS_INT16MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + int16_t *data; + size_t data_count; +} Int16MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT16MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/Int32.h b/src/APIs/c_api/include/std_msgs/Int32.h new file mode 100644 index 0000000..cac37e6 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int32.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_INT32_H +#define C_API_STD_MSGS_INT32_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + int32_t data; +} Int32; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT32_H diff --git a/src/APIs/c_api/include/std_msgs/Int32MultiArray.h b/src/APIs/c_api/include/std_msgs/Int32MultiArray.h new file mode 100644 index 0000000..5178f2d --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int32MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_INT32MULTIARRAY_H +#define C_API_STD_MSGS_INT32MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + int32_t *data; + size_t data_count; +} Int32MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT32MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/Int64.h b/src/APIs/c_api/include/std_msgs/Int64.h new file mode 100644 index 0000000..01142c1 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int64.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_INT64_H +#define C_API_STD_MSGS_INT64_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + int64_t data; +} Int64; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT64_H diff --git a/src/APIs/c_api/include/std_msgs/Int64MultiArray.h b/src/APIs/c_api/include/std_msgs/Int64MultiArray.h new file mode 100644 index 0000000..f5154d0 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int64MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_INT64MULTIARRAY_H +#define C_API_STD_MSGS_INT64MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + int64_t *data; + size_t data_count; +} Int64MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT64MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/Int8.h b/src/APIs/c_api/include/std_msgs/Int8.h new file mode 100644 index 0000000..10747b7 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int8.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_INT8_H +#define C_API_STD_MSGS_INT8_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + int8_t data; +} Int8; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT8_H diff --git a/src/APIs/c_api/include/std_msgs/Int8MultiArray.h b/src/APIs/c_api/include/std_msgs/Int8MultiArray.h new file mode 100644 index 0000000..13f3495 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Int8MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_INT8MULTIARRAY_H +#define C_API_STD_MSGS_INT8MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + int8_t *data; + size_t data_count; +} Int8MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_INT8MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/MultiArrayDimension.h b/src/APIs/c_api/include/std_msgs/MultiArrayDimension.h new file mode 100644 index 0000000..b7b1b9c --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/MultiArrayDimension.h @@ -0,0 +1,22 @@ +#ifndef C_API_STD_MSGS_MULTIARRAYDIMENSION_H +#define C_API_STD_MSGS_MULTIARRAYDIMENSION_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + char *label; + uint32_t size; + uint32_t stride; +} MultiArrayDimension; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_MULTIARRAYDIMENSION_H diff --git a/src/APIs/c_api/include/std_msgs/MultiArrayLayout.h b/src/APIs/c_api/include/std_msgs/MultiArrayLayout.h new file mode 100644 index 0000000..1928b7d --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/MultiArrayLayout.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_MULTIARRAYLAYOUT_H +#define C_API_STD_MSGS_MULTIARRAYLAYOUT_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayDimension.h" + + +typedef struct +{ + MultiArrayDimension *dim; + size_t dim_count; + uint32_t data_offset; +} MultiArrayLayout; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_MULTIARRAYLAYOUT_H diff --git a/src/APIs/c_api/include/std_msgs/String.h b/src/APIs/c_api/include/std_msgs/String.h new file mode 100644 index 0000000..ce6193d --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/String.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_STRING_H +#define C_API_STD_MSGS_STRING_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + char *data; +} String; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_STRING_H diff --git a/src/APIs/c_api/include/std_msgs/Time.h b/src/APIs/c_api/include/std_msgs/Time.h new file mode 100644 index 0000000..cb70ce1 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/Time.h @@ -0,0 +1,27 @@ +#ifndef C_API_STD_MSGS_TIME_H +#define C_API_STD_MSGS_TIME_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint32_t sec; + uint32_t nsec; +} Time; + +/** + * @brief Create a new time + * @return Time + */ +Time time_create(); + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_TIME_H diff --git a/src/APIs/c_api/include/std_msgs/UInt16.h b/src/APIs/c_api/include/std_msgs/UInt16.h new file mode 100644 index 0000000..205ef45 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt16.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_UINT16_H +#define C_API_STD_MSGS_UINT16_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint16_t data; +} UInt16; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT16_H diff --git a/src/APIs/c_api/include/std_msgs/UInt16MultiArray.h b/src/APIs/c_api/include/std_msgs/UInt16MultiArray.h new file mode 100644 index 0000000..2d6885d --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt16MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_UINT16MULTIARRAY_H +#define C_API_STD_MSGS_UINT16MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + uint16_t *data; + size_t data_count; +} UInt16MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT16MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/UInt32.h b/src/APIs/c_api/include/std_msgs/UInt32.h new file mode 100644 index 0000000..5cd3152 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt32.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_UINT32_H +#define C_API_STD_MSGS_UINT32_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint32_t data; +} UInt32; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT32_H diff --git a/src/APIs/c_api/include/std_msgs/UInt32MultiArray.h b/src/APIs/c_api/include/std_msgs/UInt32MultiArray.h new file mode 100644 index 0000000..1ad24f1 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt32MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_UINT32MULTIARRAY_H +#define C_API_STD_MSGS_UINT32MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + uint32_t *data; + size_t data_count; +} UInt32MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT32MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/UInt64.h b/src/APIs/c_api/include/std_msgs/UInt64.h new file mode 100644 index 0000000..5a94d2a --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt64.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_UINT64_H +#define C_API_STD_MSGS_UINT64_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint64_t data; +} UInt64; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT64_H diff --git a/src/APIs/c_api/include/std_msgs/UInt64MultiArray.h b/src/APIs/c_api/include/std_msgs/UInt64MultiArray.h new file mode 100644 index 0000000..32507e7 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt64MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_UINT64MULTIARRAY_H +#define C_API_STD_MSGS_UINT64MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + uint64_t *data; + size_t data_count; +} UInt64MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT64MULTIARRAY_H diff --git a/src/APIs/c_api/include/std_msgs/UInt8.h b/src/APIs/c_api/include/std_msgs/UInt8.h new file mode 100644 index 0000000..d097ad0 --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt8.h @@ -0,0 +1,20 @@ +#ifndef C_API_STD_MSGS_UINT8_H +#define C_API_STD_MSGS_UINT8_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + + +typedef struct +{ + uint8_t data; +} UInt8; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT8_H diff --git a/src/APIs/c_api/include/std_msgs/UInt8MultiArray.h b/src/APIs/c_api/include/std_msgs/UInt8MultiArray.h new file mode 100644 index 0000000..316bcaa --- /dev/null +++ b/src/APIs/c_api/include/std_msgs/UInt8MultiArray.h @@ -0,0 +1,23 @@ +#ifndef C_API_STD_MSGS_UINT8MULTIARRAY_H +#define C_API_STD_MSGS_UINT8MULTIARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include "MultiArrayLayout.h" + + +typedef struct +{ + MultiArrayLayout layout; + uint8_t *data; + size_t data_count; +} UInt8MultiArray; + +#ifdef __cplusplus +} +#endif + +#endif // C_API_STD_MSGS_UINT8MULTIARRAY_H diff --git a/src/APIs/c_api/nav-c-api-2-csharp-integration-report.md b/src/APIs/c_api/nav-c-api-2-csharp-integration-report.md new file mode 100644 index 0000000..300ffbf --- /dev/null +++ b/src/APIs/c_api/nav-c-api-2-csharp-integration-report.md @@ -0,0 +1,501 @@ +# Báo cáo ghép khung C# (RobotNet12) với move_base2 qua nav_c_api_2 + +- **Ngày:** 2026-08-10 · **Đối chiếu lại:** 2026-08-10 (mục 1b) · **Cập nhật theo API mới:** 2026-08-10 tối (mục 1c) + +> ⚠ **API đã đổi sau khi bản đầu được viết.** Năm hàm bị xoá, một hàm mới thêm vào. Đây là thay đổi +> **phá vỡ tương thích** và RobotNet12 **đang gọi 4/5 hàm đã xoá**. Đọc **mục 1c trước** mọi mục khác. +- **Phạm vi:** RobotApp `Modules/Navigation` (P/Invoke binding + client + integration service) ghép với `libnav_c_api.so` build từ `pnkx_nav_core` chạy runtime `libmove_base2.so`. +- **Nguồn đối chiếu (đã kiểm tra thực tế):** + - `T800_ws/src/AMR_T800/pnkx_nav_core/src/APIs/c_api/include/nav_c_api.h`, `nav_c_api_2.h` + - `T800_ws/src/AMR_T800/pnkx_nav_core/src/APIs/c_api/NAV_C_API_2_GUIDE.md` (gọi tắt: **Guide**) + - `nm -D` trên `T800_ws/src/AMR_T800/pnkx_nav_core/build/libnav_c_api.so` + - `T800_ws/src/AMR_T800/Test/move_base2/config/runtime/*.yaml` + - `RobotNet12/RobotApp/RobotNet12.RobotApp/Modules/Navigation/*.cs` + - `RobotNet12/RobotApp/RobotNet12.RobotApp/systemd/robotnet-robotapp.service` *(bổ sung ở lần đối chiếu lại — đây là cách robot thật khởi động)* + +> **Đây là bản kiểm điểm một thời điểm**, gắn với trạng thái `RobotNet12` ngày 2026-08-10. Nó liệt kê +> lỗi đang có và sẽ cũ đi khi những lỗi đó được sửa. Phần **hướng dẫn ghép bền vững** — kiến trúc host, +> ánh xạ VDA5050, triển khai systemd, checklist nghiệm thu — nằm ở **Guide mục 12–15**; sửa xong danh +> sách dưới đây thì dùng Guide, không dùng file này. +> +> **Bản này tồn tại ở hai chỗ, nội dung giống hệt nhau:** +> `T800_ws/.../c_api/nav-c-api-2-csharp-integration-report.md` và +> `RobotNet12/docs/nav-c-api-2-csharp-integration-report.md`. Sửa một bên thì đồng bộ bên kia, nếu +> không hai bản sẽ trôi lệch. + +--- + +## 1. Kết luận tóm tắt + +| Phía | Cần đổi gì | +|---|---| +| **move_base2 / nav_c_api_2** | **Không cần đổi gì để ghép được.** Bề mặt API đủ, 13 symbol mới đã có trong `.so`, struct khớp header. Còn 1 việc đã ghi nhận sẵn (footprint hiển thị, mục 2) + 2 khuyến nghị không chặn. | +| **C# (RobotNet12)** | Toàn bộ công việc nằm ở đây, chia 4 nhóm: (A) sửa binding cũ đang sai/chết, (B) thêm 13 `DllImport` + 4 struct, (C) đổi hành vi theo runtime mới, (D) đổi config/môi trường. Chi tiết mục 3–6. | + +Các khẳng định của Guide đã được xác minh đúng với thực tế: 13 symbol mới tồn tại; struct `DepthCameraData`/`Image`/`CameraInfo`/`RegionOfInterest` khớp header C từng field; enum `NavigationState` C# khớp C (0–13); config move_base2 khớp (`library_path: libmove_base2` tại `move_base_common_params.yaml:304`, `controller_frequency: 30.0`, topic `/map`, `/b_scan`, `/camera/depth/points_proc`, `/camera/depth/data`, `/camera_right/...`); `tf3_buffer_create/destroy` đã có trong `TF3NativeInterface.cs`. + +--- + +## 1b. Kết quả đối chiếu lại (2026-08-10) + +Toàn bộ mục 3–6 đã được kiểm lại bằng `file:line` trên mã C# thật và `nm -D` trên `.so`. **Không mục +nào sai.** Bảng dưới ghi kết quả kiểm chứng; ba mục bổ sung phát hiện thêm nằm ở **A6** và **mục 6** +(viết lại). + +| Mục | Kết quả kiểm | Ghi chú | +|---|---|---| +| **A1** | ✓ đúng dòng `NavigationNativeInterface.cs:193-198` | Call site `NavigationClient.cs:608` là **code sống**, có vòng `Marshal.PtrToStructure` ở `:621-627`. Mô tả "24 byte/điểm vào ô 8 byte" chính xác | +| **A2** | ✓ khai `:205`, gọi `NavigationClient.cs:636` | `nm` xác nhận `navigation_free_points` **không tồn tại** trong `.so` | +| **A3** | ✓ đúng cả 10 dòng | Cảnh báo trùng tên **đúng và là mục nguy hiểm nhất của nhóm A**: `navigation_free_occupancy_grid` và `navigation_free_laser_scan` **có thật** trong `.so` mới nhưng nhận `OccupancyGrid*` / `LaserScan*`. Bản C# khai `IntPtr handle` sẽ resolve trúng symbol thật rồi truyền một con trỏ sai kiểu vào — hàm sẽ `free()` những gì nó tưởng là `header.frame_id` và `data` | +| **A4** | ✓ đếm được đúng **23** `UnmanagedType.Bool`, 2 `I1` | | +| **A5** | ✓ nhưng **chưa đủ nghiêm trọng như mô tả** | Có fallback `NativeLibrary.TryLoad(...)` theo `LD_LIBRARY_PATH` tại `:40-42`, nên hard-code sai đường không chết cứng ngay. Vấn đề thật nằm ở A6 và mục 6 | +| **C1** | ✓ `Initialize()` :345 → footprint :358 → vòng poll :373-380; `navigation_initialize` tại `NavigationClient.cs:123` | Thứ tự thật sự sai với move_base2 | +| **C2** | ✓ `grep` cả `NavigationClient.cs` chỉ có `navigation_destroy` (`:127`, `:2463`), `Dispose` tại `:2445` | Không có `navigation_shutdown` ở đâu | +| **D** | ✓ đúng dòng 13, 14 của `launchSettings.json` | Nhưng **sửa hai dòng này không ảnh hưởng robot thật** — xem mục 6 viết lại | +| **§2.3** | ✓ Guide thiếu 3 symbol | `header_create`, `header_set_data`, `time_create` đều có trong `.so`. **Đã sửa Guide** (Phụ lục A) | + +**Báo cáo cũng đúng ở chỗ nó KHÔNG nêu.** Bốn lệch chữ ký từng tìm thấy trong +`pnkx_nav_core/examples/NavigationExample/NavigationAPI.cs` **không áp dụng cho RobotNet12** — binding +của RobotApp là bản khác và tốt hơn: `navigation_rotate_to` nhận `PoseStamped` (`:273-275`), +`navigation_pause/resume/cancel` khai `void` (`:282`, `:289`, `:296`), +`navigation_move_to_nodes_edges` có đủ hai tham số đếm (`:510-515`), +`navigation_dock_to_nodes_edges` không được khai báo. Không cần đụng tới. + +--- + +## 1c. API đã đổi — nhóm E (mới, ưu tiên cao nhất) + +Đọc lại mã nguồn ngày 2026-08-10 tối. So với thời điểm viết bản đầu, bề mặt API đã đổi: **62 symbol** +thay vì 64 (`nm -D` trên `build/libnav_c_api.so`, build 20:19). + +### E1. Năm hàm bị XOÁ — RobotNet12 đang gọi 4/5 + +| Hàm | Còn trong `.so`? | RobotNet12 dùng ở đâu | +|---|---|---| +| `navigation_dock_to` | **không** | khai `NavigationNativeInterface.cs:246` · gọi `NavigationClient.cs:1053` · wrapper `DockTo()` `:970` · caller `NavigationIntegrationService.cs:836` | +| `navigation_dock_to_order` | **không** | khai `:502` · gọi `NavigationClient.cs:1150` · wrapper `DockToOrder()` `:1134` · caller `NavigationIntegrationService.cs:854` | +| `navigation_dock_to_nodes_edges` | **không** | *không dùng* | +| `navigation_move_straight_to` | **không** | khai `:260` · gọi `NavigationClient.cs:1179` · wrapper `MoveStraightTo()` `:1169` · caller `NavigationIntegrationService.cs:882` **và** `Endpoints/NavigationTestEndpoints.cs:83` | +| `navigation_rotate_to` | **không** | khai `:273` · gọi `NavigationClient.cs:1209` · wrapper `RotateTo()` `:1196` · caller `NavigationIntegrationService.cs:901` **và** `Endpoints/NavigationTestEndpoints.cs:126` | + +Cả năm đã bị gỡ khỏi contract `BaseNavigation` (`move_base_core/navigation.h`), khỏi `move_base`, +`move_base2`, `nav_c_api`, `nav_c_api_2`, và khỏi host ROS (`amr_control`). **Gọi là +`EntryPointNotFoundException`** — không phải lỗi biên dịch, nên nó chỉ nổ lúc chạy, ở đúng lần dock +hoặc lần đi thẳng đầu tiên. + +**Phải xoá ở C#:** 4 khai báo `DllImport`, 4 wrapper public, 6 call site (4 trong +`NavigationIntegrationService`, 2 trong `NavigationTestEndpoints`). + +### E2. Năng lực không mất — nó chuyển vào compound action + +Docking, đi thẳng, quay tại chỗ giờ là **thuộc tính của từng chặng** khai trong +`Test/move_base2/config/runtime/compound_actions_params.yaml`: + +```yaml +PickUp: + steps: + - {action: detect} + - {move_to: dock_target, profile: docking, marker: trolley} + - {action: LiftFork} + - {move: -0.5, profile: go_straight} + +UnDockFromStation: + steps: + - {move: -1.0, profile: go_straight} + - {move: 0.0, profile: rotate} +``` + +`profile` ∈ `position | docking | go_straight | rotate`; `marker` **chỉ hợp lệ với +`profile: docking`**, chọn override trong `maker_sources.yaml`. + +Host gửi **tên action** thay vì gọi động tác: + +| Đường | Hàm | Khi nào | +|---|---|---| +| Action trong node của order | `navigation_move_to_order_v2` | Fleet giao tuyến có action giữa đường | +| `instantActions` ngoài order | `navigation_execute_instant_actions` **(mới)** | Fleet hoặc HMI yêu cầu ngay | + +**Vì sao đổi:** ba hàm cũ đi thẳng xuống lõi, **không qua mission layer** — chúng preempt order đang +chạy trong im lặng. `UnDockFromStation` gọi `moveStraightTo` là ca đã gặp thật. Đường mới đưa mọi +chuyển động về chung một hàng đợi, chung đường huỷ, chung đường báo kết quả. + +### E3. Hàm mới `navigation_execute_instant_actions` + +```c +bool navigation_execute_instant_actions(NavigationHandle handle, const Action *actions, size_t count); +``` + +Chạy trọn một message `instantActions` như **một lô**. Dùng `Action` — struct C **đã có sẵn** +(`protocol_msgs/Action.h`), không phải khai struct mới. + +Bốn ràng buộc, đầy đủ ở Guide §11.8: + +1. **Gửi cả lô một lần.** Gọi từng action riêng thì action `HARD` sau sẽ preempt và xoá chặng của + action trước — hai action cùng message ăn nhau. +2. **`blockingType` quyết định cách gặp order đang chạy.** Có `HARD` → preempt cả message; `SOFT` → + xếp hàng; `NONE` → runtime không chạy song song được nên **bị hạ xuống xếp hàng** và ghi log; không + khai / không hiểu → coi như `HARD`. +3. **Không route `cancelOrder` / `startPause` / `stopPause` qua đây** — chúng lái hàng đợi, không nằm + trong hàng đợi. Vẫn dùng `navigation_cancel()` / `_pause()` / `_resume()`. +4. **Một kết quả cho cả message.** Dừng ở chặng lỗi đầu tiên, phần còn lại bị bỏ. Theo dõi bằng + `navigation_get_state`: `ACTIVE`/`CONTROLLING` → RUNNING, `SUCCEEDED` → FINISHED, + `ABORTED`/`PREEMPTED` → FAILED. Ánh xạ chỉ đúng khi message là việc duy nhất trong hàng đợi. + +Điều này **thay thế** đường instant action mà mục 6 của báo cáo trước mô tả là "host tự dịch từng +actionType". Nay chỉ ba action điều khiển hàng đợi còn phải tự dịch; phần còn lại đẩy nguyên lô. + +### E4. Ảnh hưởng tới các mục khác của báo cáo + +| Mục | Ảnh hưởng | +|---|---| +| §4 nhóm B | Danh sách 13 `DllImport` đổi: **bỏ** `navigation_dock_to_order_v2`, **thêm** `navigation_execute_instant_actions`. Vẫn đúng 13 hàm. 4 struct mới không đổi | +| §5 C4 | `navigation_dock_to_order_v2` không còn tồn tại — bỏ khỏi khuyến nghị | +| Guide | Đã cập nhật: §0 (9 việc), §6.4 (5 hàm xoá + mô hình mới), §11.8 (thay bằng instant actions), Phụ lục A (62 symbol), Phụ lục B.2 | +| **Guide §12–15 (mới)** | Phần ghép bền vững: **§12** kiến trúc host + khung `NavigationHost` + mô hình thread · **§13** ánh xạ VDA5050 → C API (gồm ba action lái hàng đợi phải tách riêng) · **§14** triển khai systemd, `ProtectHome`, bố cục cài, xác minh runtime · **§15** checklist nghiệm thu 7 tầng | + +### E4b. Hardcode đường `/home` thứ ba — `libtf3.so` + +`Modules/tf3/TF3NativeInterface.cs:67`: + +```csharp +// private const string LibraryPath = "/usr/local/lib/libtf3.so"; ← dòng đúng, đang bị comment +private const string LibraryPath = "/home/mic-733ao/sonvh/tf3/build/libtf3.so"; +``` + +Cùng nhóm với A5 (`libnav_c_api.so`) và A6 (`LD_LIBRARY_PATH` cho plugin) — đây là chỗ thứ **ba**. +`libtf3.so` là `.so` **riêng biệt**, không nằm trong `libnav_c_api.so`, và nó cũng dính +`ProtectHome=true` (mục 6, D3). Trên robot bản đã cài là `/usr/local/lib/libtf3.so` — bỏ comment dòng +đúng, hoặc đưa cả ba đường về cấu hình. + +Không có TF thì costmap không lấy được pose robot và **không có lỗi nào rõ ràng** — xem Guide §12b.4. + +### E5. Tài liệu test thủ công của RobotNet12 đã cũ + +`RobotApp/RobotNet12.RobotApp/Modules/Navigation/navigation-capi-manual-test-guide.md` viết cho +`navigation_move_straight_to` và `navigation_rotate_to` — cả hai **không còn tồn tại**. Mục 2 và 3 của +file đó không chạy được nữa. Viết lại theo đường mới: chuyển động thẳng/quay giờ là chặng +`profile: go_straight | rotate` bên trong một action, gọi qua `navigation_execute_instant_actions` +hoặc nằm trong node của order. Mẫu nghiệm thu ở Guide §15 tầng 3–4. + +--- + +## 2. Phía move_base2 / nav_c_api_2 — cần thay đổi gì? + +**Không có thay đổi bắt buộc.** Ba mục dưới đây không chặn việc ghép: + +1. **Đã ghi nhận, nên sửa ở move_base2 (không phải ở C#):** trường `footprint` trong `navigation_get_global_data`/`_local_data` giờ trả polygon **thô** trong frame `base_link` (rỗng nếu host chưa set), thay vì bản đã pad + transform theo pose robot như bản cũ → vỡ hiển thị footprint trên bản đồ. Chỗ sửa đúng là move_base2 lấy footprint từ costmap (Guide mục 6.10, tham chiếu `C_API_MOVE_BASE2_PLAN.md` §8.4). **Tạm thời C# phải tự transform** theo pose từ `navigation_get_robot_pose_2d` nếu muốn vẽ đúng. +2. **Khuyến nghị (tuỳ chọn) cho nav_c_api_2:** `navigation_get_robot_footprint` và nhóm `navigation_get_all_*` nhận mảng do caller cấp mà **không có tham số dung lượng** — cấp thiếu là tràn mảng. Nên thêm biến thể capacity-aware về sau. Trước mắt C# né bằng cách cấp dư (≥ 64 điểm cho footprint). +3. **Sửa tài liệu (không sửa code):** Phụ lục A của Guide thiếu 3 symbol có thật trong `.so`: `header_create`, `header_set_data`, `time_create`; và Guide thiếu mục "xoá các khai báo C# cũ không còn symbol" (chính là nhóm lỗi ở mục 3 dưới đây). — **Đã sửa phần Phụ lục A ngày 2026-08-10** (bổ sung cả ba, kèm mô tả và quy tắc giải phóng `frame_id`). Phần "xoá khai báo chết" vẫn chỉ nằm ở báo cáo này, chưa đưa vào Guide. + +Ngoài ra, theo Guide mục 10: đường depth camera và `navigation_move_straight_to` lùi **chưa chạy thử trên robot/Gazebo** — đây là việc kiểm thử, không phải sửa code. + +--- + +## 3. C# nhóm A — SỬA binding cũ đang sai hoặc chết + +Guide viết "binding cũ chạy nguyên trạng" — sai ở các điểm sau (đã đối chiếu `nm` với code): + +### A1. `navigation_get_robot_footprint` — chữ ký C# sai hẳn (hỏng bộ nhớ nếu gọi) + +- Chữ ký thật (`nav_c_api.h:166`): `bool navigation_get_robot_footprint(NavigationHandle, Point *out_points, size_t &out_count)` — **caller cấp mảng**. +- C# hiện tại (`NavigationNativeInterface.cs:193`): `out IntPtr out_points, out nuint out_count` — chờ thư viện cấp phát. Gọi như hiện tại (call site `NavigationClient.cs:608`) là core ghi mảng `Point` 24 byte/điểm vào ô 8 byte trên stack. +- **Sửa:** khai lại thành `[In, Out] Point[] out_points, ref nuint out_count`, cấp sẵn mảng 64 điểm trước khi gọi; bỏ vòng `Marshal.PtrToStructure` và bỏ `navigation_free_points` (A2). + +### A2. `navigation_free_points` — symbol không tồn tại trong `.so` mới + +- Khai tại `NavigationNativeInterface.cs:205`, **đang gọi sống** tại `NavigationClient.cs:636` → `EntryPointNotFoundException` ngay lần đầu đọc footprint. Xoá cả khai báo lẫn call site (tự hết khi sửa A1). + +### A3. Xoá các khai báo chết — đặc biệt 2 khai báo trùng tên symbol mới + +Không còn tồn tại trong `.so` (call site đều đã comment, nhưng khai báo phải xoá để không ai gọi lại): + +| Khai báo (NavigationNativeInterface.cs) | Dòng | Ghi chú | +|---|---|---| +| `navigation_free_feedback` | 398 | chỉ cần free `feed_back_str` bằng `nav_c_api_free_string` (đang làm đúng) | +| `navigation_free_occupancy_grid(IntPtr)` | 404 | ⚠️ **trùng tên** symbol mới `navigation_free_occupancy_grid(OccupancyGrid*)` — giữ lại rồi gọi nhầm bản `IntPtr` là free con trỏ rác | +| `navigation_free_occupancy_grid_update` | 410 | | +| `navigation_free_laser_scan(IntPtr)` | 416 | ⚠️ **trùng tên** symbol mới `navigation_free_laser_scan(LaserScan*)` — cùng rủi ro trên | +| `navigation_free_odometry` | 422 | | +| `navigation_free_path2d` | 428 | | +| `navigation_free_polygon_stamped` | 434 | | +| `navigation_free_order` | 440 | symbol thật tên `order_free` | +| `navigation_free_named_occupancy_grids` | 446 | | +| `navigation_free_named_laser_scans` | 452 | | + +### A4. `UnmanagedType.Bool` → `UnmanagedType.I1` (23 khai báo) + +`bool` C++ là 1 byte, trả về trong thanh ghi AL; `UnmanagedType.Bool` marshal 4 byte — 3 byte cao không xác định, có thể đọc `false` thành `true`. Guide nêu đúng rule I1 nhưng không nói binding cũ đang vi phạm. **Sửa toàn bộ `[return: MarshalAs(UnmanagedType.Bool)]` trong `NavigationNativeInterface.cs` thành `UnmanagedType.I1`** (2 chỗ `navigation_dock_to_order`, `navigation_move_to_nodes_edges` đã đúng I1 sẵn). + +### A5. Đường tìm `.so` hardcode máy cũ + +`NavigationNativeInterface.cs:20` chỉ có candidate `/home/mic-733ao/sonvh/pnkx_nav_core/build/libnav_c_api.so`. Thêm đường build hiện tại (`/home/duongtd/T800_ws/src/AMR_T800/pnkx_nav_core/build/libnav_c_api.so`) hoặc chuyển hẳn sang cấu hình/`PNKX_NAV_CORE_LIBRARY_PATH`. + +**Bổ sung 2026-08-10 — mức độ nhẹ hơn tưởng.** Có fallback tại `:40-42`: + +```csharp +return NativeLibrary.TryLoad("libnav_c_api.so", assembly, searchPath, out var fallback) + ? fallback : IntPtr.Zero; +``` + +nên khi candidate không tồn tại, .NET vẫn dò tiếp theo `LD_LIBRARY_PATH` và thư mục output. Hard-code +sai đường **không** làm chết ngay. Nhưng trên robot đường `/home/...` còn bị chặn ở tầng systemd — +xem mục 6. + +### A6. `NavigationClient.cs:49-52` — đọc nhầm **tên** biến môi trường thành **giá trị**, và hardcode thứ hai + +*(phát hiện ở lần đối chiếu lại; báo cáo bản đầu bỏ sót)* + +```csharp +string navCorePath = "PNKX_NAV_CORE_LIBRARY_PATH"; // :49 ← TÊN biến +// string navCoreBuildPath = Path.Combine(navCorePath, "lib"); // :50 (đã comment) +string navCoreBuildPath = "/home/mic-733ao/sonvh/pnkx_nav_core/build"; // :52 ← hardcode THỨ HAI +... +if (Directory.Exists(navCorePath)) // :78 → Directory.Exists("PNKX_NAV_CORE_LIBRARY_PATH") +{ + Directory.SetCurrentDirectory(navCorePath); // :82 → KHÔNG BAO GIỜ chạy +} +else +{ + _logger?.LogWarning("Navigation core path not found: {Path}", navCorePath); // :93 +} +``` + +Thiếu `Environment.GetEnvironmentVariable(...)`. `Directory.Exists` gọi trên **chuỗi tên biến** nên +luôn `false`; `chdir` chưa từng thực hiện, và log ra đúng chữ +`Navigation core path not found: PNKX_NAV_CORE_LIBRARY_PATH` — nhìn log là thấy ngay. + +Đây là **hardcode thứ hai**, độc lập với A5: `:52` đặt `LD_LIBRARY_PATH` cho việc nạp plugin +(`libmove_base2.so` và các planner), còn A5 là đường nạp chính `libnav_c_api.so`. Sửa A5 mà quên A6 +thì `.so` chính nạp được nhưng plugin thì không. + +**Sửa:** + +```csharp +string? navCorePath = Environment.GetEnvironmentVariable("PNKX_NAV_CORE_LIBRARY_PATH"); +if (string.IsNullOrEmpty(navCorePath)) +{ + _logger?.LogError("PNKX_NAV_CORE_LIBRARY_PATH chưa được đặt — plugin navigation sẽ không nạp được"); +} +``` + +rồi dùng chính `navCorePath` cho cả `LD_LIBRARY_PATH` lẫn `chdir`, bỏ hằng số ở `:52`. + +**Ghi chú về `chdir`.** Việc đổi thư mục làm việc **không** giúp tìm cây config: `robot::NodeHandle` +dò theo `PNKX_NAV_CORE_CONFIG_DIR` → `PNKX_NAV_CORE_DIR/config` → các đường tương đối so với +**`/proc/self/exe`**, không phải so với cwd. Đặt đúng biến môi trường mới là cách duy nhất. + +--- + +## 4. C# nhóm B — THÊM khai báo mới + +Toàn bộ phần thêm nằm sẵn ở **Guide Phụ lục B** (đã đối chiếu đúng với `.so` và header): + +- **4 struct mới** (B.1): `RegionOfInterest`, `Image`, `CameraInfo`, `DepthCameraData` — layout khớp header C từng field. Đặt vào `NavigationInterop.cs`. +- **13 `DllImport` mới** (B.2): `navigation_initialize_checked`, `navigation_is_ready`, `navigation_shutdown`, `navigation_get_state`, `navigation_get_status_text`, `navigation_add_depth_camera_data`, `navigation_move_to_order_v2`, `navigation_execute_instant_actions`, `navigation_free_occupancy_grid`, `navigation_free_laser_scan`, `navigation_free_point_cloud`, `navigation_free_point_cloud2`, `navigation_free_planner_data`. Đặt vào `NavigationNativeInterface.cs` — **sau khi đã xoá 2 khai báo trùng tên ở A3**. + +--- + +## 5. C# nhóm C — ĐỔI hành vi (đối chiếu code hiện tại) + +### C1. Trình tự khởi tạo hiện tại SAI thứ tự với move_base2 — sẽ chết cả tiến trình + +Hiện tại (`NavigationIntegrationService.InitializeAsync`): + +``` +navigationClient.Initialize() ← dòng 345, bên trong gọi navigation_initialize (NavigationClient.cs:123) +SetRobotFootprint(...) ← dòng 358, SAU initialize +AddStaticMap(...) ← chỉ chạy khi map đến, SAU initialize +``` + +Với move_base2: planner SBPL chặn chờ costmap có kích thước ≠ 0, kích thước chỉ có khi static map đã vào **trước** `initialize` — chờ quá lâu là `exit(1)` **giết cả tiến trình RobotApp**. Trình tự bắt buộc mới: + +``` +1. tf3_buffer_create + bơm TF liên tục (bắt đầu ngay) +2. navigation_create +3. navigation_set_robot_footprint ← TRƯỚC initialize (bản mới cache, áp lúc dựng costmap) +4. navigation_add_static_map("/map", …) ← BẮT BUỘC trước initialize +5. navigation_initialize_checked ← thay navigation_initialize +6. false → đọc navigation_get_status_text, log, retry/abort +7. bật vòng bơm sensor định kỳ +8. mới nhận goal +``` + +Ghi chú thêm: + +- `navigation_initialize` dưới move_base2 **luôn trả `true`** — check `initResult` tại `NavigationClient.cs:123-130` thành vô nghĩa. Phải chuyển sang `navigation_initialize_checked`. +- Vòng chờ ready hiện tại (poll `GetFeedback().IsReady`, 50 × 100 ms tại `NavigationIntegrationService.cs:373-380`) thay bằng: `initialize_checked` đã blocking và trả kết quả thật; health-check về sau dùng `navigation_is_ready` (rẻ, không cấp phát). +- Tên map bơm vào phải đúng `"/map"` (khớp `map_topic` trong `costmap_common_params.yaml:11`) — rà giá trị `mapName`/`gridMapName` đang truyền tại `NavigationClient.cs:357` và `:505`. +- `navigation_initialize_checked` chặn hàng giây — giữ nguyên pattern chạy nền `Task.Run` hiện có, không gọi từ UI thread. + +### C2. Trình tự tắt thiếu `navigation_shutdown` + +Hiện tại (`NavigationIntegrationService.cs:670-687`): dừng timer → `_navigationClient.Dispose()` → bên trong gọi thẳng `navigation_destroy`. Với move_base2 (control thread + costmap thread + mission thread đang chạy) phải chen thêm bước quiesce: + +``` +1. Dừng MỌI thread/timer C# đang gọi navigation_add_* và đợi thoát hẳn +2. navigation_shutdown(handle) ← MỚI — lõi ngừng phát lệnh vận tốc, getter vẫn an toàn +3. navigation_destroy(handle) +4. tf3_buffer_destroy(tfHandle) ← sau cùng +``` + +Không để `navigation_destroy` rơi vào finalizer/GC. + +### C3. Tám thay đổi hành vi còn lại (rà theo call site) + +| # | Việc | Chỗ trong code | +|---|---|---| +| 1 | `pause`/`resume`/`cancel` trả về ≠ robot đã dừng — hiệu lực ở cycle sau (≤ 33 ms @ 30 Hz). Nếu tầng an toàn nào giả định dừng tức thì → chờ state `PAUSED` hoặc theo dõi twist | call site `navigation_pause/resume/cancel` trong `NavigationClient.cs` | +| 2 | `set_twist_linear/_angular`: là **trần vận tốc**, dấu `x` chọn chiều (âm = trần lùi), muốn chặn 2 chiều gọi 2 lần; giá trị hợp lệ **luôn trả `true`** — tín hiệu "false khi đang cancel" của bản cũ không còn | mỗi hàm 1 call site trong `NavigationClient.cs` | +| 3 | Không so sánh chuỗi `feed_back_str` — chỉ rẽ nhánh theo enum. `FeedbackString` đang được expose tại `NavigationClient.cs:1709` — rà mọi consumer phía trên | consumer của `FeedbackString` | +| 4 | Vòng poll trạng thái chuyển sang `navigation_get_state` (không cấp phát chuỗi); `GetFeedback` chỉ dùng khi cần message. Việc free `feed_back_str` hiện tại đã đúng (`:544`, `:1388`, `:1737`) | update timer / máy trạng thái | +| 5 | `navigation_get_twist` trả **lệnh đang phát**, stamp đứng yên khi không có request, stamp = 0 nghĩa chưa từng điều khiển — check stamp trước khi publish `cmd_vel` để không đè teleop | 3 call site `navigation_get_twist` | +| 6 | `get_global_data`/`_local_data`: tái dùng 1 struct/consumer (hàm tự free nội dung cũ), khi dừng consumer gọi `navigation_free_planner_data`; **không dùng chung struct giữa 2 timer**; footprint trả về giờ là bản thô `base_link` (mục 2.1) | 4+4 call site trong `NavigationClient.cs` | +| 7 | Getter grid/scan/cloud: sau khi dùng phải gọi `navigation_free_*` tương ứng (trước đây không có hàm free → mỗi lời gọi rò ~1 MB với map 1000×1000) | các hàm Get*Map/Scan/Cloud | +| 8 | `navigation_add_odometry` giờ là **feedback vận tốc cho controller mỗi cycle** — bơm đúng nhịp nguồn odometry, không được thưa/bỏ | đường bơm odometry | + +### C4. Nên làm thêm (không bắt buộc để chạy) + +- `navigation_add_depth_camera_data` cho `/camera/depth/data` và `/camera_right/depth/data` — đường duy nhất bật clear theo frustum (xoá vật cản ma). Point cloud không thay thế được. Mẫu code ghim mảng: Guide Phụ lục B.3. +- `navigation_move_to_order_v2` nếu fleet gửi order update (cùng `orderId`, `orderUpdateId` tăng). `navigation_move_to_nodes_edges` (đang dùng 6 chỗ) không mang được định danh — mọi lời gọi là order mới. + +--- + +## 6. C# nhóm D — config/môi trường (viết lại 2026-08-10) + +Bản đầu của mục này chỉ nói tới `launchSettings.json`. Đối chiếu lại cho thấy **như vậy chưa đủ**: +sửa file đó chỉ có tác dụng trên máy dev, robot thật không đọc nó. Chia lại thành hai đường triển +khai. + +### D1. Máy dev (`dotnet run`) + +| File | Hiện tại | Phải đổi thành | +|---|---|---| +| `Properties/launchSettings.json:13` | `PNKX_NAV_CORE_LIBRARY_PATH: /home/mic-733ao/sonvh/pnkx_nav_core/build` | đường chứa `libnav_c_api.so` + `libmove_base2.so` + toàn bộ plugin trên máy đang chạy | +| `Properties/launchSettings.json:14` | `PNKX_NAV_CORE_CONFIG_DIR: /home/mic-733ao/sonvh/pnkx_nav_core/config` | `.../Test/move_base2/config/runtime` — **không** phải `pnkx_nav_core/config`; sai chỗ này là đổi tham số planner mãi không ăn | +| `NavigationNativeInterface.cs:20` | candidate path máy cũ | xem A5 | +| `NavigationClient.cs:49-52` | tên biến dùng như giá trị + hardcode | xem A6 | + +### D2. Robot thật (systemd) — phần bản đầu bỏ sót + +**`launchSettings.json` là file chỉ dành cho phát triển.** `dotnet publish` không đóng gói nó và +runtime không đọc nó ở môi trường Production. Robot khởi động qua unit: + +``` +RobotApp/RobotNet12.RobotApp/systemd/robotnet-robotapp.service +ExecStart=/opt/robotnet/robotapp/RobotNet12.RobotApp +WorkingDirectory=/opt/robotnet/robotapp + +Environment=DOTNET_ENVIRONMENT=Production +Environment=ASPNETCORE_ENVIRONMENT=Production +Environment=ASPNETCORE_URLS=http://0.0.0.0:8080 +``` + +`grep` toàn repo: hai biến `PNKX_NAV_CORE_*` **chỉ xuất hiện trong `launchSettings.json`**. Nghĩa là +trên robot **cả hai đều không được đặt**, và `robot::NodeHandle` rơi xuống nhánh cuối cùng — dò +`../../config`, `../config`, `config` tương đối với `/proc/self/exe`, tức quanh +`/opt/robotnet/robotapp/`. Không có cây config nào ở đó, nên `findLibraryPath("MoveBase")` trả rỗng +và `navigation_create()` trả `NULL`. + +**Phải thêm vào unit file:** + +```ini +[Service] +Environment=PNKX_NAV_CORE_CONFIG_DIR=/opt/robotnet/navcore/config/runtime +Environment=PNKX_NAV_CORE_LIBRARY_PATH=/opt/robotnet/navcore/lib +``` + +### D3. `ProtectHome=true` chặn mọi đường dẫn `/home` trên robot + +Cùng unit file: + +```ini +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/dev/shm /var/log/robotnet /opt/robotnet/robotapp +``` + +`ProtectHome=true` làm `/home` **không truy cập được** đối với tiến trình. Hệ quả trực tiếp: + +- candidate `/home/mic-733ao/sonvh/pnkx_nav_core/build/...` ở A5 — không dùng được trên robot; +- hardcode `/home/mic-733ao/...` ở A6 (`NavigationClient.cs:52`) — không dùng được trên robot; +- **và cả đề xuất thay bằng `/home/duongtd/T800_ws/...`** — cũng không dùng được. Đường đó chỉ hợp + cho máy dev. + +`ProtectSystem=strict` giữ phần còn lại của hệ thống ở chế độ chỉ đọc, nhưng **vẫn đọc được** — nên +`.so` và cây config đặt ở `/usr/local/lib` hoặc `/opt/robotnet/navcore/` đều hợp lệ. + +**Bố cục triển khai đề nghị** (ngoài `/home`, khớp với D2): + +``` +/opt/robotnet/navcore/lib/ libnav_c_api.so, libmove_base2.so, toàn bộ plugin planner/recovery/costmap +/opt/robotnet/navcore/config/runtime/ bản chép của Test/move_base2/config/runtime +``` + +và bổ sung `/opt/robotnet/navcore/lib/libnav_c_api.so` vào `CandidateLibraryPaths` (A5) để không phụ +thuộc hoàn toàn vào `LD_LIBRARY_PATH`. + +### D4. Cách xác minh đang nạp đúng runtime nào + +`navigation_create()` in đường dẫn `.so` đã resolve, ở cấp `debug` nhưng `robot_cpp` **không lọc theo +cấp** nên dòng này luôn hiện: + +``` +navigation_create: loading navigation plugin from '/…/libmove_base2.so' +``` + +`journalctl -u robotnet-robotapp | grep "loading navigation plugin"` — thấy `libmove_base2.so` là +đúng runtime mới; thấy `libmove_base.so` là vẫn đang chạy bản cũ (xảy ra khi `PNKX_NAV_CORE_CONFIG_DIR` +trỏ vào `pnkx_nav_core/config`, nơi `move_base_common_params.yaml:60` ghi `library_path: libmove_base`). +Cả hai `.so` đều export alias `MoveBase`, nên nạp nhầm **không sinh lỗi nào** — đây là lý do phải kiểm +bằng dòng log này thay vì suy đoán. + +### D5. Cảnh báo vận hành + +Từ Guide §6.6: bản `.so` trước 2026-08-08 bỏ qua tham số `linear_x` và hãm trần ±0.1 m/s — sau khi +cập nhật thư viện, robot chạy đúng tốc độ host yêu cầu. **Lần deploy đầu phải quan sát tốc độ thật +trước khi cho chạy tự động.** + +--- + +## 7. Thứ tự thi công đề xuất + +0. **Nhóm E (API đã đổi)** — xoá 4 khai báo + 4 wrapper + 6 call site của các hàm không còn tồn tại, + rồi thêm `navigation_execute_instant_actions`. Không làm bước này thì dock/đi thẳng/quay ném + `EntryPointNotFoundException` lúc chạy. +1. **Nhóm D1 + D2 + D3 (môi trường)** — làm **ngay sau E**, không phải bước 3 như bản đầu. Chưa có + biến môi trường đúng thì `navigation_create()` trả `NULL` và mọi việc sau đó không kiểm chứng + được. Trên robot còn phải giải quyết `ProtectHome` trước khi bàn tới code. +2. Nhóm A (sửa binding sai/chết) — A3 làm trước A1/A2 để tránh trùng tên symbol; A6 đi cùng A5. +3. Nhóm B (thêm 13 DllImport + 4 struct). +4. Nhóm C1 + C2 (trình tự khởi tạo/tắt) — không có C1 thì tiến trình chết ngay khi initialize. +5. Nhóm C3 (8 hành vi) — rà từng call site. +6. Chạy thử: xác minh dòng log `loading navigation plugin from '…libmove_base2.so'` (D4) → khởi tạo → + `initialize_checked` trả `true` → gửi goal đơn → pause/cancel → tắt sạch. Sau đó mới bật depth + camera và order_v2 (C4). +7. Kiểm thử thực tế các mục Guide §10 chưa xác nhận: đường depth camera; và đường instant action mới + (E3) — `PickUp` gửi dạng instantAction phải sinh ra đúng chuỗi chặng như khi nó nằm trong order. + +--- + +## 8. Bảng file C# phải sửa + +| File | Việc | +|---|---| +| `Modules/Navigation/NavigationNativeInterface.cs` | **E1 (xoá 4 `DllImport` của hàm đã xoá)**, A1–A5, B (13 `DllImport`, nay gồm `navigation_execute_instant_actions` thay cho `navigation_dock_to_order_v2`) | +| `Modules/Navigation/NavigationInterop.cs` | B (4 struct mới) | +| `Modules/Navigation/NavigationClient.cs` | **E1 (xoá 4 wrapper `DockTo`/`DockToOrder`/`MoveStraightTo`/`RotateTo`)**, A1/A2 (footprint), **A6 (đọc env + bỏ hardcode `:49-52`)**, C1 (initialize_checked), C2 (shutdown trong Dispose), C3 | +| `Modules/Navigation/NavigationIntegrationService.cs` | **E1 (4 call site `:836`, `:854`, `:882`, `:901`)**, C1 (đảo thứ tự map/footprint/initialize), C2 (chen shutdown), C3.4 (bỏ vòng poll IsReady) | +| **`Endpoints/NavigationTestEndpoints.cs`** | **E1 — 2 call site `MoveStraightTo`/`RotateTo` (`:83`, `:126`) trỏ vào hàm đã xoá** | +| `Properties/launchSettings.json` | D1 — **chỉ có tác dụng trên máy dev** | +| **`RobotApp/RobotNet12.RobotApp/systemd/robotnet-robotapp.service`** | **D2 (thêm 2 dòng `Environment=`), D3 (bố cục cài đặt ngoài `/home`)** — file này bản đầu không nhắc tới, nhưng đây mới là thứ quyết định trên robot | +| *(triển khai, không phải mã nguồn)* | D3 — chép `.so` + plugin vào `/opt/robotnet/navcore/lib`, cây config vào `/opt/robotnet/navcore/config/runtime` | + +--- + +## 9. Nhật ký sửa đổi + +| Ngày | Nội dung | +|---|---| +| 2026-08-10 | Bản đầu: mục 1–8 | +| 2026-08-10 tối | **Đọc lại mã sau đợt refactor.** Thêm **mục 1c / nhóm E**: 5 hàm dock/straight/rotate bị xoá khỏi API (RobotNet12 đang gọi 4/5), năng lực chuyển vào compound action `profile`+`marker`, hàm mới `navigation_execute_instant_actions`. Cập nhật §4, §5 C4, §7 (E lên bước 0), §8. Guide cập nhật đồng bộ | +| 2026-08-10 | **Đối chiếu lại trên mã RobotNet12 thật + `nm`.** Thêm mục **1b** (bảng kiểm chứng, 9/9 khẳng định đúng); thêm **A6**; viết lại **mục 6** thành D1–D5 sau khi phát hiện `launchSettings.json` không áp dụng cho robot và `ProtectHome=true` chặn `/home`; đảo thứ tự thi công (môi trường lên bước 1); bổ sung unit file vào bảng mục 8; đánh dấu §2.3 đã sửa trong Guide | diff --git a/src/APIs/c_api/src/convertor.cpp b/src/APIs/c_api/src/convertor.cpp new file mode 100644 index 0000000..60b92a2 --- /dev/null +++ b/src/APIs/c_api/src/convertor.cpp @@ -0,0 +1,871 @@ +#include "convertor.h" +#include +#include +#include + +namespace +{ + +/** + * @brief Chuỗi rỗng cho một con trỏ NULL. + * + * Mọi `char*` đi qua biên C đều là tuỳ chọn, và chính thư viện này sinh ra NULL cho chuỗi rỗng + * (xem `convert2COccupancyGrid`). Dựng `std::string` thẳng từ con trỏ đó là hành vi không xác định, + * và vòng get -> add của cùng một message là đường chạm vào nó nhanh nhất. + */ +inline const char* safe_cstr(const char* s) +{ + return s != nullptr ? s : ""; +} + +} // namespace + +robot_sensor_msgs::LaserScan convert2CppLaserScan(const LaserScan& laser_scan) +{ + robot_sensor_msgs::LaserScan robot_laser_scan; + robot_laser_scan.header.seq = laser_scan.header.seq; + robot_laser_scan.header.stamp.sec = laser_scan.header.sec; + robot_laser_scan.header.stamp.nsec = laser_scan.header.nsec; + robot_laser_scan.header.frame_id = safe_cstr(laser_scan.header.frame_id); + robot_laser_scan.angle_min = laser_scan.angle_min; + robot_laser_scan.angle_max = laser_scan.angle_max; + robot_laser_scan.angle_increment = laser_scan.angle_increment; + robot_laser_scan.time_increment = laser_scan.time_increment; + robot_laser_scan.scan_time = laser_scan.scan_time; + robot_laser_scan.range_min = laser_scan.range_min; + robot_laser_scan.range_max = laser_scan.range_max; + size_t ranges_size = laser_scan.ranges ? laser_scan.ranges_count : 0; + size_t intensities_size = laser_scan.intensities ? laser_scan.intensities_count : 0; + robot_laser_scan.ranges.resize(ranges_size); + robot_laser_scan.intensities.resize(intensities_size); + for (size_t i = 0; i < ranges_size; i++) { + robot_laser_scan.ranges[i] = laser_scan.ranges[i]; + } + for (size_t i = 0; i < intensities_size; i++) { + robot_laser_scan.intensities[i] = laser_scan.intensities[i]; + } + return robot_laser_scan; +} + + +robot_nav_msgs::OccupancyGrid convert2CppOccupancyGrid(const OccupancyGrid& occupancy_grid) { + robot_nav_msgs::OccupancyGrid robot_occupancy_grid; + robot_occupancy_grid.header.seq = occupancy_grid.header.seq; + robot_occupancy_grid.header.stamp.sec = occupancy_grid.header.sec; + robot_occupancy_grid.header.stamp.nsec = occupancy_grid.header.nsec; + robot_occupancy_grid.header.frame_id = safe_cstr(occupancy_grid.header.frame_id); + robot_occupancy_grid.info.map_load_time.sec = occupancy_grid.info.map_load_time.sec; + robot_occupancy_grid.info.map_load_time.nsec = occupancy_grid.info.map_load_time.nsec; + robot_occupancy_grid.info.resolution = occupancy_grid.info.resolution; + robot_occupancy_grid.info.width = occupancy_grid.info.width; + robot_occupancy_grid.info.height = occupancy_grid.info.height; + robot_occupancy_grid.info.origin.position.x = occupancy_grid.info.origin.position.x; + robot_occupancy_grid.info.origin.position.y = occupancy_grid.info.origin.position.y; + robot_occupancy_grid.info.origin.position.z = occupancy_grid.info.origin.position.z; + robot_occupancy_grid.info.origin.orientation.x = occupancy_grid.info.origin.orientation.x; + robot_occupancy_grid.info.origin.orientation.y = occupancy_grid.info.origin.orientation.y; + robot_occupancy_grid.info.origin.orientation.z = occupancy_grid.info.origin.orientation.z; + robot_occupancy_grid.info.origin.orientation.w = occupancy_grid.info.origin.orientation.w; + + size_t data_size = occupancy_grid.data ? occupancy_grid.data_count : 0; + + robot_occupancy_grid.data.resize(data_size); + for (size_t i = 0; i < data_size; i++) { + robot_occupancy_grid.data[i] = occupancy_grid.data[i]; + } + return robot_occupancy_grid; +} + +robot_nav_msgs::Odometry convert2CppOdometry(const Odometry& odometry) +{ + robot_nav_msgs::Odometry robot_odometry; + robot_odometry.header.seq = odometry.header.seq; + robot_odometry.header.stamp.sec = odometry.header.sec; + robot_odometry.header.stamp.nsec = odometry.header.nsec; + robot_odometry.header.frame_id = odometry.header.frame_id ? odometry.header.frame_id : "base_link"; + + robot_odometry.child_frame_id = odometry.child_frame_id ? odometry.child_frame_id : "base_link"; + robot_odometry.pose.pose.position.x = odometry.pose.pose.position.x; + robot_odometry.pose.pose.position.y = odometry.pose.pose.position.y; + robot_odometry.pose.pose.position.z = odometry.pose.pose.position.z; + robot_odometry.pose.pose.orientation.x = odometry.pose.pose.orientation.x; + robot_odometry.pose.pose.orientation.y = odometry.pose.pose.orientation.y; + robot_odometry.pose.pose.orientation.z = odometry.pose.pose.orientation.z; + robot_odometry.pose.pose.orientation.w = odometry.pose.pose.orientation.w; + + if (odometry.pose.covariance && odometry.pose.covariance_count > 0) + { + const size_t n = std::min(static_cast(36), odometry.pose.covariance_count); + for (size_t i = 0; i < n; ++i) + robot_odometry.pose.covariance[i] = odometry.pose.covariance[i]; + } + + robot_odometry.twist.twist.linear.x = odometry.twist.twist.linear.x; + robot_odometry.twist.twist.linear.y = odometry.twist.twist.linear.y; + robot_odometry.twist.twist.linear.z = odometry.twist.twist.linear.z; + robot_odometry.twist.twist.angular.x = odometry.twist.twist.angular.x; + robot_odometry.twist.twist.angular.y = odometry.twist.twist.angular.y; + robot_odometry.twist.twist.angular.z = odometry.twist.twist.angular.z; + + if (odometry.twist.covariance && odometry.twist.covariance_count > 0) + { + const size_t n = std::min(static_cast(36), odometry.twist.covariance_count); + for (size_t i = 0; i < n; ++i) + robot_odometry.twist.covariance[i] = odometry.twist.covariance[i]; + } + + return robot_odometry; +} + +// Convert C PoseStamped to C++ PoseStamped +robot_geometry_msgs::PoseStamped convert2CppPoseStamped(const PoseStamped& c_pose) +{ + robot_geometry_msgs::PoseStamped cpp_pose; + cpp_pose.header.seq = c_pose.header.seq; + cpp_pose.header.stamp.sec = c_pose.header.sec; + cpp_pose.header.stamp.nsec = c_pose.header.nsec; + cpp_pose.header.frame_id = safe_cstr(c_pose.header.frame_id); + + + cpp_pose.pose.position.x = c_pose.pose.position.x; + cpp_pose.pose.position.y = c_pose.pose.position.y; + cpp_pose.pose.position.z = c_pose.pose.position.z; + cpp_pose.pose.orientation.x = c_pose.pose.orientation.x; + cpp_pose.pose.orientation.y = c_pose.pose.orientation.y; + cpp_pose.pose.orientation.z = c_pose.pose.orientation.z; + cpp_pose.pose.orientation.w = c_pose.pose.orientation.w; + return cpp_pose; +} + +// Convert C++ PoseStamped to C PoseStamped +PoseStamped convert2CPoseStamped(const robot_geometry_msgs::PoseStamped& cpp_pose) +{ + PoseStamped c_pose; + c_pose.header.seq = cpp_pose.header.seq; + c_pose.header.sec = cpp_pose.header.stamp.sec; + c_pose.header.nsec = cpp_pose.header.stamp.nsec; + c_pose.header.frame_id = cpp_pose.header.frame_id.empty() ? nullptr : strdup(cpp_pose.header.frame_id.c_str()); + c_pose.pose.position.x = cpp_pose.pose.position.x; + c_pose.pose.position.y = cpp_pose.pose.position.y; + c_pose.pose.position.z = cpp_pose.pose.position.z; + c_pose.pose.orientation.x = cpp_pose.pose.orientation.x; + c_pose.pose.orientation.y = cpp_pose.pose.orientation.y; + c_pose.pose.orientation.z = cpp_pose.pose.orientation.z; + c_pose.pose.orientation.w = cpp_pose.pose.orientation.w; + return c_pose; +} + +// Convert C++ Pose2D to C Pose2D +Pose2D convert2CPose2D(const robot_geometry_msgs::Pose2D& cpp_pose) +{ + Pose2D c_pose; + c_pose.x = cpp_pose.x; + c_pose.y = cpp_pose.y; + c_pose.theta = cpp_pose.theta; + return c_pose; +} + +// Convert C Pose2D to C++ Pose2D. +// +// Đã được khai báo trong convertor.h và được navigation_offset_goal_2d gọi từ đầu, nhưng chưa bao +// giờ có định nghĩa: thư viện chia sẻ vẫn link được với một symbol chưa phân giải, nên lỗi chỉ hiện +// ra lúc chạy, ở đúng lời gọi đầu tiên. +robot_geometry_msgs::Pose2D convert2CppPose2D(const Pose2D& pose_2d) +{ + robot_geometry_msgs::Pose2D cpp_pose; + cpp_pose.x = pose_2d.x; + cpp_pose.y = pose_2d.y; + cpp_pose.theta = pose_2d.theta; // [rad] + return cpp_pose; +} +Header convert2CHeader(const robot_std_msgs::Header& cpp_header) +{ + Header c_header; + c_header.seq = cpp_header.seq; + c_header.sec = cpp_header.stamp.sec; + c_header.nsec = cpp_header.stamp.nsec; + c_header.frame_id = cpp_header.frame_id.empty() ? nullptr : strdup(cpp_header.frame_id.c_str()); + return c_header; +} + +Twist2DStamped convert2CTwist2DStamped(const robot_nav_2d_msgs::Twist2DStamped& cpp_twist) +{ + Twist2DStamped c_twist; + c_twist.header = convert2CHeader(cpp_twist.header); + c_twist.velocity.x = cpp_twist.velocity.x; + c_twist.velocity.y = cpp_twist.velocity.y; + c_twist.velocity.theta = cpp_twist.velocity.theta; + return c_twist; +} + +// ========== C++ to C converters (for get_* API) ========== + +void convert2COccupancyGrid(const robot_nav_msgs::OccupancyGrid& cpp, OccupancyGrid& out) +{ + out.header.seq = cpp.header.seq; + out.header.sec = cpp.header.stamp.sec; + out.header.nsec = cpp.header.stamp.nsec; + out.header.frame_id = cpp.header.frame_id.empty() ? nullptr : strdup(cpp.header.frame_id.c_str()); + out.info.map_load_time.sec = cpp.info.map_load_time.sec; + out.info.map_load_time.nsec = cpp.info.map_load_time.nsec; + out.info.resolution = cpp.info.resolution; + out.info.width = cpp.info.width; + out.info.height = cpp.info.height; + out.info.origin.position.x = cpp.info.origin.position.x; + out.info.origin.position.y = cpp.info.origin.position.y; + out.info.origin.position.z = cpp.info.origin.position.z; + out.info.origin.orientation.x = cpp.info.origin.orientation.x; + out.info.origin.orientation.y = cpp.info.origin.orientation.y; + out.info.origin.orientation.z = cpp.info.origin.orientation.z; + out.info.origin.orientation.w = cpp.info.origin.orientation.w; + out.data_count = cpp.data.size(); + out.data = nullptr; + if (out.data_count > 0) + { + out.data = static_cast(malloc(out.data_count * sizeof(int8_t))); + if (out.data) + memcpy(out.data, cpp.data.data(), out.data_count * sizeof(int8_t)); + } +} + +static void convert2CPose2DStamped(const robot_nav_2d_msgs::Pose2DStamped& cpp, Pose2DStamped& out) +{ + out.header = convert2CHeader(cpp.header); + out.pose = convert2CPose2D(cpp.pose); +} + +void convert2CPath2D(const robot_nav_2d_msgs::Path2D& cpp, Path2D& out) +{ + out.header = convert2CHeader(cpp.header); + out.poses_count = cpp.poses.size(); + out.poses = nullptr; + if (out.poses_count > 0) + { + out.poses = static_cast(malloc(out.poses_count * sizeof(Pose2DStamped))); + if (out.poses) + { + for (size_t i = 0; i < out.poses_count; i++) + convert2CPose2DStamped(cpp.poses[i], out.poses[i]); + } + } +} + +void convert2COccupancyGridUpdate(const robot_map_msgs::OccupancyGridUpdate& cpp, OccupancyGridUpdate& out) +{ + out.header = convert2CHeader(cpp.header); + out.x = cpp.x; + out.y = cpp.y; + out.width = cpp.width; + out.height = cpp.height; + out.data_count = cpp.data.size(); + out.data = nullptr; + if (out.data_count > 0) + { + out.data = static_cast(malloc(out.data_count * sizeof(int8_t))); + if (out.data) + memcpy(out.data, cpp.data.data(), out.data_count * sizeof(int8_t)); + } +} + +static void convert2CPolygon(const robot_geometry_msgs::Polygon& cpp, Polygon& out) +{ + out.points_count = cpp.points.size(); + out.points = nullptr; + if (out.points_count > 0) + { + out.points = static_cast(malloc(out.points_count * sizeof(Point32))); + if (out.points) + { + for (size_t i = 0; i < out.points_count; i++) + { + out.points[i].x = cpp.points[i].x; + out.points[i].y = cpp.points[i].y; + out.points[i].z = cpp.points[i].z; + } + } + } +} + +void convert2CPolygonStamped(const robot_geometry_msgs::PolygonStamped& cpp, PolygonStamped& out) +{ + out.header = convert2CHeader(cpp.header); + convert2CPolygon(cpp.polygon, out.polygon); +} + +void convert2CLaserScan(const robot_sensor_msgs::LaserScan& cpp, LaserScan& out) +{ + out.header.seq = cpp.header.seq; + out.header.sec = cpp.header.stamp.sec; + out.header.nsec = cpp.header.stamp.nsec; + out.header.frame_id = cpp.header.frame_id.empty() ? nullptr : strdup(cpp.header.frame_id.c_str()); + out.angle_min = cpp.angle_min; + out.angle_max = cpp.angle_max; + out.angle_increment = cpp.angle_increment; + out.time_increment = cpp.time_increment; + out.scan_time = cpp.scan_time; + out.range_min = cpp.range_min; + out.range_max = cpp.range_max; + out.ranges_count = cpp.ranges.size(); + out.ranges = nullptr; + if (out.ranges_count > 0) + { + out.ranges = static_cast(malloc(out.ranges_count * sizeof(float))); + if (out.ranges) + memcpy(out.ranges, cpp.ranges.data(), out.ranges_count * sizeof(float)); + } + out.intensities_count = cpp.intensities.size(); + out.intensities = nullptr; + if (out.intensities_count > 0) + { + out.intensities = static_cast(malloc(out.intensities_count * sizeof(float))); + if (out.intensities) + memcpy(out.intensities, cpp.intensities.data(), out.intensities_count * sizeof(float)); + } +} + +void convert2CPointCloud(const robot_sensor_msgs::PointCloud& cpp, PointCloud& out) +{ + out.header.seq = cpp.header.seq; + out.header.sec = cpp.header.stamp.sec; + out.header.nsec = cpp.header.stamp.nsec; + out.header.frame_id = cpp.header.frame_id.empty() ? nullptr : strdup(cpp.header.frame_id.c_str()); + out.points_count = cpp.points.size(); + out.points = nullptr; + if (out.points_count > 0) + { + out.points = static_cast(malloc(out.points_count * sizeof(Point32))); + if (out.points) + for (size_t i = 0; i < out.points_count; ++i) + { + out.points[i].x = cpp.points[i].x; + out.points[i].y = cpp.points[i].y; + out.points[i].z = cpp.points[i].z; + } + } + out.channels_count = cpp.channels.size(); + out.channels = nullptr; + if (out.channels_count > 0) + { + out.channels = static_cast(malloc(out.channels_count * sizeof(ChannelFloat32))); + if (out.channels) + for (size_t i = 0; i < out.channels_count; ++i) + { + out.channels[i].name = cpp.channels[i].name.empty() ? nullptr : strdup(cpp.channels[i].name.c_str()); + out.channels[i].values_count = cpp.channels[i].values.size(); + out.channels[i].values = nullptr; + if (out.channels[i].values_count > 0) + { + out.channels[i].values = static_cast(malloc(out.channels[i].values_count * sizeof(float))); + if (out.channels[i].values) + memcpy(out.channels[i].values, cpp.channels[i].values.data(), out.channels[i].values_count * sizeof(float)); + } + } + } +} + +void convert2CPointCloud2(const robot_sensor_msgs::PointCloud2& cpp, PointCloud2& out) +{ + out.header.seq = cpp.header.seq; + out.header.sec = cpp.header.stamp.sec; + out.header.nsec = cpp.header.stamp.nsec; + out.header.frame_id = cpp.header.frame_id.empty() ? nullptr : strdup(cpp.header.frame_id.c_str()); + out.height = cpp.height; + out.width = cpp.width; + out.is_bigendian = cpp.is_bigendian; + out.point_step = cpp.point_step; + out.row_step = cpp.row_step; + out.is_dense = cpp.is_dense; + out.fields_count = cpp.fields.size(); + out.fields = nullptr; + if (out.fields_count > 0) + { + out.fields = static_cast(malloc(out.fields_count * sizeof(PointField))); + if (out.fields) + for (size_t i = 0; i < out.fields_count; ++i) + { + out.fields[i].name = cpp.fields[i].name.empty() ? nullptr : strdup(cpp.fields[i].name.c_str()); + out.fields[i].offset = cpp.fields[i].offset; + out.fields[i].datatype = cpp.fields[i].datatype; + out.fields[i].count = cpp.fields[i].count; + } + } + out.data_count = cpp.data.size(); + out.data = nullptr; + if (out.data_count > 0) + { + out.data = static_cast(malloc(out.data_count)); + if (out.data) + memcpy(out.data, cpp.data.data(), out.data_count); + } +} + +// ========== C to C++ for PointCloud / PointCloud2 (for add_* API) ========== + +robot_sensor_msgs::PointCloud convert2CppPointCloud(const PointCloud& c) +{ + robot_sensor_msgs::PointCloud cpp; + cpp.header.seq = c.header.seq; + cpp.header.stamp.sec = c.header.sec; + cpp.header.stamp.nsec = c.header.nsec; + cpp.header.frame_id = safe_cstr(c.header.frame_id); + + // Kích thước lấy TỪ con trỏ, không từ bộ đếm: con trỏ NULL kèm bộ đếm khác 0 là dữ liệu hỏng, và + // resize theo bộ đếm sẽ cấp phát một vector khổng lồ rồi không bao giờ điền vào. + const size_t points_size = c.points ? c.points_count : 0; + cpp.points.resize(points_size); + for (size_t i = 0; i < points_size; ++i) + { + cpp.points[i].x = c.points[i].x; + cpp.points[i].y = c.points[i].y; + cpp.points[i].z = c.points[i].z; + } + + const size_t channels_size = c.channels ? c.channels_count : 0; + cpp.channels.resize(channels_size); + for (size_t i = 0; i < channels_size; ++i) + { + cpp.channels[i].name = safe_cstr(c.channels[i].name); + const size_t values_size = c.channels[i].values ? c.channels[i].values_count : 0; + cpp.channels[i].values.resize(values_size); + if (values_size > 0) + memcpy(cpp.channels[i].values.data(), c.channels[i].values, values_size * sizeof(float)); + } + return cpp; +} + +robot_sensor_msgs::PointCloud2 convert2CppPointCloud2(const PointCloud2& c) +{ + robot_sensor_msgs::PointCloud2 cpp; + cpp.header.seq = c.header.seq; + cpp.header.stamp.sec = c.header.sec; + cpp.header.stamp.nsec = c.header.nsec; + cpp.header.frame_id = safe_cstr(c.header.frame_id); + cpp.height = c.height; + cpp.width = c.width; + cpp.is_bigendian = c.is_bigendian; + cpp.point_step = c.point_step; + cpp.row_step = c.row_step; + cpp.is_dense = c.is_dense; + + // Kích thước lấy từ con trỏ, không từ bộ đếm — xem ghi chú ở convert2CppPointCloud. + const size_t fields_size = c.fields ? c.fields_count : 0; + cpp.fields.resize(fields_size); + for (size_t i = 0; i < fields_size; ++i) + { + cpp.fields[i].name = safe_cstr(c.fields[i].name); + cpp.fields[i].offset = c.fields[i].offset; + cpp.fields[i].datatype = c.fields[i].datatype; + cpp.fields[i].count = c.fields[i].count; + } + + const size_t data_size = c.data ? c.data_count : 0; + cpp.data.resize(data_size); + if (data_size > 0) + memcpy(cpp.data.data(), c.data, data_size); + return cpp; +} + +// --- protocol_msgs helpers (C <-> C++ robot_protocol_msgs) --- + +static inline char* dup_cstr(const char* s) +{ + if (!s) return nullptr; + const size_t n = std::strlen(s) + 1; + char* p = static_cast(std::malloc(n)); + if (p) std::memcpy(p, s, n); + return p; +} + +static robot_protocol_msgs::ActionParameter convert2CppActionParameter(const ActionParameter& c) +{ + robot_protocol_msgs::ActionParameter cpp; + cpp.key = c.key ? c.key : ""; + cpp.value = c.value ? c.value : ""; + return cpp; +} + +static ActionParameter convert2CActionParameter(const robot_protocol_msgs::ActionParameter& cpp) +{ + ActionParameter c; + c.key = dup_cstr(cpp.key.c_str()); + c.value = dup_cstr(cpp.value.c_str()); + return c; +} + +static robot_protocol_msgs::ControlPoint convert2CppControlPoint(const ControlPoint& c) +{ + robot_protocol_msgs::ControlPoint cpp; + cpp.x = c.x; + cpp.y = c.y; + cpp.weight = c.weight; + return cpp; +} + +static ControlPoint convert2CControlPoint(const robot_protocol_msgs::ControlPoint& cpp) +{ + ControlPoint c; + c.x = cpp.x; + c.y = cpp.y; + c.weight = cpp.weight; + return c; +} + +static robot_protocol_msgs::NodePosition convert2CppNodePosition(const NodePosition& c) +{ + robot_protocol_msgs::NodePosition cpp; + cpp.x = c.x; + cpp.y = c.y; + cpp.theta = c.theta; + cpp.allowedDeviationXY = c.allowedDeviationXY; + cpp.allowedDeviationTheta = c.allowedDeviationTheta; + cpp.mapId = c.mapId ? c.mapId : ""; + cpp.mapDescription = c.mapDescription ? c.mapDescription : ""; + return cpp; +} + +static NodePosition convert2CNodePosition(const robot_protocol_msgs::NodePosition& cpp) +{ + NodePosition c; + c.x = cpp.x; + c.y = cpp.y; + c.theta = cpp.theta; + c.allowedDeviationXY = cpp.allowedDeviationXY; + c.allowedDeviationTheta = cpp.allowedDeviationTheta; + c.mapId = dup_cstr(cpp.mapId.c_str()); + c.mapDescription = dup_cstr(cpp.mapDescription.c_str()); + return c; +} + +static robot_protocol_msgs::Trajectory convert2CppTrajectory(const Trajectory& c) +{ + robot_protocol_msgs::Trajectory cpp; + cpp.degree = c.degree; + const size_t kv = c.knotVector ? c.knotVector_count : 0; + cpp.knotVector.resize(kv); + for (size_t i = 0; i < kv; i++) + cpp.knotVector[i] = c.knotVector[i]; + const size_t ncp = c.controlPoints ? c.controlPoints_count : 0; + cpp.controlPoints.resize(ncp); + for (size_t i = 0; i < ncp; i++) + cpp.controlPoints[i] = convert2CppControlPoint(c.controlPoints[i]); + return cpp; +} + +static Trajectory convert2CTrajectory(const robot_protocol_msgs::Trajectory& cpp) +{ + Trajectory c; + c.degree = cpp.degree; + c.knotVector_count = cpp.knotVector.size(); + c.knotVector = c.knotVector_count ? static_cast(std::malloc(c.knotVector_count * sizeof(double))) : nullptr; + if (c.knotVector) + for (size_t i = 0; i < c.knotVector_count; i++) + c.knotVector[i] = cpp.knotVector[i]; + c.controlPoints_count = cpp.controlPoints.size(); + c.controlPoints = c.controlPoints_count ? static_cast(std::malloc(c.controlPoints_count * sizeof(ControlPoint))) : nullptr; + if (c.controlPoints) + for (size_t i = 0; i < c.controlPoints_count; i++) + c.controlPoints[i] = convert2CControlPoint(cpp.controlPoints[i]); + return c; +} + +robot_protocol_msgs::Action convert2CppAction(const Action& c) +{ + robot_protocol_msgs::Action cpp; + cpp.actionType = c.actionType ? c.actionType : ""; + cpp.actionId = c.actionId ? c.actionId : ""; + cpp.actionDescription = c.actionDescription ? c.actionDescription : ""; + cpp.blockingType = c.blockingType ? c.blockingType : ""; + const size_t n = c.actionParameters ? c.actionParameters_count : 0; + cpp.actionParameters.resize(n); + for (size_t i = 0; i < n; i++) + cpp.actionParameters[i] = convert2CppActionParameter(c.actionParameters[i]); + return cpp; +} + +static Action convert2CAction(const robot_protocol_msgs::Action& cpp) +{ + Action c; + c.actionType = dup_cstr(cpp.actionType.c_str()); + c.actionId = dup_cstr(cpp.actionId.c_str()); + c.actionDescription = dup_cstr(cpp.actionDescription.c_str()); + c.blockingType = dup_cstr(cpp.blockingType.c_str()); + c.actionParameters_count = cpp.actionParameters.size(); + c.actionParameters = c.actionParameters_count ? static_cast(std::malloc(c.actionParameters_count * sizeof(ActionParameter))) : nullptr; + if (c.actionParameters) + for (size_t i = 0; i < c.actionParameters_count; i++) + c.actionParameters[i] = convert2CActionParameter(cpp.actionParameters[i]); + return c; +} + +static robot_protocol_msgs::Node convert2CppNode(const Node& c) +{ + robot_protocol_msgs::Node cpp; + cpp.nodeId = c.nodeId ? c.nodeId : ""; + cpp.sequenceId = c.sequenceId; + cpp.nodeDescription = c.nodeDescription ? c.nodeDescription : ""; + cpp.released = c.released; + cpp.nodePosition = convert2CppNodePosition(c.nodePosition); + const size_t n = c.actions ? c.actions_count : 0; + cpp.actions.resize(n); + for (size_t i = 0; i < n; i++) + cpp.actions[i] = convert2CppAction(c.actions[i]); + return cpp; +} + +static Node convert2CNode(const robot_protocol_msgs::Node& cpp) +{ + Node c; + c.nodeId = dup_cstr(cpp.nodeId.c_str()); + c.sequenceId = cpp.sequenceId; + c.nodeDescription = dup_cstr(cpp.nodeDescription.c_str()); + c.released = cpp.released; + c.nodePosition = convert2CNodePosition(cpp.nodePosition); + c.actions_count = cpp.actions.size(); + c.actions = c.actions_count ? static_cast(std::malloc(c.actions_count * sizeof(Action))) : nullptr; + if (c.actions) + for (size_t i = 0; i < c.actions_count; i++) + c.actions[i] = convert2CAction(cpp.actions[i]); + return c; +} + +static robot_protocol_msgs::Edge convert2CppEdge(const Edge& c) +{ + robot_protocol_msgs::Edge cpp; + cpp.edgeId = c.edgeId ? c.edgeId : ""; + cpp.sequenceId = c.sequenceId; + cpp.edgeDescription = c.edgeDescription ? c.edgeDescription : ""; + cpp.released = c.released; + cpp.startNodeId = c.startNodeId ? c.startNodeId : ""; + cpp.endNodeId = c.endNodeId ? c.endNodeId : ""; + cpp.maxSpeed = c.maxSpeed; + cpp.maxHeight = c.maxHeight; + cpp.minHeight = c.minHeight; + cpp.orientation = c.orientation; + cpp.orientationType = c.orientationType ? c.orientationType : ""; + cpp.direction = c.direction ? c.direction : ""; + cpp.rotationAllowed = c.rotationAllowed; + cpp.maxRotationSpeed = c.maxRotationSpeed; + cpp.trajectory = convert2CppTrajectory(c.trajectory); + cpp.length = c.length; + const size_t n = c.actions ? c.actions_count : 0; + cpp.actions.resize(n); + for (size_t i = 0; i < n; i++) + cpp.actions[i] = convert2CppAction(c.actions[i]); + return cpp; +} + +static Edge convert2CEdge(const robot_protocol_msgs::Edge& cpp) +{ + Edge c; + c.edgeId = dup_cstr(cpp.edgeId.c_str()); + c.sequenceId = cpp.sequenceId; + c.edgeDescription = dup_cstr(cpp.edgeDescription.c_str()); + c.released = cpp.released; + c.startNodeId = dup_cstr(cpp.startNodeId.c_str()); + c.endNodeId = dup_cstr(cpp.endNodeId.c_str()); + c.maxSpeed = cpp.maxSpeed; + c.maxHeight = cpp.maxHeight; + c.minHeight = cpp.minHeight; + c.orientation = cpp.orientation; + c.orientationType = dup_cstr(cpp.orientationType.c_str()); + c.direction = dup_cstr(cpp.direction.c_str()); + c.rotationAllowed = cpp.rotationAllowed; + c.maxRotationSpeed = cpp.maxRotationSpeed; + c.trajectory = convert2CTrajectory(cpp.trajectory); + c.length = cpp.length; + c.actions_count = cpp.actions.size(); + c.actions = c.actions_count ? static_cast(std::malloc(c.actions_count * sizeof(Action))) : nullptr; + if (c.actions) + for (size_t i = 0; i < c.actions_count; i++) + c.actions[i] = convert2CAction(cpp.actions[i]); + return c; +} + +static void free_action_parameter(ActionParameter* p) +{ + if (!p) return; + std::free(p->key); + std::free(p->value); + p->key = nullptr; + p->value = nullptr; +} + +static void free_action(Action* p) +{ + if (!p) return; + std::free(p->actionType); + std::free(p->actionId); + std::free(p->actionDescription); + std::free(p->blockingType); + p->actionType = p->actionId = p->actionDescription = p->blockingType = nullptr; + if (p->actionParameters) { + for (size_t i = 0; i < p->actionParameters_count; i++) + free_action_parameter(&p->actionParameters[i]); + std::free(p->actionParameters); + p->actionParameters = nullptr; + } + p->actionParameters_count = 0; +} + +static void free_node_position(NodePosition* p) +{ + if (!p) return; + std::free(p->mapId); + std::free(p->mapDescription); + p->mapId = p->mapDescription = nullptr; +} + +static void free_trajectory(Trajectory* p) +{ + if (!p) return; + std::free(p->knotVector); + p->knotVector = nullptr; + p->knotVector_count = 0; + std::free(p->controlPoints); + p->controlPoints = nullptr; + p->controlPoints_count = 0; +} + +static void free_node(Node* p) +{ + if (!p) return; + std::free(p->nodeId); + std::free(p->nodeDescription); + p->nodeId = p->nodeDescription = nullptr; + free_node_position(&p->nodePosition); + if (p->actions) { + for (size_t i = 0; i < p->actions_count; i++) + free_action(&p->actions[i]); + std::free(p->actions); + p->actions = nullptr; + } + p->actions_count = 0; +} + +static void free_edge(Edge* p) +{ + if (!p) return; + std::free(p->edgeId); + std::free(p->edgeDescription); + std::free(p->startNodeId); + std::free(p->endNodeId); + std::free(p->orientationType); + std::free(p->direction); + p->edgeId = p->edgeDescription = p->startNodeId = p->endNodeId = nullptr; + p->orientationType = p->direction = nullptr; + free_trajectory(&p->trajectory); + if (p->actions) { + for (size_t i = 0; i < p->actions_count; i++) + free_action(&p->actions[i]); + std::free(p->actions); + p->actions = nullptr; + } + p->actions_count = 0; +} + +robot_protocol_msgs::Order convert2CppOrder(const Order& order) +{ + robot_protocol_msgs::Order cpp_order; + cpp_order.headerId = order.headerId; + cpp_order.timestamp = order.timestamp ? order.timestamp : ""; + cpp_order.version = order.version ? order.version : ""; + cpp_order.manufacturer = order.manufacturer ? order.manufacturer : ""; + cpp_order.serialNumber = order.serialNumber ? order.serialNumber : ""; + cpp_order.orderId = order.orderId ? order.orderId : ""; + cpp_order.orderUpdateId = order.orderUpdateId; + const size_t nn = order.nodes ? order.nodes_count : 0; + cpp_order.nodes.resize(nn); + for (size_t i = 0; i < nn; i++) + cpp_order.nodes[i] = convert2CppNode(order.nodes[i]); + const size_t ne = order.edges ? order.edges_count : 0; + cpp_order.edges.resize(ne); + for (size_t i = 0; i < ne; i++) + cpp_order.edges[i] = convert2CppEdge(order.edges[i]); + cpp_order.zoneSetId = order.zoneSetId ? order.zoneSetId : ""; + return cpp_order; +} + +Order convert2COrder(const robot_protocol_msgs::Order& cpp_order) +{ + Order order; + order.headerId = cpp_order.headerId; + order.timestamp = dup_cstr(cpp_order.timestamp.c_str()); + order.version = dup_cstr(cpp_order.version.c_str()); + order.manufacturer = dup_cstr(cpp_order.manufacturer.c_str()); + order.serialNumber = dup_cstr(cpp_order.serialNumber.c_str()); + order.orderId = dup_cstr(cpp_order.orderId.c_str()); + order.orderUpdateId = cpp_order.orderUpdateId; + order.nodes_count = cpp_order.nodes.size(); + order.nodes = order.nodes_count ? static_cast(std::malloc(order.nodes_count * sizeof(Node))) : nullptr; + if (order.nodes) + for (size_t i = 0; i < order.nodes_count; i++) + order.nodes[i] = convert2CNode(cpp_order.nodes[i]); + order.edges_count = cpp_order.edges.size(); + order.edges = order.edges_count ? static_cast(std::malloc(order.edges_count * sizeof(Edge))) : nullptr; + if (order.edges) + for (size_t i = 0; i < order.edges_count; i++) + order.edges[i] = convert2CEdge(cpp_order.edges[i]); + order.zoneSetId = dup_cstr(cpp_order.zoneSetId.c_str()); + return order; +} + +extern "C" void order_free(Order* order) +{ + if (!order) return; + std::free(order->timestamp); + std::free(order->version); + std::free(order->manufacturer); + std::free(order->serialNumber); + std::free(order->orderId); + std::free(order->zoneSetId); + order->timestamp = order->version = order->manufacturer = nullptr; + order->serialNumber = order->orderId = order->zoneSetId = nullptr; + if (order->nodes) { + for (size_t i = 0; i < order->nodes_count; i++) + free_node(&order->nodes[i]); + std::free(order->nodes); + order->nodes = nullptr; + } + order->nodes_count = 0; + if (order->edges) { + for (size_t i = 0; i < order->edges_count; i++) + free_edge(&order->edges[i]); + std::free(order->edges); + order->edges = nullptr; + } + order->edges_count = 0; +} + +bool isQuaternionValid(const Quaternion& q) +{ + // first we need to check if the quaternion has nan's or infs + if (!std::isfinite(q.x) || !std::isfinite(q.y) || !std::isfinite(q.z) || !std::isfinite(q.w)) + { + robot::log_error("Quaternion has nans or infs... discarding as a navigation goal"); + return false; + } + + tf3::Quaternion tf_q(q.x, q.y, q.z, q.w); + + // next, we need to check if the length of the quaternion is close to zero + if (tf_q.length2() < 1e-6) + { + robot::log_error("Quaternion has length close to zero... discarding as navigation goal"); + return false; + } + + // next, we'll normalize the quaternion and check that it transforms the vertical vector correctly + tf_q.normalize(); + + tf3::Vector3 up(0, 0, 1); + + double dot = up.dot(up.rotate(tf_q.getAxis(), tf_q.getAngle())); + + if (fabs(dot - 1) > 1e-3) + { + robot::log_error("Quaternion is invalid... for navigation the z-axis of the quaternion must be close to vertical. dot: %f", dot); + return false; + } + + return true; +} \ No newline at end of file diff --git a/src/APIs/c_api/src/convertor_2.cpp b/src/APIs/c_api/src/convertor_2.cpp new file mode 100644 index 0000000..85a6637 --- /dev/null +++ b/src/APIs/c_api/src/convertor_2.cpp @@ -0,0 +1,78 @@ +#include "convertor_2.h" + +#include +#include +#include + +namespace +{ + +/// Empty string for a NULL C string — every char* coming from the host is optional. +inline std::string safe_string(const char* s) +{ + return s != nullptr ? std::string(s) : std::string(); +} + +} // namespace + +robot_std_msgs::Header convert2CppHeader(const Header& header) +{ + robot_std_msgs::Header cpp; + cpp.seq = header.seq; + cpp.stamp.sec = header.sec; + cpp.stamp.nsec = header.nsec; + cpp.frame_id = safe_string(header.frame_id); + return cpp; +} + +robot_sensor_msgs::Image convert2CppImage(const Image& image) +{ + robot_sensor_msgs::Image cpp; + cpp.header = convert2CppHeader(image.header); + cpp.height = image.height; + cpp.width = image.width; + cpp.encoding = safe_string(image.encoding); + cpp.is_bigendian = image.is_bigendian; + cpp.step = image.step; + + // Copy, never alias: the host buffer may be a pinned .NET array released right after this call, + // while the voxel layer reads the sample later on the map-update thread. + const size_t count = image.data != nullptr ? image.data_count : 0; + cpp.data.assign(image.data, image.data + count); + return cpp; +} + +robot_sensor_msgs::CameraInfo convert2CppCameraInfo(const CameraInfo& info) +{ + robot_sensor_msgs::CameraInfo cpp; + cpp.header = convert2CppHeader(info.header); + cpp.height = info.height; + cpp.width = info.width; + cpp.distortion_model = safe_string(info.distortion_model); + + const size_t d_count = info.D != nullptr ? info.D_count : 0; + cpp.D.assign(info.D, info.D + d_count); + + std::copy(info.K, info.K + 9, cpp.K.begin()); + std::copy(info.R, info.R + 9, cpp.R.begin()); + std::copy(info.P, info.P + 12, cpp.P.begin()); + + cpp.binning_x = info.binning_x; + cpp.binning_y = info.binning_y; + + cpp.roi.x_offset = info.roi.x_offset; + cpp.roi.y_offset = info.roi.y_offset; + cpp.roi.height = info.roi.height; + cpp.roi.width = info.roi.width; + cpp.roi.do_rectify = info.roi.do_rectify; + return cpp; +} + +robot_sensor_msgs::DepthCameraData convert2CppDepthCameraData(const DepthCameraData& data) +{ + robot_sensor_msgs::DepthCameraData cpp; + cpp.header = convert2CppHeader(data.header); + cpp.depth = convert2CppImage(data.depth); + cpp.camera_info = convert2CppCameraInfo(data.camera_info); + return cpp; +} diff --git a/src/APIs/c_api/src/nav_c_api.cpp b/src/APIs/c_api/src/nav_c_api.cpp new file mode 100644 index 0000000..44df65d --- /dev/null +++ b/src/APIs/c_api/src/nav_c_api.cpp @@ -0,0 +1,1285 @@ +#include +#include "nav_c_api.h" +#include "convertor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Keep navigation instances alive even when returning raw pointers as C handles. +// Key is the raw BaseNavigation* (used as NavigationHandle), value owns the instance. +static std::mutex g_nav_instances_mutex; +static std::unordered_map>g_nav_instances; + +static NavFeedback convert2CNavFeedback(const robot::move_base_core::NavFeedback &cpp) +{ + NavFeedback out; + out.navigation_state = static_cast(static_cast(cpp.navigation_state)); + out.feed_back_str = cpp.feed_back_str.empty() ? nullptr : strdup(cpp.feed_back_str.c_str()); + out.current_pose.x = cpp.current_pose.x; + out.current_pose.y = cpp.current_pose.y; + out.current_pose.theta = cpp.current_pose.theta; + out.goal_checked = cpp.goal_checked; + out.is_ready = cpp.is_ready; + return out; +} + +extern "C" char *navigation_state_to_string(NavigationState state) +{ + robot::move_base_core::State cpp_state = static_cast(static_cast(state)); + std::string str = robot::move_base_core::toString(cpp_state); + return strdup(str.c_str()); +} + +extern "C" void nav_c_api_free_string(char *str) +{ + if (str) + free(str); +} + +extern "C" bool navigation_offset_goal_2d(const Pose2D &in_pose, + const char *frame_id, double offset_distance, + PoseStamped &out_goal) +{ + if (!frame_id) + { + return false; + } + + robot_geometry_msgs::Pose2D pose = convert2CppPose2D(in_pose); + robot_geometry_msgs::PoseStamped result = robot::move_base_core::offset_goal(pose, std::string(frame_id), offset_distance); + out_goal = convert2CPoseStamped(result); + return true; +} + +extern "C" bool navigation_offset_goal_stamped(const PoseStamped &in_pose, double offset_distance, + PoseStamped &out_goal) +{ + robot_geometry_msgs::PoseStamped cpp_pose = convert2CppPoseStamped(in_pose); + robot_geometry_msgs::PoseStamped result = robot::move_base_core::offset_goal(cpp_pose, offset_distance); + out_goal = convert2CPoseStamped(result); + return true; +} + +// ============================================================================ +// Navigation Handle Management +// ============================================================================ +extern "C" NavigationHandle navigation_create(void) +{ + try + { + // Create a concrete MoveBase instance + // Using default constructor - initialization will be done via navigation_initialize() + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath("MoveBase"); + robot::log_debug("navigation_create: loading navigation plugin from '%s'", path_file_so.c_str()); + auto move_base_loader = boost::dll::import_alias( + path_file_so, "MoveBase", boost::dll::load_mode::append_decorations); + auto move_base_ptr = move_base_loader(); + if (!move_base_ptr) + return nullptr; + + auto *raw = move_base_ptr.get(); + { + std::lock_guard lock(g_nav_instances_mutex); + g_nav_instances[raw] = std::move(move_base_ptr); + } + + // Return raw pointer as opaque C handle. + return static_cast(raw); + } + catch (const std::exception &e) + { + // Đây là chỗ hỏng thường xuyên nhất của cả API: sai `library_path`, sai + // PNKX_NAV_CORE_CONFIG_DIR, hoặc .so không nằm trong đường tìm. Nuốt lý do là buộc người dùng + // đoán mò từ một con trỏ NULL. + robot::log_error("navigation_create failed: %s", e.what()); + return nullptr; + } + catch (...) + { + robot::log_error("navigation_create failed: unknown exception"); + return nullptr; + } +} + +extern "C" void navigation_destroy(NavigationHandle handle) +{ + if (!handle) + return; + + auto *raw = static_cast(handle); + std::lock_guard lock(g_nav_instances_mutex); + g_nav_instances.erase(raw); +} + +// ============================================================================ +// Navigation Interface Methods +// ============================================================================ + +extern "C" bool navigation_initialize(NavigationHandle handle, TFListenerHandle tf_handle) +{ + if (!handle || !tf_handle) + { + robot::log_error("navigation_initialize: null handle or tf3 buffer"); + return false; + } + try + { + robot::log_info("navigation_initialize: bringing up the navigation core"); + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + + if (!nav_ptr) + return false; + + std::shared_ptr tf_ptr = + std::shared_ptr(reinterpret_cast(tf_handle), [](::tf3::BufferCore *) {}); + if (!tf_ptr) + { + robot::log_error("navigation_initialize: invalid TF listener"); + return false; + } + nav_ptr->initialize(tf_ptr); + + return true; + } + catch (const std::exception &e) + { + robot::log_error("navigation_initialize failed: %s", e.what()); + return false; + } + catch (...) + { + robot::log_error("navigation_initialize failed: unknown exception"); + return false; + } +} + +extern "C" bool navigation_set_robot_footprint(NavigationHandle handle, const Point *points, size_t point_count) +{ + if (!handle || !points || point_count == 0) + { + return false; + } + + try + { + + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + std::vector footprint; + footprint.reserve(point_count); + for (size_t i = 0; i < point_count; ++i) + { + robot_geometry_msgs::Point pt; + pt.x = points[i].x; + pt.y = points[i].y; + pt.z = points[i].z; + footprint.push_back(pt); + } + nav_ptr->setRobotFootprint(footprint); + robot::log_debug("navigation_set_robot_footprint: %zu points", point_count); + return true; + } + catch (const std::exception &e) + { + robot::log_error("navigation_set_robot_footprint failed: %s", e.what()); + return false; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_robot_footprint(NavigationHandle handle, Point *out_points, size_t &out_count) +{ + if (!handle) + { + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + std::vector footprint = nav_ptr->getRobotFootprint(); + if (footprint.empty()) + { + return false; + } + + out_count = footprint.size(); + for (size_t i = 0; i < out_count; ++i) + { + out_points[i].x = footprint[i].x; + out_points[i].y = footprint[i].y; + out_points[i].z = footprint[i].z; + } + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_move_to(NavigationHandle handle, const PoseStamped goal) +{ + if (!handle) + { + return false; + } + if (!isQuaternionValid(goal.pose.orientation)) + { + robot::log_error("Goal quaternion is invalid"); + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_geometry_msgs::PoseStamped cpp_goal = convert2CppPoseStamped(goal); + return nav_ptr->moveTo(cpp_goal); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_move_to_order(NavigationHandle handle, const Order order, const PoseStamped goal) +{ + if (!handle) + { + return false; + } + if (!isQuaternionValid(goal.pose.orientation)) + { + robot::log_error("Goal quaternion is invalid"); + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + robot::log_debug("navigation_move_to_order: goal (%.3f, %.3f)", goal.pose.position.x, + goal.pose.position.y); + robot_protocol_msgs::Order cpp_order = convert2CppOrder(order); + robot_geometry_msgs::PoseStamped cpp_goal = convert2CppPoseStamped(goal); + return nav_ptr->moveTo(cpp_order, cpp_goal); + } + catch (const std::exception &e) + { + robot::log_error("navigation_move_to_order failed: %s", e.what()); + return false; + } + catch (...) + { + robot::log_error("navigation_move_to_order failed: unknown exception"); + return false; + } +} + +extern "C" bool navigation_move_to_nodes_edges(NavigationHandle handle, const Node *nodes, size_t node_count, const Edge *edges, size_t edge_count, const PoseStamped goal) +{ + if (!handle) + { + return false; + } + if (!isQuaternionValid(goal.pose.orientation)) + { + robot::log_error("Goal quaternion is invalid"); + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + robot::log_debug("navigation_move_to_nodes_edges: goal (%.3f, %.3f)", goal.pose.position.x, + goal.pose.position.y); + // Zero-init: the fields left unset below are all char*, and convert2CppOrder treats any + // non-null pointer as a valid string — an uninitialized struct hands it stack garbage. + Order order{}; + order.nodes = const_cast(nodes); + order.nodes_count = node_count; + order.edges = const_cast(edges); + order.edges_count = edge_count; + robot_protocol_msgs::Order cpp_order = convert2CppOrder(order); + robot_geometry_msgs::PoseStamped cpp_goal = convert2CppPoseStamped(goal); + return nav_ptr->moveTo(cpp_order, cpp_goal); + } + catch (const std::exception &e) + { + robot::log_error("navigation_move_to_nodes_edges failed: %s", e.what()); + return false; + } + catch (...) + { + robot::log_error("navigation_move_to_nodes_edges failed: unknown exception"); + return false; + } +} + +// navigation_dock_to, navigation_dock_to_order, navigation_dock_to_nodes_edges, +// navigation_move_straight_to and navigation_rotate_to were removed along with the +// BaseNavigation methods they forwarded to. Those methods bypassed the mission layer, so a goal +// arriving through them replaced the leg the mission queue was running without the queue noticing. +// Docking, go-straight and rotate now travel as ordinary legs of an order: set `profile:` on the +// leg (`docking | go_straight | rotate`) plus `marker` for docking, then send it through +// navigation_move_to_order / navigation_move_to_nodes_edges. + +extern "C" void navigation_pause(NavigationHandle handle) +{ + if (handle) + { + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return; + nav_ptr->pause(); + } + catch (...) + { + // Ignore exceptions + } + } +} + +extern "C" void navigation_resume(NavigationHandle handle) +{ + if (handle) + { + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (nav_ptr) + nav_ptr->resume(); + } + catch (...) + { + // Ignore exceptions + } + } +} + +extern "C" void navigation_cancel(NavigationHandle handle) +{ + if (handle) + { + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (nav_ptr) + nav_ptr->cancel(); + } + catch (...) + { + // Ignore exceptions + } + } +} + +extern "C" bool navigation_set_twist_linear(NavigationHandle handle, + double linear_x, double linear_y, double linear_z) +{ + if (!handle) + { + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + // Giá trị đi xuống lõi NGUYÊN DẠNG, không lấy trị tuyệt đối: DẤU của linear_x là thứ chọn chiều + // mà trần này áp vào — âm đặt trần lùi, dương đặt trần tiến (local planner giữ hai trần riêng, + // xem move_base2 navigation_server.cpp:921-944). Ép về trị tuyệt đối là bỏ mất nửa thông tin + // của lời gọi. + // + // Vì vậy một lời gọi chỉ đặt MỘT chiều. Host muốn đặt cả hai thì gọi hai lần, đúng như host ROS + // đang làm (amr_control.cpp:707-709, amr_vda_5050_client_api.cpp:410-414). + robot_geometry_msgs::Vector3 linear; + linear.x = linear_x; + linear.y = linear_y; + linear.z = linear_z; + + const bool accepted = nav_ptr->setTwistLinear(linear); + robot::log_debug("navigation_set_twist_linear: %s ceiling %.3f m/s (%s)", + linear_x < 0.0 ? "backward" : "forward", linear_x, + accepted ? "accepted" : "rejected"); + return accepted; + } + catch (const std::exception &e) + { + robot::log_error("navigation_set_twist_linear failed: %s", e.what()); + return false; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_set_twist_angular(NavigationHandle handle, + double angular_x, double angular_y, double angular_z) +{ + if (!handle) + { + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_geometry_msgs::Vector3 angular; + angular.x = angular_x; + angular.y = angular_y; + angular.z = angular_z; + return nav_ptr->setTwistAngular(angular); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_robot_pose_stamped(NavigationHandle handle, PoseStamped &out_pose) +{ + if (!handle) + { + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_geometry_msgs::PoseStamped cpp_pose; + if (nav_ptr->getRobotPose(cpp_pose)) + { + out_pose = convert2CPoseStamped(cpp_pose); + return true; + } + return false; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_robot_pose_2d(NavigationHandle handle, Pose2D &out_pose) +{ + if (!handle) + { + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_geometry_msgs::Pose2D cpp_pose; + if (nav_ptr->getRobotPose(cpp_pose)) + { + out_pose = convert2CPose2D(cpp_pose); + return true; + } + return false; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_twist(NavigationHandle handle, Twist2DStamped &out_twist) +{ + if (!handle) + { + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_nav_2d_msgs::Twist2DStamped cpp_twist = nav_ptr->getTwist(); + out_twist = convert2CTwist2DStamped(cpp_twist); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_feedback(NavigationHandle handle, NavFeedback &out_feedback) +{ + if (!handle) + { + return false; + } + + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot::move_base_core::NavFeedback *fb = nav_ptr->getFeedback(); + if (fb == nullptr) + return false; + out_feedback = convert2CNavFeedback(*fb); + return true; + } + catch (...) + { + return false; + } +} + +// ============================================================================ +// Navigation Data Management +// ============================================================================ + +extern "C" bool navigation_add_static_map(NavigationHandle handle, const char *map_name, OccupancyGrid occupancy_grid) +{ + if (!handle || !map_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_nav_msgs::OccupancyGrid robot_occupancy_grid = convert2CppOccupancyGrid(occupancy_grid); + robot::log_debug("navigation_add_static_map: '%s' %ux%u, %zu cells", map_name, + occupancy_grid.info.width, occupancy_grid.info.height, + occupancy_grid.data_count); + + nav_ptr->addStaticMap(std::string(map_name), robot_occupancy_grid); + return true; + } + catch (const std::exception &e) + { + robot::log_error("navigation_add_static_map('%s') failed: %s", map_name, e.what()); + return false; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_add_laser_scan(NavigationHandle handle, const char *laser_scan_name, LaserScan laser_scan) +{ + if (!handle || !laser_scan_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_sensor_msgs::LaserScan robot_laser_scan = convert2CppLaserScan(laser_scan); + nav_ptr->addLaserScan(std::string(laser_scan_name), robot_laser_scan); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_add_point_cloud(NavigationHandle handle, const char *point_cloud_name, const PointCloud point_cloud) +{ + if (!handle || !point_cloud_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_sensor_msgs::PointCloud cpp_cloud = convert2CppPointCloud(point_cloud); + nav_ptr->addPointCloud(std::string(point_cloud_name), cpp_cloud); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_add_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, const PointCloud2 point_cloud2) +{ + if (!handle || !point_cloud2_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_sensor_msgs::PointCloud2 cpp_cloud = convert2CppPointCloud2(point_cloud2); + nav_ptr->addPointCloud2(std::string(point_cloud2_name), cpp_cloud); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_add_odometry(NavigationHandle handle, const char *odometry_name, const Odometry odometry) +{ + if (!handle || !odometry_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + { + return false; + } + + robot_nav_msgs::Odometry robot_odometry = convert2CppOdometry(odometry); + nav_ptr->addOdometry(std::string(odometry_name), robot_odometry); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_static_map(NavigationHandle handle, const char *map_name, OccupancyGrid &out_map) +{ + if (!handle || !map_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_nav_msgs::OccupancyGrid robot_map = nav_ptr->getStaticMap(std::string(map_name)); + convert2COccupancyGrid(robot_map, out_map); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_laser_scan(NavigationHandle handle, const char *laser_scan_name, LaserScan &out_scan) +{ + if (!handle || !laser_scan_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_sensor_msgs::LaserScan robot_scan = nav_ptr->getLaserScan(std::string(laser_scan_name)); + convert2CLaserScan(robot_scan, out_scan); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_point_cloud(NavigationHandle handle, const char *point_cloud_name, PointCloud &out_cloud) +{ + if (!handle || !point_cloud_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_sensor_msgs::PointCloud robot_cloud = nav_ptr->getPointCloud(std::string(point_cloud_name)); + convert2CPointCloud(robot_cloud, out_cloud); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_point_cloud2(NavigationHandle handle, const char *point_cloud2_name, PointCloud2 &out_cloud) +{ + if (!handle || !point_cloud2_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot_sensor_msgs::PointCloud2 robot_cloud = nav_ptr->getPointCloud2(std::string(point_cloud2_name)); + convert2CPointCloud2(robot_cloud, out_cloud); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_all_static_maps(NavigationHandle handle, NamedOccupancyGrid *out_maps, size_t &out_count) +{ + if (!handle || !out_maps) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + auto maps = nav_ptr->getAllStaticMaps(); + if (maps.empty()) + { + out_count = 0; + return true; + } + out_count = maps.size(); + size_t i = 0; + for (const auto &p : maps) + { + out_maps[i].name = strdup(p.first.c_str()); + convert2COccupancyGrid(p.second, out_maps[i].grid); + ++i; + } + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_all_laser_scans(NavigationHandle handle, NamedLaserScan *out_scans, size_t &out_count) +{ + if (!handle || !out_scans) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + auto scans = nav_ptr->getAllLaserScans(); + if (scans.empty()) + { + out_count = 0; + return true; + } + out_count = scans.size(); + size_t i = 0; + for (const auto &p : scans) + { + out_scans[i].name = strdup(p.first.c_str()); + convert2CLaserScan(p.second, out_scans[i].scan); + ++i; + } + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_all_point_clouds(NavigationHandle handle, NamedPointCloud *out_clouds, size_t &out_count) +{ + if (!handle || !out_clouds) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + auto clouds = nav_ptr->getAllPointClouds(); + if (clouds.empty()) + { + out_count = 0; + return true; + } + out_count = clouds.size(); + size_t i = 0; + for (const auto &p : clouds) + { + out_clouds[i].name = strdup(p.first.c_str()); + convert2CPointCloud(p.second, out_clouds[i].cloud); + ++i; + } + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_get_all_point_cloud2s(NavigationHandle handle, NamedPointCloud2 *out_clouds, size_t &out_count) +{ + if (!handle || !out_clouds) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + auto clouds = nav_ptr->getAllPointCloud2s(); + if (clouds.empty()) + { + out_count = 0; + return true; + } + out_count = clouds.size(); + size_t i = 0; + for (const auto &p : clouds) + { + out_clouds[i].name = strdup(p.first.c_str()); + convert2CPointCloud2(p.second, out_clouds[i].cloud); + ++i; + } + return true; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_static_map(NavigationHandle handle, const char *map_name) +{ + if (!handle || !map_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removeStaticMap(std::string(map_name)); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_laser_scan(NavigationHandle handle, const char *laser_scan_name) +{ + if (!handle || !laser_scan_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removeLaserScan(std::string(laser_scan_name)); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_point_cloud(NavigationHandle handle, const char *point_cloud_name) +{ + if (!handle || !point_cloud_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removePointCloud(std::string(point_cloud_name)); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_point_cloud2(NavigationHandle handle, const char *point_cloud2_name) +{ + if (!handle || !point_cloud2_name) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removePointCloud2(std::string(point_cloud2_name)); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_all_static_maps(NavigationHandle handle) +{ + if (!handle) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removeAllStaticMaps(); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_all_laser_scans(NavigationHandle handle) +{ + if (!handle) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removeAllLaserScans(); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_all_point_clouds(NavigationHandle handle) +{ + if (!handle) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removeAllPointClouds(); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_all_point_cloud2s(NavigationHandle handle) +{ + if (!handle) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removeAllPointCloud2s(); + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_remove_all_data(NavigationHandle handle) +{ + if (!handle) + { + return false; + } + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + return nav_ptr->removeAllData(); + } + catch (...) + { + return false; + } +} + +// ============================================================================ +// Planner Data +// ============================================================================ +static void clear_planner_data(PlannerDataOutput *out) +{ + if (!out) + return; + // Free Path2D plan + if (out->plan.poses) + { + for (size_t i = 0; i < out->plan.poses_count; i++) + { + if (out->plan.poses[i].header.frame_id) + free(out->plan.poses[i].header.frame_id); + } + free(out->plan.poses); + out->plan.poses = nullptr; + out->plan.poses_count = 0; + } + if (out->plan.header.frame_id) + { + free(out->plan.header.frame_id); + out->plan.header.frame_id = nullptr; + } + // Free OccupancyGrid costmap + if (out->costmap.header.frame_id) + { + free(out->costmap.header.frame_id); + out->costmap.header.frame_id = nullptr; + } + if (out->costmap.data) + { + free(out->costmap.data); + out->costmap.data = nullptr; + } + // Free OccupancyGridUpdate + if (out->costmap_update.header.frame_id) + { + free(out->costmap_update.header.frame_id); + out->costmap_update.header.frame_id = nullptr; + } + if (out->costmap_update.data) + { + free(out->costmap_update.data); + out->costmap_update.data = nullptr; + } + // Free PolygonStamped footprint + if (out->footprint.header.frame_id) + { + free(out->footprint.header.frame_id); + out->footprint.header.frame_id = nullptr; + } + if (out->footprint.polygon.points) + { + free(out->footprint.polygon.points); + out->footprint.polygon.points = nullptr; + out->footprint.polygon.points_count = 0; + } +} + +extern "C" bool navigation_get_global_data(NavigationHandle handle, PlannerDataOutput *out_data) +{ + if (!handle || !out_data) + return false; + clear_planner_data(out_data); + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), + [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot::move_base_core::PlannerDataOutput data = nav_ptr->getGlobalData(); + convert2CPath2D(data.plan, out_data->plan); + convert2COccupancyGrid(data.costmap, out_data->costmap); + convert2COccupancyGridUpdate(data.costmap_update, out_data->costmap_update); + convert2CPolygonStamped(data.footprint, out_data->footprint); + out_data->is_costmap_updated = data.is_costmap_updated; + return true; + } + catch (...) + { + clear_planner_data(out_data); + return false; + } +} + +extern "C" bool navigation_get_local_data(NavigationHandle handle, PlannerDataOutput *out_data) +{ + if (!handle || !out_data) + return false; + clear_planner_data(out_data); + try + { + std::shared_ptr nav_ptr = + std::shared_ptr( + reinterpret_cast(handle), + [](::robot::move_base_core::BaseNavigation *) {}); + if (!nav_ptr) + return false; + + robot::move_base_core::PlannerDataOutput data = nav_ptr->getLocalData(); + convert2CPath2D(data.plan, out_data->plan); + convert2COccupancyGrid(data.costmap, out_data->costmap); + convert2COccupancyGridUpdate(data.costmap_update, out_data->costmap_update); + convert2CPolygonStamped(data.footprint, out_data->footprint); + out_data->is_costmap_updated = data.is_costmap_updated; + return true; + } + catch (...) + { + clear_planner_data(out_data); + return false; + } +} + diff --git a/src/APIs/c_api/src/nav_c_api_2.cpp b/src/APIs/c_api/src/nav_c_api_2.cpp new file mode 100644 index 0000000..baeafa6 --- /dev/null +++ b/src/APIs/c_api/src/nav_c_api_2.cpp @@ -0,0 +1,445 @@ +/** + * @file nav_c_api_2.cpp + * @brief Implementation of the move_base2 additions to the C navigation API. + * + * Deliberately separate from nav_c_api.cpp: the surface the existing binding depends on stays byte + * for byte where it is, and everything move_base2 needs on top of it lands here, where it can be + * reviewed — or dropped — on its own. + * + * The handle is the same opaque `robot::move_base_core::BaseNavigation*` navigation_create() + * returns; ownership still lives in nav_c_api.cpp, so nothing here creates or frees an instance. + */ + +#include "nav_c_api_2.h" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "convertor.h" +#include "convertor_2.h" + +namespace +{ + +/// Non-owning view of the handle. The instance is owned by the table in nav_c_api.cpp. +inline robot::move_base_core::BaseNavigation *as_navigation(NavigationHandle handle) +{ + return static_cast(handle); +} + +/** + * @brief Build a C Order from an id plus the node/edge arrays the host owns. + * + * Zero-initialized on purpose. Every optional field of Order is a char*, and the converter treats a + * non-null pointer as a valid string — an uninitialized struct therefore hands it stack garbage to + * build std::string from. The pointers below stay non-owning: the converter copies before this + * returns, and the arrays are never freed here. + */ +Order make_order(const char *order_id, uint32_t order_update_id, + const Node *nodes, size_t node_count, + const Edge *edges, size_t edge_count) +{ + Order order{}; + order.orderId = const_cast(order_id); + order.orderUpdateId = order_update_id; + order.nodes = const_cast(nodes); + order.nodes_count = nodes != nullptr ? node_count : 0; + order.edges = const_cast(edges); + order.edges_count = edges != nullptr ? edge_count : 0; + return order; +} + +} // namespace + +// ================================================================================================ +// Lifecycle +// ================================================================================================ + +extern "C" bool navigation_initialize_checked(NavigationHandle handle, TFListenerHandle tf3_buffer) +{ + if (!handle || !tf3_buffer) + { + robot::log_error("navigation_initialize_checked: null handle or tf3 buffer"); + return false; + } + + try + { + auto *nav = as_navigation(handle); + + // The host owns the buffer and must outlive the core; hand over a non-owning alias. + robot::TFListenerPtr tf(static_cast(tf3_buffer), + [](tf3::BufferCore *) {}); + + nav->initialize(tf); + + // initialize() returns void, so the runtime reports failure the only way it can: it leaves + // is_ready false and writes the reason into the feedback. Not reading it back is how a host + // ends up pushing goals into a core that has no control thread. + robot::move_base_core::NavFeedback *feedback = nav->getFeedback(); + if (feedback == nullptr) + { + robot::log_error("navigation_initialize_checked: core exposes no feedback"); + return false; + } + if (!feedback->is_ready) + { + robot::log_error("navigation_initialize_checked: core not ready: %s", + feedback->feed_back_str.c_str()); + return false; + } + return true; + } + catch (const std::exception &e) + { + robot::log_error("navigation_initialize_checked failed: %s", e.what()); + return false; + } + catch (...) + { + robot::log_error("navigation_initialize_checked failed: unknown exception"); + return false; + } +} + +extern "C" bool navigation_is_ready(NavigationHandle handle) +{ + if (!handle) + { + return false; + } + + try + { + robot::move_base_core::NavFeedback *feedback = as_navigation(handle)->getFeedback(); + return feedback != nullptr && feedback->is_ready; + } + catch (...) + { + return false; + } +} + +extern "C" void navigation_shutdown(NavigationHandle handle) +{ + if (!handle) + { + return; + } + + try + { + as_navigation(handle)->shutdown(); + } + catch (const std::exception &e) + { + // Swallowed on purpose: this runs inside the host's shutdown sequence, where throwing across + // the C boundary would abort a process that is already on its way down. + robot::log_error("navigation_shutdown failed: %s", e.what()); + } + catch (...) + { + robot::log_error("navigation_shutdown failed: unknown exception"); + } +} + +// ================================================================================================ +// Status +// ================================================================================================ + +extern "C" bool navigation_get_state(NavigationHandle handle, NavigationState *out_state) +{ + if (!handle || !out_state) + { + return false; + } + + try + { + robot::move_base_core::NavFeedback *feedback = as_navigation(handle)->getFeedback(); + if (feedback == nullptr) + { + return false; + } + *out_state = static_cast(static_cast(feedback->navigation_state)); + return true; + } + catch (...) + { + return false; + } +} + +extern "C" char *navigation_get_status_text(NavigationHandle handle) +{ + if (!handle) + { + return nullptr; + } + + try + { + robot::move_base_core::NavFeedback *feedback = as_navigation(handle)->getFeedback(); + if (feedback == nullptr || feedback->feed_back_str.empty()) + { + return nullptr; + } + return strdup(feedback->feed_back_str.c_str()); + } + catch (...) + { + return nullptr; + } +} + +// ================================================================================================ +// Sensor input +// ================================================================================================ + +extern "C" bool navigation_add_depth_camera_data(NavigationHandle handle, const char *topic, + const DepthCameraData data) +{ + if (!handle || !topic) + { + return false; + } + + try + { + // ConstPtr is a boost::shared_ptr and the core keeps the sample for as long as it needs it, so + // hand it a copy rather than a view of host memory. + auto sample = boost::make_shared( + convert2CppDepthCameraData(data)); + + as_navigation(handle)->addDepthCameraData(std::string(topic), sample); + return true; + } + catch (const std::exception &e) + { + robot::log_error("navigation_add_depth_camera_data failed: %s", e.what()); + return false; + } + catch (...) + { + return false; + } +} + +// ================================================================================================ +// Orders +// ================================================================================================ + +extern "C" bool navigation_move_to_order_v2(NavigationHandle handle, + const char *order_id, uint32_t order_update_id, + const Node *nodes, size_t node_count, + const Edge *edges, size_t edge_count, + const PoseStamped goal) +{ + if (!handle || order_id == nullptr || order_id[0] == '\0') + { + robot::log_error("navigation_move_to_order_v2: null handle or empty orderId"); + return false; + } + if (!isQuaternionValid(goal.pose.orientation)) + { + robot::log_error("navigation_move_to_order_v2: goal quaternion is invalid"); + return false; + } + + try + { + const Order order = make_order(order_id, order_update_id, nodes, node_count, edges, edge_count); + return as_navigation(handle)->moveTo(convert2CppOrder(order), convert2CppPoseStamped(goal)); + } + catch (const std::exception &e) + { + robot::log_error("navigation_move_to_order_v2 failed: %s", e.what()); + return false; + } + catch (...) + { + return false; + } +} + +extern "C" bool navigation_execute_instant_actions(NavigationHandle handle, const Action *actions, + size_t count) +{ + if (!handle || actions == nullptr || count == 0) + { + robot::log_error("navigation_execute_instant_actions: null handle, null array or zero count"); + return false; + } + + // Kiểm ở đây thay vì để adapter làm: bên kia ranh giới C, một con trỏ null và một chuỗi rỗng nhìn + // giống nhau, và thông báo lỗi phải nói được là phía gọi thiếu gì, ở phần tử nào. + std::vector cpp_actions; + cpp_actions.reserve(count); + + for (size_t i = 0; i < count; ++i) + { + const Action &action = actions[i]; + + if (action.actionType == nullptr || action.actionType[0] == '\0') + { + robot::log_error("navigation_execute_instant_actions: action %zu has a null or empty " + "actionType", i); + return false; + } + if (action.actionId == nullptr || action.actionId[0] == '\0') + { + robot::log_error("navigation_execute_instant_actions: action %zu ('%s') has a null or empty " + "actionId — the fleet needs it to match the result back to its request", + i, action.actionType); + return false; + } + + cpp_actions.push_back(convert2CppAction(action)); + } + + try + { + return as_navigation(handle)->executeInstantActions(cpp_actions); + } + catch (const std::exception &e) + { + robot::log_error("navigation_execute_instant_actions failed: %s", e.what()); + return false; + } + catch (...) + { + robot::log_error("navigation_execute_instant_actions failed: unknown exception"); + return false; + } +} + +// navigation_dock_to_order_v2 was removed together with BaseNavigation::dockTo. Docking is now a +// per-leg property of the order: set `profile: docking` and `marker` on the leg and send it +// through navigation_move_to_order_v2, so it gets the same mission id, lifecycle and cancel as +// every other leg instead of bypassing the mission layer. + +// ================================================================================================ +// Releasing what the getters allocate +// ================================================================================================ +// +// The converters allocate with malloc()/strdup(), so these release with free(). Mixing in delete[] +// here would be undefined behaviour, and the host cannot free these itself on Windows-style +// runtimes anyway — allocation and release must happen inside the same C runtime. + +namespace +{ + +/// free() a buffer and clear both the pointer and its element count in one step. +template +inline void free_array(T *&ptr, size_t &count) +{ + free(ptr); + ptr = nullptr; + count = 0; +} + +inline void free_string_field(char *&str) +{ + free(str); + str = nullptr; +} + +} // namespace + +extern "C" void navigation_free_occupancy_grid(OccupancyGrid *grid) +{ + if (!grid) + { + return; + } + free_string_field(grid->header.frame_id); + free_array(grid->data, grid->data_count); +} + +extern "C" void navigation_free_laser_scan(LaserScan *scan) +{ + if (!scan) + { + return; + } + free_string_field(scan->header.frame_id); + free_array(scan->ranges, scan->ranges_count); + free_array(scan->intensities, scan->intensities_count); +} + +extern "C" void navigation_free_point_cloud(PointCloud *cloud) +{ + if (!cloud) + { + return; + } + free_string_field(cloud->header.frame_id); + free_array(cloud->points, cloud->points_count); + + // Each channel owns a name and a value buffer of its own; freeing the array alone leaks both. + if (cloud->channels != nullptr) + { + for (size_t i = 0; i < cloud->channels_count; ++i) + { + free_string_field(cloud->channels[i].name); + free_array(cloud->channels[i].values, cloud->channels[i].values_count); + } + } + free_array(cloud->channels, cloud->channels_count); +} + +extern "C" void navigation_free_point_cloud2(PointCloud2 *cloud) +{ + if (!cloud) + { + return; + } + free_string_field(cloud->header.frame_id); + + if (cloud->fields != nullptr) + { + for (size_t i = 0; i < cloud->fields_count; ++i) + { + free_string_field(cloud->fields[i].name); + } + } + free_array(cloud->fields, cloud->fields_count); + free_array(cloud->data, cloud->data_count); +} + +extern "C" void navigation_free_planner_data(PlannerDataOutput *data) +{ + if (!data) + { + return; + } + + if (data->plan.poses != nullptr) + { + for (size_t i = 0; i < data->plan.poses_count; ++i) + { + free_string_field(data->plan.poses[i].header.frame_id); + } + } + free_array(data->plan.poses, data->plan.poses_count); + free_string_field(data->plan.header.frame_id); + + navigation_free_occupancy_grid(&data->costmap); + + free_string_field(data->costmap_update.header.frame_id); + free_array(data->costmap_update.data, data->costmap_update.data_count); + + free_string_field(data->footprint.header.frame_id); + free_array(data->footprint.polygon.points, data->footprint.polygon.points_count); + + data->is_costmap_updated = false; +} diff --git a/src/APIs/c_api/src/std_msgs/Header.cpp b/src/APIs/c_api/src/std_msgs/Header.cpp new file mode 100644 index 0000000..417d556 --- /dev/null +++ b/src/APIs/c_api/src/std_msgs/Header.cpp @@ -0,0 +1,37 @@ +#include "std_msgs/Header.h" +#include +#include +#include + +namespace +{ + +/// strdup() chấp nhận NULL. strdup(NULL) là hành vi không xác định, và frame_id là tuỳ chọn. +char *dup_or_null(const char *s) +{ + return s != nullptr ? strdup(s) : nullptr; +} + +} // namespace + +extern "C" Header header_create(const char *frame_id) { + Header header{}; + header.frame_id = dup_or_null(frame_id); + + // Đọc đồng hồ MỘT lần: hai lời gọi Time::now() riêng có thể rơi hai bên một mốc giây, để lại + // sec của lần đọc trước ghép với nsec của lần đọc sau — timestamp lệch tới một giây, và nó sẽ + // hiện ra ở tra cứu TF chứ không phải ở đây. + const robot::Time now = robot::Time::now(); + header.sec = now.sec; + header.nsec = now.nsec; + return header; +} + +extern "C" Header header_set_data(uint32_t seq, uint32_t sec, uint32_t nsec, char *frame_id) { + Header header{}; + header.seq = seq; + header.sec = sec; + header.nsec = nsec; + header.frame_id = dup_or_null(frame_id); + return header; +} diff --git a/src/APIs/c_api/src/std_msgs/Time.cpp b/src/APIs/c_api/src/std_msgs/Time.cpp new file mode 100644 index 0000000..3895350 --- /dev/null +++ b/src/APIs/c_api/src/std_msgs/Time.cpp @@ -0,0 +1,12 @@ +#include "std_msgs/Time.h" +#include +#include +#include + +extern "C" Time time_create() +{ + Time time{}; + time.sec = robot::Time::now().sec; + time.nsec = robot::Time::now().nsec; + return time; +} \ No newline at end of file diff --git a/src/APIs/c_api/test/test_convertor.cpp b/src/APIs/c_api/test/test_convertor.cpp new file mode 100644 index 0000000..8fc34a0 --- /dev/null +++ b/src/APIs/c_api/test/test_convertor.cpp @@ -0,0 +1,473 @@ +/** + * @file test_convertor.cpp + * @brief Tests for the C <-> C++ conversion layer of the navigation C API. + * + * The conversion layer is where this package concentrates its risk: every message crossing the + * boundary passes through it, every optional field arrives as a raw pointer that may be NULL, and + * every allocation it makes has to be released by a matching free helper. None of that needs a + * running navigation core to test, which is what makes these tests worth having. + * + * The cases below are the ones that actually broke: a NULL frame_id built a std::string from a null + * pointer, a null array paired with a non-zero count sized a vector from the count, and an + * uninitialized Order handed the converter stack garbage to read as strings. + */ +#include + +#include +#include +#include +#include + +#include "convertor.h" +#include "convertor_2.h" +#include "nav_c_api_2.h" + +namespace +{ + +/// A C header with no frame — the shape the library itself produces for an empty frame_id. +Header makeNullFrameHeader() +{ + Header header{}; + header.seq = 7; + header.sec = 123; + header.nsec = 456; + header.frame_id = nullptr; + return header; +} + +} // namespace + +// ================================================================================================ +// NULL frame_id must not build a std::string from a null pointer +// ================================================================================================ + +TEST(ConvertorNullSafety, LaserScanAcceptsNullFrameId) +{ + LaserScan scan{}; + scan.header = makeNullFrameHeader(); + scan.range_min = 0.1f; + scan.range_max = 10.0f; + + const robot_sensor_msgs::LaserScan cpp = convert2CppLaserScan(scan); + + EXPECT_EQ(cpp.header.frame_id, std::string()); + EXPECT_EQ(cpp.header.seq, 7u); + EXPECT_EQ(cpp.header.stamp.sec, 123u); + EXPECT_FLOAT_EQ(cpp.range_max, 10.0f); + EXPECT_TRUE(cpp.ranges.empty()); +} + +TEST(ConvertorNullSafety, OccupancyGridAcceptsNullFrameId) +{ + OccupancyGrid grid{}; + grid.header = makeNullFrameHeader(); + grid.info.resolution = 0.05f; + grid.info.width = 4; + grid.info.height = 2; + + const robot_nav_msgs::OccupancyGrid cpp = convert2CppOccupancyGrid(grid); + + EXPECT_EQ(cpp.header.frame_id, std::string()); + EXPECT_EQ(cpp.info.width, 4u); + EXPECT_TRUE(cpp.data.empty()); +} + +TEST(ConvertorNullSafety, PoseStampedAcceptsNullFrameId) +{ + PoseStamped pose{}; + pose.header = makeNullFrameHeader(); + pose.pose.position.x = 1.5; + pose.pose.orientation.w = 1.0; + + const robot_geometry_msgs::PoseStamped cpp = convert2CppPoseStamped(pose); + + EXPECT_EQ(cpp.header.frame_id, std::string()); + EXPECT_DOUBLE_EQ(cpp.pose.position.x, 1.5); + EXPECT_DOUBLE_EQ(cpp.pose.orientation.w, 1.0); +} + +TEST(ConvertorNullSafety, PointCloud2AcceptsNullFrameIdAndNullFieldNames) +{ + PointField field{}; + field.name = nullptr; + field.offset = 0; + field.datatype = 7; + field.count = 1; + + PointCloud2 cloud{}; + cloud.header = makeNullFrameHeader(); + cloud.height = 1; + cloud.width = 3; + cloud.fields = &field; + cloud.fields_count = 1; + + const robot_sensor_msgs::PointCloud2 cpp = convert2CppPointCloud2(cloud); + + EXPECT_EQ(cpp.header.frame_id, std::string()); + ASSERT_EQ(cpp.fields.size(), 1u); + EXPECT_EQ(cpp.fields[0].name, std::string()); + EXPECT_EQ(cpp.fields[0].datatype, 7); +} + +// ================================================================================================ +// A null array with a non-zero count must not size the vector from the count +// ================================================================================================ + +TEST(ConvertorNullSafety, LaserScanIgnoresCountWhenRangesAreNull) +{ + LaserScan scan{}; + scan.header = makeNullFrameHeader(); + scan.ranges = nullptr; + scan.ranges_count = 1000; // dữ liệu hỏng: bộ đếm khác 0 nhưng không có mảng + scan.intensities = nullptr; + scan.intensities_count = 1000; + + const robot_sensor_msgs::LaserScan cpp = convert2CppLaserScan(scan); + + EXPECT_TRUE(cpp.ranges.empty()); + EXPECT_TRUE(cpp.intensities.empty()); +} + +TEST(ConvertorNullSafety, PointCloudIgnoresCountWhenArraysAreNull) +{ + PointCloud cloud{}; + cloud.header = makeNullFrameHeader(); + cloud.points = nullptr; + cloud.points_count = 100000; + cloud.channels = nullptr; + cloud.channels_count = 100000; + + const robot_sensor_msgs::PointCloud cpp = convert2CppPointCloud(cloud); + + EXPECT_TRUE(cpp.points.empty()); + EXPECT_TRUE(cpp.channels.empty()); +} + +TEST(ConvertorNullSafety, PointCloud2IgnoresCountWhenDataIsNull) +{ + PointCloud2 cloud{}; + cloud.header = makeNullFrameHeader(); + cloud.data = nullptr; + cloud.data_count = 100000; + cloud.fields = nullptr; + cloud.fields_count = 100000; + + const robot_sensor_msgs::PointCloud2 cpp = convert2CppPointCloud2(cloud); + + EXPECT_TRUE(cpp.data.empty()); + EXPECT_TRUE(cpp.fields.empty()); +} + +// ================================================================================================ +// Round trip: what the library hands out must be safe to hand straight back in +// ================================================================================================ + +TEST(ConvertorRoundTrip, OccupancyGridWithEmptyFrameSurvivesRoundTrip) +{ + // An empty frame_id becomes a NULL char* on the way out — that is the exact value that used to + // crash on the way back in. + robot_nav_msgs::OccupancyGrid source; + source.header.frame_id = ""; + source.info.width = 2; + source.info.height = 2; + source.data = { 0, 100, -1, 50 }; + + OccupancyGrid c_grid{}; + convert2COccupancyGrid(source, c_grid); + ASSERT_EQ(c_grid.header.frame_id, nullptr) << "empty string is expected to become NULL"; + ASSERT_EQ(c_grid.data_count, 4u); + + const robot_nav_msgs::OccupancyGrid back = convert2CppOccupancyGrid(c_grid); + EXPECT_EQ(back.header.frame_id, std::string()); + ASSERT_EQ(back.data.size(), 4u); + EXPECT_EQ(back.data[1], 100); + EXPECT_EQ(back.data[2], -1); + + navigation_free_occupancy_grid(&c_grid); + EXPECT_EQ(c_grid.data, nullptr); + EXPECT_EQ(c_grid.data_count, 0u); +} + +TEST(ConvertorRoundTrip, LaserScanSurvivesRoundTrip) +{ + robot_sensor_msgs::LaserScan source; + source.header.frame_id = "front_laser"; + source.angle_min = -1.57f; + source.angle_max = 1.57f; + source.ranges = { 1.0f, 2.0f, 3.0f }; + source.intensities = { 10.0f, 20.0f, 30.0f }; + + LaserScan c_scan{}; + convert2CLaserScan(source, c_scan); + ASSERT_NE(c_scan.header.frame_id, nullptr); + EXPECT_STREQ(c_scan.header.frame_id, "front_laser"); + + const robot_sensor_msgs::LaserScan back = convert2CppLaserScan(c_scan); + EXPECT_EQ(back.header.frame_id, "front_laser"); + ASSERT_EQ(back.ranges.size(), 3u); + EXPECT_FLOAT_EQ(back.ranges[2], 3.0f); + ASSERT_EQ(back.intensities.size(), 3u); + + navigation_free_laser_scan(&c_scan); + EXPECT_EQ(c_scan.ranges, nullptr); + EXPECT_EQ(c_scan.ranges_count, 0u); +} + +// ================================================================================================ +// Order: every optional string is allowed to be NULL +// ================================================================================================ + +TEST(ConvertorOrder, ZeroInitialisedOrderConvertsToEmptyStrings) +{ + // This is what the *_nodes_edges entry points build: only the arrays are set, every string field + // stays NULL. Reading those as strings is what used to be undefined behaviour. + Order order{}; + + const robot_protocol_msgs::Order cpp = convert2CppOrder(order); + + EXPECT_EQ(cpp.orderId, std::string()); + EXPECT_EQ(cpp.timestamp, std::string()); + EXPECT_EQ(cpp.version, std::string()); + EXPECT_EQ(cpp.manufacturer, std::string()); + EXPECT_EQ(cpp.serialNumber, std::string()); + EXPECT_EQ(cpp.zoneSetId, std::string()); + EXPECT_EQ(cpp.orderUpdateId, 0u); + EXPECT_TRUE(cpp.nodes.empty()); + EXPECT_TRUE(cpp.edges.empty()); +} + +TEST(ConvertorOrder, NodesAndEdgesWithNullStringsConvert) +{ + Node node{}; + node.nodeId = nullptr; + node.sequenceId = 3; + node.released = 1; + node.nodePosition.x = 1.0; + node.nodePosition.y = 2.0; + + Edge edge{}; + edge.edgeId = nullptr; + edge.sequenceId = 4; + edge.maxSpeed = 0.5; + + Order order{}; + order.orderId = const_cast("order-1"); + order.orderUpdateId = 2; + order.nodes = &node; + order.nodes_count = 1; + order.edges = &edge; + order.edges_count = 1; + + const robot_protocol_msgs::Order cpp = convert2CppOrder(order); + + EXPECT_EQ(cpp.orderId, "order-1"); + EXPECT_EQ(cpp.orderUpdateId, 2u); + ASSERT_EQ(cpp.nodes.size(), 1u); + EXPECT_EQ(cpp.nodes[0].nodeId, std::string()); + EXPECT_EQ(cpp.nodes[0].sequenceId, 3); + EXPECT_DOUBLE_EQ(cpp.nodes[0].nodePosition.y, 2.0); + ASSERT_EQ(cpp.edges.size(), 1u); + EXPECT_EQ(cpp.edges[0].edgeId, std::string()); + EXPECT_DOUBLE_EQ(cpp.edges[0].maxSpeed, 0.5); +} + +TEST(ConvertorOrder, NullArraysAreIgnoredEvenWithNonZeroCounts) +{ + Order order{}; + order.nodes = nullptr; + order.nodes_count = 50; + order.edges = nullptr; + order.edges_count = 50; + + const robot_protocol_msgs::Order cpp = convert2CppOrder(order); + + EXPECT_TRUE(cpp.nodes.empty()); + EXPECT_TRUE(cpp.edges.empty()); +} + +// ================================================================================================ +// Depth camera conversion (move_base2 path) +// ================================================================================================ + +TEST(ConvertorDepthCamera, CopiesPixelsAndIntrinsics) +{ + std::vector pixels(8 * 4 * 2, 0); + pixels[0] = 0xAB; + pixels[1] = 0xCD; + + DepthCameraData data{}; + data.header.sec = 10; + data.header.nsec = 20; + data.header.frame_id = const_cast("camera_depth_optical_frame"); + + data.depth.header = data.header; + data.depth.height = 4; + data.depth.width = 8; + data.depth.step = 8 * 2; + data.depth.encoding = const_cast("16UC1"); + data.depth.data = pixels.data(); + data.depth.data_count = pixels.size(); + + data.camera_info.header = data.header; + data.camera_info.height = 4; + data.camera_info.width = 8; + data.camera_info.distortion_model = const_cast("plumb_bob"); + data.camera_info.K[0] = 500.0; + data.camera_info.K[4] = 500.0; + data.camera_info.K[8] = 1.0; + + const robot_sensor_msgs::DepthCameraData cpp = convert2CppDepthCameraData(data); + + EXPECT_EQ(cpp.header.frame_id, "camera_depth_optical_frame"); + EXPECT_EQ(cpp.depth.encoding, "16UC1"); + EXPECT_EQ(cpp.depth.step, 16u); + ASSERT_EQ(cpp.depth.data.size(), pixels.size()); + EXPECT_EQ(cpp.depth.data[0], 0xAB); + + // Copy, không alias: sửa buffer của host sau lời gọi không được đụng tới bản đã chuyển đổi. + pixels[0] = 0x00; + EXPECT_EQ(cpp.depth.data[0], 0xAB); + + EXPECT_EQ(cpp.camera_info.distortion_model, "plumb_bob"); + EXPECT_DOUBLE_EQ(cpp.camera_info.K[0], 500.0); + EXPECT_TRUE(cpp.camera_info.D.empty()); +} + +TEST(ConvertorDepthCamera, AcceptsNullOptionalFields) +{ + DepthCameraData data{}; + data.depth.data = nullptr; + data.depth.data_count = 4096; // bộ đếm khác 0 nhưng không có buffer + data.camera_info.D = nullptr; + data.camera_info.D_count = 5; + + const robot_sensor_msgs::DepthCameraData cpp = convert2CppDepthCameraData(data); + + EXPECT_EQ(cpp.header.frame_id, std::string()); + EXPECT_EQ(cpp.depth.encoding, std::string()); + EXPECT_TRUE(cpp.depth.data.empty()); + EXPECT_TRUE(cpp.camera_info.D.empty()); +} + +// ================================================================================================ +// Free helpers +// ================================================================================================ + +TEST(FreeHelpers, NullPointersAreNoOps) +{ + navigation_free_occupancy_grid(nullptr); + navigation_free_laser_scan(nullptr); + navigation_free_point_cloud(nullptr); + navigation_free_point_cloud2(nullptr); + navigation_free_planner_data(nullptr); + nav_c_api_free_string(nullptr); + SUCCEED() << "no crash on NULL"; +} + +TEST(FreeHelpers, DoubleFreeIsSafe) +{ + robot_sensor_msgs::LaserScan source; + source.header.frame_id = "laser"; + source.ranges = { 1.0f, 2.0f }; + + LaserScan c_scan{}; + convert2CLaserScan(source, c_scan); + + navigation_free_laser_scan(&c_scan); + navigation_free_laser_scan(&c_scan); // các con trỏ đã bị xoá ở lần đầu + + EXPECT_EQ(c_scan.header.frame_id, nullptr); + EXPECT_EQ(c_scan.ranges, nullptr); +} + +TEST(FreeHelpers, PlannerDataReleasesEveryNestedBuffer) +{ + robot::move_base_core::PlannerDataOutput source; + source.plan.header.frame_id = "map"; + for (int i = 0; i < 3; ++i) + { + robot_nav_2d_msgs::Pose2DStamped pose; + pose.header.frame_id = "map"; // mỗi pose mang frame_id RIÊNG — chỗ dễ rò nhất + pose.pose.x = i; + source.plan.poses.push_back(pose); + } + source.costmap.header.frame_id = "map"; + source.costmap.data = { 0, 1, 2, 3 }; + source.footprint.header.frame_id = "base_link"; + robot_geometry_msgs::Point32 p; + p.x = 0.3f; + source.footprint.polygon.points.push_back(p); + + PlannerDataOutput c_data{}; + convert2CPath2D(source.plan, c_data.plan); + convert2COccupancyGrid(source.costmap, c_data.costmap); + convert2CPolygonStamped(source.footprint, c_data.footprint); + + ASSERT_EQ(c_data.plan.poses_count, 3u); + ASSERT_NE(c_data.plan.poses[0].header.frame_id, nullptr); + ASSERT_EQ(c_data.costmap.data_count, 4u); + ASSERT_EQ(c_data.footprint.polygon.points_count, 1u); + + navigation_free_planner_data(&c_data); + + EXPECT_EQ(c_data.plan.poses, nullptr); + EXPECT_EQ(c_data.plan.poses_count, 0u); + EXPECT_EQ(c_data.plan.header.frame_id, nullptr); + EXPECT_EQ(c_data.costmap.data, nullptr); + EXPECT_EQ(c_data.footprint.polygon.points, nullptr); + EXPECT_EQ(c_data.footprint.polygon.points_count, 0u); +} + +TEST(FreeHelpers, PointCloudReleasesChannelNamesAndValues) +{ + robot_sensor_msgs::PointCloud source; + source.header.frame_id = "cloud"; + robot_geometry_msgs::Point32 p; + p.x = 1.0f; + source.points.push_back(p); + robot_sensor_msgs::ChannelFloat32 channel; + channel.name = "intensity"; + channel.values = { 1.0f, 2.0f }; + source.channels.push_back(channel); + + PointCloud c_cloud{}; + convert2CPointCloud(source, c_cloud); + ASSERT_EQ(c_cloud.channels_count, 1u); + ASSERT_NE(c_cloud.channels[0].name, nullptr); + ASSERT_NE(c_cloud.channels[0].values, nullptr); + + navigation_free_point_cloud(&c_cloud); + + EXPECT_EQ(c_cloud.points, nullptr); + EXPECT_EQ(c_cloud.channels, nullptr); + EXPECT_EQ(c_cloud.channels_count, 0u); +} + +// ================================================================================================ +// Quaternion validation guards the goal entry points +// ================================================================================================ + +TEST(QuaternionValidation, RejectsNanAndZeroLength) +{ + Quaternion nan_q{}; + nan_q.x = std::nan(""); + nan_q.w = 1.0; + EXPECT_FALSE(isQuaternionValid(nan_q)); + + Quaternion zero_q{}; + EXPECT_FALSE(isQuaternionValid(zero_q)); +} + +TEST(QuaternionValidation, RejectsTiltedAndAcceptsUpright) +{ + Quaternion upright{}; + upright.w = 1.0; + EXPECT_TRUE(isQuaternionValid(upright)); + + // Quay 90 độ quanh trục X: trục z của robot nằm ngang -> không hợp lệ cho navigation phẳng. + Quaternion tilted{}; + tilted.x = 0.7071067811865476; + tilted.w = 0.7071067811865476; + EXPECT_FALSE(isQuaternionValid(tilted)); +} diff --git a/src/Algorithms/Cores/score_algorithm/CMakeLists.txt b/src/Algorithms/Cores/score_algorithm/CMakeLists.txt new file mode 100644 index 0000000..7b0869a --- /dev/null +++ b/src/Algorithms/Cores/score_algorithm/CMakeLists.txt @@ -0,0 +1,162 @@ +cmake_minimum_required(VERSION 3.0.2) +project(score_algorithm VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building score_algorithm with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building score_algorithm with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS filesystem system) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core2 + robot_nav_core + robot_cpp + mkt_msgs + angles + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core2 + robot_nav_core + robot_cpp + mkt_msgs + angles + ) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS robot_nav_2d_msgs robot_nav_2d_utils robot_nav_core robot_nav_core2 robot_cpp mkt_msgs angles + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ) +endif() + +# Libraries +add_library(${PROJECT_NAME} SHARED + src/score_algorithm.cpp +) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_compile_definitions(${PROJECT_NAME} + PUBLIC BUILD_WITH_ROS + ) + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC ${catkin_LIBRARIES} + PRIVATE Boost::filesystem Boost::system + ) + +else() + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::filesystem Boost::system + ) + + set_target_properties(${PROJECT_NAME} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Dependencies: robot_nav_2d_msgs, robot_nav_2d_utils, robot_nav_core, robot_nav_core2, robot_cpp, mkt_msgs, angles, Boost") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Cores/score_algorithm/README.md b/src/Algorithms/Cores/score_algorithm/README.md new file mode 100644 index 0000000..b86fc66 --- /dev/null +++ b/src/Algorithms/Cores/score_algorithm/README.md @@ -0,0 +1,44 @@ +# score_algorithm + +## Giới thiệu +`score_algorithm` là lớp nền (base class) cho các thuật toán đánh giá và sinh lệnh điều khiển (local planning) trong `pnkx_nav_core`. Module này không tự sinh quỹ đạo cụ thể, mà cung cấp bộ khung và các hàm dùng chung để các thuật toán con triển khai. + +## Vai trò chính +- Chuẩn hóa giao diện (interface) cho các thuật toán tính toán quỹ đạo/lệnh. +- Cắt đoạn `global_plan` thành đoạn con phù hợp với `local costmap`. +- Chọn `sub-goal` và `start` để theo đuổi theo từng bước đường đi. +- Cung cấp các hàm tiện ích: kiểm tra dừng/đi, tính quãng đường, tìm mục tiêu theo góc và khoảng cách. + +## API chính +Được khai báo trong `include/score_algorithm/score_algorithm.h`: +- `initialize(...)`: khởi tạo tham số, TF, costmap, bộ sinh quỹ đạo. +- `prepare(...)`: chuẩn bị dữ liệu dùng chung trước khi đánh giá. +- `calculator(...)`: tính toán ra `mkt_msgs::Trajectory2D`. +- `computePlanCommand(...)`: cắt `global_plan` thành đoạn kết quả và chọn `start/goal`. +- `findSubGoalIndex(...)`, `getGoalIndex(...)`, `journey(...)`, `stopped(...)`: hàm phụ trợ. + +## Nguyên lý `computePlanCommand(...)` +Hàm này nhận `robot_pose`, `velocity`, độ dài xem trước `S` và `global_plan`, sau đó: +1) Tìm các mốc `sub-goal` (đổi hướng / điểm gãy) bằng `findSubGoalIndex`. +2) Khôi phục `sub_goal_index` và `sub_start_index` đã lưu (nếu có), cập nhật nếu robot đang dừng và đã vượt mốc. +3) Tìm `start_index` gần nhất với robot trong đoạn con hợp lệ. +4) Tìm `goal_index` dựa trên quy tắc "đi đủ xa `S` hoặc đổi hướng vượt ngưỡng". +5) Xuất `result` là đoạn từ `closet_index` đến `goal_index`. + +Kết quả được sử dụng bởi các local planner để sinh lệnh điều khiển tiếp theo. + +## Sử dụng trong hệ thống +`score_algorithm` được nạp qua pluginlib trong các local planner, ví dụ: +- `pnkx_local_planner` +- `pnkx_go_straight_local_planner` +- `pnkx_rotate_local_planner` +- `pnkx_docking_local_planner` + +Mỗi thuật toán cụ thể sẽ kế thừa `ScoreAlgorithm` và triển khai `initialize`, `prepare`, `calculator`. + +## Thư mục liên quan +- `include/score_algorithm/score_algorithm.h`: giao diện chính. +- `src/score_algorithm.cpp`: các hàm dùng chung (getGoalIndex, computePlanCommand, ...). + +## Ghi chú +Module này phụ thuộc vào `robot_nav_2d_msgs`, `robot_costmap_2d`, `mkt_msgs` và hệ thống TF/ROS. diff --git a/src/Algorithms/Cores/score_algorithm/include/score_algorithm/goal_checker.h b/src/Algorithms/Cores/score_algorithm/include/score_algorithm/goal_checker.h new file mode 100755 index 0000000..3322dee --- /dev/null +++ b/src/Algorithms/Cores/score_algorithm/include/score_algorithm/goal_checker.h @@ -0,0 +1,56 @@ +#ifndef _SCORE_GOAL_CHECKER_H_INCLUDED__ +#define _SCORE_GOAL_CHECKER_H_INCLUDED__ + +#include +#include +#include +#include +#include +#include +#include + +namespace score_algorithm +{ + + /** + * @class GoalChecker + * @brief Function-object for checking whether a goal has been reached + * + * This class defines the plugin interface for determining whether you have reached + * the goal state. This primarily consists of checking the relative positions of two poses + * (which are presumed to be in the same frame). It can also check the velocity, as some + * applications require that robot be stopped to be considered as having reached the goal. + */ + class GoalChecker + { + public: + using Ptr = std::shared_ptr; + + virtual ~GoalChecker() {} + + /** + * @brief Initialize any parameters from the NodeHandle + * @param nh NodeHandle for grabbing parameters + */ + virtual void initialize(const robot::NodeHandle& nh) = 0; + + /** + * @brief Reset the state of the goal checker (if any) + */ + virtual void reset() {} + + /** + * @brief Check whether the goal should be considered reached + * @param query_pose The pose to check + * @param goal_pose The pose to check against + * + * @param velocity The robot's current velocity + * @return True if goal is reached + */ + virtual bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped& query_pose, const robot_nav_2d_msgs::Pose2DStamped& goal_pose, + const robot_nav_2d_msgs::Path2D &path, const robot_nav_2d_msgs::Twist2D& velocity) = 0; + }; + +} // namespace score_algorithm + +#endif // _SCORE_GOAL_CHECKER_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Cores/score_algorithm/include/score_algorithm/score_algorithm.h b/src/Algorithms/Cores/score_algorithm/include/score_algorithm/score_algorithm.h new file mode 100755 index 0000000..e5c72fd --- /dev/null +++ b/src/Algorithms/Cores/score_algorithm/include/score_algorithm/score_algorithm.h @@ -0,0 +1,178 @@ +#ifndef _SCORE_ALGORITHM_H_INCLUDED__ +#define _SCORE_ALGORITHM_H_INCLUDED__ + +#ifdef BUILD_WITH_ROS +#include +#include +#endif +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#define FORWARD 1 +#define BACKWARD -1 + +namespace score_algorithm +{ + class ScoreAlgorithm + { + public: + using Ptr = std::shared_ptr; + + inline double smoothstep(double x) + { + x = std::clamp(x, 0.0, 1.0); + return x * x * (3 - 2 * x); + } + + /** + * @brief Initialize parameters as needed + * @param name Namespace for this planner + * @param tf TFListener pointer + * @param costmap_robot Costmap pointer + */ + virtual void initialize(robot::NodeHandle &nh, const std::string &name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, + const score_algorithm::TrajectoryGenerator::Ptr &traj) = 0; + + /** + * @brief Prior to evaluating any trajectories, look at contextual information constant across all trajectories + * + * Subclasses may overwrite. Return false in case there is any error. + * + * @param pose Current pose (costmap frame) + * @param velocity Current velocity + * @param goal The final goal (costmap frame) + * @param global_plan Transformed global plan in costmap frame, possibly cropped to nearby points + */ + virtual bool prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Pose2DStamped &goal, const robot_nav_2d_msgs::Path2D &global_plan, + double &x_direction, double &y_direction, double &theta_direction) = 0; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + * @param traj + */ + virtual mkt_msgs::Trajectory2D calculator( + const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) = 0; + + /** + * @brief Reset all data + */ + virtual void reset() {}; + + /** + * @brief Stoping move navigation + */ + virtual void stop() {}; + + /** + * @brief resume move navigation after stopped + */ + virtual void resume() {}; + + std::string getName() + { + return name_; + } + + protected: + double sign(double x) + { + return x < 0.0 ? -1.0 : 1.0; + } + + /** + * @brief Get goal index + * @param robot_pose + * @param plan + * @param distance + * @param start_index + * @param last_valid_index + * @return goal index + */ + virtual unsigned int getGoalIndex(const robot_geometry_msgs::Pose2D &robot_pose, const std::vector &plan, + const double distance, unsigned int start_index, unsigned int last_valid_index) const; + + /** + * @brief Get goal pose + * @param robot_pose + * @param velocity + * @param global_plan + * @param sub_goal + * @param S + * @return true if goal pose is found, false otherwise + */ + virtual bool computePlanCommand(const robot_nav_2d_msgs::Pose2DStamped &robot_pose, const robot_nav_2d_msgs::Twist2D &velocity, const double &S, + const robot_nav_2d_msgs::Path2D &global_plan, unsigned int &start_index_global_plan, unsigned int &goal_index_global_plan, robot_nav_2d_msgs::Path2D &result); + + /** + * @brief Find sub goal index + * @param plan + * @param index_s + * @return true if sub goal index is found, false otherwise + */ + virtual bool findSubGoalIndex(const std::vector &plan, std::vector &seq_s, std::vector &mutes); + + /** + * @brief Calculate journey + * @param plan + * @param start_index + * @param last_valid_index + * @return journey + */ + double journey(const std::vector &plan, const unsigned int start_index, const unsigned int last_valid_index) const; + + /** + * @brief Check whether the robot is stopped or not + * @param velocity The current odometry information for the robot + * @param rot_stopped_velocity The rotational velocity below which the robot is considered stopped + * @param trans_stopped_velocity The translational velocity below which the robot is considered stopped + * @return True if the robot is stopped, false otherwise + */ + bool stopped(const robot_nav_2d_msgs::Twist2D &velocity, const double &rot_stopped_velocity, const double &trans_stopped_velocity); + + void clear(); + + std::string name_; + TFListenerPtr tf_; + robot_costmap_2d::Costmap2DROBOT *costmap_robot_; + TrajectoryGenerator::Ptr traj_; + + int index_samples_; + bool follow_step_path_; + double xy_local_goal_tolerance_; + double old_xy_goal_tolerance_; + double angle_threshold_; + +#ifdef BUILD_WITH_ROS + ros::Publisher current_goal_pub_; + ros::Publisher closet_robot_goal_pub_; +#endif + + std::vector reached_intermediate_goals_; + std::vector start_index_saved_vt_; + unsigned int sub_goal_index_saved_, sub_goal_seq_saved_; + unsigned int sub_start_index_saved_, sub_start_seq_saved_; + + double max_vel_x_, min_vel_x_, acc_lim_x_, decel_lim_x_; + double max_vel_y_, min_vel_y_, acc_lim_y_, decel_lim_y_; + double max_vel_theta_, min_vel_theta_, acc_lim_theta_, decel_lim_theta_; + double min_speed_xy_, max_speed_xy_; + double rot_stopped_velocity_, trans_stopped_velocity_; + }; +} // namespace score_algorithm + +#endif // SCORE_ALGORITHM_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Cores/score_algorithm/include/score_algorithm/trajectory_generator.h b/src/Algorithms/Cores/score_algorithm/include/score_algorithm/trajectory_generator.h new file mode 100755 index 0000000..8dcb577 --- /dev/null +++ b/src/Algorithms/Cores/score_algorithm/include/score_algorithm/trajectory_generator.h @@ -0,0 +1,143 @@ +#ifndef _SCORE_ALGORITHM_TRAJECTORY_GENERATOR_H +#define _SCORE_ALGORITHM_TRAJECTORY_GENERATOR_H + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace score_algorithm +{ + + /** + * @class TrajectoryGenerator + * @brief Interface for iterating through possible velocities and creating trajectories + * + * This class defines the plugin interface for two separate but related components. + * + * First, this class provides an iterator interface for exploring all of the velocities + * to search, given the current velocity. + * + * Second, the class gives an independent interface for creating a trajectory from a twist, + * i.e. projecting it out in time and space. + * + * Both components rely heavily on the robot's kinematic model, and can share many parameters, + * which is why they are grouped into a singular class. + */ + class TrajectoryGenerator + { + public: + using Ptr = std::shared_ptr; + + virtual ~TrajectoryGenerator() {} + + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize(const robot::NodeHandle &nh) = 0; + + /** + * @brief Reset the state (if any) when the planner gets a new goal + */ + virtual void reset() {} + + /** + * @brief Start a new iteration based on the current velocity + * @param current_velocity + */ + virtual void startNewIteration(const robot_nav_2d_msgs::Twist2D ¤t_velocity) = 0; + + /** + * @brief Set direct of robot based on the current velocity + * @param direct + */ + virtual void setDirect(int *xytheta_direct) = 0; + + /** + * @brief set velocity for x, y asix of the robot + * @param linear the velocity command + * @return True if set is done, false otherwise + */ + virtual bool setTwistLinear(robot_geometry_msgs::Vector3 linear) = 0; + + /** + * @brief get velocity for x, y asix of the robot + * @param linear The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistLinear(bool direct) = 0; + + /** + * @brief Set velocity theta for z asix of the robot + * @param angular the command velocity + * @return True if set is done, false otherwise + */ + virtual bool setTwistAngular(robot_geometry_msgs::Vector3 angular) = 0; + + /** + * @brief Get velocity theta for z asix of the robot + * @param direct The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistAngular(bool direct) = 0; + + /** + * @brief Test to see whether there are more twists to test + * @return True if more twists, false otherwise + */ + virtual bool hasMoreTwists() = 0; + + /** + * @brief Return the next twist and advance the iteration + * @return The Twist! + */ + virtual robot_nav_2d_msgs::Twist2D nextTwist() = 0; + + /** + * @brief Get the current twist + * @return The current twist + */ + virtual robot_nav_2d_msgs::Twist2D getTwist() = 0; + + /** + * @brief Get all the twists for an iteration. + * + * Note: Resets the iterator if one is in process + * + * @param current_velocity + * @return all the twists + */ + virtual std::vector getTwists(const robot_nav_2d_msgs::Twist2D ¤t_velocity) + { + std::vector twists; + startNewIteration(current_velocity); + while (hasMoreTwists()) + { + twists.push_back(nextTwist()); + } + return twists; + } + + /** + * @brief Given a cmd_vel in the robot's frame and initial conditions, generate a Trajectory2D + * @param start_pose Current robot location + * @param start_vel Current robot velocity + * @param cmd_vel The desired command velocity + */ + virtual mkt_msgs::Trajectory2D generateTrajectory(const robot_nav_2d_msgs::Pose2DStamped &start_pose, + const robot_nav_2d_msgs::Path2D &transformed_plan, + const robot_nav_2d_msgs::Twist2D &start_vel, + const robot_nav_2d_msgs::Twist2D &cmd_vel) = 0; + + virtual robot::NodeHandle getNodeHandle() = 0; + + }; + +} // namespace score_algorithm + +#endif // _SCORE_ALGORITHM_TRAJECTORY_GENERATOR_H diff --git a/src/Algorithms/Cores/score_algorithm/package.xml b/src/Algorithms/Cores/score_algorithm/package.xml new file mode 100644 index 0000000..f607334 --- /dev/null +++ b/src/Algorithms/Cores/score_algorithm/package.xml @@ -0,0 +1,37 @@ + + score_algorithm + 0.7.10 + + score_algorithm is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. score_algorithm + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/score_algorithm + + catkin + + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core + robot_nav_core2 + robot_cpp + mkt_msgs + angles + + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core + robot_nav_core2 + robot_cpp + mkt_msgs + angles + \ No newline at end of file diff --git a/src/Algorithms/Cores/score_algorithm/src/score_algorithm.cpp b/src/Algorithms/Cores/score_algorithm/src/score_algorithm.cpp new file mode 100644 index 0000000..770b81f --- /dev/null +++ b/src/Algorithms/Cores/score_algorithm/src/score_algorithm.cpp @@ -0,0 +1,487 @@ +#include +#include +#include +#include +#include + +unsigned int score_algorithm::ScoreAlgorithm::getGoalIndex(const robot_geometry_msgs::Pose2D &robot_pose, const std::vector &plan, + const double distance, unsigned int start_index, unsigned int last_valid_index) const +{ + if (start_index >= last_valid_index) + return last_valid_index; + + unsigned int goal_index = start_index + 1; + const double start_direction_x = plan[goal_index].pose.x - plan[start_index].pose.x; + const double start_direction_y = plan[goal_index].pose.y - plan[start_index].pose.y; + if (fabs(start_direction_x) > 1e-9 || fabs(start_direction_y) > 1e-9) + { // make sure that atan2 is defined + double start_angle = atan2(start_direction_y, start_direction_x); + double S = sqrt(pow(start_direction_x, 2) + pow(start_direction_y, 2)); + // double angle_threshold = 0.0; + for (unsigned int i = start_index + 1; i <= last_valid_index; i++) + { + const double current_direction_x = plan[i].pose.x - plan[i - 1].pose.x; + const double current_direction_y = plan[i].pose.y - plan[i - 1].pose.y; + const double dd = sqrt(pow(current_direction_x, 2) + pow(current_direction_y, 2)); + S += dd; + if (fabs(current_direction_x) > 1e-9 || fabs(current_direction_y) > 1e-9) + { + double current_angle = atan2(current_direction_y, current_direction_x); + goal_index = i; + if (fabs(remainder(start_angle - current_angle, 2 * M_PI)) >= angle_threshold_ || S >= distance) + { + break; + } + } + } + } + if (last_valid_index - goal_index == 1) + goal_index = last_valid_index; + return goal_index; +} + +bool score_algorithm::ScoreAlgorithm::findSubGoalIndex(const std::vector &plan, std::vector &seq_s, std::vector &mutes) +{ + if (plan.empty()) + { + return false; + } + double x_direction_saved = 0.0; + robot_geometry_msgs::PoseArray poseArrayMsg; + poseArrayMsg.header.stamp = robot::Time::now(); + poseArrayMsg.header.frame_id = costmap_robot_->getGlobalFrameID(); + + robot_nav_2d_msgs::Pose2DStamped p1, p2, p3; + + if (plan.size() < 3) + { + seq_s.push_back(plan.back().header.seq); + mutes.push_back(plan.back()); + } + else + { + unsigned int i = 0; + p1 = plan[i]; + for (i = 0; i < (unsigned int)plan.size() - 2; i++) + { + double egde1_angle, egde2_angle; + p2 = plan[i + 1]; + if ((fabs(p2.pose.y - p1.pose.y) > 1e-9 || fabs(p2.pose.x - p1.pose.x) > 1e-9)) + { + egde1_angle = atan2(p2.pose.y - p1.pose.y, p2.pose.x - p1.pose.x); + } + else + continue; + + const double target_direction = cos(fabs(egde1_angle - p2.pose.theta)); + + if (target_direction * x_direction_saved < 0.0) + { + if (std::find(seq_s.begin(), seq_s.end(), plan[i].header.seq) == seq_s.end()) + { + seq_s.push_back(plan[i].header.seq); + mutes.push_back(plan[i]); + robot_geometry_msgs::Pose pose = robot_nav_2d_utils::pose2DToPoseStamped(plan[i]).pose; + poseArrayMsg.poses.push_back(pose); + } + } + x_direction_saved = target_direction; + + p3 = plan[i + 2]; + if ((fabs(p3.pose.y - p2.pose.y) > 1e-9 || fabs(p3.pose.x - p2.pose.x) > 1e-9)) + { + egde2_angle = atan2(p3.pose.y - p2.pose.y, p3.pose.x - p2.pose.x); + p1 = p2; + } + else + continue; + + double thresh_angle = 0.3; + double angle = fabs(remainder(egde1_angle - egde2_angle, 2 * M_PI)); + if (angle >= thresh_angle || angle >= M_PI - thresh_angle) + { + if (std::find(seq_s.begin(), seq_s.end(), plan[i].header.seq) == seq_s.end()) + { + seq_s.push_back(plan[i + 1].header.seq); + mutes.push_back(plan[i + 1]); + robot_geometry_msgs::Pose pose = robot_nav_2d_utils::pose2DToPoseStamped(plan[i + 1]).pose; + poseArrayMsg.poses.push_back(pose); + } + p2 = p3; + } + } + } + + if (seq_s.empty()) + { + seq_s.push_back(plan.back().header.seq); + mutes.push_back(plan.back()); + robot_geometry_msgs::Pose pose = robot_nav_2d_utils::pose2DToPoseStamped(plan.back()).pose; + poseArrayMsg.poses.push_back(pose); + } + else + { + if (seq_s.back() < plan.back().header.seq) + { + seq_s.push_back(plan.back().header.seq); + mutes.push_back(plan.back()); + robot_geometry_msgs::Pose pose = robot_nav_2d_utils::pose2DToPoseStamped(plan.back()).pose; + poseArrayMsg.poses.push_back(pose); + } + } + return true; +} + +bool score_algorithm::ScoreAlgorithm::computePlanCommand(const robot_nav_2d_msgs::Pose2DStamped &robot_pose, const robot_nav_2d_msgs::Twist2D &velocity, const double &S, + const robot_nav_2d_msgs::Path2D &global_plan, unsigned int &start_index_global_plan, unsigned int &goal_index_global_plan, robot_nav_2d_msgs::Path2D &result) +{ + result.poses.clear(); + if (global_plan.poses.empty()) + { + robot::log_error("ScoreAlgorithm: The global plan was empty."); + return false; + } + + std::vector seq_s; + std::vector mutes; + if (!this->findSubGoalIndex(global_plan.poses, seq_s, mutes)) + { + robot::log_error("ScoreAlgorithm: Cannot find SubGoal Index"); + return false; + } + + unsigned int sub_goal_index; + unsigned int sub_start_index; + + bool found_sub_goal_index_saved = false, found_sub_start_index_saved = false; + for (unsigned int i = 0; i < (unsigned int)global_plan.poses.size(); ++i) + { + if (global_plan.poses[i].header.seq == sub_goal_seq_saved_) + { + sub_goal_index_saved_ = i; + found_sub_goal_index_saved = true; + } + if (global_plan.poses[i].header.seq == sub_start_seq_saved_) + { + sub_start_index_saved_ = i; + found_sub_start_index_saved = true; + } + if (found_sub_goal_index_saved && found_sub_start_index_saved) + { + break; + } + } + + sub_goal_index = !found_sub_goal_index_saved ? (unsigned int)global_plan.poses.size() : sub_goal_index_saved_; + sub_start_index = !found_sub_start_index_saved ? 0 : sub_start_index_saved_; + + std::vector index_s; + for (auto seq : seq_s) + { + for (unsigned int i = 0; i < (unsigned int)global_plan.poses.size(); ++i) + { + if (global_plan.poses[i].header.seq == seq) + { + index_s.push_back(i); + break; + } + } + } + + if (index_s.empty()) + { + sub_goal_index = (unsigned int)global_plan.poses.size(); + sub_goal_seq_saved_ = global_plan.poses.back().header.seq; + } + else + { + bool is_stopped = stopped(velocity, rot_stopped_velocity_, trans_stopped_velocity_); + if (is_stopped && index_s.front() > sub_goal_index_saved_ && index_s.front() < (unsigned int)global_plan.poses.size()) + { + // sub_goal_index = (unsigned int)index_s.front() > 0 ? (unsigned int)index_s.front() - 1 : (unsigned int)index_s.front(); + sub_goal_index = index_s.front(); + sub_goal_seq_saved_ = global_plan.poses[sub_goal_index].header.seq; + } + + // Process index_s with multiple elements + if (index_s.size() > 1) + { + for (size_t i = 1; i < index_s.size(); ++i) + { + if (index_s[i - 1] >= (unsigned int)global_plan.poses.size() || index_s[i] >= (unsigned int)global_plan.poses.size()) + { + continue; + } + + double dx = robot_pose.pose.x - global_plan.poses[index_s[i - 1]].pose.x; + double dy = robot_pose.pose.y - global_plan.poses[index_s[i - 1]].pose.y; + double theta = angles::normalize_angle(robot_pose.pose.theta - global_plan.poses[index_s[i - 1]].pose.theta); + double x = cos(global_plan.poses[index_s[i - 1]].pose.theta) * dx + sin(global_plan.poses[index_s[i - 1]].pose.theta) * dy; + double y = -sin(global_plan.poses[index_s[i - 1]].pose.theta) * dx + cos(global_plan.poses[index_s[i - 1]].pose.theta) * dy; + + if (std::abs(std::sqrt(dx * dx + dy * dy)) <= xy_local_goal_tolerance_ + 0.2) + { + double tolerance = fabs(cos(theta)) >= fabs(sin(theta)) ? x : y; + if (fabs(tolerance) <= xy_local_goal_tolerance_) + { + + if (index_s[i] > sub_goal_index_saved_) + { + sub_goal_index = (i < index_s.size() - 1) ? index_s[i] : (unsigned int)global_plan.poses.size() - 1; + sub_goal_seq_saved_ = global_plan.poses[sub_goal_index].header.seq; + old_xy_goal_tolerance_ = 0.0; + if (follow_step_path_) + { + sub_start_index = index_s[i - 1]; + sub_start_seq_saved_ = global_plan.poses[sub_start_index].header.seq; + } + break; + } + } + } + else + old_xy_goal_tolerance_ = fabs(cos(theta)) >= fabs(sin(theta)) ? x : y; + } + } + else + { + // Validate sub_goal_index + if (sub_goal_index >= (unsigned int)global_plan.poses.size() - 1) + { + sub_goal_index = (unsigned int)global_plan.poses.size() - 1; + sub_goal_seq_saved_ = global_plan.poses[sub_goal_index].header.seq; + } + else + { + double dx = robot_pose.pose.x - global_plan.poses[sub_goal_index].pose.x; + double dy = robot_pose.pose.y - global_plan.poses[sub_goal_index].pose.y; + double theta = angles::normalize_angle(robot_pose.pose.theta - global_plan.poses[sub_goal_index].pose.theta); + double x = cos(global_plan.poses[sub_goal_index].pose.theta) * dx + sin(global_plan.poses[sub_goal_index].pose.theta) * dy; + double y = -sin(global_plan.poses[sub_goal_index].pose.theta) * dx + cos(global_plan.poses[sub_goal_index].pose.theta) * dy; + if (std::abs(std::sqrt(dx * dx + dy * dy)) <= xy_local_goal_tolerance_ + 0.2) + { + double tolerance = fabs(cos(theta)) >= fabs(sin(theta)) ? x : y; + if (fabs(tolerance) <= xy_local_goal_tolerance_) + { + sub_goal_index = (unsigned int)global_plan.poses.size() - 1; + sub_goal_seq_saved_ = global_plan.poses[sub_goal_index].header.seq; + old_xy_goal_tolerance_ = 0.0; + robot::log_info("ScoreAlgorithm: Single sub-goal reached, setting sub_goal_index to %d", sub_goal_index); + } + } + else + old_xy_goal_tolerance_ = fabs(cos(theta)) >= fabs(sin(theta)) ? x : y; + } + } + } + if (sub_start_index >= sub_goal_index) + { + robot::log_error("ScoreAlgorithm: Sub path is empty"); + return false; + } + + // find the "start pose", i.e. the pose on the plan closest to the robot that is also on the local map + // Tìm điểm pose bắt đầu trên kế hoạch đường đi gần nhất với robot đồng thời có tồn tại trong local map + unsigned int start_index = 0; // số vị trí pose trong kế hoạch đường đi + unsigned int closet_index = 0; + double distance_to_start = std::numeric_limits::infinity(); // Xét giá trị là vô cùng oo + bool started_path = false; + for (unsigned int i = sub_start_index; i < sub_goal_index; ++i) + { + // Still on the costmap. Continue. + double distance = fabs(robot_nav_2d_utils::poseDistance(global_plan.poses[i].pose, robot_pose.pose)); // Tính khoảng cách từ vị trí của robot đến pose đang xét + if (distance_to_start > distance) + { + start_index = i; + closet_index = start_index; + distance_to_start = distance; + started_path = true; + } + } + + // Nếu khồng tìm được điểm gần với robot nhất thì trả về false + if (!started_path) + { + robot::log_error("ScoreAlgorithm: None of the points of the global plan were in the local costmap."); + return false; + } + std::stringstream ss; + start_index_saved_vt_.push_back(global_plan.poses[start_index].header.seq); + if (start_index_saved_vt_.size() > index_samples_) + start_index_saved_vt_.erase(start_index_saved_vt_.begin()); + + unsigned num = 0; + if (!start_index_saved_vt_.empty()) + { + for (int i = 0; i < (int)start_index_saved_vt_.size() - 1; i++) + { + if (start_index_saved_vt_[i] == start_index_saved_vt_[i + 1]) + num++; + ss << start_index_saved_vt_[i] << " "; + } + } + if (num < index_samples_ - 1 && !start_index_saved_vt_.empty()) + { + auto max_iter = *(std::max_element(start_index_saved_vt_.begin(), start_index_saved_vt_.end())); + unsigned int max_start_index = start_index; + for (unsigned int i = 0; i < (unsigned int)global_plan.poses.size(); i++) + { + if (global_plan.poses[i].header.seq == max_iter) + { + max_start_index = i; + break; + } + } + double S1 = journey(global_plan.poses, start_index, (unsigned int)global_plan.poses.size() - 1); + double S2 = journey(global_plan.poses, max_start_index, (unsigned int)global_plan.poses.size() - 1); + + if (S2 - S1) + { + start_index = max_start_index; + } + } + // ROS_INFO_STREAM_THROTTLE(0.1, ss.str() << "\n"); + + // find the "last valid pose", i.e. the last pose on the plan after the start pose that is still on the local map + // Tìm điểm pose cuôi cùng sau điểm pose bắt đầu và có tồn tại trong local map + if (start_index < 1) + start_index = 1; + // unsigned int last_valid_index = (unsigned int)global_plan.poses.size() - 1; + unsigned int last_valid_index = sub_goal_index; + + // find the "goal pose" by walking along the plan as long as each step leads far enough away from the starting point, + // i.e. is within angle_threshold_ of the starting direction. + // Tìm điểm mục tiêu chạy từ điểm start pose đến last valid pose dọc thep plan + unsigned int goal_index = start_index; + while (goal_index < last_valid_index) + { + // Tìm kiếm vị trí điểm mục tiêu phù hợp + goal_index = getGoalIndex(robot_pose.pose, global_plan.poses, S, start_index, last_valid_index); + + // check if goal already reached + bool goal_already_reached = false; + + for (auto &reached_intermediate_goal : reached_intermediate_goals_) + { + double distance = fabs(robot_nav_2d_utils::poseDistance(reached_intermediate_goal.pose, global_plan.poses[goal_index].pose)); + if (distance < xy_local_goal_tolerance_) + { + goal_already_reached = true; + // choose a new start_index by walking along the plan until we're outside xy_local_goal_tolerance_ and try again + // (start_index is now > goal_index) + for (start_index = goal_index; start_index < last_valid_index; ++start_index) + { + distance = robot_nav_2d_utils::poseDistance(reached_intermediate_goal.pose, global_plan.poses[start_index].pose); + if (distance >= xy_local_goal_tolerance_) + break; + } + break; + } + } + + if (!goal_already_reached) + { + // new goal not in reached_intermediate_goals_ + double distance = fabs(robot_nav_2d_utils::poseDistance(global_plan.poses[start_index].pose, global_plan.poses[goal_index].pose)); + if (distance < xy_local_goal_tolerance_) + { + // the robot has currently reached the goal + reached_intermediate_goals_.push_back(global_plan.poses[goal_index]); + robot::log_info("ScoreAlgorithm: Number of reached_intermediate goals: %d", reached_intermediate_goals_.size()); + } + else + { + // we've found a new goal! + break; + } + } + } + + if (start_index > goal_index) + start_index = goal_index; + if (goal_index > last_valid_index) + goal_index = last_valid_index; + if ((unsigned int)global_plan.poses.size() == 2 && !global_plan.poses.empty()) + { + start_index = 0; + goal_index = 1; + } + + if (goal_index == (unsigned int)global_plan.poses.size() - 1) + start_index = (unsigned int)global_plan.poses.size() - 2; + + start_index_global_plan = start_index; + goal_index_global_plan = goal_index; + + robot_nav_2d_msgs::Pose2DStamped sub_pose; + sub_pose = global_plan.poses[closet_index]; + +#ifdef BUILD_WITH_ROS + { + robot_geometry_msgs::PoseStamped sub_pose_stamped = robot_nav_2d_utils::pose2DToPoseStamped(sub_pose); + geometry_msgs::PoseStamped sub_pose_stamped_ros; + sub_pose_stamped_ros.header.stamp = ros::Time::now(); + sub_pose_stamped_ros.header.frame_id = sub_pose_stamped.header.frame_id; + sub_pose_stamped_ros.pose.position.x = sub_pose_stamped.pose.position.x; + sub_pose_stamped_ros.pose.position.y = sub_pose_stamped.pose.position.y; + sub_pose_stamped_ros.pose.position.z = 0.9; + sub_pose_stamped_ros.pose.orientation.x = sub_pose_stamped.pose.orientation.x; + sub_pose_stamped_ros.pose.orientation.y = sub_pose_stamped.pose.orientation.y; + sub_pose_stamped_ros.pose.orientation.z = sub_pose_stamped.pose.orientation.z; + sub_pose_stamped_ros.pose.orientation.w = sub_pose_stamped.pose.orientation.w; + closet_robot_goal_pub_.publish(sub_pose_stamped_ros); + } +#endif + + robot_nav_2d_msgs::Pose2DStamped sub_goal; + sub_goal = global_plan.poses[goal_index]; +#ifdef BUILD_WITH_ROS + { + robot_geometry_msgs::PoseStamped sub_goal_stamped = robot_nav_2d_utils::pose2DToPoseStamped(sub_goal); + geometry_msgs::PoseStamped sub_goal_stamped_ros; + sub_goal_stamped_ros.header.stamp = ros::Time::now(); + sub_goal_stamped_ros.header.frame_id = sub_goal_stamped.header.frame_id; + sub_goal_stamped_ros.pose.position.x = sub_goal_stamped.pose.position.x; + sub_goal_stamped_ros.pose.position.y = sub_goal_stamped.pose.position.y; + sub_goal_stamped_ros.pose.position.z = 0.9; + sub_goal_stamped_ros.pose.orientation.x = sub_goal_stamped.pose.orientation.x; + sub_goal_stamped_ros.pose.orientation.y = sub_goal_stamped.pose.orientation.y; + sub_goal_stamped_ros.pose.orientation.z = sub_goal_stamped.pose.orientation.z; + sub_goal_stamped_ros.pose.orientation.w = sub_goal_stamped.pose.orientation.w; + current_goal_pub_.publish(sub_goal_stamped_ros); + } +#endif + + result.header = global_plan.header; + for (int i = closet_index; i <= goal_index; i++) + { + result.poses.push_back(global_plan.poses[i]); + } + return true; +} + +double score_algorithm::ScoreAlgorithm::journey(const std::vector &plan, const unsigned int start_index, const unsigned int last_valid_index) const +{ + double S = 0; + if (last_valid_index - start_index > 1) + { + for (int i = start_index; i < last_valid_index; i++) + { + S += robot_nav_2d_utils::poseDistance(plan[i].pose, plan[i + 1].pose); + } + } + return S; +} + +bool score_algorithm::ScoreAlgorithm::stopped(const robot_nav_2d_msgs::Twist2D &velocity, const double &rot_stopped_velocity, const double &trans_stopped_velocity) +{ + return fabs(velocity.theta) <= rot_stopped_velocity && fabs(velocity.x) <= trans_stopped_velocity && fabs(velocity.y) <= trans_stopped_velocity; +} + +void score_algorithm::ScoreAlgorithm::clear() +{ + reached_intermediate_goals_.clear(); + start_index_saved_vt_.clear(); + sub_goal_index_saved_ = sub_goal_seq_saved_ = 0; + sub_start_index_saved_, sub_start_seq_saved_ = 0; +} \ No newline at end of file diff --git a/src/Algorithms/Libraries/angles/CMakeLists.txt b/src/Algorithms/Libraries/angles/CMakeLists.txt new file mode 100644 index 0000000..3eb856a --- /dev/null +++ b/src/Algorithms/Libraries/angles/CMakeLists.txt @@ -0,0 +1,129 @@ +cmake_minimum_required(VERSION 3.0.2) +project(angles VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building angles with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building angles with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED) + + catkin_package( + INCLUDE_DIRS include + # LIBRARIES không cần vì đây là header-only library + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/angles/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: None") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Libraries/angles/include/angles/angles.h b/src/Algorithms/Libraries/angles/include/angles/angles.h new file mode 100644 index 0000000..4efd80e --- /dev/null +++ b/src/Algorithms/Libraries/angles/include/angles/angles.h @@ -0,0 +1,48 @@ +#ifndef ANGLES_ANGLES_H +#define ANGLES_ANGLES_H + +#include + +namespace angles +{ + +/** + * @brief Normalize an angle to the range [-π, π] + * @param angle The angle in radians to normalize + * @return The normalized angle in the range [-π, π] + */ +inline double normalize_angle(double angle) +{ + while (angle > M_PI) + angle -= 2.0 * M_PI; + while (angle < -M_PI) + angle += 2.0 * M_PI; + return angle; +} + +/** + * @brief Calculate the shortest angular distance between two angles + * + * Computes the shortest angular distance from angle 'from' to angle 'to'. + * The result is in the range [-π, π], where positive values indicate + * counter-clockwise rotation and negative values indicate clockwise rotation. + * + * @param from The starting angle in radians + * @param to The target angle in radians + * @return The shortest angular distance in radians, in the range [-π, π] + * + * @code + * double diff = angles::shortest_angular_distance(0.0, M_PI/2); // Returns π/2 + * double diff2 = angles::shortest_angular_distance(M_PI, 0.0); // Returns -π (or π, normalized) + * @endcode + */ +inline double shortest_angular_distance(double from, double to) +{ + double diff = to - from; + return normalize_angle(diff); +} + +} // namespace angles + +#endif // ANGLES_ANGLES_H + diff --git a/src/Algorithms/Libraries/angles/package.xml b/src/Algorithms/Libraries/angles/package.xml new file mode 100644 index 0000000..9eddac1 --- /dev/null +++ b/src/Algorithms/Libraries/angles/package.xml @@ -0,0 +1,22 @@ + + angles + 0.7.10 + + angles is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. angles + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/angles + + catkin + + \ No newline at end of file diff --git a/src/Algorithms/Libraries/kalman/CMakeLists.txt b/src/Algorithms/Libraries/kalman/CMakeLists.txt new file mode 100755 index 0000000..7742396 --- /dev/null +++ b/src/Algorithms/Libraries/kalman/CMakeLists.txt @@ -0,0 +1,181 @@ +cmake_minimum_required(VERSION 3.0.2) +project(kalman VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building kalman with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building kalman with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Eigen3 REQUIRED) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + DEPENDS Eigen3 + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${EIGEN3_INCLUDE_DIRS} + ) +endif() + +# ======================================================== +# Libraries +# ======================================================== +add_library(${PROJECT_NAME} SHARED + src/kalman.cpp +) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC ${catkin_LIBRARIES} + PRIVATE Eigen3::Eigen + ) + +else() + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC + Eigen3::Eigen + ) + + set_target_properties(${PROJECT_NAME} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +# ======================================================== +# Test executable +# ======================================================== +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/kalman-test.cpp) + add_executable(${PROJECT_NAME}_node src/kalman-test.cpp) + + target_link_libraries(${PROJECT_NAME}_node PRIVATE + ${PROJECT_NAME} + Eigen3::Eigen + ) + + if(NOT BUILDING_WITH_CATKIN) + # Configure RPATH to find libraries in devel space + set_target_properties(${PROJECT_NAME}_node PROPERTIES + BUILD_WITH_INSTALL_RPATH FALSE + INSTALL_RPATH_USE_LINK_PATH TRUE + BUILD_RPATH "${CMAKE_BINARY_DIR}" + ) + endif() +endif() + +# ======================================================== +# Install +# ======================================================== +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + ## Install test executable if it exists + if(TARGET ${PROJECT_NAME}_node) + install(TARGETS ${PROJECT_NAME}_node + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + endif() + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + ## Install test executable if it exists + if(TARGET ${PROJECT_NAME}_node) + install(TARGETS ${PROJECT_NAME}_node + RUNTIME DESTINATION bin + ) + endif() + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Libraries: ${PROJECT_NAME}") + if(TARGET ${PROJECT_NAME}_node) + message(STATUS "Executables: ${PROJECT_NAME}_node") + endif() + message(STATUS "Dependencies: Eigen3") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Libraries/kalman/README.md b/src/Algorithms/Libraries/kalman/README.md new file mode 100755 index 0000000..17613be --- /dev/null +++ b/src/Algorithms/Libraries/kalman/README.md @@ -0,0 +1,18 @@ +Kalman Filter +============= +This is a basic Kalman filter implementation in C++ using the +[Eigen](http://eigen.tuxfamily.org/) library. It implements the algorithm +directly as found in [An Introduction to the Kalman Filter](http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf). + +There is a test program that estimates the motion of a projectile based on +noisy observations. To run it, use CMake: + + cd kalman-cpp + mkdir build + cd build + cmake .. + make + ./kalman-test + +Note: You may have to specify the path to your Eigen library in +`CMakeLists.txt`. diff --git a/src/Algorithms/Libraries/kalman/include/kalman/kalman.h b/src/Algorithms/Libraries/kalman/include/kalman/kalman.h new file mode 100755 index 0000000..7fa1525 --- /dev/null +++ b/src/Algorithms/Libraries/kalman/include/kalman/kalman.h @@ -0,0 +1,91 @@ +/** +* Kalman filter implementation using Eigen. Based on the following +* introductory paper: +* +* http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf +* +* @author: Hayk Martirosyan +* @date: 2014.11.15 +*/ + +#include + +#pragma once + +class KalmanFilter { + +public: + + /** + * Create a Kalman filter with the specified matrices. + * A - System dynamics matrix + * C - Output matrix + * Q - Process noise covariance + * R - Measurement noise covariance + * P - Estimate error covariance + */ + KalmanFilter( + double dt, + const Eigen::MatrixXd& A, + const Eigen::MatrixXd& C, + const Eigen::MatrixXd& Q, + const Eigen::MatrixXd& R, + const Eigen::MatrixXd& P + ); + + /** + * Create a blank estimator. + */ + KalmanFilter(); + + /** + * Initialize the filter with initial states as zero. + */ + void init(); + + /** + * Initialize the filter with a guess for initial states. + */ + void init(double t0, const Eigen::VectorXd& x0); + + /** + * Update the estimated state based on measured values. The + * time step is assumed to remain constant. + */ + void update(const Eigen::VectorXd& y); + + /** + * Update the estimated state based on measured values, + * using the given time step and dynamics matrix. + */ + void update(const Eigen::VectorXd& y, double dt, const Eigen::MatrixXd A); + + /** + * Return the current state and time. + */ + Eigen::VectorXd state() { return x_hat; }; + double time() { return t; }; + +private: + + // Matrices for computation + Eigen::MatrixXd A, C, Q, R, P, K, P0; + + // System dimensions + int m, n; + + // Initial and current time + double t0, t; + + // Discrete time step + double dt; + + // Is the filter initialized? + bool initialized; + + // n-size identity + Eigen::MatrixXd I; + + // Estimated states + Eigen::VectorXd x_hat, x_hat_new; +}; diff --git a/src/Algorithms/Libraries/kalman/package.xml b/src/Algorithms/Libraries/kalman/package.xml new file mode 100644 index 0000000..9391990 --- /dev/null +++ b/src/Algorithms/Libraries/kalman/package.xml @@ -0,0 +1,22 @@ + + kalman + 0.7.10 + + kalman is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. kalman + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/kalman + + catkin + + \ No newline at end of file diff --git a/src/Algorithms/Libraries/kalman/src/kalman-test.cpp b/src/Algorithms/Libraries/kalman/src/kalman-test.cpp new file mode 100755 index 0000000..fa2cdda --- /dev/null +++ b/src/Algorithms/Libraries/kalman/src/kalman-test.cpp @@ -0,0 +1,77 @@ +/** + * Test for the KalmanFilter class with 1D projectile motion. + * + * @author: Hayk Martirosyan + * @date: 2014.11.15 + */ + +#include +#include +#include + +#include + +int main(int argc, char* argv[]) { + + int n = 3; // Number of states + int m = 1; // Number of measurements + + double dt = 1.0/30; // Time step + + Eigen::MatrixXd A(n, n); // System dynamics matrix + Eigen::MatrixXd C(m, n); // Output matrix + Eigen::MatrixXd Q(n, n); // Process noise covariance + Eigen::MatrixXd R(m, m); // Measurement noise covariance + Eigen::MatrixXd P(n, n); // Estimate error covariance + + // Discrete LTI projectile motion, measuring position only + A << 1, dt, 0, 0, 1, dt, 0, 0, 1; + C << 1, 0, 0; + + // Reasonable covariance matrices + Q << .05, .05, .0, .05, .05, .0, .0, .0, .0; + R << 5; + P << .1, .1, .1, .1, 10000, 10, .1, 10, 100; + + std::cout << "A: \n" << A << std::endl; + std::cout << "C: \n" << C << std::endl; + std::cout << "Q: \n" << Q << std::endl; + std::cout << "R: \n" << R << std::endl; + std::cout << "P: \n" << P << std::endl; + + // Construct the filter + KalmanFilter kf(dt,A, C, Q, R, P); + + // List of noisy position measurements (y) + std::vector measurements = { + 1.04202710058, 1.10726790452, 1.2913511148, 1.48485250951, 1.72825901034, + 1.74216489744, 2.11672039768, 2.14529225112, 2.16029641405, 2.21269371128, + 2.57709350237, 2.6682215744, 2.51641839428, 2.76034056782, 2.88131780617, + 2.88373786518, 2.9448468727, 2.82866600131, 3.0006601946, 3.12920591669, + 2.858361783, 2.83808170354, 2.68975330958, 2.66533185589, 2.81613499531, + 2.81003612051, 2.88321849354, 2.69789264832, 2.4342229249, 2.23464791825, + 2.30278776224, 2.02069770395, 1.94393985809, 1.82498398739, 1.52526230354, + 1.86967808173, 1.18073207847, 1.10729605087, 0.916168349913, 0.678547664519, + 0.562381751596, 0.355468474885, -0.155607486619, -0.287198661013, -0.602973173813 + }; + + // Best guess of initial states + Eigen::VectorXd x0(n); + double t = 0; + x0 << measurements[0], 0, -9.81; + kf.init(t, x0); + + // Feed measurements into filter, output estimated states + + Eigen::VectorXd y(m); + std::cout << "t = " << t << ", " << "x_hat[0]: " << kf.state().transpose() << std::endl; + for(int i = 0; i < measurements.size(); i++) { + t += dt; + y << measurements[i]; + kf.update(y); + std::cout << "t = " << t << ", " << "y[" << i << "] = " << y.transpose() + << ", x_hat[" << i << "] = " << kf.state().transpose() << std::endl; + } + + return 0; +} diff --git a/src/Algorithms/Libraries/kalman/src/kalman.cpp b/src/Algorithms/Libraries/kalman/src/kalman.cpp new file mode 100755 index 0000000..5e47d9f --- /dev/null +++ b/src/Algorithms/Libraries/kalman/src/kalman.cpp @@ -0,0 +1,96 @@ +/** +* Implementation of KalmanFilter class. +* +* @author: Hayk Martirosyan +* @date: 2014.11.15 +*/ + +#include +#include + +#include + +KalmanFilter::KalmanFilter( + double dt, + const Eigen::MatrixXd& A, + const Eigen::MatrixXd& C, + const Eigen::MatrixXd& Q, + const Eigen::MatrixXd& R, + const Eigen::MatrixXd& P) + : A(A), C(C), Q(Q), R(R), P0(P), + m(C.rows()), n(A.rows()), dt(dt), initialized(false), + I(n, n), x_hat(n), x_hat_new(n) +{ + I.setIdentity(); +} + +KalmanFilter::KalmanFilter() + : m(0), + n(0), + t0(0.0), + t(0.0), + dt(0.0), + initialized(false) +{ +} + +void KalmanFilter::init(double t0, const Eigen::VectorXd& x0) { + x_hat = x0; + P = P0; + this->t0 = t0; + t = t0; + initialized = true; +} + +void KalmanFilter::init() { + x_hat.setZero(); + P = P0; + t0 = 0; + t = t0; + initialized = true; +} + +void KalmanFilter::update(const Eigen::VectorXd& y) { + + if(!initialized) + throw std::runtime_error("Filter is not initialized!"); + + if (y.size() != m) + throw std::runtime_error("KalmanFilter::update(): measurement vector has wrong size"); + + if (A.rows() != n || A.cols() != n || C.rows() != m || C.cols() != n || + Q.rows() != n || Q.cols() != n || R.rows() != m || R.cols() != m || + P.rows() != n || P.cols() != n) + throw std::runtime_error("KalmanFilter::update(): matrix dimensions are inconsistent"); + + x_hat_new = A * x_hat; + P = A*P*A.transpose() + Q; + + const Eigen::MatrixXd S = C * P * C.transpose() + R; + Eigen::LDLT ldlt(S); + if (ldlt.info() != Eigen::Success) + throw std::runtime_error("KalmanFilter::update(): failed to decompose innovation covariance"); + + // K = P*C' * inv(S) -> solve(S * X = (P*C')^T) + const Eigen::MatrixXd PCt = P * C.transpose(); + const Eigen::MatrixXd KT = ldlt.solve(PCt.transpose()); + if (ldlt.info() != Eigen::Success) + throw std::runtime_error("KalmanFilter::update(): failed to solve for Kalman gain"); + K = KT.transpose(); + + x_hat_new += K * (y - C*x_hat_new); + + // Joseph form: keeps P symmetric / PSD under numeric errors + const Eigen::MatrixXd IKC = I - K * C; + P = IKC * P * IKC.transpose() + K * R * K.transpose(); + x_hat = x_hat_new; + + t += dt; +} + +void KalmanFilter::update(const Eigen::VectorXd& y, double dt, const Eigen::MatrixXd A) { + + this->A = A; + this->dt = dt; + update(y); +} diff --git a/src/Algorithms/Libraries/mkt_algorithm/CMakeLists.txt b/src/Algorithms/Libraries/mkt_algorithm/CMakeLists.txt new file mode 100644 index 0000000..1f54a64 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/CMakeLists.txt @@ -0,0 +1,190 @@ +cmake_minimum_required(VERSION 3.0.2) +project(mkt_algorithm VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building mkt_algorithm with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building mkt_algorithm with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS system) +find_package(Eigen3 REQUIRED) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + geometry_msgs + score_algorithm + robot_nav_2d_msgs + robot_nav_2d_utils + kalman + angles + nav_grid + robot_costmap_2d + robot_sensor_msgs + robot_std_msgs + robot_cpp + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + geometry_msgs + score_algorithm + robot_nav_2d_msgs + robot_nav_2d_utils + kalman + angles + nav_grid + robot_costmap_2d + robot_sensor_msgs + robot_std_msgs + robot_cpp + ) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME}_diff + CATKIN_DEPENDS geometry_msgs score_algorithm robot_nav_2d_msgs robot_nav_2d_utils kalman angles nav_grid robot_costmap_2d robot_sensor_msgs robot_std_msgs robot_cpp + DEPENDS Boost Eigen3 + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${EIGEN3_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ) +endif() + +# ======================================================== +# Libraries +# ======================================================== +add_library(${PROJECT_NAME}_diff SHARED + src/diff/diff_predictive_trajectory.cpp + src/diff/diff_rotate_to_goal.cpp + src/diff/diff_go_straight.cpp +) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME}_diff ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_include_directories(${PROJECT_NAME}_diff + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME}_diff + PUBLIC ${catkin_LIBRARIES} + PRIVATE Boost::system Eigen3::Eigen + ) + +else() + + target_include_directories(${PROJECT_NAME}_diff + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME}_diff + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::system Eigen3::Eigen + ) + + set_target_properties(${PROJECT_NAME}_diff PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +# ======================================================== +# Install +# ======================================================== +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME}_diff + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + ## Install plugins.xml if it exists + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml) + install(FILES plugins.xml + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + ) + endif() + +else() + + install(TARGETS ${PROJECT_NAME}_diff + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + ## Install plugins.xml if it exists + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml) + install(FILES plugins.xml + DESTINATION share/${PROJECT_NAME} + ) + endif() + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Libraries: ${PROJECT_NAME}_diff") + message(STATUS "Dependencies: geometry_msgs, score_algorithm, robot_nav_2d_msgs, robot_nav_2d_utils, kalman, angles, nav_grid, robot_costmap_2d, robot_sensor_msgs, robot_std_msgs, robot_cpp, Boost, Eigen3") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Libraries/mkt_algorithm/README.md b/src/Algorithms/Libraries/mkt_algorithm/README.md new file mode 100644 index 0000000..e69de29 diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/bicycle.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/bicycle.h new file mode 100644 index 0000000..260a595 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/bicycle.h @@ -0,0 +1,108 @@ +#ifndef _NAV_ALGORITHM_BICYCLE_H_INCLUDED__ +#define _NAV_ALGORITHM_BICYCLE_H_INCLUDED__ + +#include +#include +#include +#include +#include +#include + +namespace mkt_algorithm +{ + +/** + * @class Bicycle + * @brief Standard Bicycle-like ScoreAlgorithm +*/ +class Bicycle : public score_algorithm::ScoreAlgorithm +{ +public: + + Bicycle() {}; //: line_generator_(nullptr) {}; + + virtual ~Bicycle() {}; + + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize(const robot::NodeHandle & nh, std::string name, TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) override; + + /** + * @brief Prior to evaluating any trajectories, look at contextual information constant across all trajectories + * + * Subclasses may overwrite. Return false in case there is any error. + * + * @param pose Current pose (costmap frame) + * @param velocity Current velocity + * @param goal The final goal (costmap frame) + * @param global_plan Transformed global plan in costmap frame, possibly cropped to nearby points + */ + virtual bool prepare(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_geometry_msgs::Pose2D& goal, const robot_nav_2d_msgs::Path2D& global_plan, + double& x_direction, double& y_direction, double& theta_direction) override; + + /** + * @brief Reset all data + */ + virtual void reset() override; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + */ + virtual robot_nav_2d_msgs::Twist2DStamped calculator(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D velocity) override; + + +protected: + + unsigned int getGoalIndex(const robot_geometry_msgs::Pose2D &robot_pose, const std::vector &plan, + const double distance, unsigned int start_index, unsigned int last_valid_index) const; + + double journey(const std::vector &plan, const unsigned int start_index, const unsigned int last_valid_index) const; + + + bool getGoalPose(const robot_geometry_msgs::Pose2D &robot_pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_nav_2d_msgs::Path2D &global_plan, robot_geometry_msgs::Pose2D &sub_goal, + double &target_direction); + + bool findSubGoalIndex(const std::vector &plan, std::vector &index_s); + + robot::NodeHandle nh_priv_, nh_; + std::string frame_id_path_; + robot::Publisher reached_intermediate_goals_pub_, current_goal_pub_, closet_robot_goal_pub_; + + std::vector reached_intermediate_goals_; + robot_geometry_msgs::Pose2D rev_sub_goal_, sub_goal_; + robot_geometry_msgs::Pose2D goal_; + robot_nav_2d_msgs::Path2D global_plan_; + + unsigned int start_index_saved_; + unsigned int sub_goal_index_saved_, sub_start_index_saved_; + std::vector start_index_saved_vt_; + int index_samples_; + + double steering_fix_wheel_distance_x_; + double steering_fix_wheel_distance_y_; + double xy_local_goal_tolerance_; + double xy_goal_tolerance_; + double angle_threshold_; + double acc_lim_theta_; + double decel_lim_theta_; + double x_direction_, y_direction_, theta_direction_; + double k_d_reduce_, distance_rg_, k_ld_, ld_min_, ld_max_; + double controller_frequency_param_name_; + + bool follow_step_path_; + bool is_filter_; + boost::shared_ptr kf_; + robot::Publisher cmd_raw_pub_; + robot::Time last_actuator_update_; +}; // class Bicycle + +} // namespace mkt_algorithm + + +#endif //_NAV_ALGORITHM_BICYCLE_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/equation_line.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/equation_line.h new file mode 100644 index 0000000..e201e10 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/equation_line.h @@ -0,0 +1,74 @@ +#ifndef __NAV_ALGORITHM_EQUATION_LINE_H_INCLUDED__ +#define __NAV_ALGORITHM_EQUATION_LINE_H_INCLUDED__ +#include +#include +#include + +namespace mkt_algorithm +{ + +/** + * @class NoSolution + */ +class NoSolution : public std::exception { + public: + const char * what () const throw () { + return "Robot cannot calculate error line!"; + } +}; // class NoSolution + +/** + * @class LineGenerator + */ +class LineGenerator +{ + /* data */ + struct LineEquation { + robot_geometry_msgs::Pose2D Gi; /* 𝑮𝒊(𝒙𝒊,𝒚𝒊) */ + robot_geometry_msgs::Pose2D Gj; /* 𝑮𝒋(𝒙𝒋,𝒚𝒋) */ + float a, b, c ; /* 𝒂𝒙+𝒃𝒚+𝒄=𝟎 */ + }; + + /* Save data present position */ + struct PresentPosition { + float Gxh, Gyh; /* 𝑮𝒋(𝒙h,𝒚h) The head position in Robot */ + float Yaw_degree; /* Angle of Robot (degree) */ + float Yaw_rad; /* Angle of Robot (degree) */ + float error_line; /* 𝒆(𝑮,𝒍𝒊𝒏𝒆)=|𝒂𝒙+𝒃𝒚+𝒄|/sqrt(𝒂^2+𝒃^2) */ + double distance_to_goal; /* The distance from query pose to goal */ + double distance_to_start; /* The distance from query pose to start*/ + double distace_start_goal; + }; +public: + + /** + * @brief To caculated the equation of the line + * @param start_point start point of the line + * @param end_point end point of the line + */ + virtual bool calculatorEquationLine(robot_geometry_msgs::Pose2D start_point, robot_geometry_msgs::Pose2D end_point); + + /** + * @brief Calculating error + * @param[in] Lm The distance from the center of the wheel axis to the center line + * @param[in] pose + * @param[in] rev + */ + virtual void calculateErrorLine(float Lm, robot_geometry_msgs::Pose2D pose, bool rev = false); + + /** + * @brief Calculating tolerance + * @param query_pose The pose to check + * @param goal_pose The pose to check against + */ + virtual double calculateTolerance(const robot_geometry_msgs::Pose2D& query_pose, const robot_geometry_msgs::Pose2D& goal_pose); + + /* Properties */ + LineEquation Leq_; + PresentPosition present_pose_; + +}; // class LineGenerator + +} // namespace mkt_algorithm + +#endif // __NAV_ALGORITHM_EQUATION_LINE_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/go_straight.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/go_straight.h new file mode 100644 index 0000000..0faaa06 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/go_straight.h @@ -0,0 +1,70 @@ +#ifndef _NAV_ALGORITHM_ROTATE_TO_GOAL_H_INCLUDED__ +#define _NAV_ALGORITHM_ROTATE_TO_GOAL_H_INCLUDED__ + +#include +#include +#include +#include + +namespace mkt_algorithm +{ + +/** + * @class GoStraight + * @brief Standard Bicycle-like ScoreAlgorithm +*/ +class GoStraight : public score_algorithm::ScoreAlgorithm +{ +public: + + GoStraight() {}; + + virtual ~GoStraight() {}; + + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize(const robot::NodeHandle & nh, std::string name, TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) override; + + /** + * @brief Prior to evaluating any trajectories, look at contextual information constant across all trajectories + * + * Subclasses may overwrite. Return false in case there is any error. + * + * @param pose Current pose (costmap frame) + * @param velocity Current velocity + * @param goal The final goal (costmap frame) + * @param global_plan Transformed global plan in costmap frame, possibly cropped to nearby points + */ + virtual bool prepare(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_geometry_msgs::Pose2D& goal, const robot_nav_2d_msgs::Path2D& global_plan, + double& x_direction, double& y_direction, double& theta_direction) override; + + /** + * @brief Reset all data + */ + virtual void reset() override; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + */ + virtual robot_nav_2d_msgs::Twist2DStamped calculator(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D velocity) override; + + +protected: + robot::NodeHandle nh_; + robot::NodeHandle nh_kinematics_; + + double steering_fix_wheel_distance_x_; + double steering_fix_wheel_distance_y_; + robot_geometry_msgs::Pose2D goal_; + robot::Time time_last_cmd_; + +}; // class GoStraight + +} // namespace mkt_algorithm + +#endif \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/goal_checker.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/goal_checker.h new file mode 100644 index 0000000..6c24369 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/goal_checker.h @@ -0,0 +1,45 @@ +#ifndef _NAV_ALGORITHM_CHECKER_GOAL_H_INCLUDED__ +#define _NAV_ALGORITHM_CHECKER_GOAL_H_INCLUDED__ + +#include +#include + +namespace mkt_algorithm +{ +class GoalChecker : public score_algorithm::GoalChecker +{ +public: + + /** + * @brief Initialize any parameters from the NodeHandle + * @param nh NodeHandle for grabbing parameters + */ + virtual void initialize(const robot::NodeHandle& nh) override; + + /** + * @brief Reset the state of the goal checker (if any) + */ + virtual void reset() override; + + /** + * @brief Check whether the goal should be considered reached + * @param query_pose The pose to check + * @param goal_pose The pose to check against + * @param velocity The robot's current velocity + * @return True if goal is reached + */ + bool isGoalReached(const robot_geometry_msgs::Pose2D& query_pose, const robot_geometry_msgs::Pose2D& goal_pose, + const std::vector& path, const robot_nav_2d_msgs::Twist2D& velocity) override; + +protected: + + boost::shared_ptr line_generator_; + double yaw_goal_tolerance_; + double xy_goal_tolerance_; + double old_xy_goal_tolerance_; + bool setup_; +}; + +} // namespace mkt_algorithm + +#endif // _NAV_ALGORITHM_CHECKER_GOAL_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/pta.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/pta.h new file mode 100644 index 0000000..62ade0e --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/pta.h @@ -0,0 +1,60 @@ +#ifndef _NAV_ALGORITHM_PTA_H_INCLUDED__ +#define _NAV_ALGORITHM_PTA_H_INCLUDED__ + +#include +#include + +namespace mkt_algorithm +{ + +/** + * @class PTA + * @brief Standard PTA-like ScoreAlgorithm +*/ +class PTA : public score_algorithm::ScoreAlgorithm +{ +public: + + PTA() : line_generator_(nullptr) {}; + + virtual ~PTA() {}; + +// Standard ScoreAlgorithm Interface + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize(const robot::NodeHandle & nh, std::string name, TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) override; + + /** + * @brief Prior to evaluating any trajectories, look at contextual information constant across all trajectories + * + * Subclasses may overwrite. Return false in case there is any error. + * + * @param pose Current pose (costmap frame) + * @param velocity Current velocity + * @param goal The final goal (costmap frame) + * @param global_plan Transformed global plan in costmap frame, possibly cropped to nearby points + */ + virtual bool prepare(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_geometry_msgs::Pose2D& goal, const robot_nav_2d_msgs::Path2D& global_plan, + double& x_direction, double& y_direction, double& theta_direction) override; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + */ + virtual robot_nav_2d_msgs::Twist2DStamped calculator(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D velocity) override; + +protected: + + boost::shared_ptr line_generator_; + double pta_amplitude_max_; // (Default: 0.5 - Range: 0.1 -> 1.0) Cai dat bien do (mot phia - m) cho phep robot di chuyen trong do + +}; // class PTA + +} // namespace mkt_algorithm + + +#endif //_NAV_ALGORITHM_PTA_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/rotate_to_goal.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/rotate_to_goal.h new file mode 100644 index 0000000..413eb08 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/bicycle/rotate_to_goal.h @@ -0,0 +1,74 @@ +#ifndef _NAV_ALGORITHM_ROTATE_TO_GOAL_H_INCLUDED__ +#define _NAV_ALGORITHM_ROTATE_TO_GOAL_H_INCLUDED__ + +#include +#include +#include +#include + +namespace mkt_algorithm +{ + +/** + * @class GoStraight + * @brief Standard Bicycle-like ScoreAlgorithm +*/ +class RotateToGoal : public score_algorithm::ScoreAlgorithm +{ +public: + + RotateToGoal() {}; + + virtual ~RotateToGoal() {}; + + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize(const robot::NodeHandle & nh, std::string name, TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) override; + + /** + * @brief Prior to evaluating any trajectories, look at contextual information constant across all trajectories + * + * Subclasses may overwrite. Return false in case there is any error. + * + * @param pose Current pose (costmap frame) + * @param velocity Current velocity + * @param goal The final goal (costmap frame) + * @param global_plan Transformed global plan in costmap frame, possibly cropped to nearby points + */ + virtual bool prepare(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_geometry_msgs::Pose2D& goal, const robot_nav_2d_msgs::Path2D& global_plan, + double& x_direction, double& y_direction, double& theta_direction) override; + + /** + * @brief Reset all data + */ + virtual void reset() override; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + */ + virtual robot_nav_2d_msgs::Twist2DStamped calculator(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D velocity) override; + + +protected: + robot::NodeHandle nh_; + robot::NodeHandle nh_kinematics_; + robot_geometry_msgs::Pose2D sub_goal_; + + double steering_fix_wheel_distance_x_; + double steering_fix_wheel_distance_y_; + double angle_threshold_; + double current_direction_; + double velocity_rotate_min_, velocity_rotate_max_; + robot_geometry_msgs::Pose2D goal_; + robot::Time time_last_cmd_; + +}; // class RotateToGoal + +} // namespace mkt_algorithm + +#endif \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_go_straight.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_go_straight.h new file mode 100644 index 0000000..88d3dba --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_go_straight.h @@ -0,0 +1,49 @@ +#ifndef _NAV_ALGORITHM_DIFF_ROTATE_TO_GOAL_H_INCLUDED__ +#define _NAV_ALGORITHM_DIFF_ROTATE_TO_GOAL_H_INCLUDED__ + +#include + +namespace mkt_algorithm +{ + + namespace diff + { + /** + * @class GoStraight + * @brief Standard Bicycle-like ScoreAlgorithm + */ + class GoStraight : public mkt_algorithm::diff::PredictiveTrajectory + { + public: + GoStraight(); + + virtual ~GoStraight(); + + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize( + robot::NodeHandle &nh, const std::string &name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, const score_algorithm::TrajectoryGenerator::Ptr &traj) override; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + * @param traj + */ + virtual mkt_msgs::Trajectory2D calculator( + const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Create a new GoStraight instance + * @return A pointer to the new GoStraight instance + */ + static score_algorithm::ScoreAlgorithm::Ptr create(); + + }; // class GoStraight + } // namespace diff + +} // namespace mkt_algorithm + +#endif // _NAV_ALGORITHM_DIFF_ROTATE_TO_GOAL_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_predictive_trajectory.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_predictive_trajectory.h new file mode 100644 index 0000000..76233d8 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_predictive_trajectory.h @@ -0,0 +1,433 @@ +#ifndef _NAV_ALGORITHM_DIFF_PREDICTIVE_TRAJECTORY_H_INCLUDED__ +#define _NAV_ALGORITHM_DIFF_PREDICTIVE_TRAJECTORY_H_INCLUDED__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace mkt_algorithm +{ + namespace diff + { + /** + * @class PredictiveTrajectory + * @brief Standard PredictiveTrajectory-like ScoreAlgorithm + */ + class PredictiveTrajectory : public score_algorithm::ScoreAlgorithm + { + public: + /** + * @brief Constructor + */ + PredictiveTrajectory(); + + /** + * @brief Destructor + */ + virtual ~PredictiveTrajectory(); + + // Standard ScoreAlgorithm Interface + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize( + robot::NodeHandle &nh, const std::string &name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, const score_algorithm::TrajectoryGenerator::Ptr &traj) override; + + /** + * @brief Prior to evaluating any trajectories, look at contextual information constant across all trajectories + * + * Subclasses may overwrite. Return false in case there is any error. + * + * @param pose Current pose (costmap frame) + * @param velocity Current velocity + * @param goal The final goal (costmap frame) + * @param global_plan Transformed global plan in costmap frame, possibly cropped to nearby points + */ + virtual bool prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Pose2DStamped &goal, const robot_nav_2d_msgs::Path2D &global_plan, + double &x_direction, double &y_direction, double &theta_direction) override; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + * @param traj + */ + virtual mkt_msgs::Trajectory2D calculator( + const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Reset all data + */ + virtual void reset() override; + + /** + * @brief Stoping move navigation + */ + virtual void stop() override; + + /** + * @brief resume move navigation after stopped + */ + virtual void resume() override; + + /** + * @brief Create a new PredictiveTrajectory instance + * @return A pointer to the new PredictiveTrajectory instance + */ + static score_algorithm::ScoreAlgorithm::Ptr create(); + + protected: + inline double sign(double x) + { + return x < 0.0 ? -1.0 : 1.0; + } + + /** + * @brief Initialize parameters + */ + virtual void getParams(); + + /** + * @brief Dynamically adjust look ahead distance based on the speed + * @param velocity + * @return look ahead distance + */ + double getLookAheadDistance(const robot_nav_2d_msgs::Twist2D &velocity); + + /** + * @brief Get lookahead point on the global plan + * @param lookahead_dist + * @param global_plan + * @return lookahead point + */ + std::vector::iterator + getLookAheadPoint(const robot_nav_2d_msgs::Twist2D &velocity, const double &lookahead_dist, robot_nav_2d_msgs::Path2D global_plan); + + /** + * @brief Prune global plan + * @param tf + * @param pose + * @param global_plan + * @param dist_behind_robot + * @return true if plan is pruned, false otherwise + */ + bool pruneGlobalPlan(TFListenerPtr tf, const robot_nav_2d_msgs::Pose2DStamped &pose, + robot_nav_2d_msgs::Path2D &global_plan, double dist_behind_robot); + + /** + * @brief Transforms the global plan of the robot from the planner frame to the local frame (modified). + * + * The method replaces transformGlobalPlan as defined in base_local_planner/goal_functions.h + * such that the index of the current goal pose is returned as well as + * the transformation between the global plan and the planning frame. + * @param tf A reference to a tf buffer + * @param global_plan The plan to be transformed + * @param pose The pose of the robot + * @param costmap A reference to the costmap being used so the window size for transforming can be computed + * @param global_frame The frame to transform the plan to + * @param max_plan_length Specify maximum length (cumulative Euclidean distances) of the transformed plan [if <=0: disabled; the length is also bounded by the local costmap size!] + * @param[out] transformed_plan Populated with the transformed plan + * @return \c true if the global plan is transformed, \c false otherwise + */ + bool transformGlobalPlan( + TFListenerPtr tf, const robot_nav_2d_msgs::Path2D &global_plan, const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_costmap_2d::Costmap2DROBOT *costmap, const std::string &robot_base_frame, double max_plan_length, + robot_nav_2d_msgs::Path2D &transformed_plan); + + /** + * @brief Calculate max kappa + * @param path + * @param preview_distance + * @return max kappa + */ + double calculateMaxKappa(const robot_nav_2d_msgs::Path2D &path, const double preview_distance = std::numeric_limits::max()); + + /** + * @brief Adjust speed with Hermite trajectory + * @param velocity + * @param trajectory + * @param v_target + * @param sign_x + * @return speed + */ + double adjustSpeedWithHermiteTrajectory( + const robot_nav_2d_msgs::Twist2D &velocity, const robot_nav_2d_msgs::Path2D &trajectory, double v_target, const double &sign_x + ); + + /** + * @brief Generate Hermite trajectory + * @param path + * @param drive_target + * @param velocity + * @param sign_x + * @param drive_cmd + * @return trajectory + */ + robot_nav_2d_msgs::Path2D generateTrajectory( + const robot_nav_2d_msgs::Path2D &path, const robot_nav_2d_msgs::Twist2D &drive_target, + const robot_nav_2d_msgs::Twist2D &velocity, const double &sign_x, robot_nav_2d_msgs::Twist2D &drive_cmd, const double &dt); + + /** + * @brief Generate trajectory + * @param path + * @param sign_x + * @return trajectory + */ + robot_nav_2d_msgs::Path2D generateParallelPath( + const robot_nav_2d_msgs::Path2D &path, const double &sign_x); + + /** + * @brief Generate Hermite trajectory + * @param path + * @param sign_x + * @return trajectory + */ + robot_nav_2d_msgs::Path2D generateHermiteTrajectory(const robot_nav_2d_msgs::Path2D &path, const double &sign_x); + + /** + * @brief Generate Hermite quadratic trajectory + * @param pose + * @param sign_x + * @return trajectory + */ + robot_nav_2d_msgs::Path2D generateHermiteQuadraticTrajectory(const robot_nav_2d_msgs::Path2D &path, const double &sign_x); + + /** + * @brief Should rotate to path + * @param carrot_pose + * @param velocity + * @param sign_x + * @param angle_to_path + * @return true if should rotate, false otherwise + */ + bool shouldRotateToPath( + const robot_nav_2d_msgs::Path2D &global_plan, const robot_nav_2d_msgs::Pose2DStamped &carrot_pose, robot_nav_2d_msgs::Twist2D velocity, double &angle_to_path, const double &sign_x); + + /** + * @brief Rotate to heading + * @param angle_to_path + * @param velocity The velocity of the robot + * @param cmd_vel The velocity commands to be filled + */ + void rotateToHeading(const double &angle_to_path, const robot_nav_2d_msgs::Twist2D &velocity, robot_nav_2d_msgs::Twist2D &cmd_vel, const double &dt); + + /** + * @brief Check if robot should align to final heading (near goal position) + * @param trajectory The transformed trajectory in robot frame + * @param goal The goal pose with desired final heading + * @param velocity Current velocity + * @param xy_error Output: distance to goal + * @param heading_error Output: angle difference to goal heading + * @return true if should enter final heading alignment phase + */ + bool shouldAlignToFinalHeading( + const robot_nav_2d_msgs::Path2D &trajectory, + const robot_nav_2d_msgs::Pose2DStamped &goal, + const robot_nav_2d_msgs::Twist2D &velocity, + double &xy_error, + double &heading_error, + const double &sign_x); + + /** + * @brief Arc Motion controller for final heading alignment + * Smoothly reduces linear velocity while adjusting angular velocity to reach final heading + * @param xy_error Distance to goal position + * @param heading_error Angle difference to goal heading + * @param velocity Current velocity + * @param sign_x Direction of motion (forward/backward) + * @param dt Time step + * @param cmd_vel Output velocity command + */ + void alignToFinalHeading( + const double &xy_error, + const double &heading_error, + const robot_nav_2d_msgs::Twist2D &velocity, + const double &sign_x, + const double &dt, + robot_nav_2d_msgs::Twist2D &cmd_vel); + + /** + * @brief PID controller + * @param error + * @param integral + * @param last_error + * @param dt + * @param kp + * @param ki + * @param kd + * @param output + */ + void pid(const double &error, double &integral, double &last_error, const double &dt, const double &kp, const double &ki, const double &kd, double &output); + + /** + * @brief the robot is moving acceleration limits + * @param velocity The velocity of the robot + * @param cmd_vel The velocity commands + * @param cmd_vel_result The velocity commands result + * @param dt The time step + */ + void moveWithAccLimits( + const robot_nav_2d_msgs::Twist2D &velocity, const robot_nav_2d_msgs::Twist2D &cmd_vel, robot_nav_2d_msgs::Twist2D &cmd_vel_result, const double &dt); + + /** + * @brief Stop the robot taking into account acceleration limits + * @param pose The pose of the robot in the global frame + * @param velocity The velocity of the robot + * @param cmd_vel The velocity commands to be filled + * @param dt The time step + * @return True if a valid trajectory was found, false otherwise + */ + bool stopWithAccLimits(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity, robot_nav_2d_msgs::Twist2D &cmd_vel, const double &dt); + + /** + * @brief Compute pure pursuit + * @param carrot_pose + * @param drive_target + * @param velocity + * @param trajectory + * @param min_approach_linear_velocity + * @param sign_x + * @param dt + * @param drive_cmd + */ + void computePurePursuit( + const robot_nav_2d_msgs::Pose2DStamped &carrot_pose, + const robot_nav_2d_msgs::Twist2D &drive_target, + const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Path2D &trajectory, + const double &min_approach_linear_velocity, + const double &sign_x, + const double &dt, + robot_nav_2d_msgs::Twist2D &drive_cmd); + + /** + * @brief Apply distance-based speed scaling and acceleration limits + * @param plan The plan to be scaled + * @param velocity Current velocity + * @param drive_cmd Input/output velocity command + * @param sign_x Direction of motion + * @param dt Time step + */ + void applyDistanceSpeedScaling( + const robot_nav_2d_msgs::Path2D &plan, + const robot_nav_2d_msgs::Twist2D &velocity, + robot_nav_2d_msgs::Twist2D &drive_cmd, + const double &sign_x, + const double &dt); + + /** + * @brief Interpolate footprint + * @param pose + * @param footprint + * @param resolution + * @return interpolated footprint + */ + std::vector interpolateFootprint( + const robot_geometry_msgs::Pose2D &pose, const std::vector &footprint, const double &resolution); + + /** + * @brief Cost at pose + * @param x + * @param y + * @return cost + */ + double costAtPose(const double &x, const double &y); + + + bool initialized_; + bool nav_stop_; + robot::NodeHandle nh_, nh_priv_; + std::string frame_id_path_; + std::string robot_base_frame_; + + robot_nav_2d_msgs::Pose2DStamped goal_; + robot_nav_2d_msgs::Path2D global_plan_; + robot_nav_2d_msgs::Path2D compute_plan_; + robot_nav_2d_msgs::Path2D transform_plan_; + robot_nav_2d_msgs::Twist2D prevous_drive_cmd_; + + double x_direction_, y_direction_, theta_direction_; + + // Lookahead + bool use_velocity_scaled_lookahead_dist_; + double lookahead_time_; + double lookahead_dist_; + double min_lookahead_dist_; + double max_lookahead_dist_; + double max_lateral_accel_; + + // journey + double min_journey_squared_{1e9}; + double max_journey_squared_{1e9}; + + // Rotate to heading + bool use_rotate_to_heading_; + double rotate_to_heading_min_angle_; + double min_path_distance_, max_path_distance_; + + // Final heading alignment (Arc Motion) + bool use_final_heading_alignment_; + double final_heading_xy_tolerance_; // Distance threshold to trigger alignment + double final_heading_angle_tolerance_; // Angle threshold to consider heading reached + double final_heading_min_velocity_; // Minimum linear velocity during alignment + double final_heading_kp_angular_; // Proportional gain for angular control + double final_heading_ki_angular_; + double final_heading_kd_angular_; + + double near_goal_heading_integral_; + double near_goal_heading_last_error_; + bool near_goal_heading_was_active_; + + double min_approach_linear_velocity_; + + bool use_cost_regulated_linear_velocity_scaling_; + double inflation_cost_scaling_factor_; + double cost_scaling_dist_, cost_scaling_gain_; + + // Control frequency + double control_duration_; + std::vector footprint_spec_; + + robot::Time last_actuator_update_; + boost::shared_ptr kf_; + int m_, n_; + Eigen::MatrixXd A; + Eigen::MatrixXd C; + Eigen::MatrixXd Q; + Eigen::MatrixXd R; + Eigen::MatrixXd P; + + // Kalman filter tuning (for v and w filtering) + double kf_q_v_; + double kf_q_w_; + double kf_r_v_; + double kf_r_w_; + double kf_p0_; + bool kf_filter_angular_; +#ifdef BUILD_WITH_ROS + ros::Publisher lookahead_point_pub_; +#endif + + }; // class PredictiveTrajectory + + } // namespace diff + +} // namespace mkt_algorithm + +#endif //_NAV_ALGORITHM_DIFF_PREDICTIVE_TRAJECTORY_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_rotate_to_goal.h b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_rotate_to_goal.h new file mode 100644 index 0000000..e888cfc --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/include/mkt_algorithm/diff/diff_rotate_to_goal.h @@ -0,0 +1,68 @@ +#ifndef _NAV_ALGORITHM_ROTATE_TO_GOAL_DIFF_H_INCLUDED__ +#define _NAV_ALGORITHM_ROTATE_TO_GOAL_DIFF_H_INCLUDED__ + +#include + +namespace mkt_algorithm +{ + namespace diff + { + /** + * @class GoStraight + * @brief Standard Bicycle-like ScoreAlgorithm + */ + class RotateToGoal : public mkt_algorithm::diff::PredictiveTrajectory + { + public: + RotateToGoal(); + + virtual ~RotateToGoal(); + + /** + * @brief Initialize parameters as needed + * @param nh NodeHandle to read parameters from + */ + virtual void initialize( + robot::NodeHandle &nh, const std::string &name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, const score_algorithm::TrajectoryGenerator::Ptr &traj) override; + + /** + * @brief Prior to evaluating any trajectories, look at contextual information constant across all trajectories + * + * Subclasses may overwrite. Return false in case there is any error. + * + * @param pose Current pose (costmap frame) + * @param velocity Current velocity + * @param goal The final goal (costmap frame) + * @param global_plan Transformed global plan in costmap frame, possibly cropped to nearby points + */ + virtual bool prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Pose2DStamped &goal, const robot_nav_2d_msgs::Path2D &global_plan, + double &x_direction, double &y_direction, double &theta_direction) override; + + /** + * @brief Reset all data + */ + virtual void reset() override; + + /** + * @brief Calculating algorithm + * @param pose + * @param velocity + * @param traj + */ + virtual mkt_msgs::Trajectory2D calculator( + const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Create a new RotateToGoal instance + * @return A pointer to the new RotateToGoal instance + */ + static score_algorithm::ScoreAlgorithm::Ptr create(); + + }; // class RotateToGoalDiff + + } // namespace diff + +} // namespace mkt_algorithm + +#endif // _NAV_ALGORITHM_ROTATE_TO_GOAL_DIFF_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/package.xml b/src/Algorithms/Libraries/mkt_algorithm/package.xml new file mode 100644 index 0000000..4a9b2bd --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/package.xml @@ -0,0 +1,44 @@ + + mkt_algorithm + 0.7.10 + + mkt_algorithm is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. mkt_algorithm + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/mkt_algorithm + + catkin + geometry_msgs + score_algorithm + robot_nav_2d_msgs + robot_nav_2d_utils + kalman + angles + nav_grid + robot_costmap_2d + robot_sensor_msgs + robot_std_msgs + robot_cpp + + geometry_msgs + score_algorithm + robot_nav_2d_msgs + robot_nav_2d_utils + kalman + angles + nav_grid + robot_costmap_2d + robot_sensor_msgs + robot_std_msgs + robot_cpp + \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycel_go_straight.cpp b/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycel_go_straight.cpp new file mode 100644 index 0000000..c35abf5 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycel_go_straight.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +namespace mkt_algorithm +{ + +void GoStraight::initialize(const robot::NodeHandle & nh, std::string name, TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) +{ + nh_ = robot::NodeHandle(nh, name); + name_ = name; + tf_ = tf; + costmap_robot_ = costmap_robot; + + steering_fix_wheel_distance_x_ = robot_nav_2d_utils::searchAndGetParam(nh_, "steering_fix_wheel_distance_x", 1.1); + steering_fix_wheel_distance_y_ = robot_nav_2d_utils::searchAndGetParam(nh_, "steering_fix_wheel_distance_y", 0.); +} + +void GoStraight::reset() +{ + time_last_cmd_ = robot::Time::now(); +} + +bool GoStraight::prepare( const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_geometry_msgs::Pose2D& goal, const robot_nav_2d_msgs::Path2D& global_plan, + double& x_direction, double& y_direction, double& theta_direction) +{ + goal_ = goal; + + const double rb_direction_x = goal_.x - pose.x; + const double rb_direction_y = goal_.y - pose.y; + const double rb_angle = atan2(rb_direction_y, rb_direction_x); + double rb_dir = cos(rb_angle- pose.theta); + x_direction = y_direction = theta_direction = rb_dir; + + return true; +} + +robot_nav_2d_msgs::Twist2DStamped GoStraight::calculator(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D velocity) +{ + robot_nav_2d_msgs::Twist2DStamped result; + result.header.stamp = robot::Time::now(); + + robot_geometry_msgs::Pose2D steer_to_baselink_pose; + + if(!getPose("steer_link", "base_link", steer_to_baselink_pose)) + return result; + double odom_alpha = steer_to_baselink_pose.theta; + if(fabs(odom_alpha) > 0.03) return result; + + double delta_x = goal_.x - pose.x; + double delta_y = goal_.y - pose.y; + + double d_rg = sqrt(pow(delta_x, 2) + pow(delta_y, 2)); + double d_reduce = std::min(std::max(fabs(velocity.x), 0.6), 0.9); + double v_min = 0.03 * velocity.x / (fabs(velocity.x) + 1e-9); + +// Van toc robot + double vr = d_rg > d_reduce? velocity.x : (velocity.x - v_min)*sin((d_rg / d_reduce) * (M_PI/2)) + v_min; + result.velocity.x = fabs(cos(fabs(0.0 - odom_alpha))) * vr / cos(std::min(M_PI/3, fabs(odom_alpha))); + // ROS_INFO("d_rg %f d_reduce %f V = %f %f", d_rg, d_reduce,velocity.x, vr); + return result; +} + +}; // namespace mkt_algorithm + +PLUGINLIB_EXPORT_CLASS(mkt_algorithm::GoStraight, score_algorithm::ScoreAlgorithm) \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_pure_pursuit.cpp b/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_pure_pursuit.cpp new file mode 100644 index 0000000..39f63c2 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_pure_pursuit.cpp @@ -0,0 +1,641 @@ +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace mkt_algorithm +{ + +void Bicycle::initialize(const robot::NodeHandle& nh, std::string name, TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) +{ + nh_priv_ = robot::NodeHandle(nh, name); + nh_ = robot::NodeHandle("~"); + name_ = name; + tf_ = tf; + costmap_robot_ = costmap_robot; + last_actuator_update_ = robot::Time(0); + + nh_priv_.param("xy_local_goal_tolerance", xy_local_goal_tolerance_, 0.5); + nh_priv_.param("xy_local_goal_tolerance_offset", xy_local_goal_tolerance_offset_, 0.5); + nh_priv_.param("angle_threshold", angle_threshold_, M_PI/8); + nh_priv_.param("index_samples", index_samples_, 0); + nh_priv_.param("filter", is_filter_, false); + + steering_fix_wheel_distance_x_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "steering_fix_wheel_distance_x", 1.1); + steering_fix_wheel_distance_y_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "steering_fix_wheel_distance_y", 0.); + xy_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "xy_goal_tolerance", 0.1); + acc_lim_theta_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "acc_lim_theta", 0.1); + decel_lim_theta_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "decel_lim_theta", 0.1); + controller_frequency_param_name_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "controller_frequency", 10); + if(controller_frequency_param_name_ <= 0.0) + { + ROS_WARN("controller_frequency is not setting lower 0.0 so will set to 1.0"); + controller_frequency_param_name_ = 1.0; + } + + reached_intermediate_goals_pub_ = nh_.advertise("reached_intermediate_goals", 1); + current_goal_pub_ = nh_.advertise("current_goal", 1); + closet_robot_goal_pub_ = nh_.advertise("closet_robot_goal", 1); + cmd_raw_pub_ = nh_.advertise("cmd_raw", 1); + x_direction_ = y_direction_= theta_direction_ = 0; + +// kalman + int n = 3; // Number of states + int m = 1; // Number of measurements + double dt = 1.0/controller_frequency_param_name_; // Time step + // ROS_INFO("controller_frequency_param_name %f", controller_frequency_param_name); + Eigen::MatrixXd A(n, n); // System dynamics matrix + Eigen::MatrixXd C(m, n); // Output matrix + Eigen::MatrixXd Q(n, n); // Process noise covariance + Eigen::MatrixXd R(m, m); // Measurement noise covariance + Eigen::MatrixXd P(n, n); // Estimate error covariance + + // Discrete LTI projectile motion, measuring position only + A << 1, dt, 0, 0, 1, dt, 0, 0, 1; + C << 1, 0, 0; + + // Reasonable covariance matrices + double q = 0.1; + double r = 0.6; + double p = 0.2; + Q << q, q, 0.0, q, q, 0.0, 0.0, 0.0, 0.0; + R << r; + P << p, p, p, p, 10.0, 1, p, 1, 10.0; + + // Construct the filter + kf_ = boost::make_shared(dt,A, C, Q, R, P); + // Best guess of initial states + Eigen::VectorXd x0(n); + x0 << 0.0, 0.0, 0.0; + kf_->init(robot::Time::now().toSec(), x0); +} + +void Bicycle::reset() +{ + reached_intermediate_goals_.clear(); + start_index_saved_vt_.clear(); + start_index_saved_ = 0; + sub_goal_index_saved_ = 0; + sub_start_index_saved_ = 0; + x_direction_ = y_direction_= theta_direction_ = 0; + follow_step_path_ = false; + last_actuator_update_ = robot::Time(0); +} + +bool Bicycle::prepare( const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_geometry_msgs::Pose2D& goal, const robot_nav_2d_msgs::Path2D& global_plan, + double& x_direction, double& y_direction, double& theta_direction) +{ + nh_priv_.param("xy_local_goal_tolerance", xy_local_goal_tolerance_, 0.5); + nh_priv_.param("xy_local_goal_tolerance_offset", xy_local_goal_tolerance_offset_, 0.5); + nh_priv_.param("angle_threshold", angle_threshold_, M_PI/8); + nh_priv_.param("index_samples", index_samples_, 0); + nh_priv_.param("distance_rg", distance_rg_, 0.1); + nh_priv_.param("k_ld", k_ld_, 1.0); + nh_priv_.param("k_d_reduce", k_d_reduce_, 1.0); + nh_priv_.param("ld_min", ld_min_, 0.2); + nh_priv_.param("ld_max", ld_max_, 1.1); + nh_priv_.param("follow_step_path", follow_step_path_, false); + + // ROS_INFO("%f %f %f %d", xy_local_goal_tolerance_, xy_local_goal_tolerance_offset_, angle_threshold_, index_samples_); + frame_id_path_ = global_plan.header.frame_id; + goal_ = goal; + global_plan_ = global_plan; + double rb_direction; + if(!getGoalPose(pose, velocity,global_plan, sub_goal_, rb_direction)) + { + ROS_ERROR("getGoalPose Failed"); + return false; + } + x_direction_= fabs(rb_direction)/rb_direction; + x_direction = x_direction_; + y_direction = y_direction_ = 0; + theta_direction = theta_direction_; + return true; +} + +robot_nav_2d_msgs::Twist2DStamped Bicycle::calculator(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D velocity) +{ + robot_nav_2d_msgs::Twist2DStamped result; + result.header.stamp = robot::Time::now(); + + robot_geometry_msgs::Pose2D steer_to_baselink_pose; + + if(!getPose("steer_link", "base_link", steer_to_baselink_pose)) + return result; + double actual_phi_steer = steer_to_baselink_pose.theta; + + const double L = sqrt(pow(steering_fix_wheel_distance_x_, 2) + pow(steering_fix_wheel_distance_y_, 2)); + const double delta_x = sub_goal_.x - pose.x; + const double delta_y = sub_goal_.y - pose.y; + const double d_rg = sqrt(pow(delta_x, 2) + pow(delta_y, 2)); + +// Van toc robot + double d_reduce = std::min(std::max(fabs(velocity.x) * k_d_reduce_, 0.6), 3.0); + double v_min = 0.05 * velocity.x / (fabs(velocity.x) + 1e-9); + double vr = d_rg > d_reduce? velocity.x : (velocity.x - v_min)*sin((d_rg / d_reduce) * (M_PI/2)) + v_min; + +// Góc lái của bánh lái là: α(t) + double alpha = atan2(delta_y,delta_x) - pose.theta; + double ld = std::min(std::max(fabs(velocity.x)*k_ld_, ld_min_), ld_max_); + // double ld = std::min(std::max(d_rg*k_ld_, ld_min_), ld_max_); + + double phi_steer = atan2(2 * L * sin(alpha), ld); + if(d_rg <= distance_rg_ && global_plan_.poses.size() > 1) + { + const double d_x = goal_.x - sub_goal_.x; + const double d_y = goal_.y - sub_goal_.y; + const double dd = sqrt(d_x * d_x + d_y * d_y); + const double d_theta = goal_.theta - sub_goal_.theta; + if(dd < 1e-5) + { + robot_geometry_msgs::Pose2D p = global_plan_.poses[global_plan_.poses.size() - 2]; + alpha = velocity.x / (fabs(velocity.x) + 1e-9)*(p.theta - pose.theta); + phi_steer = atan2(2 * L * sin(alpha), 1.0); + } + } + + double alpha_reduce = std::min(std::max(fabs(vr), 0.6), 1.0); + double cos_actual_phi_steer = cos( std::min(M_PI/2.3, fabs(actual_phi_steer))); + + // limit W + double result_W_max = 0.25; + // double result_W_min = 0.13; + double result_W = vr * fabs(cos(alpha)) * tan(actual_phi_steer) / L; + double V_s = std::max(alpha_reduce, fabs(cos(alpha))) * vr / cos_actual_phi_steer; + std::stringstream ss; + if(fabs(result_W) > 0.02) + { + double d_w = fabs(result_W) - fabs(velocity.theta); + double a = fabs(velocity.theta) > fabs(result_W) ? fabs(acc_lim_theta_/controller_frequency_param_name_) : fabs(decel_lim_theta_/controller_frequency_param_name_); + // ss << d_w << " " << a << " "; + double result; + if(fabs(d_w) >= a) + result = fabs(velocity.theta) + d_w / fabs(d_w + 1e-9) * a; + else if (fabs(d_w) < fabs(a)) + result = fabs(velocity.theta); + // ss << result_W << " " << velocity.theta << " "; + result_W = result_W / (fabs(result_W) + 1e-9) * result; + // ss << result_W << " "; + // ROS_INFO_STREAM(ss.str()); + + double d_v = fabs(result_W * L / tan(actual_phi_steer)) - fabs(vr); + if(fabs(d_v) >= a) + result = velocity.x / (fabs(velocity.x) + 1e-9)* (fabs(vr) + d_v / fabs(d_v + 1e-9) * a); + else if (fabs(d_v) < fabs(a)) + result = velocity.x / (fabs(velocity.x) + 1e-9) * fabs(vr); + + V_s = std::max(alpha_reduce, fabs(cos(alpha)))*result/ cos_actual_phi_steer; + } + + if(fabs(result_W) > result_W_max) + V_s = ( result_W / (fabs(result_W) + 1e-9) * result_W_max * L / tan(actual_phi_steer)) / cos_actual_phi_steer; + + if(is_filter_) + { + robot_geometry_msgs::Twist msg; + msg.linear.x = result.velocity.x; + msg.angular.z = phi_steer; + cmd_raw_pub_.publish(msg); + + Eigen::VectorXd y(1); + y << phi_steer; + robot::Time current_time = robot::Time::now(); + double dt = robot::Duration(current_time - last_actuator_update_).toSec(); + last_actuator_update_ = current_time; + Eigen::MatrixXd A(3, 3); // System dynamics matrix + A << 1, dt, 0, 0, 1, dt, 0, 0, 1; + kf_->update(y, dt, A); + phi_steer = kf_->state().transpose()[0]; + } + theta_direction_ = phi_steer !=0 ? phi_steer/(fabs(phi_steer) + 1e-9) * velocity.x/((fabs(velocity.x) + 1e-9)) : 0; + + result.velocity.theta = phi_steer; + result.velocity.x = fabs(cos(phi_steer - actual_phi_steer)) * V_s; + return result; +} + +unsigned int Bicycle::getGoalIndex(const robot_geometry_msgs::Pose2D &robot_pose, const std::vector &plan, + const double distance, unsigned int start_index, unsigned int last_valid_index) const +{ + if (start_index >= last_valid_index) + return last_valid_index; + + unsigned int goal_index = start_index; + const double start_direction_x = plan[start_index + 1].x - plan[start_index].x; + const double start_direction_y = plan[start_index + 1].y - plan[start_index].y; + if (fabs(start_direction_x) > 1e-9 || fabs(start_direction_y) > 1e-9) { // make sure that atan2 is defined + double start_angle = atan2(start_direction_y, start_direction_x); + double S = sqrt(pow(start_direction_x, 2) + pow(start_direction_y, 2)); + // double angle_threshold = 0.0; + for (unsigned int i = start_index + 1; i <= last_valid_index; ++i) + { + const double current_direction_x = plan[i].x - plan[i - 1].x; + const double current_direction_y = plan[i].y - plan[i - 1].y; + const double dd = sqrt(pow(current_direction_x, 2) + pow(current_direction_y, 2)); + S += dd; + if (fabs(current_direction_x) > 1e-9 || fabs(current_direction_y) > 1e-9) + { + double current_angle = atan2(current_direction_y, current_direction_x); + if(fabs(remainder(start_angle - current_angle, 2 * M_PI)) >= angle_threshold_ || S >= distance) + { + break; + } + goal_index = i; + } + } + } + return goal_index; +} + +bool Bicycle::getGoalPose(const robot_geometry_msgs::Pose2D &robot_pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_nav_2d_msgs::Path2D &global_plan, robot_geometry_msgs::Pose2D &sub_goal, + double &target_direction) +{ + const robot_nav_core2::Costmap &costmap = *costmap_; + const nav_grid::NavGridInfo &info = costmap.getInfo(); + + if (global_plan.poses.empty()) + { + ROS_ERROR_NAMED("PathProgressCritic", "The global plan was empty."); + return false; + } + // Chuyển đổi dữ liệu kế hoạch đường đi 'robot_nav_2d_msgs::Path2D' sang 'std::vector' + std::vector plan = global_plan.poses; + + std::vector index_s; + if(!findSubGoalIndex(plan, index_s)) + { + ROS_ERROR_NAMED("PathProgressCritic", "Can not find SubGoal Index"); + return false; + } + // else + // { + // std::stringstream ss; + // for(auto i : index_s) ss << i << " "; + // ROS_INFO_STREAM(ss.str()); + // } + + unsigned int sub_goal_index = sub_goal_index_saved_; + unsigned int sub_start_index = sub_start_index_saved_; + if(index_s.empty() || index_s.size() < 1) + { + sub_goal_index = (unsigned int)plan.size(); + sub_goal_index_saved_ = sub_goal_index; + } + else + { + if(index_s.front() > sub_goal_index_saved_) + { + sub_goal_index = (unsigned int)(index_s.front()) + 1; + sub_goal_index_saved_ = sub_goal_index; + } + if(index_s.size() > 1) + { + for(int i = 1; i < index_s.size(); ++i) + { + // double tolerance = line_generator->calculateTolerance(robot_pose, plan[index_s[i-1]]); + double distance = fabs(robot_nav_2d_utils::poseDistance(robot_pose, plan[index_s[i-1]])); + // double dx = plan[index_s[i-1]].x - robot_pose.x; + // double dy = plan[index_s[i-1]].y - robot_pose.y; + // if(std::abs(std::sqrt(dx * dx + dy * dy)) <= xy_goal_tolerance_ + 0.15) + if (distance < xy_local_goal_tolerance_offset_) + { + if(index_s[i] > sub_goal_index_saved_) + { + if(i < index_s.size()-1) + { + sub_goal_index = index_s[i] + 1; + } + else + { + sub_goal_index = (unsigned int)plan.size(); + } + if(follow_step_path_) + { + sub_start_index = index_s[i-1]; + sub_start_index_saved_ = sub_start_index; + } + ROS_INFO("Tang nac path tu %d den %d boi khoang cach", sub_goal_index_saved_, sub_goal_index); + // ROS_WARN("i %d follow_step_path_ = %x start = %d sub_goal = %d size = %d", i, follow_step_path_, sub_start_index, sub_goal_index, (unsigned int)plan.size()); + sub_goal_index_saved_ = sub_goal_index; + break; + } + } + } + } + else + { + double distance = fabs(robot_nav_2d_utils::poseDistance(plan[sub_goal_index], robot_pose)); + if(distance <= xy_local_goal_tolerance_ ) + { + sub_goal_index = (unsigned int)plan.size(); + sub_goal_index_saved_ = sub_goal_index; + } + } + + } + + // find the "start pose", i.e. the pose on the plan closest to the robot that is also on the local map + // Tìm điểm pose bắt đầu trên kế hoạch đường đi gần nhất với robot đồng thời có tồn tại trong local map + unsigned int start_index = 0; // số vị trí pose trong kế hoạch đường đi + double distance_to_start = std::numeric_limits::infinity(); // Xét giá trị là vô cùng oo + bool started_path = false; + // for (unsigned int i = 0; i < plan.size(); i++) + // ROS_INFO_THROTTLE(1.0, "follow_step_path_ = %x start = %d sub_goal = %d size = %d", follow_step_path_, sub_start_index, sub_goal_index, (unsigned int)plan.size()); + for (unsigned int i = sub_start_index; i < sub_goal_index; i++) + { + + // double g_x = plan[i].x; + // double g_y = plan[i].y; + // unsigned int map_x, map_y; + // if (worldToGridBounded(info, g_x, g_y, map_x, map_y) // chuyển tọa độ từ đơn vị mét sang pixel + // && costmap(map_x, map_y) != robot_nav_core2::Costmap::NO_INFORMATION) + // { + // Still on the costmap. Continue. + double distance = fabs(robot_nav_2d_utils::poseDistance(plan[i], robot_pose)); // Tính khoảng cách từ vị trí của robot đến pose đang xét + if (distance_to_start > distance) + { + start_index = i; + distance_to_start = distance; + started_path = true; + } + // else + // { + // break; + // } + // else if (started_path) + // { + // // Plan is going away from the robot again. It's possible that it comes back and we would find a pose that's + // // even closer to the robot, but then we would skip over parts of the plan. + // break; + // } + // else, we have not yet found a point on the costmap, so we just continue + } + // Nếu khồng tìm được điểm gần với robot nhất thì trả về false + if (!started_path) + { + ROS_ERROR_NAMED("PathProgressCritic", "None of the points of the global plan were in the local costmap."); + return false; + } + + // find the "last valid pose", i.e. the last pose on the plan after the start pose that is still on the local map + // Tìm điểm pose cuôi cùng sau điểm pose bắt đầu và có tồn tại trong local map + if(start_index < 1) start_index == 1; + // unsigned int last_valid_index = plan.size() - 1; + unsigned int last_valid_index = sub_goal_index - 1; + // for (unsigned int i = start_index + 1; i < sub_goal_index; i++) + // { + // double g_x = plan[i].x; + // double g_y = plan[i].y; + // unsigned int map_x, map_y; + // if (worldToGridBounded(info, g_x, g_y, map_x, map_y) && costmap(map_x, map_y) != robot_nav_core2::Costmap::NO_INFORMATION) + // { + // // Still on the costmap. Continue. + // last_valid_index = i; + // } + // else + // { + // // Off the costmap after being on the costmap. + // break; + // } + // } + + // find the "goal pose" by walking along the plan as long as each step leads far enough away from the starting point, + // i.e. is within angle_threshold_ of the starting direction. + // Tìm điểm mục tiêu chạy từ điểm start pose đến last valid pose dọc thep plan + + unsigned int goal_index = start_index; + robot::Rate r(30); + while (goal_index < last_valid_index && robot::ok()) + { + // Tìm kiếm vị trí điểm mục tiêu phù hợp + double S; + if(velocity.x > 0) S = std::min(4.0, std::max(0.9, fabs(velocity.x)*k_d_reduce_)); + // else if(velocity.x < 0) S = 0.5; + else if(velocity.x < 0) S = std::min(0.7, std::max(0.5, fabs(velocity.x)*k_d_reduce_)); + else S = 0.5; + goal_index = getGoalIndex(robot_pose, plan, S, start_index, last_valid_index); + + // check if goal already reached + bool goal_already_reached = false; + + robot_geometry_msgs::PoseArray poseArrayMsg; + poseArrayMsg.header.stamp = robot::Time::now(); + poseArrayMsg.header.frame_id = frame_id_path_; + // std::stringstream ss; + for (auto &reached_intermediate_goal : reached_intermediate_goals_) + { + double distance = fabs(robot_nav_2d_utils::poseDistance(reached_intermediate_goal, plan[goal_index])); + // ss << distance << " "; + robot_geometry_msgs::Pose pose = robot_nav_2d_utils::pose2DToPose(reached_intermediate_goal); + poseArrayMsg.poses.push_back(pose); + } + reached_intermediate_goals_pub_.publish(poseArrayMsg); + // if(!reached_intermediate_goals_.empty()) + // { + // ROS_INFO_STREAM(ss.str()); + // } + + for (auto &reached_intermediate_goal : reached_intermediate_goals_) + { + double distance = fabs(robot_nav_2d_utils::poseDistance(reached_intermediate_goal, plan[goal_index])); + if (distance < xy_local_goal_tolerance_) + { + goal_already_reached = true; + // choose a new start_index by walking along the plan until we're outside xy_local_goal_tolerance_ and try again + // (start_index is now > goal_index) + for (start_index = goal_index; start_index <= last_valid_index; ++start_index) + { + distance = robot_nav_2d_utils::poseDistance(reached_intermediate_goal, plan[start_index]); + if ( distance >= xy_local_goal_tolerance_offset_) + { + break; + } + } + // start_index_saved_ = start_index; + break; + } + } + + //try hiep + unsigned num = 0; + start_index_saved_vt_.insert(start_index_saved_vt_.begin(),start_index); + if(start_index_saved_vt_.size() > index_samples_) start_index_saved_vt_.pop_back(); + std::stringstream ss; + for(int i = 0; i < start_index_saved_vt_.size() - 1; i++) + { + double edge = 0; + if(start_index_saved_vt_[i] != start_index_saved_vt_[i+1]) + edge = journey(plan, start_index_saved_vt_[i], start_index_saved_vt_[i+1]); + if(edge < xy_local_goal_tolerance_) num++; + ss << start_index_saved_vt_[i] << " "; + } + // ss << start_index << " "; + + if(num < index_samples_ - 1 && !start_index_saved_vt_.empty()) + { + auto max_iter = *(std::max_element(start_index_saved_vt_.begin(), start_index_saved_vt_.end())); + start_index_saved_ = start_index_saved_ >= max_iter? start_index_saved_ : max_iter; + double S1 = journey(plan, start_index, plan.size()-1 ); + double S2 = journey(plan, start_index_saved_, plan.size()-1 ); + + // ROS_INFO_STREAM(ss.str()); + if(S2 - S1 < -fabs(xy_local_goal_tolerance_)) + { + start_index = start_index_saved_; + } + else start_index_saved_ = start_index; + // ROS_INFO(" %d %d %f %d %f %f", max_iter, start_index, S1, start_index_saved_, S2, S2 - S1); + } + else start_index_saved_ = start_index; + + if(start_index >= goal_index) goal_index = getGoalIndex(robot_pose, plan, S,start_index, last_valid_index); + + if (!goal_already_reached) + { + // new goal not in reached_intermediate_goals_ + double distance = fabs(robot_nav_2d_utils::poseDistance(plan[goal_index], plan[start_index])); + if (distance < xy_local_goal_tolerance_) + { + // ROS_INFO("goal_index %d distance %f", goal_index, distance); + // the robot has currently reached the goal + reached_intermediate_goals_.push_back(plan[goal_index]); + ROS_DEBUG_NAMED("PathProgressCritic", "Number of reached_intermediate goals: %zu", reached_intermediate_goals_.size()); + } + else + { + // we've found a new goal! + break; + } + } + + r.sleep(); + robot::spinOnce(); + } + + if (start_index > goal_index) + start_index = goal_index; + ROS_ASSERT(goal_index <= last_valid_index); + if((unsigned int)plan.size() == 2 && !plan.empty()) + { + start_index = 0; + goal_index = 1; + } + + // Tham chiếu lại đối số đầu vao + sub_goal = plan[goal_index]; + if(goal_index > 0) rev_sub_goal_ = plan[goal_index - 1]; + else rev_sub_goal_ = plan[start_index]; + + target_direction = x_direction_; + if(goal_index > 0 && (unsigned int)plan.size() > 1) + { + if(goal_index < (unsigned int)(plan.size() -1)) + { + const robot_geometry_msgs::Pose2D p1 = plan[start_index]; + int index; + for(index = start_index+1; index < goal_index; index++) + { + robot_geometry_msgs::Pose2D pose = plan[index]; + if(robot_nav_2d_utils::poseDistance(p1, pose) > xy_goal_tolerance_) break; + } + const robot_geometry_msgs::Pose2D p2 = plan[index]; + if(fabs(p2.y - p1.y) > 1e-9 || fabs(p2.x - p1.x) > 1e-9) + { + const double path_angle = atan2(p2.y - p1.y, p2.x - p1.x); + const double dir_path = cos(fabs(path_angle - p2.theta)); + if(fabs(dir_path) > 1e-9) + target_direction = dir_path; + // ROS_INFO("%f %f %f %f", p1.x ,p1.y, p2.x ,p2.y); + // ROS_INFO("%d %0.2f %0.2f %0.2f", goal_index, path_angle, p2.theta, target_direction); + } + } + else + { + const double rb_direction_x = sub_goal.x - robot_pose.x; + const double rb_direction_y = sub_goal.y - robot_pose.y; + const double rb_angle = atan2(rb_direction_y, rb_direction_x); + double dir_rg = cos(rb_angle - robot_pose.theta); + const double angle_threshold = 0.6; + if(fabs(dir_rg) > angle_threshold) + target_direction = dir_rg; + } + } + + // Publish start_index + robot_geometry_msgs::PoseStamped pose_st = robot_nav_2d_utils::pose2DToPoseStamped(plan[start_index], global_plan.header.frame_id, robot::Time::now()); + closet_robot_goal_pub_.publish(pose_st); + + // Publish goal_index + robot_geometry_msgs::PoseStamped pose_g = robot_nav_2d_utils::pose2DToPoseStamped(plan[goal_index], global_plan.header.frame_id, robot::Time::now()); + current_goal_pub_.publish(pose_g); + + return true; +} + +bool Bicycle::findSubGoalIndex(const std::vector &plan, std::vector &index_s) +{ + if (plan.empty()) + { + return false; + } + double x_direction_saved = 0.0; + robot_geometry_msgs::PoseArray poseArrayMsg; + poseArrayMsg.header.stamp = robot::Time::now(); + poseArrayMsg.header.frame_id = frame_id_path_; + + for (unsigned int i = 1; i < (unsigned int)plan.size(); i++) + { + robot_geometry_msgs::Pose2D p1 = plan[i]; + robot_geometry_msgs::Pose2D p2 = plan[i+1]; + // robot_geometry_msgs::Pose2D p3 = plan[i+2]; + double angle1; + if(fabs(p2.y - p1.y) > 1e-9 || fabs(p2.x - p1.x) > 1e-9) + angle1 = atan2(p2.y - p1.y, p2.x - p1.x); + else continue; + // const double angle2 = atan2(p3.y - p2.y, p3.x - p2.x); + const double target_direction = cos(fabs(angle1 - p2.theta)); + + if(target_direction * x_direction_saved < 0.0) + { + index_s.push_back(i); + robot_geometry_msgs::Pose pose = robot_nav_2d_utils::pose2DToPose(plan[i]); + poseArrayMsg.poses.push_back(pose); + } + x_direction_saved = target_direction; + } + + if(index_s.empty()) + index_s.push_back((unsigned int)plan.size() - 1); + else + { + if(index_s.back() < (unsigned int)plan.size() - 1) + index_s.push_back((unsigned int)plan.size() - 1); + } + reached_intermediate_goals_pub_.publish(poseArrayMsg); + return true; +} + +double Bicycle::journey(const std::vector &plan, const unsigned int start_index, const unsigned int last_valid_index) const +{ + double S = 0; + if(last_valid_index - start_index > 1) + { + for(int i= start_index; i < last_valid_index; i++) + { + S += robot_nav_2d_utils::poseDistance(plan[i], plan[i+1]); + } + } + return S; +} + + +} // namespace mkt_algorithm + +PLUGINLIB_EXPORT_CLASS(mkt_algorithm::Bicycle, score_algorithm::ScoreAlgorithm) diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_rotate_to_goal.cpp b/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_rotate_to_goal.cpp new file mode 100644 index 0000000..e9a7980 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/bicycle/bicycle_rotate_to_goal.cpp @@ -0,0 +1,78 @@ +#include +#include +#include +#include + +namespace mkt_algorithm +{ + +void RotateToGoal::initialize(const robot::NodeHandle & nh, std::string name, TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) +{ + nh_ = robot::NodeHandle(nh, name); + name_ = name; + tf_ = tf; + costmap_robot_ = costmap_robot; + + steering_fix_wheel_distance_x_ = robot_nav_2d_utils::searchAndGetParam(nh_, "steering_fix_wheel_distance_x", 1.1); + steering_fix_wheel_distance_y_ = robot_nav_2d_utils::searchAndGetParam(nh_, "steering_fix_wheel_distance_y", 0.); + nh_.param("velocity_rotate_min", velocity_rotate_min_, 0.1); + nh_.param("velocity_rotate_max", velocity_rotate_max_, 0.6); + nh_.param("angle_pass_rotate", angle_threshold_, 0.02); +} + +void RotateToGoal::reset() +{ + time_last_cmd_ = robot::Time::now(); +} + +bool RotateToGoal::prepare( const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D& velocity, + const robot_geometry_msgs::Pose2D& goal, const robot_nav_2d_msgs::Path2D& global_plan, + double& x_direction, double& y_direction, double& theta_direction) +{ + goal_ = goal; + double angle = angles::shortest_angular_distance(pose.theta, goal_.theta); + + if(angle > 0) current_direction_ = 1; + else if(angle < 0) current_direction_ = -1; + x_direction = y_direction = theta_direction = current_direction_; + return true; +} + +robot_nav_2d_msgs::Twist2DStamped RotateToGoal::calculator(const robot_geometry_msgs::Pose2D& pose, const robot_nav_2d_msgs::Twist2D velocity) +{ + robot_nav_2d_msgs::Twist2DStamped result; + result.header.stamp = robot::Time::now(); + + robot_geometry_msgs::Pose2D steer_to_baselink_pose; + + if(!getPose("steer_link", "base_link", steer_to_baselink_pose)) + return result; + double actual_phi_steer = steer_to_baselink_pose.theta; + + double L = sqrt(pow(steering_fix_wheel_distance_x_, 2) + pow(steering_fix_wheel_distance_y_, 2)); + + // robot::Time t = robot::Time::now(); + // double dt = time_last_cmd_.isZero() ? 0.0 : (t - time_last_cmd_).toSec(); + // time_last_cmd_ = robot::Time::now(); + + double angle_rg = angles::shortest_angular_distance(pose.theta, goal_.theta); + double angle_reduce = std::min(std::max(fabs(velocity.theta), 0.15), velocity_rotate_max_); + double w_min = velocity.theta / (fabs(velocity.theta) + 1e-9) * velocity_rotate_min_; + double w_r = fabs(angle_rg) > angle_reduce? velocity.theta : (velocity.theta - w_min)*sin((fabs(angle_rg) / angle_reduce) * (M_PI/2)) + w_min; + + int direct_rotate = (angle_rg/fabs(angle_rg)); + double target_phi_steer = direct_rotate * M_PI/2; + if( fabs(target_phi_steer - actual_phi_steer) <= angle_threshold_) + { + double target_v = fabs(w_r * L); + result.velocity.x = std::min(velocity_rotate_max_ * L, fabs(target_v)); + } + else result.velocity.x = 0.0; + + result.velocity.theta = target_phi_steer; + return result; +} + +}; // namespace mkt_algorithm + +PLUGINLIB_EXPORT_CLASS(mkt_algorithm::RotateToGoal, score_algorithm::ScoreAlgorithm) \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/diff/Hermite.md b/src/Algorithms/Libraries/mkt_algorithm/src/diff/Hermite.md new file mode 100644 index 0000000..9d58754 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/diff/Hermite.md @@ -0,0 +1,126 @@ +## Hermite (quỹ đạo 2D) từ robot đến look-ahead pose + +![Hermite trajectory](hermite_trajectory.svg) + +### Bài toán +Cho pose đích trong hệ tọa độ robot: `goal = (x, y, theta)`, với robot ở gốc +`(0, 0, 0)` (hướng theo trục +x). Cần sinh quỹ đạo từ robot đến pose đích. + +### Ý tưởng +Dùng đường cong Hermite bậc 3 để đảm bảo: +- Đi qua đúng điểm đầu và cuối. +- Đúng hướng đầu và cuối. + +Đường cong tham số `t` từ `0` đến `1`: + +``` +p(t) = (x(t), y(t)) +``` + +Ràng buộc: +- p(0) = (0, 0), hướng 0 rad. +- p(1) = (x, y), hướng theta rad. + +### Hệ số Hermite +``` +h00 = 2t^3 - 3t^2 + 1 +h10 = t^3 - 2t^2 + t +h01 = -2t^3 + 3t^2 +h11 = t^3 - t^2 +``` + +### Đạo hàm đầu/cuối +Chọn độ dài đặc trưng `L` (thường L = sqrt(x^2 + y^2)) và hướng `dir`: +``` +dir = +1 (đi xuôi) +dir = -1 (đi ngược 180° ở cả đầu và cuối) +``` +Khi đó: +``` +p'(0) = (dir * L, 0) +p'(1) = (dir * L*cos(theta), dir * L*sin(theta)) +``` + +### Công thức quỹ đạo +``` +x(t) = h10*(dir*L) + h01*x + h11*(dir*L*cos(theta)) +y(t) = h01*y + h11*(dir*L*sin(theta)) +``` + +### Hướng (heading) trên đường cong +Đạo hàm: +``` +h00' = 6t^2 - 6t +h10' = 3t^2 - 4t + 1 +h01' = -6t^2 + 6t +h11' = 3t^2 - 2t + +dx = h10'*(dir*L) + h01'*x + h11'*(dir*L*cos(theta)) +dy = h01'*y + h11'*(dir*L*sin(theta)) +``` +Hướng: +``` +heading(t) = atan2(dy, dx) +``` + +### Cách sử dụng +Lấy mẫu `t` đều (ví dụ 50-200 điểm) để tạo danh sách điểm quỹ đạo. +Nếu cần độ cong, có thể tính thêm từ đạo hàm bậc 2. + +### Ví dụ code C++ +``` +#include +#include + +struct Pose2D { + double x; + double y; + double theta; +}; + +std::vector generateHermiteTrajectory( + double x, double y, double theta, + int samples = 100) +{ + std::vector path; + path.reserve(samples + 1); + + double L = std::sqrt(x * x + y * y); + if (L < 1e-6) { + path.push_back({0.0, 0.0, 0.0}); + return path; + } + + for (int i = 0; i <= samples; ++i) { + double t = static_cast(i) / samples; + double t2 = t * t; + double t3 = t2 * t; + + double h00 = 2 * t3 - 3 * t2 + 1; + double h10 = t3 - 2 * t2 + t; + double h01 = -2 * t3 + 3 * t2; + double h11 = t3 - t2; + + double px = h10 * L + h01 * x + h11 * (L * std::cos(theta)); + double py = h01 * y + h11 * (L * std::sin(theta)); + + double dh00 = 6 * t2 - 6 * t; + double dh10 = 3 * t2 - 4 * t + 1; + double dh01 = -6 * t2 + 6 * t; + double dh11 = 3 * t2 - 2 * t; + + double dx = dh10 * L + dh01 * x + dh11 * (L * std::cos(theta)); + double dy = dh01 * y + dh11 * (L * std::sin(theta)); + + double heading = std::atan2(dy, dx); + + path.push_back({px, py, heading}); + } + + return path; +} +``` + +### Ghi chú +- Nếu (x, y) rất gần 0 thì quỹ đạo suy biến, chỉ trả về điểm gốc. +- L có thể điều chỉnh lớn hơn để quỹ đạo mềm hơn. \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/diff/Hermite.pdf b/src/Algorithms/Libraries/mkt_algorithm/src/diff/Hermite.pdf new file mode 100644 index 0000000000000000000000000000000000000000..aabf3d7ed25a13ec1b8a642617ea354c1992f5ad GIT binary patch literal 35440 zcmb5WbC4)cmo3`1ZQI?aZQHhOyHDH3Y1_7K+qP}vo$tQ6_x>j4n-}vcqB62FBeVY4 zD_8B@YiE(l3yab+(y>619^PKPLa`Gt5ZD=7LUD7`OPko5Ihzx(aIkUEi&|Jan>f;o zS{pc<2%8w$8Jqk^HzNVZFIIM5UMMGLM-u}ZDEG`GPAhjMm1eIjG1-LY!=+*#=HN_w zNe>Wn3C&!HLkJrhRnj6_G7*B{08o74b%S2Dz+6LwQaGl-n0cRSEd z;F;T5q;>u&6FmW-_&{-y)OmKqN5x_TC$+j_(nmJj*m}kO!AHL)eLO#R?FAQX15VF!Gs_10O;3pKZnL^f5YoeDdF-6ySMS?l54p| zIL=E3PYXrD6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f~dqe$z+>HtRRrGoMuODqkjpP%M030i5iS?6?QN~}e@@r#2JENb0n zSGX_TpLngV#xJD))2^&23F|}yr~_E{GvA+ znL-l9l{5~iy*a2k=YXAz125k~KKBA1-V7)A=I0+yC;r$nY5jp0x8-kM-|?h$VdmBB z6)$&Rci7CoKKrcldTrhKy?I;ze3sIz<(yu(?#w?%@gDIRnDJ3ul2}wyQIwj-Wo&9- NXu+kb>gw;t1pw*mAdvt7 literal 0 HcmV?d00001 diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_go_straight.cpp b/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_go_straight.cpp new file mode 100644 index 0000000..eaf041d --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_go_straight.cpp @@ -0,0 +1,224 @@ +#include +#include +#include + +mkt_algorithm::diff::GoStraight::GoStraight() + : PredictiveTrajectory() +{ +} + +mkt_algorithm::diff::GoStraight::~GoStraight() {} + +void mkt_algorithm::diff::GoStraight::initialize( + robot::NodeHandle &nh, const std::string &name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, const score_algorithm::TrajectoryGenerator::Ptr &traj) +{ + if (!initialized_) + { + nh_ = nh; + nh_priv_ = robot::NodeHandle(nh, name); + name_ = name; + tf_ = tf; + traj_ = traj; + costmap_robot_ = costmap_robot; + nh_.param("min_approach_linear_velocity", min_approach_linear_velocity_, 0.0); + this->getParams(); + + std::vector footprint = costmap_robot_? costmap_robot_->getRobotFootprint() : std::vector(); + if (footprint.size() > 1) + { + double min_length = 1e10; + double max_length = 0.0; + for (size_t i = 0; i < footprint.size(); ++i) + { + const robot_geometry_msgs::Point &p1 = footprint[i]; + const robot_geometry_msgs::Point &p2 = footprint[(i + 1) % footprint.size()]; // wrap around to first point + double len = std::hypot(p2.x - p1.x, p2.y - p1.y) / 2.0; + if (len > max_length) + { + max_length = len; + } + if (len < min_length) + { + min_length = len; + } + } + this->min_path_distance_ = min_length > 0.1 ? min_length : 0.1; + this->max_path_distance_ = max_length > 0.1 ? max_length : 0.1; + } + + // kalman + last_actuator_update_ = robot::Time::now(); + n_ = 6; // [x, vx, ax, y, vy, ay, theta, vtheta, atheta] + m_ = 2; // measurements: x, y, theta + double dt = control_duration_; + + // Khởi tạo ma trận + A = Eigen::MatrixXd::Identity(n_, n_); + C = Eigen::MatrixXd::Zero(m_, n_); + Q = Eigen::MatrixXd::Zero(n_, n_); + R = Eigen::MatrixXd::Identity(m_, m_); + P = Eigen::MatrixXd::Identity(n_, n_); + + for (int i = 0; i < n_; i += 3) + { + A(i, i + 1) = dt; + A(i, i + 2) = 0.5 * dt * dt; + A(i + 1, i + 2) = dt; + } + + C(0, 0) = 1; + C(1, 3) = 1; + Q(2, 2) = 0.1; + Q(5, 5) = 0.6; + + R(0, 0) = 0.1; + R(1, 1) = 0.2; + + P(3, 3) = 0.4; + P(4, 4) = 0.4; + P(5, 5) = 0.4; + + kf_ = boost::make_shared(dt, A, C, Q, R, P); + Eigen::VectorXd x0(n_); + x0 << 0, 0, 0, 0, 0, 0; + kf_->init(robot::Time::now().toSec(), x0); + + x_direction_ = y_direction_ = theta_direction_ = 0; + initialized_ = true; + robot::log_info("GoStraight Initialized successfully"); + } +} + +mkt_msgs::Trajectory2D mkt_algorithm::diff::GoStraight::calculator( + const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + // robot::log_info("x %f y %f theta %f", pose.pose.x, pose.pose.y, pose.pose.theta); + mkt_msgs::Trajectory2D result; + result.velocity.x = result.velocity.y = result.velocity.theta = 0.0; + if (!traj_) + return result; + if (compute_plan_.poses.size() < 2) + { + robot::log_warning("Local compute plan is available"); + return result; + } + + robot::Time current_time = robot::Time::now(); + const double dt = (current_time - last_actuator_update_).toSec(); + last_actuator_update_ = current_time; + + robot_nav_2d_msgs::Twist2D drive_cmd; + double sign_x = x_direction_; + + robot_nav_2d_msgs::Twist2D twist; + traj_->startNewIteration(velocity); // Nhận tốc độ hiện tại từ odom + while (robot::ok() && traj_->hasMoreTwists()) + { + twist = traj_->nextTwist(); + } + double v_max = sign_x > 0 ? traj_->getTwistLinear(true).x : traj_->getTwistLinear(false).x; + drive_cmd.x = std::min(sqrt(twist.x * twist.x), fabs(v_max)); + robot_nav_2d_msgs::Path2D transformed_plan = this->transform_plan_; + if (transformed_plan.poses.empty()) + { + robot::log_warning("[%s:%d]\n Transformed plan is empty. Cannot determine a localglobal_plan.", __FILE__, __LINE__); + stopWithAccLimits(pose, velocity, drive_cmd, dt); + result.velocity = drive_cmd; + prevous_drive_cmd_ = drive_cmd; + return result; + } + double lookahead_dist = getLookAheadDistance(velocity); + auto carrot_pose = *getLookAheadPoint(velocity, lookahead_dist, transformed_plan); + robot_geometry_msgs::PoseStamped carrot_pose_stamped = robot_nav_2d_utils::pose2DToPoseStamped(carrot_pose); + +// // === Final Heading Alignment Check === +// double xy_error = 0.0, heading_error = 0.0; +// if (shouldAlignToFinalHeading(transformed_plan, carrot_pose, velocity, xy_error, heading_error, sign_x)) +// { +// // Use Arc Motion controller for final heading alignment +// alignToFinalHeading(xy_error, heading_error, velocity, sign_x, dt, drive_cmd); +// #ifdef BUILD_WITH_ROS +// ROS_INFO("xy_err=%.3f, heading_err=%.3f deg, v=%.3f, w_current=%.3f, w_target=%.3f", +// xy_error, heading_error * 180.0 / M_PI, drive_cmd.x, velocity.theta, drive_cmd.theta); +// #endif +// } +// else +// { + // robot::log_info_at(__FILE__, __LINE__, "journey : %f lookahead_dist : %f", + // journey(transformed_plan.poses, 0, transformed_plan.poses.size() - 1), lookahead_dist); + if(fabs(carrot_pose.pose.y) > 0.2) + { + lookahead_dist = sqrt(carrot_pose.pose.y *carrot_pose.pose.y + lookahead_dist * lookahead_dist); + } + robot_nav_2d_msgs::Twist2D drive_target; + transformed_plan = this->generateTrajectory(transformed_plan, drive_cmd, velocity, sign_x, drive_target, dt); + carrot_pose = *getLookAheadPoint(velocity, lookahead_dist, transformed_plan); + + // Normal Pure Pursuit + this->computePurePursuit( + carrot_pose, + drive_target, + velocity, + transformed_plan, + min_approach_linear_velocity_, + sign_x, + dt, + drive_cmd); + // } + applyDistanceSpeedScaling(compute_plan_, velocity, drive_cmd, sign_x, dt); + + if (this->nav_stop_) + { + if (!stopped(velocity, rot_stopped_velocity_, trans_stopped_velocity_)) + { + if (!stopWithAccLimits(pose, velocity, drive_cmd, dt)) + return result; + } + else + drive_cmd = {}; + result.velocity = drive_cmd; + return result; + } + + Eigen::VectorXd y(2); + y << drive_cmd.x, drive_cmd.theta; + + // Cập nhật lại A nếu dt thay đổi + for (int i = 0; i < n_; ++i) + for (int j = 0; j < n_; ++j) + A(i, j) = (i == j ? 1.0 : 0.0); + for (int i = 0; i < n_; i += 3) + { + A(i, i + 1) = dt; + A(i, i + 2) = 0.5 * dt * dt; + A(i + 1, i + 2) = dt; + } + kf_->update(y, dt, A); + double v_min = min_approach_linear_velocity_; + drive_cmd.x = std::clamp(kf_->state()[0], -fabs(v_max), fabs(v_max)); + drive_cmd.x = fabs(drive_cmd.x) >= v_min ? drive_cmd.x : std::copysign(v_min, sign_x); + drive_cmd.theta = std::clamp(kf_->state()[3], -max_vel_theta_, max_vel_theta_); + + + result.poses.clear(); + result.poses.reserve(transformed_plan.poses.size()); + for (const auto &pose_stamped : transformed_plan.poses) + { + result.poses.push_back(pose_stamped.pose); + if(fabs(pose_stamped.pose.x - carrot_pose.pose.x) < 1e-6 && + fabs(pose_stamped.pose.y - carrot_pose.pose.y) < 1e-6 && + fabs(pose_stamped.pose.theta - carrot_pose.pose.theta) < 1e-6) + break; + } + drive_cmd.theta = std::clamp(drive_cmd.theta, -fabs(0.02), fabs(0.02)); + result.velocity = drive_cmd; + prevous_drive_cmd_ = drive_cmd; + return result; +} + +score_algorithm::ScoreAlgorithm::Ptr mkt_algorithm::diff::GoStraight::create() +{ + return std::make_shared(); +} + +BOOST_DLL_ALIAS(mkt_algorithm::diff::GoStraight::create, MKTAlgorithmDiffGoStraight) \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_predictive_trajectory.cpp b/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_predictive_trajectory.cpp new file mode 100644 index 0000000..95d4ba5 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_predictive_trajectory.cpp @@ -0,0 +1,1705 @@ +#include +#include + + +mkt_algorithm::diff::PredictiveTrajectory::PredictiveTrajectory() + : initialized_(false), + nav_stop_(false), + x_direction_(0.0), + y_direction_(0.0), + theta_direction_(0.0), + use_velocity_scaled_lookahead_dist_(false), + lookahead_time_(0.0), + lookahead_dist_(0.0), + min_lookahead_dist_(0.0), + max_lookahead_dist_(0.0), + max_lateral_accel_(0.0), + use_rotate_to_heading_(false), + rotate_to_heading_min_angle_(0.0), + min_path_distance_(0.0), + max_path_distance_(0.0), + use_final_heading_alignment_(false), + final_heading_xy_tolerance_(0.0), + final_heading_angle_tolerance_(0.0), + final_heading_min_velocity_(0.0), + final_heading_kp_angular_(0.0), + final_heading_ki_angular_(0.0), + final_heading_kd_angular_(0.0), + near_goal_heading_integral_(0.0), + near_goal_heading_last_error_(0.0), + near_goal_heading_was_active_(false), + min_approach_linear_velocity_(0.0), + use_cost_regulated_linear_velocity_scaling_(false), + inflation_cost_scaling_factor_(0.0), + cost_scaling_dist_(0.0), + cost_scaling_gain_(0.0), + control_duration_(0.0), + kf_(nullptr), + kf_q_v_(0.25), + kf_q_w_(0.8), + kf_r_v_(0.05), + kf_r_w_(0.08), + kf_p0_(0.5), + kf_filter_angular_(false), + m_(0), + n_(0) +{ +} + +mkt_algorithm::diff::PredictiveTrajectory::~PredictiveTrajectory() {} + +void mkt_algorithm::diff::PredictiveTrajectory::initialize( + robot::NodeHandle &nh, const std::string &name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, const score_algorithm::TrajectoryGenerator::Ptr &traj) +{ + if (!initialized_) + { + nh_ = nh; + nh_priv_ = robot::NodeHandle(nh, name); + robot::log_info_at(__FILE__, __LINE__, "nh_ : %s", nh_.getNamespace().c_str()); + robot::log_info_at(__FILE__, __LINE__, "nh_priv_ : %s", nh_priv_.getNamespace().c_str()); + name_ = name; + tf_ = tf; + traj_ = traj; + costmap_robot_ = costmap_robot; + nh_.param("min_approach_linear_velocity", min_approach_linear_velocity_, 0.0); + this->getParams(); + + std::vector footprint = costmap_robot_ ? costmap_robot_->getRobotFootprint() : std::vector(); + if (footprint.size() > 1) + { + double min_length = 1e10; + double max_length = 0.0; + for (size_t i = 0; i < footprint.size(); ++i) + { + const robot_geometry_msgs::Point &p1 = footprint[i]; + const robot_geometry_msgs::Point &p2 = footprint[(i + 1) % footprint.size()]; // wrap around to first point + double len = std::hypot(p2.x - p1.x, p2.y - p1.y) / 2.0; + if (len > max_length) + { + max_length = len; + } + if (len < min_length) + { + min_length = len; + } + } + this->min_path_distance_ = min_length > 0.1 ? min_length : 0.1; + this->max_path_distance_ = max_length > 0.1 ? max_length : 0.1; + } + + // kalman + last_actuator_update_ = robot::Time::now(); + // State: [v, a, j, w, alpha, jw] where: + // - v: linear velocity, a: linear accel, j: linear jerk + // - w: angular velocity, alpha: angular accel, jw: angular jerk + // Measurement: [v, w] + n_ = 6; + m_ = 2; + double dt = control_duration_; + + // Khởi tạo ma trận + A = Eigen::MatrixXd::Identity(n_, n_); + C = Eigen::MatrixXd::Zero(m_, n_); + Q = Eigen::MatrixXd::Zero(n_, n_); + R = Eigen::MatrixXd::Zero(m_, m_); + P = Eigen::MatrixXd::Identity(n_, n_) * std::max(1e-9, kf_p0_); + + for (int i = 0; i < n_; i += 3) + { + A(i, i + 1) = dt; + A(i, i + 2) = 0.5 * dt * dt; + A(i + 1, i + 2) = dt; + } + + C(0, 0) = 1; + C(1, 3) = 1; + Q(2, 2) = std::max(1e-12, kf_q_v_); + Q(5, 5) = std::max(1e-12, kf_q_w_); + + R(0, 0) = std::max(1e-12, kf_r_v_); + R(1, 1) = std::max(1e-12, kf_r_w_); + + kf_ = boost::make_shared(dt, A, C, Q, R, P); + Eigen::VectorXd x0(n_); + x0 << 0, 0, 0, 0, 0, 0; + kf_->init(robot::Time::now().toSec(), x0); + +#ifdef BUILD_WITH_ROS + ros::NodeHandle nh_ros; + current_goal_pub_ = nh_ros.advertise("current_goal", 10); + closet_robot_goal_pub_ = nh_ros.advertise("closet_robot_goal", 10); + lookahead_point_pub_ = nh_ros.advertise("lookahead_point", 10); +#endif + + x_direction_ = y_direction_ = theta_direction_ = 0; + this->initialized_ = true; + robot::log_info("[%s:%d]\n PredictiveTrajectory Initialized successfully", __FILE__, __LINE__); + } +} + +void mkt_algorithm::diff::PredictiveTrajectory::getParams() +{ + robot_base_frame_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "robot_base_frame", std::string("base_link")); + nh_priv_.param("xy_local_goal_tolerance", xy_local_goal_tolerance_, 0.5); + nh_priv_.param("angle_threshold", angle_threshold_, M_PI / 8); + nh_priv_.param("index_samples", index_samples_, 0); + nh_priv_.param("follow_step_path", follow_step_path_, false); + + nh_priv_.param("use_velocity_scaled_lookahead_dist", use_velocity_scaled_lookahead_dist_, false); + nh_priv_.param("lookahead_dist", lookahead_dist_, 0.25); + nh_priv_.param("min_lookahead_dist", min_lookahead_dist_, 0.3); + nh_priv_.param("max_lookahead_dist", max_lookahead_dist_, 0.9); + nh_priv_.param("lookahead_time", lookahead_time_, 1.5); + nh_priv_.param("min_journey_squared", min_journey_squared_, std::numeric_limits::infinity()); + nh_priv_.param("max_journey_squared", max_journey_squared_, std::numeric_limits::infinity()); + + nh_priv_.param("use_rotate_to_heading", use_rotate_to_heading_, false); + nh_priv_.param("rotate_to_heading_min_angle", rotate_to_heading_min_angle_, 0.785); + + // Final heading alignment (Arc Motion) + nh_priv_.param("use_final_heading_alignment", use_final_heading_alignment_, true); + nh_priv_.param("final_heading_xy_tolerance", final_heading_xy_tolerance_, 0.15); + nh_priv_.param("final_heading_angle_tolerance", final_heading_angle_tolerance_, 0.05); + nh_priv_.param("final_heading_min_velocity", final_heading_min_velocity_, 0.05); + nh_priv_.param("final_heading_kp_angular", final_heading_kp_angular_, 1.5); + nh_priv_.param("final_heading_ki_angular", final_heading_ki_angular_, 0.0); + nh_priv_.param("final_heading_kd_angular", final_heading_kd_angular_, 0.0); + + nh_priv_.param("rot_stopped_velocity", rot_stopped_velocity_, 0.01); + nh_priv_.param("trans_stopped_velocity", trans_stopped_velocity_, 0.01); + if (trans_stopped_velocity_ < 0.02) + trans_stopped_velocity_ = 0.5 * min_approach_linear_velocity_; + if (trans_stopped_velocity_ > min_approach_linear_velocity_) + trans_stopped_velocity_ = min_approach_linear_velocity_ + 0.01; + + // Inflation cost scaling (Limit velocity by proximity to obstacles) + nh_priv_.param("use_cost_regulated_linear_velocity_scaling", use_cost_regulated_linear_velocity_scaling_, true); + nh_priv_.param("inflation_cost_scaling_factor", inflation_cost_scaling_factor_, 3.0); + nh_priv_.param("cost_scaling_dist", cost_scaling_dist_, 0.6); + nh_priv_.param("cost_scaling_gain", cost_scaling_gain_, 1.0); + nh_priv_.param("max_lateral_accel", max_lateral_accel_, 1.0); + if (inflation_cost_scaling_factor_ <= 0.0) + { + robot::log_warning("[%s:%d]\n The value inflation_cost_scaling_factor is incorrectly set, it should be >0. Disabling cost regulated linear velocity scaling.", __FILE__, __LINE__); + use_cost_regulated_linear_velocity_scaling_ = false; + } + + // Kalman filter tuning (filtering v and w commands) + nh_priv_.param("kf_q_v", kf_q_v_, kf_q_v_); + nh_priv_.param("kf_q_w", kf_q_w_, kf_q_w_); + nh_priv_.param("kf_r_v", kf_r_v_, kf_r_v_); + nh_priv_.param("kf_r_w", kf_r_w_, kf_r_w_); + nh_priv_.param("kf_p0", kf_p0_, kf_p0_); + nh_priv_.param("kf_filter_angular", kf_filter_angular_, kf_filter_angular_); + + double control_frequency = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "controller_frequency", 10); + control_duration_ = 1.0 / control_frequency; + + if (traj_) + { + traj_.get()->getNodeHandle().param("max_vel_x", max_vel_x_, 0.0); + traj_.get()->getNodeHandle().param("min_vel_x", min_vel_x_, 0.0); + traj_.get()->getNodeHandle().param("acc_lim_x", acc_lim_x_, 0.0); + traj_.get()->getNodeHandle().param("decel_lim_x", decel_lim_x_, 0.0); + + traj_.get()->getNodeHandle().param("max_vel_y", max_vel_y_, 0.0); + traj_.get()->getNodeHandle().param("min_vel_y", min_vel_y_, 0.0); + traj_.get()->getNodeHandle().param("acc_lim_y", acc_lim_y_, 0.0); + traj_.get()->getNodeHandle().param("decel_lim_y", decel_lim_y_, 0.0); + + traj_.get()->getNodeHandle().param("max_vel_theta", max_vel_theta_, 0.0); + traj_.get()->getNodeHandle().param("min_vel_theta", min_vel_theta_, 0.0); + traj_.get()->getNodeHandle().param("acc_lim_theta", acc_lim_theta_, 0.0); + traj_.get()->getNodeHandle().param("decel_lim_theta", decel_lim_theta_, 0.0); + traj_.get()->getNodeHandle().param("min_speed_xy", min_speed_xy_, 0.0); + if(fabs(min_speed_xy_) > sqrt(max_vel_x_ * max_vel_x_ + max_vel_y_ * max_vel_y_)) + { + min_speed_xy_ = sqrt(max_vel_x_ * max_vel_x_ + max_vel_y_ * max_vel_y_); + } + if(fabs(min_speed_xy_) > sqrt(min_vel_x_ * min_vel_x_ + min_vel_y_ * min_vel_y_)) + { + min_speed_xy_ = sqrt(max_vel_x_ * max_vel_x_ + max_vel_y_ * max_vel_y_); + } + + traj_.get()->getNodeHandle().param("max_speed_xy", max_speed_xy_, 0.0); + } +} + +void mkt_algorithm::diff::PredictiveTrajectory::reset() +{ + if (this->initialized_) + { + robot::log_info("[%s:%d]\n PredictiveTrajectory is reset", __FILE__, __LINE__); + reached_intermediate_goals_.clear(); + start_index_saved_vt_.clear(); + this->clear(); + x_direction_ = y_direction_ = theta_direction_ = 0; + this->follow_step_path_ = false; + this->nav_stop_ = false; + last_actuator_update_ = robot::Time::now(); + prevous_drive_cmd_ = robot_nav_2d_msgs::Twist2D(); + near_goal_heading_integral_ = 0.0; + near_goal_heading_last_error_ = 0.0; + near_goal_heading_was_active_ = false; + + if (kf_) + { + Eigen::VectorXd x0(n_); + x0 << 0, 0, 0, 0, 0, 0; + kf_->init(robot::Time::now().toSec(), x0); + } + } +} + +void mkt_algorithm::diff::PredictiveTrajectory::stop() +{ + this->nav_stop_ = true; +} + +void mkt_algorithm::diff::PredictiveTrajectory::resume() +{ + if (this->initialized_) + { + if(!this->nav_stop_) + return; + prevous_drive_cmd_ = robot_nav_2d_msgs::Twist2D(); + last_actuator_update_ = robot::Time::now(); + + if (kf_) + { + Eigen::VectorXd x0(n_); + x0 << 0, 0, 0, 0, 0, 0; + kf_->init(robot::Time::now().toSec(), x0); + } + this->nav_stop_ = false; + } +} + +bool mkt_algorithm::diff::PredictiveTrajectory::prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Pose2DStamped &goal, const robot_nav_2d_msgs::Path2D &global_plan, + double &x_direction, double &y_direction, double &theta_direction) +{ + if (!initialized_) + { + robot::log_error("[%s:%d]\n This planner has not been initialized, please call initialize() before using this planner", __FILE__, __LINE__); + return false; + } + if(robot::Time::now() - last_actuator_update_ > robot::Duration(0.5)) + { + last_actuator_update_ = robot::Time::now(); + } + + std::vector footprint = costmap_robot_ ? costmap_robot_->getRobotFootprint() : std::vector(); + if (footprint.size() > 1) + { + double min_length = 1e10; + double max_length = 0.0; + for (size_t i = 0; i < footprint.size(); ++i) + { + const robot_geometry_msgs::Point &p1 = footprint[i]; + const robot_geometry_msgs::Point &p2 = footprint[(i + 1) % footprint.size()]; // wrap around to first point + double len = std::hypot(p2.x - p1.x, p2.y - p1.y) / 2.0; + if (len > max_length) + { + max_length = len; + } + if (len < min_length) + { + min_length = len; + } + } + this->min_path_distance_ = min_length > 0.1 ? min_length : 0.1; + this->max_path_distance_ = max_length > 0.1 ? max_length : 0.1; + } + + if (global_plan.poses.empty() || (unsigned int)global_plan.poses.size() < 2) + { + robot::log_error("[%s:%d]\n The Local plan is empty or less than 1 points %d", __FILE__, __LINE__, (unsigned int)global_plan.poses.size()); + return false; + } + this->getParams(); + + frame_id_path_ = global_plan.header.frame_id; + goal_ = goal; + global_plan_ = global_plan; + + // prune global plan to cut off parts of the past (spatially before the robot) + if (!this->pruneGlobalPlan(tf_, pose, global_plan_, 1.0)) + { + robot::log_error("[%s:%d]\n pruneGlobalPlan Failed", __FILE__, __LINE__); + return false; + } + + double S = std::numeric_limits::infinity(); + S = std::max(costmap_robot_->getCostmap()->getSizeInCellsX() * costmap_robot_->getCostmap()->getResolution() / 2.0, + costmap_robot_->getCostmap()->getSizeInCellsY() * costmap_robot_->getCostmap()->getResolution() / 2.0); + const double min_S = min_lookahead_dist_ * 1.5 + max_path_distance_, max_S = max_lookahead_dist_ * 1.5 + max_path_distance_; + S = std::clamp(S * fabs(velocity.x) * lookahead_time_, min_S, max_S); + compute_plan_.poses.clear(); + + if ((unsigned int)global_plan_.poses.size() == 2) + { + double dx = global_plan_.poses.back().pose.x - global_plan_.poses.front().pose.x; + double dy = global_plan_.poses.back().pose.y - global_plan_.poses.front().pose.y; + if (hypot(dx, dy) <= 2.0 * costmap_robot_->getCostmap()->getResolution()) + { + compute_plan_ = global_plan_; + } + else + { + robot::log_error("[%s:%d]\n The Local Plan has 2 points and hypot between more than is %.3f m", __FILE__, __LINE__, costmap_robot_->getCostmap()->getResolution()); + return false; + } + } + else + { + unsigned int start_index, goal_index; + if (!this->computePlanCommand(pose, velocity, S, global_plan_, start_index, goal_index, compute_plan_)) + { + robot::log_error("[%s:%d]\n computePlanCommand is Failed", __FILE__, __LINE__); + return false; + } + } + + double lookahead_dist = this->getLookAheadDistance(velocity); + transform_plan_.poses.clear(); + if (!this->transformGlobalPlan(tf_, compute_plan_, pose, costmap_robot_, robot_base_frame_, lookahead_dist, transform_plan_)) + { + robot::log_warning("[%s:%d]\n Could not transform the global plan to the frame of the controller", __FILE__, __LINE__); + return false; + } + + const auto carrot_pose = *getLookAheadPoint(velocity, lookahead_dist, transform_plan_); + if(fabs(carrot_pose.pose.y) > 0.2) + { + lookahead_dist = sqrt(carrot_pose.pose.y *carrot_pose.pose.y + lookahead_dist * lookahead_dist); + if (!this->transformGlobalPlan(tf_, compute_plan_, pose, costmap_robot_, robot_base_frame_, lookahead_dist, transform_plan_)) + { + robot::log_warning("[%s:%d]\n Could not transform the global plan to the frame of the controller", __FILE__, __LINE__); + return false; + } + } + + x_direction = x_direction_; + y_direction = y_direction_ = 0; + theta_direction = theta_direction_; + + if ((unsigned int)(compute_plan_.poses.size() > 1) && + journey(compute_plan_.poses, 0, compute_plan_.poses.size() - 1) >= costmap_robot_->getCostmap()->getResolution()) + { + const robot_geometry_msgs::Pose2D p2 = compute_plan_.poses.back().pose; + int index; + for (index = (unsigned int)(compute_plan_.poses.size() - 1); index > 0; index--) + { + robot_geometry_msgs::Pose2D pose = compute_plan_.poses[index].pose; + if (robot_nav_2d_utils::poseDistance(p2, pose) > xy_local_goal_tolerance_) + break; + } + const robot_geometry_msgs::Pose2D p1 = compute_plan_.poses[index].pose; + if (fabs(p2.y - p1.y) > 1e-9 || fabs(p2.x - p1.x) > 1e-9) + { + const double path_angle = atan2(p2.y - p1.y, p2.x - p1.x); + const double dir_path = cos(fabs(path_angle - p2.theta)); + if (fabs(dir_path) > M_PI / 6 || x_direction < 1e-9) + x_direction = dir_path > 0 ? FORWARD : BACKWARD; + } + + } + else if(compute_plan_.poses.size() == 1) + { + try + { + // auto carrot_pose_it = getLookAheadPoint(velocity, lookahead_dist, transform_plan_); + // auto prev_carrot_pose_it = transform_plan_.poses.begin(); + // double distance_it = 0; + // for (auto it = carrot_pose_it - 1; it != transform_plan_.poses.begin(); --it) + // { + // double dx = it->pose.x - carrot_pose_it->pose.x; + // double dy = it->pose.y - carrot_pose_it->pose.y; + // distance_it += std::hypot(dx, dy); + // if (distance_it > costmap_robot_->getCostmap()->getResolution()) + // { + // prev_carrot_pose_it = it; + // break; + // } + // } + + // robot_geometry_msgs::Pose front = journey(transform_plan_.poses, 0, transform_plan_.poses.size() - 1) > 5.0 * costmap_robot_->getCostmap()->getResolution() + // ? robot_nav_2d_utils::pose2DToPose((*(prev_carrot_pose_it)).pose) + // : robot_nav_2d_utils::pose2DToPose(robot_geometry_msgs::Pose2D()); + + // robot_geometry_msgs::Pose back = robot_nav_2d_utils::pose2DToPose((*(carrot_pose_it)).pose); + + // teb_local_planner::PoseSE2 start_pose(front); + // teb_local_planner::PoseSE2 goal_pose(back); + // const double dir_path = (goal_pose.position() - start_pose.position()).dot(start_pose.orientationUnitVec()); + + + auto goal_pose = compute_plan_.poses.front().pose; + auto start_pose = pose.pose; + double angle_path = atan2(goal_pose.y - start_pose.y, goal_pose.x - start_pose.x); + double dir_path = cos(fabs(angle_path - goal_pose.theta)); + if (fabs(dir_path) > M_PI / 6 || x_direction < 1e-9) + x_direction = dir_path > 0 ? FORWARD : BACKWARD; + } + catch (std::exception &e) + { + robot::log_warning_throttle(0.2, "[%s:%d]\n getLookAheadPoint throw an exception: %s", __FILE__, __LINE__, e.what()); + x_direction = x_direction_; + } + } + + x_direction_ = x_direction; + y_direction_ = y_direction; + theta_direction_ = theta_direction; + return true; +} + +mkt_msgs::Trajectory2D mkt_algorithm::diff::PredictiveTrajectory::calculator( + const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + mkt_msgs::Trajectory2D result; + result.velocity.x = result.velocity.y = result.velocity.theta = 0.0; + if (!traj_) + return result; + if (compute_plan_.poses.size() < 2) + { + robot::log_warning("[%s:%d]\n Local compute plan is available", __FILE__, __LINE__); + return result; + } + + robot::Time current_time = robot::Time::now(); + const double dt = (current_time - last_actuator_update_).toSec(); + last_actuator_update_ = current_time; + + robot_nav_2d_msgs::Twist2D drive_cmd; + double sign_x = sign(x_direction_); + + robot_nav_2d_msgs::Twist2D twist; + traj_->startNewIteration(velocity); + while (robot::ok() && traj_->hasMoreTwists()) + { + twist = traj_->nextTwist(); + } + double v_max = sign_x > 0 ? traj_->getTwistLinear(true).x : traj_->getTwistLinear(false).x; + drive_cmd.x = std::min(sqrt(twist.x * twist.x), fabs(v_max)); + // drive_cmd.x = sqrt(twist.x * twist.x); + + robot_nav_2d_msgs::Path2D transformed_plan = this->transform_plan_; + if (transformed_plan.poses.empty()) + { + robot::log_warning("[%s:%d]\n Transformed plan is empty. Cannot determine a localglobal_plan.", __FILE__, __LINE__); + stopWithAccLimits(pose, velocity, drive_cmd, dt); + result.velocity = drive_cmd; + prevous_drive_cmd_ = drive_cmd; + return result; + } + double lookahead_dist = getLookAheadDistance(velocity); + auto carrot_pose = *getLookAheadPoint(velocity, lookahead_dist, transformed_plan); + robot_geometry_msgs::PoseStamped carrot_pose_stamped = robot_nav_2d_utils::pose2DToPoseStamped(carrot_pose); + +#ifdef BUILD_WITH_ROS + { + geometry_msgs::PoseStamped lookahead_point; + lookahead_point.header.stamp = ros::Time::now(); + lookahead_point.header.frame_id = carrot_pose_stamped.header.frame_id; + lookahead_point.pose.position.x = carrot_pose_stamped.pose.position.x; + lookahead_point.pose.position.y = carrot_pose_stamped.pose.position.y; + lookahead_point.pose.position.z = carrot_pose_stamped.pose.position.z; + lookahead_point.pose.orientation.x = carrot_pose_stamped.pose.orientation.x; + lookahead_point.pose.orientation.y = carrot_pose_stamped.pose.orientation.y; + lookahead_point.pose.orientation.z = carrot_pose_stamped.pose.orientation.z; + lookahead_point.pose.orientation.w = carrot_pose_stamped.pose.orientation.w; + lookahead_point_pub_.publish(lookahead_point); + } +#endif + + bool allow_rotate = false; + nh_priv_.param("allow_rotate", allow_rotate, false); + + const double distance_allow_rotate = min_journey_squared_; + const double path_distance_to_rotate = journey(transformed_plan.poses, 0, transformed_plan.poses.size() - 1); + allow_rotate |= path_distance_to_rotate >= distance_allow_rotate; + // robot_geometry_msgs::Pose2D back_pose = transformed_plan.poses.back().pose; + // allow_rotate |= fabs(atan2(back_pose.y, back_pose.x) - back_pose.theta) > M_PI / 3.0; + + allow_rotate &= (fabs(transformed_plan.poses.front().pose.y) <= 0.5); + + double angle_to_heading; + if (allow_rotate && shouldRotateToPath(transformed_plan, carrot_pose, velocity, angle_to_heading, sign_x)) + { + if (!stopped(velocity, max_vel_theta_ + rot_stopped_velocity_, trans_stopped_velocity_)) + { + if (!stopWithAccLimits(pose, velocity, drive_cmd, dt)) + return result; + } + else + { + rotateToHeading(angle_to_heading, velocity, drive_cmd, dt); + } + } + else + { +// // === Final Heading Alignment Check === +// double xy_error = 0.0, heading_error = 0.0; +// if (shouldAlignToFinalHeading(transformed_plan, carrot_pose, velocity, xy_error, heading_error, sign_x)) +// { +// // Use Arc Motion controller for final heading alignment +// alignToFinalHeading(xy_error, heading_error, velocity, sign_x, dt, drive_cmd); +// #ifdef BUILD_WITH_ROS +// ROS_INFO("heading_err=%.3f deg, v=%.3f, w_current=%.3f, w_target=%.3f", +// heading_error * 180.0 / M_PI, drive_cmd.x, velocity.theta, drive_cmd.theta); +// #endif +// } +// else +// { + robot_nav_2d_msgs::Twist2D drive_target = drive_cmd; + transformed_plan = this->generateTrajectory(transformed_plan, drive_cmd, velocity, sign_x, drive_target, dt); + carrot_pose = *getLookAheadPoint(velocity, lookahead_dist, transformed_plan); + + // Normal Pure Pursuit + this->computePurePursuit( + carrot_pose, + drive_target, + velocity, + transformed_plan, + min_approach_linear_velocity_, + sign_x, + dt, + drive_cmd); + // } + applyDistanceSpeedScaling(compute_plan_, velocity, drive_cmd, sign_x, dt); + if (this->nav_stop_) + { + if (!stopped(velocity, rot_stopped_velocity_, trans_stopped_velocity_)) + { + if (!stopWithAccLimits(pose, velocity, drive_cmd, dt)) + return result; + } + else + drive_cmd = {}; + result.velocity = drive_cmd; + return result; + } + + } + result.poses.clear(); + result.poses.reserve(transformed_plan.poses.size()); + for (const auto &pose_stamped : transformed_plan.poses) + { + result.poses.push_back(pose_stamped.pose); + if(fabs(pose_stamped.pose.x - carrot_pose.pose.x) < 1e-6 && + fabs(pose_stamped.pose.y - carrot_pose.pose.y) < 1e-6 && + fabs(pose_stamped.pose.theta - carrot_pose.pose.theta) < 1e-6) + break; + } + + if(fabs(v_max == 0.0)) + { + drive_cmd.x = 0.0; + robot::log_warning_throttle(0.2, "[%s:%d]\n v_max is 0.0", __FILE__, __LINE__); + return result; + } + result.velocity = drive_cmd; + prevous_drive_cmd_ = drive_cmd; + return result; +} + +void mkt_algorithm::diff::PredictiveTrajectory::computePurePursuit( + const robot_nav_2d_msgs::Pose2DStamped &carrot_pose, + const robot_nav_2d_msgs::Twist2D &drive_target, + const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Path2D &trajectory, + const double &min_approach_linear_velocity, + const double &sign_x, + const double &dt, + robot_nav_2d_msgs::Twist2D &drive_cmd) +{ + // 1) Curvature from pure pursuit + const double L2 = carrot_pose.pose.x * carrot_pose.pose.x + carrot_pose.pose.y * carrot_pose.pose.y; + const double L2_min = 0.01; // m^2, chỉnh theo nhu cầu (0.02–0.1) + const double L2_safe = std::max(L2, L2_min); + const double L = std::sqrt(L2_safe); + + const double kappa = 2.0 * carrot_pose.pose.y / L2_safe; + + // 3) Adjust speed using Hermite trajectory curvature + remaining distance + double v_target = adjustSpeedWithHermiteTrajectory(velocity, trajectory, drive_target.x, sign_x); + // const double L_min = 0.1; // m, chỉnh theo nhu cầu + // double scale_close = std::clamp(L / L_min, 0.0, 1.0); + // v_target *= scale_close; + const double y_abs = std::fabs(carrot_pose.pose.y); + const double y_soft = 0.1; + if (y_abs > y_soft) + { + double scale = y_soft / y_abs; // y càng lớn => scale càng nhỏ + scale = std::clamp(scale, 0.6, 1.0); // không giảm quá sâu + v_target *= scale; + robot_nav_2d_msgs::Twist2D cmd, result; + cmd.x = v_target; + this->moveWithAccLimits(velocity, cmd, result, dt); + v_target = result.x; + } + + // 4) Maintain minimum approach speed + if (std::fabs(v_target) < min_approach_linear_velocity) + v_target = std::copysign(min_approach_linear_velocity, sign_x); + // 5) Angular speed from curvature + double w_target = v_target * kappa; + if(journey(trajectory.poses, 0, trajectory.poses.size() - 1) <= min_journey_squared_) + { + if (trajectory.poses.size() >= 2) { + const auto& p1 = trajectory.poses[trajectory.poses.size() - 1].pose; + double heading_ref = 0.0; + for(int i = trajectory.poses.size() - 2; i >= 0; i--) + { + const auto& p = trajectory.poses[i].pose; + const auto& dx = p1.x - p.x ; + const auto& dy = p1.y - p.y ; + if(std::hypot(dx, dy) >= costmap_robot_->getCostmap()->getResolution()) + { + if(fabs(dx) < 1e-6 && fabs(dy) < 1e-6) + continue; + heading_ref = std::atan2(dy, dx); + if(sign_x < 0.0) + heading_ref += std::copysign(M_PI, heading_ref) * (-1.0); + break; + } + } + + const double error = heading_ref; + double w_heading = 0.0; + pid(error, + near_goal_heading_integral_, + near_goal_heading_last_error_, + dt, + final_heading_kp_angular_, + final_heading_ki_angular_, + final_heading_kd_angular_, + w_heading); + // Apply acceleration limits + double dw_heading = std::clamp(w_heading - velocity.theta, -acc_lim_theta_ * dt, acc_lim_theta_ * dt); + w_target = velocity.theta + dw_heading; + w_target = std::clamp(w_target, -fabs(drive_target.theta), fabs(drive_target.theta)); + } + else + { + w_target = std::clamp(w_target, -0.001, 0.001); + near_goal_heading_was_active_ = false; + } + } + else + { + near_goal_heading_was_active_ = false; + } + w_target = std::clamp(w_target, -fabs(drive_target.theta), fabs(drive_target.theta)); + + // 6) Apply acceleration limits (linear + angular) + const double dv = std::clamp(v_target - velocity.x, -acc_lim_x_ * dt, acc_lim_x_ * dt); + const double dw = std::clamp(w_target - velocity.theta, -acc_lim_theta_ * dt, acc_lim_theta_ * dt); + + drive_cmd.x = velocity.x + dv; + drive_cmd.theta = velocity.theta + dw; + + Eigen::VectorXd y(2); + y << drive_cmd.x, drive_cmd.theta; + + // Cập nhật lại A nếu dt thay đổi + for (int i = 0; i < n_; ++i) + for (int j = 0; j < n_; ++j) + A(i, j) = (i == j ? 1.0 : 0.0); + for (int i = 0; i < n_; i += 3) + { + A(i, i + 1) = dt; + A(i, i + 2) = 0.5 * dt * dt; + A(i + 1, i + 2) = dt; + } + kf_->update(y, dt, A); + double v_min = min_approach_linear_velocity_; + drive_cmd.x = std::clamp(kf_->state()[0], -fabs(v_target), fabs(v_target)); + drive_cmd.x = fabs(drive_cmd.x) >= v_min ? drive_cmd.x : std::copysign(v_min, sign_x); + if (kf_filter_angular_) + drive_cmd.theta = std::clamp(kf_->state()[3], -fabs(drive_target.theta), fabs(drive_target.theta)); + // robot::log_info("drive_cmd.theta: %f, drive_target.theta: %f", drive_cmd.theta, drive_target.theta); +} + +void mkt_algorithm::diff::PredictiveTrajectory::applyDistanceSpeedScaling( + const robot_nav_2d_msgs::Path2D &plan, + const robot_nav_2d_msgs::Twist2D &velocity, + robot_nav_2d_msgs::Twist2D &drive_cmd, + const double &sign_x, + const double &dt) +{ + double s = plan.poses.empty() + ? min_journey_squared_ + : journey(plan.poses, 0, plan.poses.size() - 1); + double S_th = 0.1 + max_path_distance_ + fabs(velocity.x) * lookahead_time_; + double S_final = std::min(S_th * 0.2, 0.1 + max_path_distance_); + + double max_speed = fabs(drive_cmd.x); + double target_speed = max_speed; + if (s < S_th) + { + double r = std::clamp(s / S_th, 0.0, 1.0); + double cosine_factor = 0.5 * (1.0 + std::cos(M_PI * (1.0 - r))); + target_speed = max_speed * cosine_factor; + } + const double v_limited = sign_x > 0 ? traj_->getTwistLinear(true).x : traj_->getTwistLinear(false).x; + const double v_min = std::min(fabs(v_limited), min_speed_xy_); + double reduce_speed = std::min(max_speed, v_min); + if (s < S_final) + { + double r = std::clamp(s / S_final, 0.0, 1.0); + double cosine_factor = 0.5 * (1.0 + std::cos(M_PI * (1.0 - r))); + reduce_speed = (reduce_speed - min_approach_linear_velocity_) * cosine_factor + min_approach_linear_velocity_; + reduce_speed = std::max(reduce_speed, min_approach_linear_velocity_); + } + target_speed = std::max(target_speed, reduce_speed); + + double v_desired = std::copysign(target_speed, sign_x); + double max_acc_vel = velocity.x + fabs(acc_lim_x_) * dt; + double min_acc_vel = velocity.x - fabs(acc_lim_x_) * dt; + double v_samp = std::clamp(v_desired, min_acc_vel, max_acc_vel); + + double max_speed_to_stop = std::sqrt(2.0 * fabs(decel_lim_x_) * std::max(0.0, s)); + v_samp = std::copysign(std::min(max_speed_to_stop, fabs(v_samp)), sign_x); + if (sign_x > 0.0) + drive_cmd.x = std::clamp(v_samp, min_approach_linear_velocity_, max_speed); + else + drive_cmd.x = std::clamp(v_samp, -max_speed, -min_approach_linear_velocity_); +} + +bool mkt_algorithm::diff::PredictiveTrajectory::shouldRotateToPath( + const robot_nav_2d_msgs::Path2D &global_plan, const robot_nav_2d_msgs::Pose2DStamped &carrot_pose, + robot_nav_2d_msgs::Twist2D velocity, double &angle_to_path, const double &sign_x) +{ + + const bool is_stopped = stopped(velocity, max_vel_theta_ + rot_stopped_velocity_ + 0.01, trans_stopped_velocity_ + 0.01); + // const double straight_threshold = std::max(0.05, 2.0 * (costmap_robot_ ? costmap_robot_->getCostmap()->getResolution() : 0.05)); + // const double max_kappa = calculateMaxKappa(global_plan); + // const bool curvature = max_kappa > straight_threshold; + double path_angle = std::atan2(carrot_pose.pose.y, carrot_pose.pose.x); + if(is_stopped && global_plan.poses.size() >= 4 && + journey(global_plan.poses, 0, global_plan.poses.size() - 1) >= 0.7 * min_lookahead_dist_) + { + const auto& p1 = global_plan.poses[2]; + for(int i = 3; i < global_plan.poses.size(); i++) + { + const auto& p = global_plan.poses[i]; + const auto& dx = p.pose.x - p1.pose.x; + const auto& dy = p.pose.y - p1.pose.y; + if(std::hypot(dx, dy) > costmap_robot_->getCostmap()->getResolution()) + { + if(fabs(dx) < 1e-9 && fabs(dy) < 1e-9) + continue; + path_angle = std::atan2(dy, dx); + break; + } + } + } + + // Whether we should rotate robot to rough path heading + // if(sign_x < 0.0) + // path_angle += std::copysign(M_PI, path_angle) * (-1.0); + // angle_to_path = path_angle; + angle_to_path = sign_x < 0.0 ? angles::normalize_angle(M_PI + path_angle) : path_angle; + double heading_linear = sqrt(velocity.x * velocity.x + velocity.y * velocity.y); + // The difference in the path orientation and the starting robot orientation (radians) to trigger a rotate in place. (default: 0.785) + double heading_rotate = rotate_to_heading_min_angle_; + + heading_rotate = is_stopped + ? rotate_to_heading_min_angle_ + heading_linear + : std::clamp(heading_rotate + heading_linear, angle_threshold_ + rotate_to_heading_min_angle_, M_PI_2); + + // bool result = use_rotate_to_heading_ && + // (is_stopped || sign(angle_to_path) * sign_x < 0 ) && fabs(angle_to_path) > heading_rotate; + + bool result = use_rotate_to_heading_ && fabs(angle_to_path) > heading_rotate; +#ifdef BUILD_WITH_ROS + if (result) + ROS_WARN_THROTTLE(0.1, "angle_to_path: %f, heading_rotate: %f, is_stopped: %x %x, sign_x: %f", angle_to_path, heading_rotate, is_stopped, sign(angle_to_path) * sign_x < 0, sign_x); +#else + if (result) + robot::log_info_throttle(0.1, "angle_to_path: %f, heading_rotate: %f, is_stopped: %x %x, sign_x: %f", angle_to_path, heading_rotate, is_stopped, sign(angle_to_path) * sign_x < 0, sign_x); +#endif + return result; +} + +void mkt_algorithm::diff::PredictiveTrajectory::rotateToHeading( + const double &angle_to_path, const robot_nav_2d_msgs::Twist2D &velocity, robot_nav_2d_msgs::Twist2D &cmd_vel, const double &dt) +{ + const double theta_direction = angle_to_path > 0.0 ? 1.0 : -1.0; + double ang_diff = angle_to_path; + double max_vel_theta = traj_ ? fabs(traj_->getTwistAngular(true).z) : 0.3; + double min_vel_theta = min_vel_theta_; + + double angular_decel_zone = 0.3; // rad - khoảng cách bắt đầu giảm tốc + nh_priv_.param("angular_decel_zone", angular_decel_zone, 0.5); + angular_decel_zone += std::clamp( + fabs(max_vel_theta) + (M_PI_2 - fabs(atan2(min_path_distance_, max_path_distance_))), 0.4, M_PI_2); + double zone_begin = std::max(angular_decel_zone * 0.2, 0.2); + double cosine_begin_factor = 0.5 * (1.0 + cos(M_PI * (1.0 - fabs(ang_diff) / zone_begin))); + + double reduce_vel_theta = std::min(max_vel_theta, 0.25 + min_vel_theta); + reduce_vel_theta = fabs(ang_diff) > zone_begin ? reduce_vel_theta : (reduce_vel_theta - min_vel_theta) * cosine_begin_factor + min_vel_theta_; + + // === ANGULAR DECELERATION ZONE === + double target_angular_speed = max_vel_theta; + if (fabs(ang_diff) < angular_decel_zone) + { + double cosine_factor = 0.5 * (1.0 + cos(M_PI * (1.0 - fabs(ang_diff) / angular_decel_zone))); + double cosine_speed = max_vel_theta * cosine_factor; + + // Choose deceleration profile + target_angular_speed = cosine_speed; // Smoothest option + + // Ensure minimum speed to avoid stalling + target_angular_speed = std::max(target_angular_speed, reduce_vel_theta); + } + // Apply direction + double v_theta_desired = std::copysign(target_angular_speed, ang_diff); + + // === STOPPING CONSTRAINT === + double max_speed_to_stop = sqrt(2.0 * fabs(decel_lim_theta_) * fabs(ang_diff)); + + double v_theta_samp = std::copysign( + std::min(max_speed_to_stop, fabs(v_theta_desired)), ang_diff); + + // === ACCELERATION LIMITS === + double max_acc_vel = fabs(acc_lim_theta_) * dt; + double domega = std::clamp(v_theta_samp - velocity.theta, -max_acc_vel, max_acc_vel); + + // === FINAL LIMITS === + cmd_vel.x = 0.0; + cmd_vel.y = 0.0; + cmd_vel.theta = velocity.theta + domega; + // robot::log_info("cmd_vel.theta: %f, velocity.theta: %f, domega: %f, max_acc_vel: %f, v_theta_samp: %f", cmd_vel.theta, velocity.theta, domega, max_acc_vel, v_theta_samp); +} + +bool mkt_algorithm::diff::PredictiveTrajectory::shouldAlignToFinalHeading( + const robot_nav_2d_msgs::Path2D &trajectory, + const robot_nav_2d_msgs::Pose2DStamped &goal, + const robot_nav_2d_msgs::Twist2D &velocity, + double &xy_error, + double &heading_error, + const double &sign_x) +{ + if (!use_final_heading_alignment_) + return false; + + if (trajectory.poses.empty()) + return false; + + // Calculate distance to goal (last point in trajectory is closest to goal in robot frame) + const auto &last_pose = trajectory.poses.back().pose; + xy_error = std::hypot(last_pose.x, last_pose.y); + + // Transform goal heading to robot frame + // In robot frame, robot heading is 0, so heading_error = goal_heading_in_robot_frame + heading_error = 0.0; + if(trajectory.poses.size() >= 2) + { + const auto& p1 = trajectory.poses[trajectory.poses.size() - 1].pose; + for(int i = trajectory.poses.size() - 2; i >= 0; i--) + { + const auto& p = trajectory.poses[i].pose; + const auto& dx = sign_x < 0.0 ? p1.x - p.x : p.x - p1.x; + const auto& dy = sign_x < 0.0 ? p1.y - p.y : p.y - p1.y; + if(std::hypot(dx, dy) >= costmap_robot_->getCostmap()->getResolution()) + { + heading_error = angles::normalize_angle(std::atan2(dy, dx)); + break; + } + } + } + + // Check if we're close enough to goal position to start final heading alignment + double distance_threshold = final_heading_xy_tolerance_; + + // Dynamic threshold: increase when moving fast to allow smooth transition + double velocity_factor = std::max(0.0, std::fabs(velocity.x) * 0.5); + distance_threshold += velocity_factor; + + bool near_goal = xy_error < distance_threshold; + bool heading_not_reached = std::fabs(heading_error) > final_heading_angle_tolerance_; + + return near_goal && heading_not_reached; +} + +void mkt_algorithm::diff::PredictiveTrajectory::alignToFinalHeading( + const double &xy_error, + const double &heading_error, + const robot_nav_2d_msgs::Twist2D &velocity, + const double &sign_x, + const double &dt, + robot_nav_2d_msgs::Twist2D &cmd_vel) +{ + // ============================================================ + // Arc Motion Controller for Final Heading Alignment + // ============================================================ + // + // Strategy: + // 1. Linear velocity: proportional to xy_error, decreasing as we approach goal + // 2. Angular velocity: proportional to heading_error with feedforward + // 3. Coordinate both to arrive at goal with correct heading + // + // Key insight: For arc motion, the relationship is: + // arc_length = radius * angle + // v = omega * radius + // + // We want to cover xy_error distance while rotating heading_error angle + // So ideal radius = xy_error / |heading_error| (when heading_error != 0) + // ============================================================ + + const double abs_heading_error = std::fabs(heading_error); + const double heading_sign = (heading_error > 0) ? 1.0 : -1.0; + + // --- Linear velocity calculation --- + // Base velocity proportional to distance, with minimum for smooth motion + double v_base = std::sqrt(2.0 * std::fabs(decel_lim_x_) * xy_error); + const double v_limited = sign_x > 0 ? traj_->getTwistLinear(true).x : traj_->getTwistLinear(false).x; + const double v_min = std::min(fabs(v_limited), min_speed_xy_); + v_base = std::max(v_base, final_heading_min_velocity_); + v_base = std::min(v_base, v_min); + + // Scale down when heading error is large (prioritize rotation) + double heading_scale = 1.0; + if (abs_heading_error > 0.1) // ~5.7 degrees + { + // Reduce linear velocity when heading error is significant + heading_scale = std::clamp(0.3 / abs_heading_error, 0.3, 1.0); + } + + double v_target = v_base * heading_scale * sign_x; + + // --- Angular velocity calculation --- + double omega_target = 0.0; + + if (abs_heading_error > final_heading_angle_tolerance_) + { + // Method 1: Proportional control + double omega_p = 0.0; + pid(heading_error, + near_goal_heading_integral_, + near_goal_heading_last_error_, + dt, + final_heading_kp_angular_, + final_heading_ki_angular_, + final_heading_kd_angular_, + omega_p); + + // Method 2: Arc-based feedforward (coordinate linear and angular motion) + double omega_arc = 0.0; + if (xy_error > 0.01 && abs_heading_error > 0.01) + { + // Ideal omega to complete rotation while traveling remaining distance + // omega = v * heading_error / xy_error + omega_arc = std::fabs(v_target - velocity.x) * heading_error / xy_error; + } + + // Blend proportional and arc-based control + // Use more arc-based when far, more proportional when close + double blend_factor = std::clamp(xy_error / final_heading_xy_tolerance_, 0.0, 1.0); + omega_target = blend_factor * omega_arc + (1.0 - blend_factor) * omega_p; + + // Reduce angular speed as heading error approaches zero + double heading_scale = std::clamp( + abs_heading_error / std::max(final_heading_angle_tolerance_, 1e-3), + 0.0, 1.0); + heading_scale = heading_scale * heading_scale; // smoother near zero + omega_target *= heading_scale; + + // Ensure minimum angular velocity for responsiveness + double omega_min = min_vel_theta_; + if (std::fabs(omega_target) < omega_min && + abs_heading_error > final_heading_angle_tolerance_ * 3.0) + { + omega_target = heading_sign * omega_min; + } + } + + // --- Apply acceleration limits --- + // Linear + double v_current = velocity.x; + double dv_max = acc_lim_x_ * dt; + double dv = std::clamp(v_target - v_current, -dv_max, dv_max); + cmd_vel.x = v_current + dv; + + // Angular + double omega_current = velocity.theta; + double domega_max = acc_lim_theta_ * dt; + double domega = std::clamp(omega_target - omega_current, -domega_max, domega_max); + cmd_vel.theta = omega_current + domega; + + // --- Apply velocity limits --- + cmd_vel.x = std::clamp(cmd_vel.x, -v_min, v_min); + cmd_vel.theta = std::clamp(cmd_vel.theta, -max_vel_theta_, max_vel_theta_); + + // --- Safety: ensure we can stop --- + double max_v_to_stop = std::sqrt(2.0 * std::fabs(decel_lim_x_) * xy_error); + if (std::fabs(cmd_vel.x) > max_v_to_stop) + { + cmd_vel.x = std::copysign(max_v_to_stop, cmd_vel.x); + } + + cmd_vel.y = 0.0; + +#ifdef BUILD_WITH_ROS + ROS_DEBUG_THROTTLE(0.2, "[FinalHeading] xy=%.3f, heading=%.3f, v=%.3f, omega=%.3f", + xy_error, heading_error, cmd_vel.x, cmd_vel.theta); +#endif +} + +void mkt_algorithm::diff::PredictiveTrajectory::pid( + const double &error, double &integral, double &last_error, const double &dt, const double &kp, const double &ki, const double &kd, double &output) +{ + if (!near_goal_heading_was_active_) + { + integral = 0.0; + last_error = error; + near_goal_heading_was_active_ = true; + } + const double dt_safe = std::max(dt, 1e-6); + double w_p = kp * error; + integral += error * dt_safe; + const double integral_cap = (std::fabs(ki) > 1e-9)? (2.0 / ki) : 1e6; + integral = std::clamp(integral, -integral_cap, integral_cap); + double w_i = ki * integral; + double w_d = kd * (error - last_error) / dt_safe; + last_error = error; + output = w_p + w_i + w_d; +} + +double mkt_algorithm::diff::PredictiveTrajectory::getLookAheadDistance(const robot_nav_2d_msgs::Twist2D &velocity) +{ + // If using velocity-scaled look ahead distances, find and clamp the dist + // Else, use the static look ahead distance + double lookahead_dist = lookahead_dist_; + if (use_velocity_scaled_lookahead_dist_) + { + lookahead_dist = fabs(velocity.x) * lookahead_time_; + lookahead_dist = std::clamp(lookahead_dist, min_lookahead_dist_, max_lookahead_dist_); + } + return lookahead_dist; +} + +std::vector::iterator +mkt_algorithm::diff::PredictiveTrajectory::getLookAheadPoint(const robot_nav_2d_msgs::Twist2D &velocity, const double &lookahead_dist, robot_nav_2d_msgs::Path2D global_plan) +{ + if (global_plan.poses.empty()) + throw robot_nav_core2::PlannerTFException("The global plan passed to the local planner is empty."); + + if (global_plan.poses.size() < 2) + return std::prev(global_plan.poses.end()); + + unsigned int goal_index = (unsigned)global_plan.poses.size() - 1; + + // Góc đầu và ngưỡng gãy (fixed) + const auto &p0 = global_plan.poses[0].pose; + const auto &p1 = global_plan.poses[1].pose; + double start_angle = atan2(p1.y - p0.y, p1.x - p0.x); + double turn_threshold = M_PI_2 * 0.6; // ~54deg, chỉnh theo nhu cầu + + // Dừng nếu gãy góc + for (unsigned int i = 1; i < global_plan.poses.size(); ++i) + { + const auto &a = global_plan.poses[i - 1].pose; + const auto &b = global_plan.poses[i].pose; + double current_angle = atan2(b.y - a.y, b.x - a.x); + double delta = angles::normalize_angle(current_angle - start_angle); + goal_index = i; + if (fabs(delta) >= turn_threshold) + break; + } + // Chọn điểm lookahead theo khoảng cách + auto goal_pose_it = std::find_if( + global_plan.poses.begin(), global_plan.poses.begin() + goal_index, + [&](const auto &ps) { + return std::hypot(ps.pose.x, ps.pose.y) >= lookahead_dist; + }); + + if (goal_pose_it == global_plan.poses.end()) + goal_pose_it = std::prev(global_plan.poses.end()); + + return goal_pose_it; +} + +bool mkt_algorithm::diff::PredictiveTrajectory::pruneGlobalPlan(TFListenerPtr tf, const robot_nav_2d_msgs::Pose2DStamped &pose, robot_nav_2d_msgs::Path2D &global_plan, double dist_behind_robot) +{ + if (global_plan.poses.empty()) + return false; + if (tf == nullptr) + return false; + try + { + // let's get the pose of the robot in the frame of the plan + robot_nav_2d_msgs::Pose2DStamped robot; + if (!robot_nav_2d_utils::transformPose(tf, global_plan.header.frame_id, pose, robot)) + { + throw robot_nav_core2::PlannerTFException("Unable to transform robot pose into global plan's frame"); + } + + double dist_thresh_sq = dist_behind_robot * dist_behind_robot; + + // iterate plan until a pose close the robot is found + std::vector::iterator it = global_plan.poses.begin(); + std::vector::iterator erase_end = it; + while (it != global_plan.poses.end()) + { + double dx = robot.pose.x - it->pose.x; + double dy = robot.pose.y - it->pose.y; + double dist_sq = dx * dx + dy * dy; + if (dist_sq < dist_thresh_sq) + { + erase_end = it; + break; + } + ++it; + } + if (erase_end == global_plan.poses.end()) + return false; + + if (erase_end != global_plan.poses.begin()) + global_plan.poses.erase(global_plan.poses.begin(), erase_end); + } + catch (const tf3::TransformException &ex) + { + robot::log_debug("[%s:%d]\n Cannot prune path since no transform is available: %s\n", __FILE__, __LINE__, ex.what()); + return false; + } + return true; +} + +double mkt_algorithm::diff::PredictiveTrajectory::calculateMaxKappa(const robot_nav_2d_msgs::Path2D &path, const double preview_distance) +{ + double traveled = 0.0; + double max_kappa = 0.0; + for (size_t i = 1; i + 1 < path.poses.size(); ++i) + { + const auto &p0 = path.poses[i - 1].pose; + const auto &p1 = path.poses[i].pose; + const auto &p2 = path.poses[i + 1].pose; + + const double a = std::hypot(p1.x - p0.x, p1.y - p0.y); + const double b = std::hypot(p2.x - p1.x, p2.y - p1.y); + const double c = std::hypot(p2.x - p0.x, p2.y - p0.y); + traveled += a; + + if (a > 1e-6 && b > 1e-6 && c > 1e-6) + { + const double cross = (p1.x - p0.x) * (p2.y - p0.y) - (p1.y - p0.y) * (p2.x - p0.x); + const double area2 = std::fabs(cross); // 2 * area + const double kappa = 2.0 * area2 / (a * b * c); + max_kappa = std::max(max_kappa, std::fabs(kappa)); + } + + if (traveled >= preview_distance) + break; + } + return max_kappa; +} + +double mkt_algorithm::diff::PredictiveTrajectory::adjustSpeedWithHermiteTrajectory( + const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Path2D &trajectory, + double v_target, + const double &sign_x) +{ + if(trajectory.poses.size() < 2) + return min_approach_linear_velocity_ * sign_x; + + double preview_distance = std::clamp(std::fabs(velocity.x) * lookahead_time_, min_lookahead_dist_, max_lookahead_dist_); + + double max_kappa = calculateMaxKappa(trajectory, preview_distance); + double v_limit = std::fabs(v_target); + double journey_distance = journey(trajectory.poses, 0, trajectory.poses.size() - 1); + + const double v_limited = sign_x > 0 ? traj_->getTwistLinear(true).x : traj_->getTwistLinear(false).x; + const double v_min = std::min(fabs(v_limited), min_speed_xy_); + if (journey_distance < min_journey_squared_) + { + v_limit = std::clamp(sqrt(2.0 * fabs(decel_lim_x_) * journey_distance), min_approach_linear_velocity_, v_min) * sign_x; + } + + if (max_kappa > 1e-6 && max_lateral_accel_ > 1e-6) + { + const double v_curve = std::sqrt(max_lateral_accel_ / max_kappa); + v_limit = std::min(v_limit, v_curve); + } + + if(trajectory.poses.size() > 2 && fabs(trajectory.poses.front().pose.theta) >= angle_threshold_) + v_limit = v_min * sign_x; + + if (fabs(decel_lim_x_) > 1e-6) + { + const double remaining = journey(trajectory.poses, 0, trajectory.poses.size() - 1); + const double v_stop = std::sqrt(2.0 * fabs(decel_lim_x_) * std::max(0.0, remaining)); + v_limit = std::min(v_limit, v_stop); + } + v_limit = std::min(v_limit, fabs(v_target)); + + return std::copysign(v_limit, sign_x); +} + +robot_nav_2d_msgs::Path2D mkt_algorithm::diff::PredictiveTrajectory::generateTrajectory( + const robot_nav_2d_msgs::Path2D &path, + const robot_nav_2d_msgs::Twist2D &drive_target, + const robot_nav_2d_msgs::Twist2D &velocity, + const double &sign_x, + robot_nav_2d_msgs::Twist2D &drive_cmd, + const double &dt) +{ + if (path.poses.empty()) + { + drive_cmd.x = 0.0; + drive_cmd.theta = 0.0; + return robot_nav_2d_msgs::Path2D(); + } + + drive_cmd.x = drive_target.x; + drive_cmd.theta = max_vel_theta_; + double max_kappa = calculateMaxKappa(path); + const double straight_threshold = std::max(0.05, 2.0 * (costmap_robot_ ? costmap_robot_->getCostmap()->getResolution() : 0.05)); + // nếu đường thẳng + if (max_kappa <= straight_threshold) + { + if(fabs(path.poses.back().pose.x) < min_lookahead_dist_ * 0.8) + { + if(fabs(path.poses.back().pose.x) < min_journey_squared_) + drive_cmd.theta = 0.01; + return generateParallelPath(path, sign_x); + } + return generateHermiteTrajectory(path, sign_x); + } + else // nếu đường cong + { + const double v_limited = sign_x > 0 ? traj_->getTwistLinear(true).x : traj_->getTwistLinear(false).x; + const double v_min = std::min(fabs(v_limited), min_speed_xy_); + if(fabs(drive_cmd.x) < v_min) + { + drive_cmd.x = std::copysign(v_min, sign_x); + } + return generateHermiteQuadraticTrajectory(path, sign_x); + } +} + +robot_nav_2d_msgs::Path2D mkt_algorithm::diff::PredictiveTrajectory::generateParallelPath( + const robot_nav_2d_msgs::Path2D &path, const double &sign_x) +{ + robot_nav_2d_msgs::Path2D parallel_path; + parallel_path.header = path.header; + int N = path.poses.size(); + if (N < 2) return parallel_path; + + double offset_y = path.poses.front().pose.y; + + parallel_path.poses.resize(N); + for (int i = 0; i < N; ++i) + { + const auto& p = path.poses[i].pose; + + double dx, dy; + if (i == 0) { + dx = path.poses[i+1].pose.x - p.x; + dy = path.poses[i+1].pose.y - p.y; + } else if (i == N-1) { + dx = p.x - path.poses[i-1].pose.x; + dy = p.y - path.poses[i-1].pose.y; + } else { + dx = path.poses[i+1].pose.x - path.poses[i-1].pose.x; + dy = path.poses[i+1].pose.y - path.poses[i-1].pose.y; + } + if(fabs(dx) < 1e-6 && fabs(dy) < 1e-6) + continue; + double theta = atan2(dy, dx); + double x_off = p.x - offset_y * sin(theta)*sign_x; + double y_off = p.y - offset_y * cos(theta)*sign_x; + + parallel_path.poses[i].header = path.poses[i].header; + parallel_path.poses[i].pose.x = x_off; + parallel_path.poses[i].pose.y = y_off; + parallel_path.poses[i].pose.theta = sign_x < 0 ? angles::normalize_angle(theta + M_PI) : theta; + } + return parallel_path; +} + +robot_nav_2d_msgs::Path2D mkt_algorithm::diff::PredictiveTrajectory::generateHermiteTrajectory( + const robot_nav_2d_msgs::Path2D &path, const double &sign_x) +{ + robot_nav_2d_msgs::Path2D hermite_trajectory; + hermite_trajectory.poses.clear(); + hermite_trajectory.header = path.header; + + if (path.poses.empty()) + return hermite_trajectory; + + const auto &goal = path.poses.back(); + if (hermite_trajectory.header.frame_id.empty()) + hermite_trajectory.header.frame_id = goal.header.frame_id; + if (hermite_trajectory.header.stamp.isZero()) + hermite_trajectory.header.stamp = goal.header.stamp; + + const double x = goal.pose.x; + const double y = goal.pose.y; + double theta = goal.pose.theta; + const double L = std::hypot(x, y); + if (L < 1e-6) { + robot_nav_2d_msgs::Pose2DStamped pose_stamped; + pose_stamped.pose.x = x; + pose_stamped.pose.y = y; + pose_stamped.pose.theta = theta; + pose_stamped.header.stamp = hermite_trajectory.header.stamp; + pose_stamped.header.frame_id = hermite_trajectory.header.frame_id; + hermite_trajectory.poses.push_back(pose_stamped); + return hermite_trajectory; + } + + int samples = L/costmap_robot_->getCostmap()->getResolution(); + if (samples < 1) { + samples = 1; + } + hermite_trajectory.poses.reserve(samples + 1); + const double Lnegative = sign_x < 0 ? -L : L; + for (int i = 0; i <= samples; ++i) { + double t = static_cast(i) / samples; + double t2 = t * t; + double t3 = t2 * t; + + double h00 = 2 * t3 - 3 * t2 + 1; + double h10 = t3 - 2 * t2 + t; + double h01 = -2 * t3 + 3 * t2; + double h11 = t3 - t2; + + // Hermite interpolation + double px = h10 * Lnegative + h01 * x + h11 * Lnegative * std::cos(theta); + double py = h01 * y + h11 * Lnegative * std::sin(theta); + + // First derivatives for heading + double dh00 = 6 * t2 - 6 * t; + double dh10 = 3 * t2 - 4 * t + 1; + double dh01 = -6 * t2 + 6 * t; + double dh11 = 3 * t2 - 2 * t; + + double dx = dh10 * Lnegative + dh01 * x + dh11 * Lnegative * std::cos(theta); + double dy = dh01 * y + dh11 * Lnegative * std::sin(theta); + + if(fabs(dx) < 1e-6 && fabs(dy) < 1e-6) + continue; + double heading = std::atan2(dy, dx); + + robot_nav_2d_msgs::Pose2DStamped pose_out; + pose_out.pose.x = px; + pose_out.pose.y = py; + pose_out.pose.theta = sign_x < 0 ? angles::normalize_angle(heading + M_PI) : heading; + pose_out.header.stamp = hermite_trajectory.header.stamp; + pose_out.header.frame_id = hermite_trajectory.header.frame_id; + hermite_trajectory.poses.push_back(pose_out); + } + return hermite_trajectory; +} + +robot_nav_2d_msgs::Path2D mkt_algorithm::diff::PredictiveTrajectory::generateHermiteQuadraticTrajectory( + const robot_nav_2d_msgs::Path2D &path, const double &sign_x) +{ + robot_nav_2d_msgs::Path2D trajectory; + trajectory.poses.clear(); + trajectory.header = path.header; + if (path.poses.empty()) + return trajectory; + + const auto &goal = path.poses.back(); + if (trajectory.header.frame_id.empty()) + trajectory.header.frame_id = goal.header.frame_id; + if (trajectory.header.stamp.isZero()) + trajectory.header.stamp = goal.header.stamp; + + const double x = goal.pose.x; + const double y = goal.pose.y; + const double theta = sign_x < 0 ? angles::normalize_angle(goal.pose.theta + M_PI) : goal.pose.theta; + const double L = std::hypot(x, y); + if (L < 1e-6) + { + robot_nav_2d_msgs::Pose2DStamped pose_stamped; + pose_stamped.pose.x = 0.0; + pose_stamped.pose.y = 0.0; + pose_stamped.pose.theta = 0.0; + pose_stamped.header.stamp = trajectory.header.stamp; + pose_stamped.header.frame_id = trajectory.header.frame_id; + trajectory.poses.push_back(pose_stamped); + return trajectory; + } + + int samples = L/costmap_robot_->getCostmap()->getResolution(); + if (samples < 1) { + samples = 1; + } + trajectory.poses.reserve(samples + 1); + + // Quadratic Hermite with end tangent aligned to carrot_pose heading: + // p(0) = 0, p(1) = goal, p'(1) = v1 + const double v1x = L * std::cos(theta); + const double v1y = L * std::sin(theta); + const double ax = v1x - x; + const double ay = v1y - y; + const double bx = 2.0 * x - v1x; + const double by = 2.0 * y - v1y; + + trajectory.poses.reserve(samples + 1); + for (int i = 0; i <= samples; ++i) + { + double t = static_cast(i) / samples; + double t2 = t * t; + + double px = ax * t2 + bx * t; + double py = ay * t2 + by * t; + + double dx = 2.0 * ax * t + bx; + double dy = 2.0 * ay * t + by; + if(fabs(dx) < 1e-6 && fabs(dy) < 1e-6) + continue; + double heading = std::atan2(dy, dx); + + robot_nav_2d_msgs::Pose2DStamped pose_out; + pose_out.pose.x = px; + pose_out.pose.y = py; + pose_out.pose.theta = sign_x < 0 ? angles::normalize_angle(heading + M_PI) : heading; + pose_out.header.stamp = trajectory.header.stamp; + pose_out.header.frame_id = trajectory.header.frame_id; + trajectory.poses.push_back(pose_out); + } + + return trajectory; +} + +bool mkt_algorithm::diff::PredictiveTrajectory::transformGlobalPlan( + TFListenerPtr tf, const robot_nav_2d_msgs::Path2D &global_plan, const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_costmap_2d::Costmap2DROBOT *costmap, const std::string &robot_base_frame, double max_plan_length, + robot_nav_2d_msgs::Path2D &transformed_plan) +{ + // this method is a slightly modified version of base_local_planner/goal_functions.h + transformed_plan.poses.clear(); + transformed_plan.header.stamp = pose.header.stamp; + transformed_plan.header.frame_id = robot_base_frame; + + if (global_plan.poses.empty()) + return false; + + if (tf == nullptr) + return false; + + if (costmap == nullptr || costmap->getCostmap() == nullptr) + return false; + + try + { + if (global_plan.poses.empty()) + { + robot::log_error("[%s:%d]\n Received plan with zero length", __FILE__, __LINE__); + return false; + } + + // let's get the pose of the robot in the frame of the plan + robot_nav_2d_msgs::Pose2DStamped robot_pose; + if (!robot_nav_2d_utils::transformPose(tf, global_plan.header.frame_id, pose, robot_pose)) + { + throw robot_nav_core2::PlannerTFException("Unable to transform robot pose into global plan's frame"); + } + + // we'll discard points on the plan that are outside the local costmap + double dist_threshold = std::max(costmap->getCostmap()->getSizeInCellsX() * costmap->getCostmap()->getResolution() / 2.0, + costmap->getCostmap()->getSizeInCellsY() * costmap->getCostmap()->getResolution() / 2.0); + + dist_threshold *= 0.85; // just consider 85% of the costmap size to better incorporate point obstacle that are + double sq_dist_threshold = dist_threshold * dist_threshold; + // located on the border of the local costmap + + int i = 0; + double sq_dist = std::numeric_limits::infinity(); + + // we need to loop to a point on the plan that is within a certain distance of the robot + bool robot_reached = false; + for (int j = 0; j < (int)global_plan.poses.size(); ++j) + { + double x_diff = robot_pose.pose.x - global_plan.poses[j].pose.x; + double y_diff = robot_pose.pose.y - global_plan.poses[j].pose.y; + double new_sq_dist = x_diff * x_diff + y_diff * y_diff; + if (robot_reached && new_sq_dist > sq_dist_threshold) + { + break; + } // force stop if we have reached the costmap border + + if (new_sq_dist < sq_dist) // find closest distance + { + sq_dist = new_sq_dist; + i = j; + if (sq_dist < costmap->getCostmap()->getResolution()) // 5 cm to the robot; take the immediate local minima; if it's not the global + robot_reached = true; // minima, probably means that there's a loop in the path, and so we prefer this + } + } + + double plan_length = 0; // check cumulative Euclidean distance along the plan + double x_direction_saved = 0.0; + // now we'll transform until points are outside of our distance threshold + while (i < (int)global_plan.poses.size() && sq_dist <= sq_dist_threshold && + (max_plan_length <= 0 || plan_length <= max_plan_length)) + { + robot_nav_2d_msgs::Pose2DStamped stamped_pose; + stamped_pose.pose = global_plan.poses[i].pose; + stamped_pose.header.frame_id = global_plan.header.frame_id; + + robot_nav_2d_msgs::Pose2DStamped newer_pose; + if (!robot_nav_2d_utils::transformPose(tf, robot_base_frame, stamped_pose, newer_pose)) + { + ++i; + continue; + } + transformed_plan.poses.push_back(newer_pose); + + double x_diff = robot_pose.pose.x - global_plan.poses[i].pose.x; + double y_diff = robot_pose.pose.y - global_plan.poses[i].pose.y; + sq_dist = x_diff * x_diff + y_diff * y_diff; + + // Calculate distance to previous pose + if (i > 0 && max_plan_length > 0) + { + robot_geometry_msgs::Pose2D p1 = global_plan.poses[i].pose; + robot_geometry_msgs::Pose2D p2 = global_plan.poses[i - 1].pose; + plan_length += std::sqrt(std::pow(p1.x - p2.x, 2) + std::pow(p1.y - p2.y, 2)); + if (fabs(p2.y - p1.y) > 1e-9 || fabs(p2.x - p1.x) > 1e-9) + { + const double egde_angle = atan2(p1.y - p2.y, p1.x - p2.x); + const double target_direction = cos(fabs(egde_angle - p1.theta)); + if (target_direction * x_direction_saved < 0.0) + { + plan_length = 0; + } + x_direction_saved = target_direction; + } + } + ++i; + } + } + catch (tf3::LookupException &ex) + { + robot::log_error("[%s:%d]\n No Transform available Error: %s\n", __FILE__, __LINE__, ex.what()); + return false; + } + catch (tf3::ConnectivityException &ex) + { + robot::log_error("[%s:%d]\n Connectivity Error: %s\n", __FILE__, __LINE__, ex.what()); + return false; + } + catch (tf3::ExtrapolationException &ex) + { + robot::log_error("[%s:%d]\n Extrapolation Error: %s\n", __FILE__, __LINE__, ex.what()); + if (global_plan.poses.size() > 0) + robot::log_error("[%s:%d]\n Robot Frame: %s Plan Frame size %d: %s\n", __FILE__, __LINE__, robot_base_frame.c_str(), (unsigned int)global_plan.poses.size(), global_plan.header.frame_id.c_str()); + + return false; + } + return true; +} + +void mkt_algorithm::diff::PredictiveTrajectory::moveWithAccLimits( + const robot_nav_2d_msgs::Twist2D &velocity, const robot_nav_2d_msgs::Twist2D &cmd_vel, robot_nav_2d_msgs::Twist2D &cmd_vel_result, const double &dt) +{ + // --- X axis --- + double min_vel_x = traj_ ? min_vel_x_ : fabs(traj_->getTwistLinear(false).x); + double max_vel_x = traj_ ? max_vel_x_ : fabs(traj_->getTwistLinear(true).x); + + double vx = cmd_vel.x > 0.0 ? std::min(max_vel_x, std::max(min_vel_x, cmd_vel.x)) : std::max(-max_vel_x, std::min(-min_vel_x, cmd_vel.x)); + + double max_acc_vx = velocity.x + fabs(acc_lim_x_) * dt; + double min_acc_vx = velocity.x - fabs(decel_lim_x_) * dt; + vx = std::clamp(vx, min_acc_vx, max_acc_vx); + + // --- Y axis --- + double min_vel_y = traj_ ? min_vel_y_ : fabs(traj_->getTwistLinear(false).y); + double max_vel_y = traj_ ? max_vel_y_ : fabs(traj_->getTwistLinear(true).y); + double vy = cmd_vel.y > 0.0 ? std::min(max_vel_y, std::max(min_vel_y, cmd_vel.y)) : std::max(-max_vel_y, std::min(-min_vel_y, cmd_vel.y)); + + double max_acc_vy = velocity.y + fabs(acc_lim_y_) * dt; + double min_acc_vy = velocity.y - fabs(decel_lim_y_) * dt; + vy = std::clamp(vy, min_acc_vy, max_acc_vy); + // --- Assign result --- + cmd_vel_result.x = vx; + cmd_vel_result.y = vy; + // cmd_vel_result.theta = vth; +} + +bool mkt_algorithm::diff::PredictiveTrajectory::stopWithAccLimits(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity, robot_nav_2d_msgs::Twist2D &cmd_vel, const double &dt) +{ + // slow down with the maximum possible acceleration... we should really use the frequency that we're running at to determine what is feasible + // but we'll use a tenth of a second to be consistent with the implementation of the local planner. + double vx = sign(velocity.x) * std::max(0.0, (fabs(velocity.x) - fabs(decel_lim_x_) * dt)); + double vy = sign(velocity.y) * std::max(0.0, (fabs(velocity.y) - fabs(decel_lim_y_) * dt)); + + double vel_yaw = velocity.theta; + double vth = sign(vel_yaw) * std::max(0.0, (fabs(vel_yaw) - fabs(decel_lim_theta_) * dt)); + + cmd_vel.x = vx; + cmd_vel.y = vy; + cmd_vel.theta = vth; + return true; +} + +std::vector +mkt_algorithm::diff::PredictiveTrajectory::interpolateFootprint(const robot_geometry_msgs::Pose2D &pose, const std::vector &footprint, const double &resolution) +{ + + // Dịch sang tọa độ tuyệt đối + std::vector abs_footprint; + double cos_th = std::cos(pose.theta); + double sin_th = std::sin(pose.theta); + for (auto pt : footprint) + { + pt.x *= 1.2; + pt.y *= 1.2; + robot_geometry_msgs::Point abs_pt; + abs_pt.x = pose.x + pt.x * cos_th - pt.y * sin_th; + abs_pt.y = pose.y + pt.x * sin_th + pt.y * cos_th; + abs_footprint.push_back(abs_pt); + } + + std::vector points; + for (size_t i = 0; i < abs_footprint.size(); ++i) + { + const robot_geometry_msgs::Point &start = abs_footprint[i]; + const robot_geometry_msgs::Point &end = abs_footprint[(i + 1) % abs_footprint.size()]; + + double dx = end.x - start.x; + double dy = end.y - start.y; + double distance = std::hypot(dx, dy); + int steps = std::max(1, static_cast(std::floor(distance / resolution))); + + for (int j = 0; j <= steps; ++j) + { + if (j == steps && i != abs_footprint.size() - 1) + continue; // tránh lặp + double t = static_cast(j) / steps; + robot_geometry_msgs::Point pt; + pt.x = start.x + t * dx; + pt.y = start.y + t * dy; + points.push_back(pt); + } + } + return points; +} + +double mkt_algorithm::diff::PredictiveTrajectory::costAtPose(const double &x, const double &y) +{ + unsigned int mx, my; + unsigned char cost; + if (costmap_robot_->getCostmap()->worldToMap(x, y, mx, my)) + { + cost = costmap_robot_->getCostmap()->getCost(mx, my); + } + return static_cast(cost); +} + +score_algorithm::ScoreAlgorithm::Ptr mkt_algorithm::diff::PredictiveTrajectory::create() +{ + return std::make_shared(); +} + +BOOST_DLL_ALIAS(mkt_algorithm::diff::PredictiveTrajectory::create, MKTAlgorithmDiffPredictiveTrajectory) \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_rotate_to_goal.cpp b/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_rotate_to_goal.cpp new file mode 100644 index 0000000..51670e9 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/diff/diff_rotate_to_goal.cpp @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include + + +mkt_algorithm::diff::RotateToGoal::RotateToGoal() + : PredictiveTrajectory() +{ +} + +mkt_algorithm::diff::RotateToGoal::~RotateToGoal() {} + +void mkt_algorithm::diff::RotateToGoal::initialize( + robot::NodeHandle &nh, const std::string &name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, const score_algorithm::TrajectoryGenerator::Ptr &traj) +{ + if (!initialized_) + { + nh_ = robot::NodeHandle(nh, name); + name_ = name; + tf_ = tf; + traj_ = traj; + costmap_robot_ = costmap_robot; + nh_.param("min_approach_linear_velocity", min_approach_linear_velocity_, 0.0); + this->getParams(); + + last_actuator_update_ = robot::Time::now(); + x_direction_ = y_direction_ = theta_direction_ = 0; + this->initialized_ = true; + robot::log_info("[%s:%d]\n RotateToGoal Initialized successfully", __FILE__, __LINE__); + } +} + +void mkt_algorithm::diff::RotateToGoal::reset() +{ + robot::log_info("[%s:%d]\n RotateToGoal is reset", __FILE__, __LINE__); + if (initialized_) + { + this->clear(); + x_direction_ = y_direction_ = theta_direction_ = 0; + last_actuator_update_ = robot::Time::now(); + } +} + +bool mkt_algorithm::diff::RotateToGoal::prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity, + const robot_nav_2d_msgs::Pose2DStamped &goal, const robot_nav_2d_msgs::Path2D &global_plan, + double &x_direction, double &y_direction, double &theta_direction) +{ + + if (!initialized_) + { + robot::log_error("This planner has not been initialized, please call initialize() before using this planner"); + return false; + } + if (global_plan.poses.empty() || (unsigned int)global_plan.poses.size() < 2) + { + robot::log_error("[%s:%d]\n The Local plan is empty or less than 1 points %d", __FILE__, __LINE__, (unsigned int)global_plan.poses.size()); + return false; + } + if(robot::Time::now() - last_actuator_update_ > robot::Duration(0.5)) + { + last_actuator_update_ = robot::Time::now(); + } + this->getParams(); + frame_id_path_ = global_plan.header.frame_id; + goal_ = goal; + + double angle = angles::shortest_angular_distance(pose.pose.theta, goal_.pose.theta); + x_direction = y_direction = theta_direction = sign(angle); + return true; +} + +mkt_msgs::Trajectory2D mkt_algorithm::diff::RotateToGoal::calculator( + const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + mkt_msgs::Trajectory2D result; + robot_nav_2d_msgs::Twist2D drive_cmd; + result.velocity.x = result.velocity.y = result.velocity.theta = 0.0; + if (!traj_) + return result; + + robot::Time current_time = robot::Time::now(); + const double dt = (current_time - last_actuator_update_).toSec(); + last_actuator_update_ = current_time; + double vel_yaw = velocity.theta; + double ang_diff = angles::shortest_angular_distance(pose.pose.theta, goal_.pose.theta); + rotateToHeading(ang_diff, velocity, drive_cmd, dt); + + drive_cmd.x = 0.0; + drive_cmd.y = 0.0; + result.velocity = drive_cmd; + return result; +} + +score_algorithm::ScoreAlgorithm::Ptr mkt_algorithm::diff::RotateToGoal::create() +{ + return std::make_shared(); +} + +BOOST_DLL_ALIAS(mkt_algorithm::diff::RotateToGoal::create, MKTAlgorithmDiffRotateToGoal) \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_algorithm/src/diff/hermite_trajectory.svg b/src/Algorithms/Libraries/mkt_algorithm/src/diff/hermite_trajectory.svg new file mode 100644 index 0000000..fe475ae --- /dev/null +++ b/src/Algorithms/Libraries/mkt_algorithm/src/diff/hermite_trajectory.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + x + y + O(0,0) + + + + + + + + + + + + + + + + + + + + + + + heading 0 + goal (x,y,theta) + Hermite trajectory + + diff --git a/src/Algorithms/Libraries/mkt_msgs/CMakeLists.txt b/src/Algorithms/Libraries/mkt_msgs/CMakeLists.txt new file mode 100644 index 0000000..a837f12 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_msgs/CMakeLists.txt @@ -0,0 +1,144 @@ +cmake_minimum_required(VERSION 3.0.2) +project(mkt_msgs VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building mkt_msgs with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building mkt_msgs with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_nav_2d_msgs + geometry_msgs + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_nav_2d_msgs + geometry_msgs + ) + + catkin_package( + INCLUDE_DIRS include + # LIBRARIES không cần vì đây là header-only library + CATKIN_DEPENDS robot_nav_2d_msgs geometry_msgs + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/mkt_msgs/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PACKAGES_DIR} + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: robot_nav_2d_msgs, geometry_msgs") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Libraries/mkt_msgs/include/mkt_msgs/Trajectory2D.h b/src/Algorithms/Libraries/mkt_msgs/include/mkt_msgs/Trajectory2D.h new file mode 100644 index 0000000..84ab6e5 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_msgs/include/mkt_msgs/Trajectory2D.h @@ -0,0 +1,66 @@ +// Generated by gencpp from file mkt_msgs/Trajectory2D.msg +// DO NOT EDIT! + +#ifndef MKT_MSGS_MESSAGE_TRAJECTORY2D_H +#define MKT_MSGS_MESSAGE_TRAJECTORY2D_H + +#include +#include +#include +#include +#include +#include + +namespace mkt_msgs +{ + template + struct Trajectory2D_ + { + typedef Trajectory2D_ Type; + + Trajectory2D_() + : velocity(), poses(), time_offsets() + { + } + Trajectory2D_(const ContainerAllocator &_alloc) + : velocity(_alloc), poses(_alloc), time_offsets(_alloc) + { + (void)_alloc; + } + + typedef ::robot_nav_2d_msgs::Twist2D_ _velocity_type; + _velocity_type velocity; + + typedef std::vector::template rebind_alloc> _poses_type; + _poses_type poses; + + typedef std::vector::template rebind_alloc> _time_offsets_type; + _time_offsets_type time_offsets; + + typedef boost::shared_ptr<::mkt_msgs::Trajectory2D_> Ptr; + typedef boost::shared_ptr<::mkt_msgs::Trajectory2D_ const> ConstPtr; + + }; // struct Trajectory2D_ + + typedef ::mkt_msgs::Trajectory2D_> Trajectory2D; + + typedef boost::shared_ptr<::mkt_msgs::Trajectory2D> Trajectory2DPtr; + typedef boost::shared_ptr<::mkt_msgs::Trajectory2D const> Trajectory2DConstPtr; + + template + bool operator==(const ::mkt_msgs::Trajectory2D_ &lhs, const ::mkt_msgs::Trajectory2D_ &rhs) + { + return lhs.velocity == rhs.velocity && + lhs.poses == rhs.poses && + lhs.time_offsets == rhs.time_offsets; + } + + template + bool operator!=(const ::mkt_msgs::Trajectory2D_ &lhs, const ::mkt_msgs::Trajectory2D_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace mkt_msgs + +#endif // MKT_MSGS_MESSAGE_TRAJECTORY2D_H diff --git a/src/Algorithms/Libraries/mkt_msgs/package.xml b/src/Algorithms/Libraries/mkt_msgs/package.xml new file mode 100644 index 0000000..c1573bf --- /dev/null +++ b/src/Algorithms/Libraries/mkt_msgs/package.xml @@ -0,0 +1,27 @@ + + mkt_msgs + 0.7.10 + + mkt_msgs is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. mkt_msgs + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/mkt_msgs + + catkin + + robot_nav_2d_msgs + geometry_msgs + + robot_nav_2d_msgs + geometry_msgs + \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_plugins/CMakeLists.txt b/src/Algorithms/Libraries/mkt_plugins/CMakeLists.txt new file mode 100644 index 0000000..8217e36 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/CMakeLists.txt @@ -0,0 +1,208 @@ +cmake_minimum_required(VERSION 3.0.2) +project(mkt_plugins VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building mkt_plugins with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building mkt_plugins with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS system) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + score_algorithm + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core2 + geometry_msgs + robot_nav_msgs + robot_std_msgs + robot_sensor_msgs + angles + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + score_algorithm + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core2 + geometry_msgs + robot_nav_msgs + robot_std_msgs + robot_sensor_msgs + angles + ) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME}_goal_checker ${PROJECT_NAME}_standard_traj_generator + CATKIN_DEPENDS score_algorithm robot_nav_2d_msgs robot_nav_2d_utils robot_nav_core2 geometry_msgs robot_nav_msgs robot_std_msgs robot_sensor_msgs angles + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ) +endif() + +# ======================================================== +# Libraries +# ======================================================== +add_library(${PROJECT_NAME}_goal_checker SHARED + src/goal_checker.cpp + src/simple_goal_checker.cpp + src/equation_line.cpp +) + +add_library(${PROJECT_NAME}_standard_traj_generator SHARED + src/kinematic_parameters.cpp + src/xy_theta_iterator.cpp + src/standard_traj_generator.cpp + src/limited_accel_generator.cpp +) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME}_goal_checker ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(${PROJECT_NAME}_standard_traj_generator ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_include_directories(${PROJECT_NAME}_goal_checker + PUBLIC + $ + $ + ) + + target_include_directories(${PROJECT_NAME}_standard_traj_generator + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME}_goal_checker + PUBLIC ${catkin_LIBRARIES} + PRIVATE Boost::system + ) + + target_link_libraries(${PROJECT_NAME}_standard_traj_generator + PUBLIC ${catkin_LIBRARIES} + PRIVATE Boost::system + ) + +else() + + target_include_directories(${PROJECT_NAME}_goal_checker + PUBLIC + $ + $ + ) + + target_include_directories(${PROJECT_NAME}_standard_traj_generator + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME}_goal_checker + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::system + ) + + target_link_libraries(${PROJECT_NAME}_standard_traj_generator + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::system + ) + + set_target_properties(${PROJECT_NAME}_goal_checker PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + + set_target_properties(${PROJECT_NAME}_standard_traj_generator PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +# ======================================================== +# Install +# ======================================================== +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME}_goal_checker ${PROJECT_NAME}_standard_traj_generator + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME}_goal_checker ${PROJECT_NAME}_standard_traj_generator + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Libraries: ${PROJECT_NAME}_goal_checker, ${PROJECT_NAME}_standard_traj_generator") + message(STATUS "Dependencies: score_algorithm, robot_nav_2d_msgs, robot_nav_2d_utils, robot_nav_core2, geometry_msgs, robot_nav_msgs, robot_std_msgs, robot_sensor_msgs, angles, Boost") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Libraries/mkt_plugins/doc/VelocitySpace.png b/src/Algorithms/Libraries/mkt_plugins/doc/VelocitySpace.png new file mode 100644 index 0000000000000000000000000000000000000000..cb5e660ee1f73c785da6372d0d0a964ef787e4ca GIT binary patch literal 34570 zcmeFYWl&w;m-l&-kN_b8F75;f9^5^+ThQPHcXvzRLN4wQ+yWPO3-0dj1a}DTFo*n} z{&#m(PfhpC)Kl|fDn%|F&N*yZd+qP~thECb!Gz(ajV6GDYBFc)N)~v)oh9)4=anl!7(S`)6nf-`)={j{TIK zTg;I(6A~(4zIU#;?YAD+B9Ez*<*+*0K#+70tYwP#Yh^;kU&CLUk2AWC_^=lzc6uv3 zful);AHI+3%13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0HPUp6@KeyN_eb|4s!Ky5JA?FENNuI-0$grG=B1$C0t zMa`|bt!*}>x;EC~v?q&U!-h>$Q``AE)V0uNUX4Ryc z&qSXFYpx?s_`}bfH#TuaKT@3l7p6XsTi79?6`?2?O}Y5J?XMP=?xA z!cVYdW{F5G2q#h=XpMI856zvO^AG@m&AHiJ!7Xbvj!>ie9XWgFyHlyqljVbxh^8-H zYIQs$#15s2-%&;fk;M(-Ug}L+s}`AsK(VM4Zul+i&<#+%4=RZeqSL1#C4i}V`2V61 zI+pPa!{IlgqPcFZ#{p%m_+!CNIn?C=WlcemE#u0)$1bg_6+q}r%@P?s`YiCnGB|PP znybf@rpURyEfwX+q7Z-Ge2bs7c#WQS!{Bw7eegOcAU^5T1TAVTm1SRMB;c^ULYF%W zt2d*>y8#Aqiy_&nhgv*#sZvst z$p5PK!FG9kyO_!UC@um*KQnUz!SSnCc(a*o1da^EDEx2IRC92tf literal 0 HcmV?d00001 diff --git a/src/Algorithms/Libraries/mkt_plugins/doc/std_pv.png b/src/Algorithms/Libraries/mkt_plugins/doc/std_pv.png new file mode 100644 index 0000000000000000000000000000000000000000..0307645bba8310c8f389c0a0cffda0de8c91e84c GIT binary patch literal 31906 zcmb5Wby!wg_b$BXZb@kblomufL&zH@!ob^bZ*{l0r|So# z9~b^awEOQr_y_hAg)>Mh*o4*1-1*642YXgw0r-oL)yl=iQBqLw|6Cy8;A|-vlGaOvAgstO z#cS#wZ!GKq`-jr4P&$nGkcnKR=9bt8Yzx=#^zW@LBY?!Ohms+O6R z-HpX(!w!R=Z&o)+^brd9=@Z12XNMn-Cgi4~qN14@9TE-~L=t1M!f#_^jgbrRTVY{h zfB3DUQV7Ni^yA-z5K8zpJw2{`25x6Z2hmh(RDNRr^T@~`MfPiYdU`e02KSamYtB=K zV=G59UUs=;CV#|8-Y0-7FMQjwE48KPz8uN@`}Z%#-~L)rk$yi-R;$c5Nu}<->^`>K z>Cu;fJX?>+$w}7Oo7P)>FBJaOyp?!@%i^;|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ap%+DG< zglQhj8LvR4k0h>h8!qha_@$YhsV`qfpma-O@j3a}m;j2aRZpF2TZw%6XO%RN8leWw zi*dpF;(1sT|7klqHQWJ>wtgPPvHMZHP=Y2laLF4`Wb>;22Pkq2Q%`pN4r2w*KmSgb zXJ7?Rn+jE!oUT?HxS+)Fp~nu@en2_8x}qQp@}dstoRbrG^q~#;vn4W0Q{^KXNymb~ zjy-lqkdIFSZEtU(7V4~y;H>lKbbxzi%1X$kxMe9u{xBQ#Z z`!W5L_BT}V-BUih->#JkZ~lv-8=CDFg#w3jE-rtdY2Y0+q$MRV?W>!FZAOhyR7L~* zg40k(XAdjTKK}x%S;4(M`Sk|ckl6G8ho76il6ty7D44)JB->Pe;k|#c*^t}>WP8en v#3cTNFA{nF6QCnk`8O5r|MxG?dn-?8J(4}}s0RJSDZi^9q9yM&yZnCu2p_rK literal 0 HcmV?d00001 diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/equation_line.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/equation_line.h new file mode 100644 index 0000000..31bbeaa --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/equation_line.h @@ -0,0 +1,74 @@ +#ifndef __MKT_PLUGINS_EQUATION_LINE_H_INCLUDED__ +#define __MKT_PLUGINS_EQUATION_LINE_H_INCLUDED__ +#include +#include +#include + +namespace mkt_plugins +{ + +/** + * @class NoSolution + */ +class NoSolution : public std::exception { + public: + const char * what () const throw () { + return "Robot cannot calculate error line!"; + } +}; // class NoSolution + +/** + * @class LineGenerator + */ +class LineGenerator +{ + /* data */ + struct LineEquation { + robot_geometry_msgs::Pose2D Gi; /* 𝑮𝒊(𝒙𝒊,𝒚𝒊) */ + robot_geometry_msgs::Pose2D Gj; /* 𝑮𝒋(𝒙𝒋,𝒚𝒋) */ + float a, b, c ; /* 𝒂𝒙+𝒃𝒚+𝒄=𝟎 */ + }; + + /* Save data present position */ + struct PresentPosition { + float Gxh, Gyh; /* 𝑮𝒋(𝒙h,𝒚h) The head position in Robot */ + float Yaw_degree; /* Angle of Robot (degree) */ + float Yaw_rad; /* Angle of Robot (degree) */ + float error_line; /* 𝒆(𝑮,𝒍𝒊𝒏𝒆)=|𝒂𝒙+𝒃𝒚+𝒄|/sqrt(𝒂^2+𝒃^2) */ + double distance_to_goal; /* The distance from query pose to goal */ + double distance_to_start; /* The distance from query pose to start*/ + double distace_start_goal; + }; +public: + + /** + * @brief To caculated the equation of the line + * @param start_point start point of the line + * @param end_point end point of the line + */ + virtual bool calculatorEquationLine(robot_geometry_msgs::Pose2D start_point, robot_geometry_msgs::Pose2D end_point); + + /** + * @brief Calculating error + * @param[in] Lm The distance from the center of the wheel axis to the center line + * @param[in] pose + * @param[in] rev + */ + virtual void calculateErrorLine(float Lm, robot_geometry_msgs::Pose2D pose, bool rev = false); + + /** + * @brief Calculating tolerance + * @param query_pose The pose to check + * @param goal_pose The pose to check against + */ + virtual double calculateTolerance(const robot_geometry_msgs::Pose2D& query_pose, const robot_geometry_msgs::Pose2D& goal_pose); + + /* Properties */ + LineEquation Leq_; + PresentPosition present_pose_; + +}; // class LineGenerator + +} // namespace mkt_plugins + +#endif // __MKT_PLUGINS_EQUATION_LINE_H_INCLUDED__ diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/goal_checker.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/goal_checker.h new file mode 100644 index 0000000..76bccae --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/goal_checker.h @@ -0,0 +1,57 @@ +#ifndef _MKT_PLUGINS_CHECKER_GOAL_H_INCLUDED__ +#define _MKT_PLUGINS_CHECKER_GOAL_H_INCLUDED__ + +#include +#include + +namespace mkt_plugins +{ + class GoalChecker : public score_algorithm::GoalChecker + { + public: + GoalChecker(); + /** + * @brief Initialize any parameters from the NodeHandle + * @param nh NodeHandle for grabbing parameters + */ + virtual void initialize(const robot::NodeHandle &nh) override; + + /** + * @brief Reset the state of the goal checker (if any) + */ + virtual void reset() override; + + /** + * @brief Check whether the goal should be considered reached + * @param query_pose The pose to check + * @param goal_pose The pose to check against + * @param velocity The robot's current velocity + * @return True if goal is reached + */ + bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &query_pose, const robot_nav_2d_msgs::Pose2DStamped &goal_pose, + const robot_nav_2d_msgs::Path2D &path, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Factory function to create a GoalChecker instance + * @return Shared pointer to a new GoalChecker instance + */ + static score_algorithm::GoalChecker::Ptr create(); + protected: + /** + * @brief Internal method to initialize parameters from NodeHandle + * @param nh NodeHandle to load parameters from + * + * Loads xy_goal_tolerance and yaw_goal_tolerance parameters + */ + void intParam(const robot::NodeHandle &nh); + + robot::NodeHandle nh_; + std::shared_ptr line_generator_; + double yaw_goal_tolerance_; + double xy_goal_tolerance_; + double old_xy_goal_tolerance_; + }; + +} // namespace mkt_plugins + +#endif // _MKT_PLUGINS_CHECKER_GOAL_H_INCLUDED__ diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/kinematic_parameters.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/kinematic_parameters.h new file mode 100644 index 0000000..56aac68 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/kinematic_parameters.h @@ -0,0 +1,318 @@ +#ifndef MKT_PLUGINS_KINEMATIC_PARAMETERS_H_INCLUDED_ +#define MKT_PLUGINS_KINEMATIC_PARAMETERS_H_INCLUDED_ + +#include +#include + +namespace mkt_plugins +{ + + /** + * @class KinematicParameters + * @brief A dynamically reconfigurable class containing one representation of the robot's kinematics + */ + class KinematicParameters + { + public: + KinematicParameters(); + virtual ~KinematicParameters(); + void initialize(const robot::NodeHandle &nh); + + /** + * @brief Get the direction array for X, Y, and theta movement + * @return Pointer to an array of integers representing the direction of movement for X, Y, and theta (e.g., 1 for forward/right/clockwise, -1 for backward/left/counterclockwise, 0 for stop) + * + * This array controls the intended direction of the robot. Sudden changes in the theta component can cause discontinuities in odometry data, potentially leading to localization jumps in AMCL when rotating in place. + */ + int *getDirect(); + + /** + * @brief Get the minimum linear velocity along the X-axis + * @return Minimum linear velocity (m/s) for forward/backward motion + * + * Used to ensure the robot does not move too slowly along X, which could lead to odometry drift. Less relevant for in-place rotation issues. + */ + double getMinX(); + + /** + * @brief Get the maximum linear velocity along the X-axis + * @return Maximum linear velocity (m/s) for forward/backward motion + * + * Ensures the robot does not exceed safe speeds along X. Not directly related to rotation-induced localization jumps. + */ + double getMaxX(); + + /** + * @brief Get the maximum linear acceleration along the X-axis + * @return Maximum linear acceleration (m/s²) for forward/backward motion + * + * High acceleration can cause odometry errors if the robot's hardware cannot keep up. Less relevant for in-place rotation. + */ + double getAccX(); + + /** + * @brief Get the maximum linear deceleration along the X-axis + * @return Maximum linear deceleration (m/s²) for forward/backward motion + * + * Improper deceleration may cause jerky stops, leading to minor odometry errors. Not a primary cause of rotation-induced localization jumps. + */ + double getDecelX(); + + /** + * @brief Get the minimum linear velocity along the Y-axis + * @return Minimum linear velocity (m/s) for lateral motion (if applicable) + * + * Typically zero for differential drive robots. Not relevant for in-place rotation. + */ + double getMinY(); + + /** + * @brief Get the maximum linear velocity along the Y-axis + * @return Maximum linear velocity (m/s) for lateral motion + * + * Typically zero for differential drive robots. Not relevant for in-place rotation. + */ + double getMaxY(); + + /** + * @brief Get the maximum linear acceleration along the Y-axis + * @return Maximum linear acceleration (m/s²) for lateral motion + * + * Not relevant for in-place rotation in differential drive robots. + */ + double getAccY(); + + /** + * @brief Get the maximum linear deceleration along the Y-axis + * @return Maximum linear deceleration (m/s²) for lateral motion + * + * Not relevant for in-place rotation in differential drive robots. + */ + double getDecelY(); + + /** + * @brief Get the minimum combined linear velocity in the XY plane + * @return Minimum combined velocity (m/s) for motion in the XY plane + * + * Ensures the robot moves at a meaningful speed in the XY plane. Not directly related to in-place rotation issues. + */ + double getMinSpeedXY(); + + /** + * @brief Get the minimum angular velocity for rotation + * @return Minimum angular velocity (rad/s) for rotation around the Z-axis + * + * A very low value may cause the robot to struggle with stable rotation, leading to odometry errors and potential localization jumps in AMCL. + */ + double getMinTheta(); + + /** + * @brief Get the maximum angular velocity for rotation + * @return Maximum angular velocity (rad/s) for rotation around the Z-axis + * + * A high value (e.g., >2.0 rad/s) can cause wheel slip or odometry errors during fast rotation, leading to localization jumps in AMCL. + */ + double getMaxTheta(); + + /** + * @brief Get the maximum angular acceleration for rotation + * @return Maximum angular acceleration (rad/s²) for rotation around the Z-axis + * + * High angular acceleration can cause jerky rotation, leading to odometry errors and potential localization jumps in AMCL. + */ + double getAccTheta(); + + /** + * @brief Get the maximum angular deceleration for rotation + * @return Maximum angular deceleration (rad/s²) for rotation around the Z-axis + * + * Improper deceleration can cause jerky stops during rotation, leading to odometry errors and localization jumps in AMCL. + */ + double getDecelTheta(); + + /** + * @brief Get the minimum angular speed for rotation + * @return Minimum angular speed (rad/s) for rotation around the Z-axis + * + * Similar to getMinTheta(), a very low value may cause unstable rotation, contributing to odometry errors and AMCL localization issues. + */ + double getMinSpeedTheta(); + + /** + * @brief Set the direction array for X, Y, and theta movement + * @param xytheta_direct Pointer to an array of integers specifying the direction for X, Y, and theta + * + * Sets the intended direction of motion. Sudden changes in the theta component can cause discontinuities in odometry, leading to localization jumps in AMCL during in-place rotation. + */ + void setDirect(int *xytheta_direct); + + /** + * @brief Set the minimum linear velocity along the X-axis + * @param value Minimum linear velocity (m/s) for forward/backward motion + * + * Ensures the robot does not move too slowly along X. Not directly related to in-place rotation issues. + */ + void setMinX(double value); + + /** + * @brief Set the maximum linear velocity along the X-axis + * @param value Maximum linear velocity (m/s) for forward/backward motion + * + * Limits the robot's speed along X. Not directly related to in-place rotation issues. + */ + void setMaxX(double value); + + /** + * @brief Set the maximum linear acceleration along the X-axis + * @param value Maximum linear acceleration (m/s²) for forward/backward motion + * + * High acceleration can cause odometry errors if not supported by hardware. Less relevant for in-place rotation. + */ + void setAccX(double value); + + /** + * @brief Set the maximum linear deceleration along the X-axis + * @param value Maximum linear deceleration (m/s²) for forward/backward motion + * + * Improper deceleration may cause minor odometry errors. Not a primary cause of rotation-induced localization jumps. + */ + void setDecelX(double value); + + /** + * @brief Set the minimum linear velocity along the Y-axis + * @param value Minimum linear velocity (m/s) for lateral motion + * + * Typically zero for differential drive robots. Not relevant for in-place rotation. + */ + void setMinY(double value); + + /** + * @brief Set the maximum linear velocity along the Y-axis + * @param value Maximum linear velocity (m/s) for lateral motion + * + * Typically zero for differential drive robots. Not relevant for in-place rotation. + */ + void setMaxY(double value); + + /** + * @brief Set the maximum linear acceleration along the Y-axis + * @param value Maximum linear acceleration (m/s²) for lateral motion + * + * Not relevant for in-place rotation in differential drive robots. + */ + void setAccY(double value); + + /** + * @brief Set the maximum linear deceleration along the Y-axis + * @param value Maximum linear deceleration (m/s²) for lateral motion + * + * Not relevant for in-place rotation in differential drive robots. + */ + void setDecelY(double value); + + /** + * @brief Set the minimum combined linear velocity in the XY plane + * @param value Minimum combined velocity (m/s) for motion in the XY plane + * + * Ensures meaningful motion in the XY plane. Not directly related to in-place rotation issues. + */ + void setMinSpeedXY(double value); + + /** + * @brief Set the maximum angular velocity for rotation + * @param value Maximum angular velocity (rad/s) for rotation around the Z-axis + * + * A high value can cause fast rotation, leading to wheel slip or odometry errors, which may cause AMCL to jump during in-place rotation. + */ + void setMaxTheta(double value); + + /** + * @brief Set the maximum angular acceleration for rotation + * @param value Maximum angular acceleration (rad/s²) for rotation around the Z-axis + * + * High acceleration can cause jerky rotation, leading to odometry errors and AMCL localization jumps. + */ + void setAccTheta(double value); + + /** + * @brief Set the maximum angular deceleration for rotation + * @param value Maximum angular deceleration (rad/s²) for rotation around the Z-axis + * + * Improper deceleration can cause jerky stops, leading to odometry errors and AMCL localization jumps. + */ + void setDecelTheta(double value); + + /** + * @brief Set the minimum angular speed for rotation + * @param value Minimum angular speed (rad/s) for rotation around the Z-axis + * + * A very low value may cause unstable rotation, contributing to odometry errors and AMCL localization issues. + */ + void setMinSpeedTheta(double value); + + /** + * @brief Check to see whether the combined x/y/theta velocities are valid + * @return True if the magnitude hypot(x,y) and theta are within the robot's absolute limits + * + * This is based on three parameters: min_speed_xy, max_speed_xy and min_speed_theta. + * The speed is valid if + * 1) The combined magnitude hypot(x,y) is less than max_speed_xy (or max_speed_xy is negative) + * AND + * 2) min_speed_xy is negative or min_speed_theta is negative or + * hypot(x,y) is greater than min_speed_xy or fabs(theta) is greater than min_speed_theta. + * + * In English, it makes sure the diagonal motion is not too fast, + * and that the velocity is moving in some meaningful direction. + * + * In Latin, quod si motus sit signum quaerit et movere ieiunium et significantissime comprehendite. + */ + bool isValidSpeed(double x, double y, double theta); + + using Ptr = std::shared_ptr; + + protected: + + /** + * @brief Configure the kinematic parameters + * @param nh NodeHandle + * + * Configures the kinematic parameters from the given NodeHandle. + */ + void configure(const robot::NodeHandle &nh); + + /** + * @brief Reconfigure the kinematic parameters + * @param nh NodeHandle + * + * Reconfigures the kinematic parameters from the given NodeHandle. + */ + void reconfigure(const robot::NodeHandle &nh); + + // For parameter descriptions, see cfg/KinematicParams.cfg + int xytheta_direct_[3]; + double min_vel_x_, min_vel_y_; + double max_vel_x_, max_vel_y_, max_vel_theta_; + + double min_speed_xy_, max_speed_xy_; + double min_speed_theta_; + + double acc_lim_x_, acc_lim_y_, acc_lim_theta_; + double decel_lim_x_, decel_lim_y_, decel_lim_theta_; + + // Cached square values of min_speed_xy and max_speed_xy + double min_speed_xy_sq_, max_speed_xy_sq_; + + private: + double original_min_vel_x_, original_min_vel_y_; + double original_max_vel_x_, original_max_vel_y_, original_max_vel_theta_; + + double original_min_speed_xy_, original_max_speed_xy_; + double original_min_speed_theta_; + + double original_acc_lim_x_, original_acc_lim_y_, original_acc_lim_theta_; + double original_decel_lim_x_, original_decel_lim_y_, original_decel_lim_theta_; + }; + +} // namespace mkt_plugins + +#endif // MKT_PLUGINS_KINEMATIC_PARAMETERS_H_INCLUDED_ diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/limited_accel_generator.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/limited_accel_generator.h new file mode 100644 index 0000000..5c0d783 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/limited_accel_generator.h @@ -0,0 +1,51 @@ +#ifndef MKT_PLUGINS_LIMITED_ACCEL_GENERATOR_H_INCLUDED_ +#define MKT_PLUGINS_LIMITED_ACCEL_GENERATOR_H_INCLUDED_ + +#include + +namespace mkt_plugins +{ +/** + * @class LimitedAccelGenerator + * @brief Limits the acceleration in the generated trajectories to a fraction of the simulated time. + */ +class LimitedAccelGenerator : public StandardTrajectoryGenerator +{ +public: + /** + * @brief Constructor + */ + LimitedAccelGenerator(); + /** + * @brief Destructor + */ + virtual ~LimitedAccelGenerator(); + + /** + * @brief Initialize the generator with parameters from NodeHandle + * @param nh NodeHandle for loading acceleration_time parameter + * + * Loads the acceleration_time parameter which limits acceleration to a fraction + * of the simulated time. + */ + void initialize(const robot::NodeHandle& nh) override; + + /** + * @brief Start a new iteration with current velocity + * @param current_velocity Current velocity of the robot + * + * Overrides the base class to apply acceleration limits based on acceleration_time. + */ + void startNewIteration(const robot_nav_2d_msgs::Twist2D& current_velocity) override; + + /** + * @brief Factory function to create a LimitedAccelGenerator instance + * @return Shared pointer to a new LimitedAccelGenerator instance + */ + static score_algorithm::TrajectoryGenerator::Ptr create(); +protected: + double acceleration_time_; +}; +} // namespace mkt_plugins + +#endif // MKT_PLUGINS_LIMITED_ACCEL_GENERATOR_H_INCLUDED_ diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/one_d_velocity_iterator.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/one_d_velocity_iterator.h new file mode 100644 index 0000000..e9ecf68 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/one_d_velocity_iterator.h @@ -0,0 +1,220 @@ +#ifndef MKT_PLUGINS_ONE_D_VELOCITY_ITERATOR_H_INCLUDED_ +#define MKT_PLUGINS_ONE_D_VELOCITY_ITERATOR_H_INCLUDED_ + +#include +#include +#include + +namespace mkt_plugins +{ + + const double EPSILON = 5E-2; + + inline double exponentialFactor(double x, double k = 2.5) + { + x = std::clamp(x, 0.0, 1.0); + return 1.0 - std::exp(-k * x); // tương đương (1 - e^{-kx}) + } + + /** + * @brief Given initial conditions and a time, figure out the end velocity + * + * @param v0 Initial velocity + * @param accel The acceleration rate + * @param decel The decceleration rate + * @param dt Delta time - amount of time to project into the future + * @param target target velocity + * @return The velocity dt seconds after v0. + */ + inline double projectVelocity(double v0, double accel, double decel, double dt, double target) + { + double magnitude; + if (fabs(v0) < EPSILON) + { + // Starting from standstill, always accelerate + if (target >= 0.0) + { + magnitude = fabs(accel); + } + else + { + magnitude = -fabs(accel); + } + } + else if (v0 > 0.0) + { + if (v0 < target) + { + // Acceleration (speed magnitude increases) + magnitude = fabs(accel); + } + else + { + // Deceleration (speed magnitude decreases) + magnitude = -fabs(decel); + } + } + else + { + if (v0 < target) + { + // Deceleration (speed magnitude decreases) + magnitude = fabs(decel); + } + else + { + // Acceleration (speed magnitude increases) + magnitude = -fabs(accel); + } + } + + double delta_v = fabs(target - v0); + double max_v = std::max(fabs(target), 1e-3); + magnitude *= exponentialFactor(delta_v / max_v, 3.0); + double v1 = v0 + magnitude * dt; + + if (magnitude > 0.0) + { + return std::min(target, v1); + } + else + { + return std::max(target, v1); + } + } + + /** + * @class OneDVelocityIterator + * @brief An iterator for generating a number of samples in a range + * + * In its simplest usage, this gives us N (num_samples) different velocities that are reachable + * given our current velocity. However, there is some fancy logic around zero velocities and + * the min/max velocities + * + * If the current velocity is 2 m/s, and the acceleration limit is 1 m/ss and the acc_time is 1 s, + * this class would provide velocities between 1 m/s and 3 m/s. + * + * + * + */ + class OneDVelocityIterator + { + public: + std::string name_; + /** + * @brief Constructor for the velocity iterator + * @param current Current velocity of the robot + * @param direct Direction multiplier (1 for forward, -1 for backward, 0 for stop) + * @param min Minimum velocity allowable + * @param max Maximum velocity allowable + * @param acc_limit Maximum acceleration limit + * @param decel_limit Maximum deceleration limit + * @param acc_time Time delta for velocity projection + * @param num_samples Number of velocity samples to generate + * + * Creates an iterator that generates num_samples velocities reachable from + * current velocity within acc_time seconds, respecting acceleration/deceleration limits. + * The velocities range from min_vel_ to max_vel_ (projected from current velocity). + */ + OneDVelocityIterator( + std::string name, double current, int direct, double min, double max, double acc_limit, double decel_limit, double acc_time, int num_samples) + : name_(name) + { + // if (current < min) + // { + // current = min; + // } + // else if (current > max) + // { + // current = max; + // } + max_vel_ = projectVelocity(current, acc_limit, decel_limit, acc_time, max); + min_vel_ = projectVelocity(current, acc_limit, decel_limit, acc_time, min); + direct_ = direct; + current_ = direct_ > 0 ? max_vel_ : min_vel_; + reset(); + + if (min_vel_ - max_vel_ < EPSILON) + { + increment_ = 1.0; + return; + } + num_samples = std::max(2, num_samples); + + // e.g. for 4 samples, split distance in 3 even parts + increment_ = (max_vel_ - min_vel_) / std::max(1, (num_samples - 1)); + } + + /** + * @brief Get the current velocity value + * @return Current velocity value, or 0.0 if return_zero_now_ is true + * + * Returns the velocity at the current iterator position. + * If the iterator is set to return zero (when crossing zero velocity), + * returns 0.0 instead of the current value. + */ + double getVelocity() const + { + if (return_zero_now_) + return 0.0; + return current_; + } + + /** + * @brief Increment the iterator to the next velocity sample + * @return Reference to this iterator + * + * Moves to the next velocity sample. If the iterator crosses zero velocity + * (from negative to positive), it will return zero velocity on the next call + * to getVelocity() before continuing with positive velocities. + */ + OneDVelocityIterator &operator++() + { + if (return_zero_ && current_ < 0.0 && current_ + increment_ > 0.0 && current_ + increment_ <= max_vel_ + EPSILON) + { + return_zero_now_ = true; + return_zero_ = false; + } + else + { + current_ += increment_; + return_zero_now_ = false; + } + return *this; + } + + /** + * @brief Reset the iterator back to the first velocity + * + * Resets the iterator to the starting velocity (max_vel_ if direct > 0, + * min_vel_ if direct <= 0) and enables zero-velocity return if applicable. + */ + void reset() + { + return_zero_ = true; + return_zero_now_ = false; + } + + /** + * @brief Check if all velocities for this iteration have been returned + * @return True if the iterator has passed beyond the limit velocity + * + * Returns true when the current velocity has exceeded the maximum + * (if direct > 0) or minimum (if direct <= 0) velocity limit. + */ + bool isFinished() const + { + double limit_vel = direct_ > 0? max_vel_ : min_vel_; + return fabs(current_) > fabs(limit_vel) + EPSILON; + } + + private: + bool return_zero_, return_zero_now_; + double min_vel_, max_vel_; + double current_; + double direct_; + double increment_; + }; +} // namespace mkt_plugins + +#endif // MKT_PLUGINS_ONE_D_VELOCITY_ITERATOR_H_INCLUDED diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/simple_goal_checker.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/simple_goal_checker.h new file mode 100644 index 0000000..4acd429 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/simple_goal_checker.h @@ -0,0 +1,77 @@ +#ifndef _MKTPLUGINS_SIMPLE_GOAL_CHECKER_H_INCLUDED__ +#define _MKTPLUGINS_SIMPLE_GOAL_CHECKER_H_INCLUDED__ + +#include +#include + +namespace mkt_plugins +{ + + /** + * @class SimpleGoalChecker + * @brief Goal Checker plugin that only checks the position difference + * + * This class can be stateful if the stateful parameter is set to true (which it is by default). + * This means that the goal checker will not check if the xy position matches again once it is found to be true. + */ + class SimpleGoalChecker : public score_algorithm::GoalChecker + { + public: + /** + * @brief Default constructor + * Initializes default values for goal tolerances and stateful behavior + */ + SimpleGoalChecker(); + + /** + * @brief Initialize the goal checker with parameters from NodeHandle + * @param nh NodeHandle for loading parameters (xy_goal_tolerance, yaw_goal_tolerance, stateful, check_xy) + */ + void initialize(const robot::NodeHandle &nh) override; + + /** + * @brief Reset the state of the goal checker + * Clears any cached state to allow re-checking of goal conditions + */ + void reset() override; + + /** + * @brief Check if the goal has been reached + * @param query_pose Current pose of the robot + * @param goal_pose Target pose to reach + * @param path Path to follow (not used in simple checker) + * @param velocity Current velocity of the robot (not used in simple checker) + * @return True if the robot is within xy_goal_tolerance and yaw_goal_tolerance of the goal + * + * If stateful is true, once xy position matches, it will not check xy again. + * This prevents oscillation when the robot is close to the goal. + */ + bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &query_pose, const robot_nav_2d_msgs::Pose2DStamped &goal_pose, + const robot_nav_2d_msgs::Path2D &path, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Factory function to create a SimpleGoalChecker instance + * @return Shared pointer to a new SimpleGoalChecker instance + */ + static score_algorithm::GoalChecker::Ptr create(); + + protected: + /** + * @brief Internal method to initialize parameters from NodeHandle + * @param nh NodeHandle to load parameters from + * + * Loads xy_goal_tolerance, yaw_goal_tolerance, stateful, and check_xy parameters + */ + void intParam(const robot::NodeHandle& nh); + + robot::NodeHandle nh_; + double xy_goal_tolerance_, yaw_goal_tolerance_; + bool stateful_, check_xy_; + + // Cached squared xy_goal_tolerance_ + double xy_goal_tolerance_sq_; + }; + +} // namespace mkt_plugins + +#endif // _MKTPLUGINS_SIMPLE_GOAL_CHECKER_H_INCLUDED__ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/standard_traj_generator.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/standard_traj_generator.h new file mode 100644 index 0000000..b7480d0 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/standard_traj_generator.h @@ -0,0 +1,205 @@ +#ifndef MKT_PLUGINS_STANDARD_TRAJ_GENERATOR_H_INCLUDED_ +#define MKT_PLUGINS_STANDARD_TRAJ_GENERATOR_H_INCLUDED_ + +#include +#include +#include +#include +#include +#include + +namespace mkt_plugins +{ + /** + * @class StandardTrajectoryGenerator + * @brief Standard MKT-like trajectory generator. + */ + class StandardTrajectoryGenerator : public score_algorithm::TrajectoryGenerator + { + public: + + /** + * @brief Constructor + */ + StandardTrajectoryGenerator(); + + /** + * @brief Destructor + */ + virtual ~StandardTrajectoryGenerator(); + /** + * @brief Initialize the trajectory generator with parameters from NodeHandle + * @param nh NodeHandle for loading configuration parameters + * + * Loads parameters such as sim_time, discretize_by_time, time_granularity, + * linear_granularity, angular_granularity, and include_last_point. + */ + void initialize(const robot::NodeHandle &nh) override; + + /** + * @brief Set the direction array for X, Y, and Theta movement + * @param xytheta_direct Pointer to array of 3 integers representing direction + * (1 for forward/right/clockwise, -1 for backward/left/counterclockwise) + */ + void setDirect(int *xytheta_direct) override; + + /** + * @brief set velocity for x, y asix of the robot + * @param linear the velocity command + * @return True if set is done, false otherwise + */ + bool setTwistLinear(robot_geometry_msgs::Vector3 linear) override; + + /** + * @brief get velocity for x, y asix of the robot + * @param linear The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistLinear(bool direct) override; + + /** + * @brief Set velocity theta for z asix of the robot + * @param angular the command velocity + * @return True if set is done, false otherwise + */ + virtual bool setTwistAngular(robot_geometry_msgs::Vector3 angular) override; + + /** + * @brief Get velocity theta for z asix of the robot + * @param direct The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistAngular(bool direct) override; + + /** + * @brief Start a new iteration with current velocity + * @param current_velocity Current velocity of the robot + * + * Resets the velocity iterator and prepares it to generate velocities + * reachable from the current velocity. + */ + void startNewIteration(const robot_nav_2d_msgs::Twist2D ¤t_velocity) override; + + /** + * @brief Check if there are more velocity samples available + * @return True if there are more valid velocity combinations to iterate + */ + bool hasMoreTwists() override; + + /** + * @brief Get the next velocity sample + * @return Next valid velocity combination + */ + robot_nav_2d_msgs::Twist2D nextTwist() override; + + /** + * @brief Get the current velocity + * @return The current velocity + */ + robot_nav_2d_msgs::Twist2D getTwist() override; + + /** + * @brief Generate a trajectory from start pose to goal + * @param start_pose Starting pose of the robot + * @param transformed_plan Transformed global plan (path to follow) + * @param start_vel Starting velocity of the robot + * @param cmd_vel Command velocity to achieve + * @return Generated trajectory containing poses and velocities over time + * + * Generates a trajectory by: + * 1. Computing velocity steps based on acceleration limits + * 2. Projecting poses forward using kinematic model + * 3. Sampling velocities using the velocity iterator + */ + mkt_msgs::Trajectory2D generateTrajectory(const robot_nav_2d_msgs::Pose2DStamped &start_pose, + const robot_nav_2d_msgs::Path2D &transformed_plan, + const robot_nav_2d_msgs::Twist2D &start_vel, + const robot_nav_2d_msgs::Twist2D &cmd_vel) override; + + /** + * @brief Get the NodeHandle used for kinematics configuration + * @return NodeHandle scoped to kinematics namespace + */ + virtual robot::NodeHandle getNodeHandle() override; + + /** + * @brief Factory function to create a StandardTrajectoryGenerator instance + * @return Shared pointer to a new StandardTrajectoryGenerator instance + */ + static score_algorithm::TrajectoryGenerator::Ptr create(); + + protected: + /** + * @brief Initialize the VelocityIterator pointer. Put in its own function for easy overriding + */ + virtual void initializeIterator(const robot::NodeHandle &nh); + + /** + * @brief Calculate the velocity after a set period of time, given the desired velocity and acceleration limits + * + * @param cmd_vel Desired velocity + * @param start_vel starting velocity + * @param dt amount of time in seconds + * @return new velocity after dt seconds + */ + virtual robot_nav_2d_msgs::Twist2D computeNewVelocity(const robot_nav_2d_msgs::Twist2D &cmd_vel, + const robot_nav_2d_msgs::Twist2D &start_vel, + const double dt); + + /** + * @brief Use the robot's kinematic model to predict new positions for the robot + * + * @param start_pose Starting pose + * @param vel Actual robot velocity (assumed to be within acceleration limits) + * @param dt amount of time in seconds + * @return New pose after dt seconds + */ + virtual robot_geometry_msgs::Pose2D computeNewPosition(const robot_geometry_msgs::Pose2D start_pose, + const robot_nav_2d_msgs::Twist2D &vel, + const double dt); + + /** + * @brief Compute an array of time deltas between the points in the generated trajectory. + * + * @param cmd_vel The desired command velocity + * @return vector of the difference between each time step in the generated trajectory + * + * If we are discretizing by time, the returned vector will be the same constant time_granularity + * for all cmd_vels. Otherwise, you will get times based on the linear/angular granularity. + * + * Right now the vector contains a single value repeated many times, but this method could be overridden + * to allow for dynamic spacing + */ + virtual std::vector getTimeSteps(const robot_nav_2d_msgs::Twist2D &cmd_vel); + + robot::NodeHandle nh_kinematics_; + KinematicParameters::Ptr kinematics_; + std::shared_ptr velocity_iterator_; + + double sim_time_; + + // Sampling Parameters + bool discretize_by_time_; + double time_granularity_; ///< If discretizing by time, the amount of time between each point in the traj + double linear_granularity_; ///< If not discretizing by time, the amount of linear space between points + double angular_granularity_; ///< If not discretizing by time, the amount of angular space between points + + /* Backwards Compatibility Parameter: include_last_point + * + * dwa had an off-by-one error built into it. + * It generated N trajectory points, where N = ceil(sim_time / time_delta). + * If for example, sim_time=3.0 and time_delta=1.5, it would generate trajectories with 2 points, which + * indeed were time_delta seconds apart. However, the points would be at t=0 and t=1.5, and thus the + * actual sim_time was much less than advertised. + * + * This is remedied by adding one final point at t=sim_time, but only if include_last_point_ is true. + * + * Nothing I could find actually used the time_delta variable or seemed to care that the trajectories + * were not projected out as far as they intended. + */ + bool include_last_point_; + }; // class StandardTrajectoryGenerator + +} // namespace dwb_plugins + +#endif // MKT_PLUGINS_STANDARD_TRAJ_GENERATOR_H_INCLUDED_ \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/velocity_iterator.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/velocity_iterator.h new file mode 100644 index 0000000..2d1dbc8 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/velocity_iterator.h @@ -0,0 +1,67 @@ +#ifndef MKT_PLUGINS_VELOCITY_ITERATOR_H_INCLUDED_ +#define MKT_PLUGINS_VELOCITY_ITERATOR_H_INCLUDED_ + +#include +#include +#include + +namespace mkt_plugins +{ +/** + * @class VelocityIterator + * @brief Abstract base class for iterating over valid velocity samples + * + * This interface provides a way to generate and iterate through velocity samples + * that satisfy kinematic constraints. Implementations should generate velocities + * reachable from the current velocity within acceleration limits. + */ +class VelocityIterator +{ +public: + /** + * @brief Virtual destructor + */ + virtual ~VelocityIterator() {} + + /** + * @brief Initialize the iterator with parameters and kinematics + * @param nh NodeHandle for loading configuration parameters + * @param kinematics Shared pointer to kinematic parameters for validation + */ + virtual void initialize(const robot::NodeHandle& nh, KinematicParameters::Ptr kinematics) = 0; + + /** + * @brief Start a new iteration with current velocity and time delta + * @param current_velocity Current velocity of the robot + * @param dt Time delta for velocity projection + * + * Resets the iterator and prepares it to generate velocities reachable + * from the current velocity within dt seconds. + */ + virtual void startNewIteration(const robot_nav_2d_msgs::Twist2D& current_velocity, double dt) = 0; + + /** + * @brief Check if there are more velocity samples available + * @return True if there are more valid velocity combinations to iterate + */ + virtual bool hasMoreTwists() = 0; + + /** + * @brief Get the next velocity sample + * @return Next valid velocity combination + * + * Returns the next velocity sample that satisfies kinematic constraints. + * Should only be called when hasMoreTwists() returns true. + */ + virtual robot_nav_2d_msgs::Twist2D nextTwist() = 0; + + /** + * @brief Get the current velocity + * @return The current velocity + */ + virtual robot_nav_2d_msgs::Twist2D getTwist() = 0; +}; // class VelocityIterator + +} // namespace mkt_plugins + +#endif // MKT_PLUGINS_VELOCITY_ITERATOR_H_INCLUDED_ diff --git a/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/xy_theta_iterator.h b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/xy_theta_iterator.h new file mode 100644 index 0000000..37ecab8 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/include/mkt_plugins/xy_theta_iterator.h @@ -0,0 +1,90 @@ +#ifndef MKT_PLUGINS_XY_THETA_ITERATOR_H_INCLUDED_ +#define MKT_PLUGINS_XY_THETA_ITERATOR_H_INCLUDED_ + +#include +#include +#include + +namespace mkt_plugins +{ + /** + * @class XYThetaIterator + * @brief Iterator that generates velocity samples for X, Y, and Theta dimensions + * + * This iterator combines three OneDVelocityIterator instances (one for each dimension) + * to generate valid velocity combinations that satisfy kinematic constraints. + */ + class XYThetaIterator : public VelocityIterator + { + public: + /** + * @brief Default constructor + * Initializes all iterators to nullptr + */ + XYThetaIterator(); + + /** + * @brief Destructor + */ + virtual ~XYThetaIterator(); + + /** + * @brief Initialize the iterator with parameters and kinematics + * @param nh NodeHandle for loading sampling parameters (vx_samples, vy_samples, vtheta_samples) + * @param kinematics Shared pointer to kinematic parameters for validation + */ + void initialize(const robot::NodeHandle& nh, KinematicParameters::Ptr kinematics) override; + + /** + * @brief Start a new iteration with current velocity and time delta + * @param current_velocity Current velocity of the robot + * @param dt Time delta for velocity projection + * + * Creates new OneDVelocityIterator instances for X, Y, and Theta dimensions + * based on the current velocity and kinematic constraints. + */ + void startNewIteration(const robot_nav_2d_msgs::Twist2D& current_velocity, double dt) override; + + /** + * @brief Check if there are more velocity samples to iterate + * @return True if there are more valid velocity combinations available + */ + bool hasMoreTwists() override; + + /** + * @brief Get the next velocity sample + * @return Next valid velocity combination (x, y, theta) + * + * Returns the next valid velocity that satisfies kinematic constraints. + * Automatically iterates to the next valid velocity if current is invalid. + */ + robot_nav_2d_msgs::Twist2D nextTwist() override; + + /** + * @brief Get the current velocity + * @return The current velocity (x, y, theta) + */ + robot_nav_2d_msgs::Twist2D getTwist() override; + + protected: + /** + * @brief Check if the current velocity combination is valid + * @return True if the current velocity (x_it_, y_it_, th_it_) satisfies kinematic constraints + */ + virtual bool isValidVelocity(); + + /** + * @brief Iterate through velocity samples until a valid combination is found + * + * Increments the iterators (theta first, then y, then x) until a valid + * velocity combination is found or all combinations are exhausted. + */ + void iterateToValidVelocity(); + + int vx_samples_, vy_samples_, vtheta_samples_; + KinematicParameters::Ptr kinematics_; + std::shared_ptr x_it_, y_it_, th_it_; + }; +} // namespace mkt_plugins + +#endif // MKT_PLUGINS_XY_THETA_ITERATOR_H_INCLUDED_ diff --git a/src/Algorithms/Libraries/mkt_plugins/package.xml b/src/Algorithms/Libraries/mkt_plugins/package.xml new file mode 100644 index 0000000..a82e9a3 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/package.xml @@ -0,0 +1,49 @@ + + mkt_plugins + 0.7.10 + + mkt_plugins is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. mkt_plugins + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/mkt_plugins + + catkin + + score_algorithm + score_algorithm + + robot_nav_2d_msgs + robot_nav_2d_msgs + + robot_nav_2d_utils + robot_nav_2d_utils + + robot_nav_core2 + robot_nav_core2 + + geometry_msgs + geometry_msgs + + robot_nav_msgs + robot_nav_msgs + + robot_std_msgs + robot_std_msgs + + robot_sensor_msgs + robot_sensor_msgs + + angles + angles + + \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_plugins/src/equation_line.cpp b/src/Algorithms/Libraries/mkt_plugins/src/equation_line.cpp new file mode 100644 index 0000000..2b142b8 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/src/equation_line.cpp @@ -0,0 +1,118 @@ +#include "mkt_plugins/equation_line.h" +#include +#include + +namespace mkt_plugins +{ + +bool LineGenerator::calculatorEquationLine(robot_geometry_msgs::Pose2D start_point, robot_geometry_msgs::Pose2D end_point) +{ + /** + * Phương trình đường thẳng có dạng: + * (y - yi)/(yj - yi) = (x - xi)/(xj - xi) + */ + Leq_.Gi = start_point; Leq_.Gj = end_point; + Leq_.a = (Leq_.Gj.y - Leq_.Gi.y); + Leq_.b = (Leq_.Gi.x - Leq_.Gj.x); + Leq_.c = (Leq_.Gj.x * Leq_.Gi.y - Leq_.Gi.x * Leq_.Gj.y); + + return Leq_.a != 0 || Leq_.b !=0; +} + +void LineGenerator::calculateErrorLine(float Lm, robot_geometry_msgs::Pose2D pose, bool rev) +{ + float pha = rev? M_PI : 0; + float Yaw_rad = pose.theta - pha; + +/* + * Tính tọa độ điểm R +*/ + float G_xr = float(pose.x); + float G_yr = float(pose.y); + +/* + * Tính tọa độ điểm H +*/ + present_pose_.Gxh = G_xr + Lm * cos(Yaw_rad); + present_pose_.Gyh = G_yr + Lm * sin(Yaw_rad); + +/** + * Phương trình đường thẳng (rh) có dạng: + * (y - yr)/(yh - yr) = (x - xr)/(xh - xr) +*/ + float A_rh = (present_pose_.Gyh - G_yr); + float B_rh = (G_xr - present_pose_.Gxh); + float C_rh = (present_pose_.Gxh * G_yr - G_xr * present_pose_.Gyh); +/* + * Phương trình đường thẳng vuông góc (y - yr)/(yh - yr) = (x - xr)/(xh - xr) + * và đi qua Gh có dạng: + * -B_rh*(x - Gxh) + Arh*(y - Gyh) = 0 +*/ + float A_he = -B_rh; + float B_he = A_rh; + float C_he = (-B_rh) * (-present_pose_.Gxh) + A_rh * (-present_pose_.Gyh); +/* + * Đường thẳng (he) giao với đường thẳng (ij) tại e + * vậy G_xe và G_ye là nghiệm của hệ phương trình 2 ẩn của 2 đường thẳng trên: +*/ + float D = A_he * Leq_.b - Leq_.a * B_he; + float Dx = (-C_he) * Leq_.b - (-Leq_.c) * B_he; + float Dy = A_he * (-Leq_.c) - Leq_.a * (-C_he); +/* + * Tính tọa độ điểm E +*/ + if(D == 0) { + if(Dx + Dy == 0) + { +/* + * Vì hai đường thẳng trùng nhau nên sai số giữa robot và đường đi là bằng 0 +*/ + present_pose_.error_line = 0; + } + else throw NoSolution(); + } + else + { + float G_xe = Dx/D; + float G_ye = Dy/D; +/* + * Tính khoảng cách từ điểm E đến đường thẳng (RH) +*/ + present_pose_.error_line = -(A_rh * G_xe + B_rh * G_ye + C_rh) / (sqrt(pow(A_rh, 2) + pow(B_rh, 2))); + } + // present_pose_.error_line = (Leq.a * present_pose_.Gxh + Leq.b * present_pose_.Gyh + Leq.c) / (sqrt(pow(Leq.a, 2) + pow(Leq.b, 2))); + present_pose_.distance_to_goal = sqrt(pow((Leq_.Gj.x - G_xr),2) + pow((Leq_.Gj.y - G_yr),2)); + present_pose_.distance_to_start = sqrt(pow((Leq_.Gi.x - G_xr),2) + pow((Leq_.Gi.y - G_yr),2)); + + +} + +double LineGenerator::calculateTolerance(const robot_geometry_msgs::Pose2D& query_pose, const robot_geometry_msgs::Pose2D& goal_pose) +{ + /** + * Phương trình đường thẳng có dạng: + * (y - yi)/(yj - yi) = (x - xi)/(xj - xi) + */ + // LineEquation Leq; + // Leq.Gi = query_pose; Leq.Gj = goal_pose; + // Leq.a = (Leq.Gj.y - Leq.Gi.y); + // Leq.b = (Leq.Gi.x - Leq.Gj.x); + // Leq.c = (Leq.Gj.x * Leq.Gi.y - Leq.Gi.x * Leq.Gj.y); + + /** + * Phương trình đường thẳng vuông góc + */ + LineEquation Leq_l; + Leq_l.a = -Leq_.b; + Leq_l.b = Leq_.a; + Leq_l.c = Leq_.b * goal_pose.x - Leq_.a * goal_pose.y; + + present_pose_.distance_to_goal = sqrt(pow((Leq_.Gj.x - query_pose.x),2) + pow((Leq_.Gj.y - query_pose.y),2)); + present_pose_.distance_to_start = sqrt(pow((Leq_.Gi.x - query_pose.x),2) + pow((Leq_.Gi.y - query_pose.y),2)); + present_pose_.distace_start_goal = sqrt(pow((Leq_.Gj.x - Leq_.Gi.x),2) + pow((Leq_.Gj.y - Leq_.Gi.y),2)); + // ROS_INFO_THROTTLE(0.2, "Goal checker %f %f %f %f %f", Leq_.Gj.x, Leq_.Gj.y, Leq_.Gj.theta, query_pose.x, query_pose.y); + + return (Leq_l.a * query_pose.x + Leq_l.b * query_pose.y + Leq_l.c ) / (sqrt(pow(Leq_l.a, 2) + pow(Leq_l.b, 2))); +} + +} // namespace mkt_plugins diff --git a/src/Algorithms/Libraries/mkt_plugins/src/goal_checker.cpp b/src/Algorithms/Libraries/mkt_plugins/src/goal_checker.cpp new file mode 100644 index 0000000..2548090 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/src/goal_checker.cpp @@ -0,0 +1,115 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +mkt_plugins::GoalChecker::GoalChecker() + : nh_(), + line_generator_(nullptr), + yaw_goal_tolerance_(0.25), + xy_goal_tolerance_(0.25), + old_xy_goal_tolerance_(0.0) +{ +} + +void mkt_plugins::GoalChecker::initialize(const robot::NodeHandle &nh) +{ + nh_ = nh; + this->intParam(nh); + robot::log_info_at(__FILE__, __LINE__, "[GoalChecker] xy_goal_tolerance %f yaw_goal_tolerance %f", xy_goal_tolerance_, yaw_goal_tolerance_); + line_generator_ = std::make_shared(); +} + +void mkt_plugins::GoalChecker::intParam(const robot::NodeHandle &nh) +{ + if (!nh.param("xy_goal_tolerance", xy_goal_tolerance_, 0.1)) + { + xy_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "xy_goal_tolerance", 0.1); + } + if (!nh.param("yaw_goal_tolerance", yaw_goal_tolerance_, 0.1)) + { + yaw_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "yaw_goal_tolerance", 0.1); + } +} + +void mkt_plugins::GoalChecker::reset() +{ + old_xy_goal_tolerance_ = 0; +} + +bool mkt_plugins::GoalChecker::isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &query_pose, const robot_nav_2d_msgs::Pose2DStamped &goal_pose, + const robot_nav_2d_msgs::Path2D &path, const robot_nav_2d_msgs::Twist2D &velocity) +{ + this->intParam(nh_); + double dx = query_pose.pose.x - goal_pose.pose.x; + double dy = query_pose.pose.y - goal_pose.pose.y; + double xy_tolerance = std::abs(std::sqrt(dx * dx + dy * dy)); + + if (!path.poses.empty() && path.poses.size() > 2) + { + double theta = angles::normalize_angle(query_pose.pose.theta - goal_pose.pose.theta); + for(int i = path.poses.size() - 1; i >= 0; i--) + { + double dx = path.poses[i].pose.x - path.poses.back().pose .x; + double dy = path.poses[i].pose.y - path.poses.back().pose.y; + if(std::sqrt(dx * dx + dy * dy) > 0.05 // TODO: get resolution from costmap + && fabs(dx) > 1e-6 && fabs(dy) > 1e-6) + { + theta = angles::normalize_angle(query_pose.pose.theta - atan2(dy, dx)); + break; + } + } + double x = cos(goal_pose.pose.theta) * dx + sin(goal_pose.pose.theta) * dy; + double y = -sin(goal_pose.pose.theta) * dx + cos(goal_pose.pose.theta) * dy; + if (xy_tolerance <= xy_goal_tolerance_ + 0.1) + { + double tolerance = fabs(cos(theta)) >= fabs(sin(theta)) ? x : y; + if(fabs(tolerance) <= xy_goal_tolerance_) + { + robot::log_info_at(__FILE__, __LINE__, "%.3f %.3f %.3f %.3f %.3f", fabs(cos(theta)), fabs(sin(theta)),xy_tolerance, xy_goal_tolerance_, yaw_goal_tolerance_); + robot::log_info_at(__FILE__, __LINE__, "Goal checker 1 ok %.3f %.3f %.3f %.3f %.3f ", tolerance, old_xy_goal_tolerance_, x, y, theta); + return true; + } + } + else + old_xy_goal_tolerance_ = fabs(cos(theta)) >= fabs(sin(theta)) ? x : y; + } + else + { + double theta = angles::normalize_angle(query_pose.pose.theta - goal_pose.pose.theta); + double x = cos(goal_pose.pose.theta) * dx + sin(goal_pose.pose.theta) * dy; + double y = -sin(goal_pose.pose.theta) * dx + cos(goal_pose.pose.theta) * dy; + if (xy_tolerance <= xy_goal_tolerance_ + 0.1) + { + double tolerance = fabs(x) > fabs(y) ? x : y; + if( + (fabs(tolerance) <= xy_goal_tolerance_ || tolerance * old_xy_goal_tolerance_ < 0) + ) + { + robot::log_info_at(__FILE__, __LINE__, "%f %f", fabs(cos(theta)), fabs(sin(theta))); + robot::log_info_at(__FILE__, __LINE__, "Goal checker 2 ok %f %f %f %f %f ", tolerance, old_xy_goal_tolerance_, x, y, theta); + return true; + } + } + else + old_xy_goal_tolerance_ = fabs(x) > fabs(y) ? x : y; + } + + if (xy_tolerance <= xy_goal_tolerance_) + { + robot::log_info_at(__FILE__, __LINE__, "Goal checker ok %f %f", xy_tolerance, xy_goal_tolerance_); + return true; + } + return false; +} + +score_algorithm::GoalChecker::Ptr mkt_plugins::GoalChecker::create() +{ + return std::make_shared(); +} + +BOOST_DLL_ALIAS(mkt_plugins::GoalChecker::create, GoalChecker) \ No newline at end of file diff --git a/src/Algorithms/Libraries/mkt_plugins/src/kinematic_parameters.cpp b/src/Algorithms/Libraries/mkt_plugins/src/kinematic_parameters.cpp new file mode 100644 index 0000000..dfd45dd --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/src/kinematic_parameters.cpp @@ -0,0 +1,243 @@ +#include +#include +#include +#include +#include + + +using robot_nav_2d_utils::moveDeprecatedParameter; + +namespace mkt_plugins +{ + + const double EPSILON = 1E-5; + + /** + * @brief Helper function to set the deceleration to the negative acceleration if it was not already set. + * @param nh NodeHandle + * @param dimension String representing the dimension, used in constructing parameter names + */ + void setDecelerationAsNeeded(const robot::NodeHandle &nh, const std::string dimension) + { + std::string decel_param = "decel_lim_" + dimension; + if (nh.hasParam(decel_param)) + return; + + std::string accel_param = "acc_lim_" + dimension; + if (!nh.hasParam(accel_param)) + return; + + double accel; + nh.getParam(accel_param, accel); + nh.setParam(decel_param, -accel); + } + + KinematicParameters::KinematicParameters() + : xytheta_direct_(), + min_vel_x_(0.0), + min_vel_y_(0.0), + max_vel_x_(0.0), + max_vel_y_(0.0), + max_vel_theta_(0.0), + min_speed_xy_(0.0), + max_speed_xy_(0.0), + min_speed_theta_(0.0), + acc_lim_x_(0.0), + acc_lim_y_(0.0), + acc_lim_theta_(0.0), + decel_lim_x_(0.0), + decel_lim_y_(0.0), + decel_lim_theta_(0.0), + min_speed_xy_sq_(0.0), + max_speed_xy_sq_(0.0), + original_min_vel_x_(0.0), + original_min_vel_y_(0.0), + original_max_vel_x_(0.0), + original_max_vel_y_(0.0), + original_max_vel_theta_(0.0), + original_min_speed_xy_(0.0), + original_max_speed_xy_(0.0), + original_min_speed_theta_(0.0), + original_acc_lim_x_(0.0), + original_acc_lim_y_(0.0), + original_acc_lim_theta_(0.0), + original_decel_lim_x_(0.0), + original_decel_lim_y_(0.0), + original_decel_lim_theta_(0.0) + { + } + + KinematicParameters::~KinematicParameters() + { + } + + void KinematicParameters::initialize(const robot::NodeHandle &nh) + { + // Special handling for renamed parameters + moveDeprecatedParameter(nh, "max_vel_theta", "max_rot_vel"); + moveDeprecatedParameter(nh, "min_speed_xy", "min_trans_vel"); + moveDeprecatedParameter(nh, "max_speed_xy", "max_trans_vel"); + moveDeprecatedParameter(nh, "min_speed_theta", "min_rot_vel"); + + // Set the deceleration parameters to negative the acceleration if the deceleration not already specified + setDecelerationAsNeeded(nh, "x"); + setDecelerationAsNeeded(nh, "y"); + setDecelerationAsNeeded(nh, "theta"); + + configure(nh); + xytheta_direct_[0] = xytheta_direct_[1] = xytheta_direct_[2] = 1; + } + + + void KinematicParameters::configure(const robot::NodeHandle &nh) + { + nh.param("max_vel_x", original_max_vel_x_, 0.0); + nh.param("max_vel_y", original_max_vel_y_, 0.0); + nh.param("max_vel_theta", original_max_vel_theta_, 0.0); + nh.param("min_vel_x", original_min_vel_x_, 0.0); + nh.param("min_vel_y", original_min_vel_y_, 0.0); + nh.param("min_speed_xy", original_min_speed_xy_, 0.0); + nh.param("max_speed_xy", original_max_speed_xy_, 0.0); + nh.param("min_speed_theta", original_min_speed_theta_, 0.0); + nh.param("acc_lim_x", original_acc_lim_x_, 0.0); + nh.param("acc_lim_y", original_acc_lim_y_, 0.0); + nh.param("acc_lim_theta", original_acc_lim_theta_, 0.0); + nh.param("decel_lim_x", original_decel_lim_x_, 0.0); + nh.param("decel_lim_y", original_decel_lim_y_, 0.0); + nh.param("decel_lim_theta", original_decel_lim_theta_, 0.0); + reconfigure(nh); + } + + void KinematicParameters::reconfigure(const robot::NodeHandle &nh) + { + nh.param("max_vel_x", max_vel_x_, 0.0); + nh.param("max_vel_y", max_vel_y_, 0.0); + nh.param("max_vel_theta", max_vel_theta_, 0.0); + nh.param("min_vel_x", min_vel_x_, 0.0); + nh.param("min_vel_y", min_vel_y_, 0.0); + nh.param("min_speed_xy", min_speed_xy_, 0.0); + nh.param("max_speed_xy", max_speed_xy_, 0.0); + nh.param("min_speed_theta", min_speed_theta_, 0.0); + nh.param("acc_lim_x", acc_lim_x_, 0.0); + nh.param("acc_lim_y", acc_lim_y_, 0.0); + nh.param("acc_lim_theta", acc_lim_theta_, 0.0); + nh.param("decel_lim_x", decel_lim_x_, 0.0); + nh.param("decel_lim_y", decel_lim_y_, 0.0); + nh.param("decel_lim_theta", decel_lim_theta_, 0.0); + } + + void KinematicParameters::setDirect(int *xytheta_direct) + { + xytheta_direct_[0] = xytheta_direct[0]; + xytheta_direct_[1] = xytheta_direct[1]; + xytheta_direct_[2] = xytheta_direct[2]; + } + + bool KinematicParameters::isValidSpeed(double x, double y, double theta) + { + double vmag_sq = x * x + y * y; + if (max_speed_xy_ >= 0.0 && vmag_sq > max_speed_xy_sq_ + EPSILON) + return false; + if (min_speed_xy_ >= 0.0 && vmag_sq + EPSILON < min_speed_xy_sq_ && + min_speed_theta_ >= 0.0 && fabs(theta) + EPSILON < min_speed_theta_) + return false; + if (vmag_sq == 0.0 && theta == 0.0) + return false; + return true; + } + + int *KinematicParameters::getDirect() { return xytheta_direct_; } + + double KinematicParameters::getMinX() { return min_vel_x_; } + + double KinematicParameters::getMaxX() { return max_vel_x_; } + + double KinematicParameters::getAccX() { return acc_lim_x_; } + + double KinematicParameters::getDecelX() { return decel_lim_x_; } + + double KinematicParameters::getMinY() { return min_vel_y_; } + + double KinematicParameters::getMaxY() { return max_vel_y_; } + + double KinematicParameters::getAccY() { return acc_lim_y_; } + + double KinematicParameters::getDecelY() { return decel_lim_y_; } + + double KinematicParameters::getMinSpeedXY() { return min_speed_xy_; } + + double KinematicParameters::getMinTheta() { return -max_vel_theta_; } + + double KinematicParameters::getMaxTheta() { return max_vel_theta_; } + + double KinematicParameters::getAccTheta() { return acc_lim_theta_; } + + double KinematicParameters::getDecelTheta() { return decel_lim_theta_; } + + double KinematicParameters::getMinSpeedTheta() { return min_speed_theta_; } + + void KinematicParameters::setMinX(double value) + { + min_vel_x_ = fabs(value) < fabs(original_min_vel_x_) + EPSILON ? value : min_vel_x_; + } + + void KinematicParameters::setMaxX(double value) + { + max_vel_x_ = fabs(value) <= fabs(original_max_vel_x_) + EPSILON ? value : original_max_vel_x_; + } + + void KinematicParameters::setAccX(double value) + { + acc_lim_x_ = fabs(value) <= fabs(original_acc_lim_x_) + EPSILON ? value : acc_lim_x_; + } + + void KinematicParameters::setDecelX(double value) + { + decel_lim_x_ = fabs(value) <= fabs(original_decel_lim_x_) + EPSILON ? value : decel_lim_x_; + } + + void KinematicParameters::setMinY(double value) + { + min_vel_y_ = fabs(value) <= fabs(original_min_vel_y_) + EPSILON ? value : min_vel_y_; + } + + void KinematicParameters::setMaxY(double value) + { + max_vel_y_ = fabs(value) <= fabs(original_max_vel_y_) + EPSILON ? value : max_vel_y_; + } + + void KinematicParameters::setAccY(double value) + { + acc_lim_y_ = fabs(value) <= fabs(original_acc_lim_y_) + EPSILON ? value : acc_lim_y_; + } + + void KinematicParameters::setDecelY(double value) + { + decel_lim_y_ = fabs(value) <= fabs(original_decel_lim_y_) + EPSILON ? value : decel_lim_y_; + } + + void KinematicParameters::setMinSpeedXY(double value) + { + min_speed_xy_ = fabs(value) <= fabs(original_min_speed_xy_) + EPSILON ? value : min_speed_xy_; + } + + void KinematicParameters::setMaxTheta(double value) + { + max_vel_theta_ = fabs(value) <= fabs(original_max_vel_theta_) + EPSILON? value : original_max_vel_theta_; + } + + void KinematicParameters::setAccTheta(double value) + { + acc_lim_theta_ = fabs(value) <= fabs(original_acc_lim_theta_) + EPSILON ? value : acc_lim_theta_; + } + + void KinematicParameters::setDecelTheta(double value) + { + decel_lim_theta_ = fabs(value) <= fabs(original_decel_lim_theta_) + EPSILON ? value : decel_lim_theta_; + } + + void KinematicParameters::setMinSpeedTheta(double value) + { + min_speed_theta_ = fabs(value) <= fabs(original_min_speed_theta_) + EPSILON ? value : min_speed_theta_; + } +} // namespace mkt_plugins diff --git a/src/Algorithms/Libraries/mkt_plugins/src/limited_accel_generator.cpp b/src/Algorithms/Libraries/mkt_plugins/src/limited_accel_generator.cpp new file mode 100644 index 0000000..1b6e8c6 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/src/limited_accel_generator.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include + +namespace mkt_plugins +{ + +LimitedAccelGenerator::LimitedAccelGenerator() + : StandardTrajectoryGenerator(), + acceleration_time_(0.0) +{ +} + +LimitedAccelGenerator::~LimitedAccelGenerator() +{ +} + +void LimitedAccelGenerator::initialize(const robot::NodeHandle& nh) +{ + StandardTrajectoryGenerator::initialize(nh); + if (nh.hasParam("sim_period")) + { + nh.getParam("sim_period", acceleration_time_); + } + else + { + double controller_frequency = robot_nav_2d_utils::searchAndGetParam(nh, "controller_frequency", 20.0); + robot::log_warning("[%s:%d] limited_accel_generator: %f", __FILE__, __LINE__, controller_frequency); + if (controller_frequency > 0) + { + acceleration_time_ = 1.0 / controller_frequency; + } + else + { + robot::log_warning_at(__FILE__, __LINE__, "A controller_frequency less than or equal to 0 has been set. " + "Ignoring the parameter, assuming a rate of 20Hz"); + acceleration_time_ = 0.05; + } + } + +} + +void LimitedAccelGenerator::startNewIteration(const robot_nav_2d_msgs::Twist2D& current_velocity) +{ + // Limit our search space to just those within the limited acceleration_time + velocity_iterator_->startNewIteration(current_velocity, acceleration_time_); +} + + score_algorithm::TrajectoryGenerator::Ptr LimitedAccelGenerator::create() + { + return std::make_shared(); + } + +} // namespace mkt_plugins + +BOOST_DLL_ALIAS(mkt_plugins::LimitedAccelGenerator::create, LimitedAccelGenerator) diff --git a/src/Algorithms/Libraries/mkt_plugins/src/simple_goal_checker.cpp b/src/Algorithms/Libraries/mkt_plugins/src/simple_goal_checker.cpp new file mode 100644 index 0000000..fa26177 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/src/simple_goal_checker.cpp @@ -0,0 +1,81 @@ +#include +#include +#include +#include +#include + +namespace mkt_plugins +{ + +SimpleGoalChecker::SimpleGoalChecker() + : nh_(), + xy_goal_tolerance_(0.25), + yaw_goal_tolerance_(0.25), + stateful_(true), + check_xy_(true), + xy_goal_tolerance_sq_(0.0625) +{ +} + +void SimpleGoalChecker::initialize(const robot::NodeHandle& nh) +{ + nh_ = nh; + this->intParam(nh); + robot::log_info_at(__FILE__, __LINE__, "[SimpleGoalChecker] xy_goal_tolerance %f yaw_goal_tolerance %f stateful %x check_xy_ %x" , xy_goal_tolerance_, yaw_goal_tolerance_, stateful_, check_xy_); +} + +void SimpleGoalChecker::intParam(const robot::NodeHandle& nh) +{ + if(!nh.param("xy_goal_tolerance", xy_goal_tolerance_, 0.1)) + { + xy_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "xy_goal_tolerance", 0.1); + } + if(!nh.param("yaw_goal_tolerance", yaw_goal_tolerance_, 0.1)) + { + yaw_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "yaw_goal_tolerance", 0.1); + } + if(nh.param("stateful", stateful_, true)) + { + stateful_ = robot_nav_2d_utils::searchAndGetParam(nh, "stateful", true); + } + robot::log_info_throttle(1.0,"[SimpleGoalChecker] xy_goal_tolerance %f yaw_goal_tolerance %f stateful %x check_xy_ %x" , xy_goal_tolerance_, yaw_goal_tolerance_, stateful_, check_xy_); + xy_goal_tolerance_sq_ = xy_goal_tolerance_ * xy_goal_tolerance_; +} + +void SimpleGoalChecker::reset() +{ + check_xy_ = true; +} + +bool SimpleGoalChecker::isGoalReached(const robot_nav_2d_msgs::Pose2DStamped& query_pose, const robot_nav_2d_msgs::Pose2DStamped& goal_pose, + const robot_nav_2d_msgs::Path2D& path, const robot_nav_2d_msgs::Twist2D& velocity) +{ + this->intParam(nh_); + if (check_xy_) + { + double dx = query_pose.pose.x - goal_pose.pose.x, + dy = query_pose.pose.y - goal_pose.pose.y; + if (dx * dx + dy * dy > 0.25) + { + return false; + } + // We are within the window + // If we are stateful, change the state. + if (stateful_) + { + check_xy_ = false; + } + } + double dyaw = angles::shortest_angular_distance(query_pose.pose.theta, goal_pose.pose.theta); + // robot::log_info_throttle(1.0, "dyaw %f yaw_goal_tolerance_ %f", fabs(dyaw), yaw_goal_tolerance_); + return fabs(dyaw) < yaw_goal_tolerance_; +} + +} // namespace mkt_plugins + +score_algorithm::GoalChecker::Ptr mkt_plugins::SimpleGoalChecker::create() +{ + return std::make_shared(); +} + +BOOST_DLL_ALIAS(mkt_plugins::SimpleGoalChecker::create, SimpleGoalChecker) diff --git a/src/Algorithms/Libraries/mkt_plugins/src/standard_traj_generator.cpp b/src/Algorithms/Libraries/mkt_plugins/src/standard_traj_generator.cpp new file mode 100644 index 0000000..581a835 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/src/standard_traj_generator.cpp @@ -0,0 +1,287 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using robot_nav_2d_utils::loadParameterWithDeprecation; + +namespace mkt_plugins +{ + + StandardTrajectoryGenerator::StandardTrajectoryGenerator() + : nh_kinematics_(), + kinematics_(nullptr), + velocity_iterator_(nullptr), + sim_time_(0.0), + discretize_by_time_(false), + time_granularity_(0.0), + linear_granularity_(0.0), + angular_granularity_(0.0), + include_last_point_(false) + { + } + + StandardTrajectoryGenerator::~StandardTrajectoryGenerator() + { + } + + void StandardTrajectoryGenerator::initialize(const robot::NodeHandle &nh) + { + nh_kinematics_ = nh; + kinematics_ = std::make_shared(); + kinematics_->initialize(nh); + initializeIterator(nh); + + nh.param("sim_time", sim_time_, 1.7); + + nh.param("include_last_point", include_last_point_, true); + /* + * If discretize_by_time, then sim_granularity represents the amount of time that should be between + * two successive points on the trajectory. + * + * If discretize_by_time is false, then sim_granularity is the maximum amount of distance between + * two successive points on the trajectory, and angular_sim_granularity is the maximum amount of + * angular distance between two successive points. + */ + nh.param("discretize_by_time", discretize_by_time_, false); + if (discretize_by_time_) + { + time_granularity_ = loadParameterWithDeprecation(nh, "time_granularity", "sim_granularity", 0.025); + } + else + { + linear_granularity_ = loadParameterWithDeprecation(nh, "linear_granularity", "sim_granularity", 0.025); + angular_granularity_ = loadParameterWithDeprecation(nh, "angular_granularity", "angular_sim_granularity", 0.1); + } + } + + robot::NodeHandle StandardTrajectoryGenerator::getNodeHandle() + { + return nh_kinematics_; + } + + void StandardTrajectoryGenerator::initializeIterator(const robot::NodeHandle &nh) + { + velocity_iterator_ = std::make_shared(); + velocity_iterator_->initialize(nh, kinematics_); + } + + void StandardTrajectoryGenerator::setDirect(int *direct) + { + kinematics_->setDirect(direct); + } + + bool StandardTrajectoryGenerator::setTwistLinear(robot_geometry_msgs::Vector3 linear) + { + try + { + // ROS_INFO("Get linear %f ", linear.x); + if (linear.x > 0) + kinematics_->setMaxX(linear.x); + else if (linear.x < 0) + kinematics_->setMinX(linear.x); + else + { + kinematics_->setMinX(linear.x); + kinematics_->setMaxX(linear.x); + } + + if (linear.y > 0) + kinematics_->setMaxY(linear.y); + else if (linear.y < 0) + kinematics_->setMinY(linear.y); + else + { + kinematics_->setMinY(linear.y); + kinematics_->setMaxY(linear.y); + } + } + catch (const std::exception &e) + { + throw std::exception(e); + return false; + } + + return true; + } + + robot_geometry_msgs::Vector3 StandardTrajectoryGenerator::getTwistLinear(bool direct) + { + robot_geometry_msgs::Vector3 linear; + try + { + if (direct) + { + linear.x = kinematics_->getMaxX(); + linear.y = kinematics_->getMaxY(); + } + else + { + linear.x = kinematics_->getMinX(); + linear.y = kinematics_->getMinY(); + } + } + catch (const std::exception &e) + { + throw std::exception(e); + } + return linear; + } + + bool StandardTrajectoryGenerator::setTwistAngular(robot_geometry_msgs::Vector3 angular) + { + try + { + kinematics_->setMaxTheta(angular.z); + } + catch (const std::exception &e) + { + throw std::exception(e); + return false; + } + return true; + } + + robot_geometry_msgs::Vector3 StandardTrajectoryGenerator::getTwistAngular(bool direct) + { + robot_geometry_msgs::Vector3 angular; + try + { + if (direct) + { + angular.z = kinematics_->getMaxTheta(); + } + else + { + angular.z = kinematics_->getMinTheta(); + } + } + catch (const std::exception &e) + { + throw std::exception(e); + } + return angular; + } + + void StandardTrajectoryGenerator::startNewIteration(const robot_nav_2d_msgs::Twist2D ¤t_velocity) + { + velocity_iterator_->startNewIteration(current_velocity, sim_time_); + } + + bool StandardTrajectoryGenerator::hasMoreTwists() + { + return velocity_iterator_->hasMoreTwists(); + } + + robot_nav_2d_msgs::Twist2D StandardTrajectoryGenerator::nextTwist() + { + return velocity_iterator_->nextTwist(); + } + + robot_nav_2d_msgs::Twist2D StandardTrajectoryGenerator::getTwist() + { + return velocity_iterator_->getTwist(); + } + + std::vector StandardTrajectoryGenerator::getTimeSteps(const robot_nav_2d_msgs::Twist2D &cmd_vel) + { + std::vector steps; + if (discretize_by_time_) + { + steps.resize(ceil(sim_time_ / time_granularity_)); + } + else // discretize by distance + { + double vmag = hypot(cmd_vel.x, cmd_vel.y); + + // the distance the robot would travel in sim_time if it did not change velocity + double projected_linear_distance = vmag * sim_time_; + + // the angle the robot would rotate in sim_time + double projected_angular_distance = fabs(cmd_vel.theta) * sim_time_; + + // Pick the maximum of the two + int num_steps = ceil(std::max(projected_linear_distance / linear_granularity_, + projected_angular_distance / angular_granularity_)); + steps.resize(num_steps); + } + if (steps.size() == 0) + { + steps.resize(1); + } + std::fill(steps.begin(), steps.end(), sim_time_ / steps.size()); + return steps; + } + + mkt_msgs::Trajectory2D StandardTrajectoryGenerator::generateTrajectory(const robot_nav_2d_msgs::Pose2DStamped &start_pose, + const robot_nav_2d_msgs::Path2D &transformed_plan, + const robot_nav_2d_msgs::Twist2D &start_vel, + const robot_nav_2d_msgs::Twist2D &cmd_vel) + { + mkt_msgs::Trajectory2D traj; + traj.velocity = cmd_vel; + + // simulate the trajectory + robot_geometry_msgs::Pose2D pose = start_pose.pose; + robot_nav_2d_msgs::Twist2D vel = start_vel; + double running_time = 0.0; + std::vector steps = getTimeSteps(cmd_vel); + + for (double dt : steps) + { + traj.poses.push_back(pose); + traj.time_offsets.push_back(robot::Duration(running_time)); + // calculate velocities + vel = computeNewVelocity(cmd_vel, vel, dt); + + // update the position of the robot using the velocities passed in + pose = computeNewPosition(pose, vel, dt); + running_time += dt; + } // end for simulation steps + + if (include_last_point_) + { + traj.poses.push_back(pose); + traj.time_offsets.push_back(robot::Duration(running_time)); + } + + return traj; + } + + /** + * change vel using acceleration limits to converge towards sample_target-vel + */ + robot_nav_2d_msgs::Twist2D StandardTrajectoryGenerator::computeNewVelocity(const robot_nav_2d_msgs::Twist2D &cmd_vel, + const robot_nav_2d_msgs::Twist2D &start_vel, const double dt) + { + robot_nav_2d_msgs::Twist2D new_vel; + new_vel.x = projectVelocity(start_vel.x, kinematics_->getAccX(), kinematics_->getDecelX(), dt, cmd_vel.x); + new_vel.y = projectVelocity(start_vel.y, kinematics_->getAccY(), kinematics_->getDecelY(), dt, cmd_vel.y); + new_vel.theta = projectVelocity(start_vel.theta, kinematics_->getAccTheta(), kinematics_->getDecelTheta(), + dt, cmd_vel.theta); + return new_vel; + } + + robot_geometry_msgs::Pose2D StandardTrajectoryGenerator::computeNewPosition(const robot_geometry_msgs::Pose2D start_pose, + const robot_nav_2d_msgs::Twist2D &vel, const double dt) + { + robot_geometry_msgs::Pose2D new_pose; + new_pose.x = start_pose.x + (vel.x * cos(start_pose.theta) + vel.y * cos(M_PI_2 + start_pose.theta)) * dt; + new_pose.y = start_pose.y + (vel.x * sin(start_pose.theta) + vel.y * sin(M_PI_2 + start_pose.theta)) * dt; + new_pose.theta = start_pose.theta + vel.theta * dt; + return new_pose; + } + + score_algorithm::TrajectoryGenerator::Ptr StandardTrajectoryGenerator::create() + { + return std::make_shared(); + } +} // namespace mkt_plugins + +BOOST_DLL_ALIAS(mkt_plugins::StandardTrajectoryGenerator::create, StandardTrajectoryGenerator) diff --git a/src/Algorithms/Libraries/mkt_plugins/src/xy_theta_iterator.cpp b/src/Algorithms/Libraries/mkt_plugins/src/xy_theta_iterator.cpp new file mode 100644 index 0000000..c4de3c0 --- /dev/null +++ b/src/Algorithms/Libraries/mkt_plugins/src/xy_theta_iterator.cpp @@ -0,0 +1,92 @@ +#include +#include +#include + +namespace mkt_plugins +{ +XYThetaIterator::XYThetaIterator() + : vx_samples_(0), + vy_samples_(0), + vtheta_samples_(0), + kinematics_(nullptr), + x_it_(nullptr), + y_it_(nullptr), + th_it_(nullptr) +{ +} + +XYThetaIterator::~XYThetaIterator() +{ +} + +void XYThetaIterator::initialize(const robot::NodeHandle& nh, KinematicParameters::Ptr kinematics) +{ + kinematics_ = kinematics; + nh.param("vx_samples", vx_samples_, 20); + nh.param("vy_samples", vy_samples_, 5); + vtheta_samples_ = robot_nav_2d_utils::loadParameterWithDeprecation(nh, "vtheta_samples", "vth_samples", 20); +} + +void XYThetaIterator::startNewIteration(const robot_nav_2d_msgs::Twist2D& current_velocity, double dt) +{ + x_it_ = std::make_shared("x_it_", current_velocity.x, kinematics_->getDirect()[0], kinematics_->getMinX(), kinematics_->getMaxX(), + kinematics_->getAccX(), kinematics_->getDecelX(), dt, vx_samples_); + + y_it_ = std::make_shared("y_it_", current_velocity.y, kinematics_->getDirect()[1], kinematics_->getMinY(), kinematics_->getMaxY(), + kinematics_->getAccY(), kinematics_->getDecelY(), dt, vy_samples_); + + th_it_ = std::make_shared("th_it_", current_velocity.theta, kinematics_->getDirect()[2], kinematics_->getMinTheta(), kinematics_->getMaxTheta(), + kinematics_->getAccTheta(), kinematics_->getDecelTheta(), dt, vtheta_samples_); +} + +bool XYThetaIterator::hasMoreTwists() +{ + return x_it_ && !x_it_->isFinished(); +} + +robot_nav_2d_msgs::Twist2D XYThetaIterator::nextTwist() +{ + robot_nav_2d_msgs::Twist2D velocity; + velocity.x = x_it_->getVelocity(); + velocity.y = y_it_->getVelocity(); + velocity.theta = th_it_->getVelocity(); + iterateToValidVelocity(); + return velocity; +} + +robot_nav_2d_msgs::Twist2D XYThetaIterator::getTwist() +{ + robot_nav_2d_msgs::Twist2D velocity; + velocity.x = x_it_->getVelocity(); + velocity.y = y_it_->getVelocity(); + velocity.theta = th_it_->getVelocity(); + return velocity; +} + +bool XYThetaIterator::isValidVelocity() +{ + return kinematics_->isValidSpeed(x_it_->getVelocity(), y_it_->getVelocity(), th_it_->getVelocity()); +} + +void XYThetaIterator::iterateToValidVelocity() +{ + bool valid = false; + while (!valid && hasMoreTwists()) + { + ++(*th_it_); + if (th_it_->isFinished()) + { + th_it_->reset(); + ++(*y_it_); + if (y_it_->isFinished()) + { + y_it_->reset(); + ++(*x_it_); + } + } + valid = isValidVelocity(); + } +} + +} // namespace mkt_plugins + diff --git a/src/Algorithms/Packages/actions/dock_pattern_action b/src/Algorithms/Packages/actions/dock_pattern_action new file mode 160000 index 0000000..302dd11 --- /dev/null +++ b/src/Algorithms/Packages/actions/dock_pattern_action @@ -0,0 +1 @@ +Subproject commit 302dd113f3b14a90b4e78a3942baac4454cb5674 diff --git a/src/Algorithms/Packages/global_planners/custom_planner b/src/Algorithms/Packages/global_planners/custom_planner new file mode 160000 index 0000000..6eed3d8 --- /dev/null +++ b/src/Algorithms/Packages/global_planners/custom_planner @@ -0,0 +1 @@ +Subproject commit 6eed3d8772e94f1bb986202690d56c3ddfc304c3 diff --git a/src/Algorithms/Packages/global_planners/dock_planner b/src/Algorithms/Packages/global_planners/dock_planner new file mode 160000 index 0000000..1f04a95 --- /dev/null +++ b/src/Algorithms/Packages/global_planners/dock_planner @@ -0,0 +1 @@ +Subproject commit 1f04a95e1bf40ee0bd65b0d99ff4b663181e6756 diff --git a/src/Algorithms/Packages/global_planners/sbpl_lattice_planner b/src/Algorithms/Packages/global_planners/sbpl_lattice_planner new file mode 160000 index 0000000..6fbc29f --- /dev/null +++ b/src/Algorithms/Packages/global_planners/sbpl_lattice_planner @@ -0,0 +1 @@ +Subproject commit 6fbc29f6d8be815cfcfc4f0c8ec476bc72acd135 diff --git a/src/Algorithms/Packages/global_planners/two_points_planner/CMakeLists.txt b/src/Algorithms/Packages/global_planners/two_points_planner/CMakeLists.txt new file mode 100755 index 0000000..54e76f5 --- /dev/null +++ b/src/Algorithms/Packages/global_planners/two_points_planner/CMakeLists.txt @@ -0,0 +1,176 @@ +cmake_minimum_required(VERSION 3.0.2) +project(two_points_planner VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building two_points_planner with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building two_points_planner with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS filesystem system) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_costmap_2d + robot_nav_core + robot_geometry_msgs + robot_nav_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + tf3 + robot_tf3_geometry_msgs + robot_time + robot_cpp + ) + + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_costmap_2d + robot_nav_core + robot_geometry_msgs + robot_nav_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + robot_tf3_geometry_msgs + robot_time + robot_cpp + ) + + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + find_package(Boost REQUIRED COMPONENTS system) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS robot_costmap_2d robot_nav_core robot_geometry_msgs robot_nav_msgs robot_tf3_geometry_msgs robot_time robot_cpp + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${TF3_INCLUDE_DIR} + ) +endif() + +# ======================================================== +# Libraries +# ======================================================== +add_library(${PROJECT_NAME} SHARED + src/two_points_planner.cpp +) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC ${catkin_LIBRARIES} + PRIVATE Boost::filesystem Boost::system + ${TF3_LIBRARY} + ) + +else() + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::filesystem Boost::system + ${TF3_LIBRARY} + ) + + set_target_properties(${PROJECT_NAME} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +# ======================================================== +# Install +# ======================================================== +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Dependencies: robot_costmap_2d, robot_nav_core, robot_geometry_msgs, robot_nav_msgs, tf3, robot_tf3_geometry_msgs, robot_time, robot_cpp, Boost") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Packages/global_planners/two_points_planner/include/two_points_planner/two_points_planner.h b/src/Algorithms/Packages/global_planners/two_points_planner/include/two_points_planner/two_points_planner.h new file mode 100755 index 0000000..88ace26 --- /dev/null +++ b/src/Algorithms/Packages/global_planners/two_points_planner/include/two_points_planner/two_points_planner.h @@ -0,0 +1,83 @@ + +#ifndef TWO_POINTS_PLANNER_H_INCLUDED +#define TWO_POINTS_PLANNER_H_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace two_points_planner +{ + +/** + * @class TwoPointsPlanner + * @brief Plugin-based flexible global_planner + */ +class TwoPointsPlanner : public robot_nav_core::BaseGlobalPlanner +{ +public: + /** + * @brief Default constructor for the NavFnROS object + */ + TwoPointsPlanner(); + + virtual ~TwoPointsPlanner(){}; + + /** + * @brief Constructor for the TwoPointsPlanner object + * @param name The name of this planner + * @param costmap_robot A pointer to the ROS wrapper of the costmap to use + */ + TwoPointsPlanner(std::string name, robot_costmap_2d::Costmap2DROBOT* costmap_robot); + + /** + * @brief Initialization function for the TwoPointsPlanner object + * @param name The name of this planner + * @param costmap_robot A pointer to the ROS wrapper of the costmap to use + */ + virtual bool initialize(std::string name, + robot_costmap_2d::Costmap2DROBOT* costmap_robot); + + /** + * @brief Given a goal pose in the world, compute a plan + * @param start The start pose + * @param goal The goal pose + * @param plan The plan... filled by the planner + * @return True if a valid plan was found, false otherwise + */ + virtual bool makePlan(const robot_geometry_msgs::PoseStamped& start, + const robot_geometry_msgs::PoseStamped& goal, + std::vector& plan); + + /** + * @brief Create a new TwoPointsPlanner instance + * @return A pointer to the new TwoPointsPlanner instance + */ + static robot_nav_core::BaseGlobalPlanner::Ptr create(); + +protected: + + unsigned char computeCircumscribedCost(); + unsigned char costMapCostToSBPLCost(unsigned char newcost); + + bool initialized_; + unsigned char lethal_obstacle_; + unsigned char inscribed_inflated_obstacle_; + unsigned char circumscribed_cost_; + + bool allow_unknown_; + + std::string name_; + robot_costmap_2d::Costmap2DROBOT* costmap_robot_; /**< manages the cost map for us */ + std::vector footprint_; + unsigned int current_env_width_; + unsigned int current_env_height_; + +}; + +} // namespace two_points_planner + +#endif // TWO_POINTS_PLANNER_H_INCLUDED \ No newline at end of file diff --git a/src/Algorithms/Packages/global_planners/two_points_planner/package.xml b/src/Algorithms/Packages/global_planners/two_points_planner/package.xml new file mode 100644 index 0000000..1384fa4 --- /dev/null +++ b/src/Algorithms/Packages/global_planners/two_points_planner/package.xml @@ -0,0 +1,52 @@ + + two_points_planner + 0.7.10 + + two_points_planner is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. two_points_planner + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/two_points_planner + + catkin + + robot_costmap_2d + robot_costmap_2d + + robot_nav_core + robot_nav_core + + robot_geometry_msgs + robot_geometry_msgs + + robot_nav_msgs + robot_nav_msgs + + robot_nav_2d_msgs + robot_nav_2d_msgs + + robot_nav_2d_utils + robot_nav_2d_utils + + + + + robot_tf3_geometry_msgs + robot_tf3_geometry_msgs + + robot_time + robot_time + + robot_cpp + robot_cpp + + \ No newline at end of file diff --git a/src/Algorithms/Packages/global_planners/two_points_planner/src/two_points_planner.cpp b/src/Algorithms/Packages/global_planners/two_points_planner/src/two_points_planner.cpp new file mode 100755 index 0000000..e02c199 --- /dev/null +++ b/src/Algorithms/Packages/global_planners/two_points_planner/src/two_points_planner.cpp @@ -0,0 +1,246 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace two_points_planner +{ + TwoPointsPlanner::TwoPointsPlanner() + : initialized_(false), + lethal_obstacle_(0), + inscribed_inflated_obstacle_(0), + circumscribed_cost_(0), + allow_unknown_(false), + costmap_robot_(nullptr), + current_env_width_(0), + current_env_height_(0) + { + } + + TwoPointsPlanner::TwoPointsPlanner(std::string name, robot_costmap_2d::Costmap2DROBOT* costmap_robot) + : initialized_(false), costmap_robot_(NULL) + { + initialize(name, costmap_robot); + } + + bool TwoPointsPlanner::initialize(std::string name, robot_costmap_2d::Costmap2DROBOT* costmap_robot) + { + if (!initialized_) + { + robot::NodeHandle nh_priv_("~/" + name); + int lethal_obstacle; + nh_priv_.getParam("lethal_obstacle", lethal_obstacle, 20); + lethal_obstacle_ = (unsigned char)lethal_obstacle; + inscribed_inflated_obstacle_ = lethal_obstacle_ - 1; + + nh_priv_.getParam("allow_unknown", allow_unknown_, true); + + name_ = name; + costmap_robot_ = costmap_robot; + + + + if(!costmap_robot_ || !costmap_robot_->getCostmap()) + { + robot::log_warning("[%s:%d]TwoPointsPlanner Initialized failed", __FILE__, __LINE__); + return false; + } + current_env_width_ = costmap_robot_->getCostmap()->getSizeInCellsX(); + current_env_height_ = costmap_robot_->getCostmap()->getSizeInCellsY(); + footprint_ = costmap_robot_->getRobotFootprint(); + + robot::log_info("size x: %d, size y: %d, resolution: %f", costmap_robot_->getCostmap()->getSizeInCellsX(), costmap_robot_->getCostmap()->getSizeInCellsY(), costmap_robot_->getCostmap()->getResolution()); + + robot::log_info("TwoPointsPlanner Initialized successfully"); + initialized_ = true; + return true; + } + robot::log_info("[%s:%d]\n TwoPointsPlanner: Already initialized", __FILE__, __LINE__); + return true; + } + + unsigned char TwoPointsPlanner::computeCircumscribedCost() + { + unsigned char result = 0; + + + if (!costmap_robot_) + { + std::cerr << "TwoPointsPlanner: Costmap is not initialized" << std::endl; + return 0; + } + + // Bug + // // check if the costmap has an inflation layer + // for (std::vector>::const_iterator layer = costmap_robot_->getLayeredCostmap()->getPlugins()->begin(); + // layer != costmap_robot_->getLayeredCostmap()->getPlugins()->end(); + // ++layer) + // { + // boost::shared_ptr inflation_layer = boost::dynamic_pointer_cast(*layer); + // if (!inflation_layer) + // continue; + + // result = costMapCostToSBPLCost(inflation_layer->computeCost(costmap_robot_->getLayeredCostmap()->getCircumscribedRadius() / costmap_robot_->getCostmap()->getResolution())); + // } + return result; + } + + // Taken from Sachin's sbpl_cart_planner + // This rescales the costmap according to a rosparam which sets the obstacle cost + unsigned char TwoPointsPlanner::costMapCostToSBPLCost(unsigned char newcost) + { + if (newcost == robot_costmap_2d::LETHAL_OBSTACLE || (!allow_unknown_ && newcost == robot_costmap_2d::NO_INFORMATION)) + return lethal_obstacle_; + else if (newcost == robot_costmap_2d::INSCRIBED_INFLATED_OBSTACLE) + return inscribed_inflated_obstacle_; + else if (newcost == 0) + return 0; + else if (newcost == robot_costmap_2d::NO_INFORMATION) + return robot_costmap_2d::FREE_SPACE; + else + { + unsigned char cost = newcost; + if (cost == 0) + cost = 1; + return cost; + } + } + + bool TwoPointsPlanner::makePlan(const robot_geometry_msgs::PoseStamped& start, + const robot_geometry_msgs::PoseStamped& goal, + std::vector& plan) + { + if (!initialized_) + { + robot::log_error("[%s:%d]\n TwoPointsPlanner: Global planner is not initialized", __FILE__, __LINE__); + return false; + } + + robot::Time start_time = robot::Time::now(); + robot::Rate rate(1.0); + while(costmap_robot_->getCostmap()->getSizeInCellsX() == 0 || costmap_robot_->getCostmap()->getSizeInCellsY() == 0){ + robot::log_warning("Waiting for costmap to be initialized..."); + rate.sleep(); + if((robot::Time::now() - start_time).toSec() > 5.0){ + robot::log_error("Costmap not initialized after 10 seconds, exiting..."); + exit(1); + } + } + + robot_nav_2d_msgs::Pose2DStamped start_2d = robot_nav_2d_utils::poseStampedToPose2D(start); + robot_nav_2d_msgs::Pose2DStamped goal_2d = robot_nav_2d_utils::poseStampedToPose2D(goal); + robot::log_info_at(__FILE__, __LINE__, "Making plan from start (%.2f,%.2f,%.2f) to goal (%.2f,%.2f,%.2f)", + start_2d.pose.x, start_2d.pose.y, start_2d.pose.theta, goal_2d.pose.x, goal_2d.pose.y, goal_2d.pose.theta); + + bool do_init = false; + if (current_env_width_ != costmap_robot_->getCostmap()->getSizeInCellsX() || + current_env_height_ != costmap_robot_->getCostmap()->getSizeInCellsY()) + { + robot::log_warning("[%s:%d]\n TwoPointsPlanner: Costmap dimensions have changed from (%u x %u) to (%u x %u), reinitializing two_points_planner.", __FILE__, __LINE__, + current_env_width_, current_env_height_, + costmap_robot_->getCostmap()->getSizeInCellsX(), costmap_robot_->getCostmap()->getSizeInCellsY()); + do_init = true; + } + else if (footprint_ != costmap_robot_->getRobotFootprint()) + { + robot::log_warning("[%s:%d]\n TwoPointsPlanner: Robot footprint has changed, reinitializing two_points_planner.", __FILE__, __LINE__); + do_init = true; + } + + if (do_init) + { + initialized_ = false; + initialize(name_, costmap_robot_); + } + + plan.clear(); + // plan.push_back(start); + + // unsigned int mx_start, my_start; + // unsigned int mx_end, my_end; + // if (!costmap_robot_->getCostmap()->worldToMap(start.pose.position.x, + // start.pose.position.y, + // mx_start, my_start) + + // || !costmap_robot_->getCostmap()->worldToMap(goal.pose.position.x, + // goal.pose.position.y, + // mx_end, my_end)) + // { + // robot::log_error("[%s:%d]\n TwoPointsPlanner: can not convert world to Map 'start point' or 'goal point'", __FILE__, __LINE__); + // return false; + // } + // unsigned char start_cost = costMapCostToSBPLCost(costmap_robot_->getCostmap()->getCost(mx_start, my_start)); + // unsigned char end_cost = costMapCostToSBPLCost(costmap_robot_->getCostmap()->getCost(mx_end, my_end)); + // if (start_cost == costMapCostToSBPLCost(robot_costmap_2d::LETHAL_OBSTACLE) || start_cost == costMapCostToSBPLCost(robot_costmap_2d::INSCRIBED_INFLATED_OBSTACLE) + // || end_cost == costMapCostToSBPLCost(robot_costmap_2d::LETHAL_OBSTACLE) || end_cost == costMapCostToSBPLCost(robot_costmap_2d::INSCRIBED_INFLATED_OBSTACLE)) + // { + // robot::log_error("[%s:%d]\n TwoPointsPlanner: base_pootprint in infated obstacle", __FILE__, __LINE__); + // return false; + // } + robot::Time plan_time = robot::Time::now(); + // Tính toán khoảng cách giữa điểm bắt đầu và điểm đích + const double dx = goal.pose.position.x - start.pose.position.x; + const double dy = goal.pose.position.y - start.pose.position.y; + const double distance = std::sqrt(dx * dx + dy * dy); + double theta; + // Lấy độ phân giải của costmap + double resolution = costmap_robot_->getCostmap()->getResolution(); + + if(fabs(dx) > 1e-9 || fabs(dy) > 1e-9) + { + theta = std::atan2(dy, dx); + // tf3::Quaternion goal_quat(goal.pose.orientation.x, goal.pose.orientation.y, + // goal.pose.orientation.z, goal.pose.orientation.w); + // double goal_theta = tf3::getYaw(goal_quat); + double goal_theta = robot_nav_2d_utils::poseStampedToPose2D(goal).pose.theta; + if(cos(goal_theta - theta) < 0) theta += M_PI; + } + else + { + robot_geometry_msgs::PoseStamped pose = start; + pose.pose.position.x += resolution * cos(theta); + pose.pose.position.y += resolution * sin(theta); + plan.push_back(pose); + plan.push_back(goal); + return true; + } + // Tính số điểm cần chia + int num_points = std::ceil(distance / resolution); + + // Chia nhỏ tuyến đường + for (int i = 0; i <= num_points; i++) + { + double fraction = static_cast(i) / num_points; + + robot_nav_2d_msgs::Pose2DStamped pose2d; + pose2d.header.stamp = plan_time; + pose2d.header.frame_id = costmap_robot_->getGlobalFrameID(); + pose2d.pose.x = start.pose.position.x + fraction * dx; + pose2d.pose.y = start.pose.position.y + fraction * dy; + pose2d.pose.theta = theta; + + // Nội suy hướng + robot_geometry_msgs::PoseStamped pose = robot_nav_2d_utils::pose2DToPoseStamped(pose2d); + plan.push_back(pose); + } + plan.push_back(goal); + return true; + } + + robot_nav_core::BaseGlobalPlanner::Ptr TwoPointsPlanner::create() + { + return std::make_shared(); + } + +} // namespace two_points_planner + +// Register this planner as a GlobalPlanner plugin +BOOST_DLL_ALIAS(two_points_planner::TwoPointsPlanner::create, TwoPointsPlanner) \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/hybrid_local_planner b/src/Algorithms/Packages/local_planners/hybrid_local_planner new file mode 160000 index 0000000..dd7f123 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/hybrid_local_planner @@ -0,0 +1 @@ +Subproject commit dd7f123601e360e91def3ac6ffe0356ac7a65358 diff --git a/src/Algorithms/Packages/local_planners/mppi_local_planner b/src/Algorithms/Packages/local_planners/mppi_local_planner new file mode 160000 index 0000000..19b728f --- /dev/null +++ b/src/Algorithms/Packages/local_planners/mppi_local_planner @@ -0,0 +1 @@ +Subproject commit 19b728f8e239c1bebc78ce17d3b54a1e745c65b1 diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/CMakeLists.txt b/src/Algorithms/Packages/local_planners/pnkx_local_planner/CMakeLists.txt new file mode 100644 index 0000000..9255f4c --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/CMakeLists.txt @@ -0,0 +1,244 @@ +cmake_minimum_required(VERSION 3.0.2) +project(pnkx_local_planner VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building pnkx_local_planner with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building pnkx_local_planner with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS system) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_geometry_msgs + robot_nav_msgs + robot_std_msgs + robot_visualization_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core2 + mkt_msgs + score_algorithm + robot_costmap_2d + tf3 + robot_tf3_geometry_msgs + data_convert + robot_cpp + angles + ) + + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_geometry_msgs + robot_nav_msgs + robot_std_msgs + robot_visualization_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_core2 + mkt_msgs + score_algorithm + robot_costmap_2d + robot_tf3_geometry_msgs + data_convert + robot_cpp + angles + ) + + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + find_package(Boost REQUIRED COMPONENTS system) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} ${PROJECT_NAME}_utils + CATKIN_DEPENDS robot_geometry_msgs robot_nav_msgs robot_std_msgs robot_visualization_msgs robot_nav_2d_msgs robot_nav_2d_utils robot_nav_core2 mkt_msgs score_algorithm robot_costmap_2d robot_tf3_geometry_msgs data_convert robot_cpp angles + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${TF3_INCLUDE_DIR} + ) +endif() + +# ======================================================== +# Libraries +# ======================================================== +# Tạo thư viện utils trước +add_library(${PROJECT_NAME}_utils SHARED + src/transforms.cpp +) + +# Tạo thư viện chính +add_library(${PROJECT_NAME} SHARED + src/pnkx_local_planner.cpp + src/pnkx_go_straight_local_planner.cpp + src/pnkx_rotate_local_planner.cpp + src/pnkx_docking_local_planner.cpp +) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME}_utils ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_include_directories(${PROJECT_NAME}_utils + PUBLIC + $ + $ + ) + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME}_utils + PUBLIC ${catkin_LIBRARIES} + PRIVATE Boost::system + ${TF3_LIBRARY} + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC ${PROJECT_NAME}_utils + PUBLIC ${catkin_LIBRARIES} + PRIVATE Boost::system + ${TF3_LIBRARY} + ) + +else() + + target_include_directories(${PROJECT_NAME}_utils + PUBLIC + $ + $ + ) + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + target_link_libraries(${PROJECT_NAME}_utils + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::system + ) + + target_link_libraries(${PROJECT_NAME} + PUBLIC ${PROJECT_NAME}_utils + PUBLIC + ${PACKAGES_DIR} + PRIVATE + Boost::system + ${TF3_LIBRARY} + ) + + set_target_properties(${PROJECT_NAME}_utils PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + + set_target_properties(${PROJECT_NAME} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +# ======================================================== +# Install +# ======================================================== +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_utils + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + ## Install plugins.xml if it exists + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml) + install(FILES plugins.xml + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + ) + endif() + +else() + + install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_utils + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + ## Install plugins.xml if it exists + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml) + install(FILES plugins.xml + DESTINATION share/${PROJECT_NAME} + ) + endif() + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Libraries: ${PROJECT_NAME}, ${PROJECT_NAME}_utils") + message(STATUS "Dependencies: robot_geometry_msgs, robot_nav_msgs, robot_std_msgs, robot_visualization_msgs, robot_nav_2d_msgs, robot_nav_2d_utils, robot_nav_core2, mkt_msgs, score_algorithm, robot_costmap_2d, tf3, robot_tf3_geometry_msgs, data_convert, robot_cpp, angles, Boost") + message(STATUS "=================================") +endif() diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_docking_local_planner.h b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_docking_local_planner.h new file mode 100644 index 0000000..36b3f23 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_docking_local_planner.h @@ -0,0 +1,182 @@ +#ifndef _PNKX_DOCKING_LOCAL_PLANNER_H_INCLUDED_ +#define _PNKX_DOCKING_LOCAL_PLANNER_H_INCLUDED_ + +#include +#include +#include + +namespace pnkx_local_planner +{ + + /** + * @class PNKXDockingLocalPlanner + * @brief Plugin-based flexible local_planner + */ + class PNKXDockingLocalPlanner : public pnkx_local_planner::PNKXLocalPlanner + { + public: + /** + * @brief Constructor that brings up pluginlib loaders + */ + PNKXDockingLocalPlanner(); + + virtual ~PNKXDockingLocalPlanner(); + + /** + * @brief robot_nav_core2 initialization + * @param name Namespace for this planner + * @param tf TFListener pointer + * @param costmap_robot Costmap pointer + */ + void initialize(robot::NodeHandle &parent, const std::string &name, + TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) override; + + /** + * @brief robot_nav_core2 computeVelocityCommands - calculates the best command given the current pose and velocity + * + * It is presumed that the global plan is already set. + * + * This is mostly a wrapper for the protected computeVelocityCommands + * function which has additional debugging info. + * + * @param pose Current robot pose + * @param velocity Current robot velocity + * @return The best command for the robot to drive + */ + virtual robot_nav_2d_msgs::Twist2DStamped computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief robot_nav_core2 isGoalReached - Check whether the robot has reached its goal, given the current pose & velocity. + * + * The pose that it checks against is the last pose in the current global plan. + * The calculation is delegated to the goal_checker plugin. + * + * @param pose Current pose + * @param velocity Current velocity + * @return True if the robot should be considered as having reached the goal. + */ + virtual bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Create a new instance of the PNKXDockingLocalPlanner + * @return A shared pointer to the new instance + */ + static robot_nav_core2::LocalPlanner::Ptr create(); + + protected: + /** + * @brief robot_nav_core2 initialization other + */ + void initializeOthers() override; + + /** + * @brief get docking maker + */ + void getMaker(); + + /** + * @brief robot_nav_core2 reset other + */ + void reset() override; + + /** + * @brief get parameters + * @param nh NodeHandle to read parameters from + */ + void getParams(robot::NodeHandle &nh) override; + + /** + * @brief Helper method for preparing for the core scoring algorithm + * + * Runs the prepare method on all the critics with freshly transformed data + */ + virtual void prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Iterate through all the twists and find the best one + */ + virtual robot_nav_2d_msgs::Twist2DStamped ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + private: + class DockingPlanner + { + public: + DockingPlanner(const std::string &name); + ~DockingPlanner(); + + /** + * @brief initialization + * @param name Namespace for maker + * @param tf TFListener pointer + * @param costmap_robot Costmap pointer + */ + void initialize(robot::NodeHandle &nh, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, + score_algorithm::TrajectoryGenerator::Ptr traj_generator); + + bool getMakerGoal(robot_nav_2d_msgs::Pose2DStamped &maker_goal); + + bool geLocalGoal(robot_nav_2d_msgs::Pose2DStamped &local_goal); + + bool getLocalPath(const robot_nav_2d_msgs::Pose2DStamped &local_pose, + const robot_nav_2d_msgs::Pose2DStamped &local_goal, robot_nav_msgs::Path &local_path); + + bool initialized_; + bool is_detected_; + bool is_goal_reached_; + bool following_; + bool allow_rotate_; + + double xy_goal_tolerance_; + double yaw_goal_tolerance_; + double min_lookahead_dist_; + double max_lookahead_dist_; + double lookahead_time_; + double angle_threshold_; + + std::string name_; + std::string docking_planner_name_; + std::string docking_nav_name_; + + robot_nav_core::BaseGlobalPlanner::Ptr docking_planner_; + score_algorithm::ScoreAlgorithm::Ptr docking_nav_; + + robot_geometry_msgs::Vector3 linear_; + robot_geometry_msgs::Vector3 angular_; + + private: + /** + * @brief Callback wall timer for detect timeout + */ + virtual void detectedTimeOutCb(const ::robot::WallTimerEvent &timer_event); + + /** + * @brief Callback wall timer for delay + */ + virtual void delayCb(const ::robot::WallTimerEvent &timer_event); + + robot::NodeHandle nh_, nh_priv_; + TFListenerPtr tf_; + robot_costmap_2d::Costmap2DROBOT *costmap_robot_; + score_algorithm::TrajectoryGenerator::Ptr traj_generator_; + std::function docking_planner_loader_; + std::function docking_nav_loader_; + + robot::WallTimer detected_timeout_wt_, delayed_wt_; + bool delayed_; + bool detected_timeout_; + std::string robot_base_frame_, maker_goal_frame_; + }; + + bool start_docking_; + double original_xy_goal_tolerance_, original_yaw_goal_tolerance_; + robot_xmlrpcpp::XmlRpcValue original_papams_; + std::vector dkpl_; + + bool dockingHanlde(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity); + + }; // PNKXDockingLocalPlanner + +} // namespace pnkx_local_planner + +#endif // _PNKX_DOCKING_LOCAL_PLANNER_H_INCLUDED_ \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_go_straight_local_planner.h b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_go_straight_local_planner.h new file mode 100644 index 0000000..f05ccfa --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_go_straight_local_planner.h @@ -0,0 +1,85 @@ +#ifndef _PNKX_GO_STRAIGHT_LOCAL_PLANNER_H_INCLUDED_ +#define _PNKX_GO_STRAIGHT_LOCAL_PLANNER_H_INCLUDED_ + +#include + +namespace pnkx_local_planner +{ + /** + * @class PNKXGoStraightLocalPlanner + * @brief Plugin-based flexible local_planner + */ + class PNKXGoStraightLocalPlanner : public pnkx_local_planner::PNKXLocalPlanner + { + public: + /** + * @brief Constructor that brings up pluginlib loaders + */ + PNKXGoStraightLocalPlanner(); + + virtual ~PNKXGoStraightLocalPlanner(); + + /** + * @brief robot_nav_core2 initialization + * @param name Namespace for this planner + * @param tf TFListener pointer + * @param costmap_robot Costmap pointer + */ + void initialize(robot::NodeHandle &parent, const std::string &name, + TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) override; + + /** + * @brief robot_nav_core2 computeVelocityCommands - calculates the best command given the current pose and velocity + * + * It is presumed that the global plan is already set. + * + * This is mostly a wrapper for the protected computeVelocityCommands + * function which has additional debugging info. + * + * @param pose Current robot pose + * @param velocity Current robot velocity + * @return The best command for the robot to drive + */ + robot_nav_2d_msgs::Twist2DStamped computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief robot_nav_core2 isGoalReached - Check whether the robot has reached its goal, given the current pose & velocity. + * + * The pose that it checks against is the last pose in the current global plan. + * The calculation is delegated to the goal_checker plugin. + * + * @param pose Current pose + * @param velocity Current velocity + * @return True if the robot should be considered as having reached the goal. + */ + bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Create a new instance of the PNKXGoStraightLocalPlanner + * @return A shared pointer to the new instance + */ + static robot_nav_core2::LocalPlanner::Ptr create(); + + protected: + /** + * @brief robot_nav_core2 reset other + */ + virtual void reset() override;; + + /** + * @brief Helper method for preparing for the core scoring algorithm + * + * Runs the prepare method on all the critics with freshly transformed data + */ + void prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Iterate through all the twists and find the best one + */ + robot_nav_2d_msgs::Twist2DStamped ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + }; + +} // namespace pnkx_local_planner +#endif // _PNKX_GO_STRAIGHT_LOCAL_PLANNER_H_INCLUDED_ \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_local_planner.h b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_local_planner.h new file mode 100644 index 0000000..f28d849 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_local_planner.h @@ -0,0 +1,212 @@ +#ifndef _PNKX_LOCAL_PLANNER_H_INCLUDED_ +#define _PNKX_LOCAL_PLANNER_H_INCLUDED_ + +#include +#include +#include +#include +#include +#include + +namespace pnkx_local_planner +{ + + /** + * @class PNKXLocalPlanner + * @brief Plugin-based flexible local_planner + */ + class PNKXLocalPlanner : public robot_nav_core2::LocalPlanner + { + public: + /** + * @brief Constructor that brings up pluginlib loaders + */ + PNKXLocalPlanner(); + + virtual ~PNKXLocalPlanner(); + + /** + * @brief robot_nav_core2 initialization + * @param name Namespace for this planner + * @param tf TFListener pointer + * @param costmap_robot Costmap pointer + */ + void initialize(robot::NodeHandle &parent, const std::string &name, + TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) override; + + /** + * @brief robot_nav_core2 setGoalPose - Sets the global goal pose + * @param goal_pose The Goal Pose + */ + void setGoalPose(const robot_nav_2d_msgs::Pose2DStamped &goal_pose) override; + + /** + * @brief robot_nav_core2 setPlan - Sets the global plan + * @param path The global plan + */ + void setPlan(const robot_nav_2d_msgs::Path2D &path) override; + + /** + * @brief robot_nav_core2 getPlan - Gets the current global plan + * @param path The global plan + */ + void getPlan(robot_nav_2d_msgs::Path2D &path) override; + + /** + * @brief robot_nav_core2 getGlobalPlan - Gets the current global plan + * @param path The global plan + */ + void getGlobalPlan(robot_nav_2d_msgs::Path2D &path) override; + + /** + * @brief robot_nav_core2 computeVelocityCommands - calculates the best command given the current pose and velocity + * + * It is presumed that the global plan is already set. + * + * This is mostly a wrapper for the protected computeVelocityCommands + * function which has additional debugging info. + * + * @param pose Current robot pose + * @param velocity Current robot velocity + * @return The best command for the robot to drive + */ + robot_nav_2d_msgs::Twist2DStamped computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief set velocity for x, y asix of the robot + * @param linear the velocity command + * @return True if set is done, false otherwise + */ + bool setTwistLinear(robot_geometry_msgs::Vector3 linear) override; + + /** + * @brief get velocity for x, y asix of the robot + * @param linear The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistLinear(bool direct) override; + + /** + * @brief Set velocity theta for z asix of the robot + * @param angular the command velocity + * @return True if set is done, false otherwise + */ + virtual bool setTwistAngular(robot_geometry_msgs::Vector3 angular) override; + + /** + * @brief Get velocity theta for z asix of the robot + * @param direct The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistAngular(bool direct) override; + + /** + * @brief Check if the kinematic parameters are currently locked + * @return True if the kinematic parameters are locked, false otherwise + * + * This function indicates whether the kinematic parameters (e.g., velocities, accelerations, or direction settings) are in a locked state, preventing modifications. If the parameters are locked during in-place rotation, it could prevent updates to the direction or velocity, potentially causing inconsistencies in motion commands that lead to odometry errors and localization jumps in AMCL. + */ + virtual bool islock() override; + + /** + * @brief robot_nav_core2 isGoalReached - Check whether the robot has reached its goal, given the current pose & velocity. + * + * The pose that it checks against is the last pose in the current global plan. + * The calculation is delegated to the goal_checker plugin. + * + * @param pose Current pose + * @param velocity Current velocity + * @return True if the robot should be considered as having reached the goal. + */ + bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Create a new PNKXLocalPlanner + * @return A shared pointer to the new PNKXLocalPlanner + */ + static robot_nav_core2::LocalPlanner::Ptr create(); + + protected: + /** + * @brief Lock the kinematic parameters to prevent modifications + * + * This function sets the kinematic parameters to a locked state, ensuring that values such as direction (xytheta_direct), velocities, or accelerations cannot be changed until unlocked. Locking during critical operations like in-place rotation may stabilize motion commands but could cause issues if the lock persists too long, preventing necessary updates to odometry data used by AMCL. + */ + virtual void lock(); + + /** + * @brief Unlock the kinematic parameters to allow modifications + * + * This function releases the lock on kinematic parameters, allowing changes to values such as direction, velocities, or accelerations. If the parameters are unlocked prematurely during in-place rotation, sudden changes to motion parameters (e.g., theta direction) could lead to odometry discontinuities, contributing to localization jumps in AMCL. + */ + virtual void unlock(); + /** + * @brief robot_nav_core2 initialization other + */ + virtual void initializeOthers(); + + /** + * @brief robot_nav_core2 reset other + */ + virtual void reset(); + + /** + * @brief Get parameters + * @param nh NodeHandle to read parameters from + */ + virtual void getParams(robot::NodeHandle &nh); + + /** + * @brief Helper method for preparing for the core scoring algorithm + * + * Runs the prepare method on all the critics with freshly transformed data + */ + virtual void prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity); + + /** + * @brief Iterate through all the twists and find the best one + */ + virtual robot_nav_2d_msgs::Twist2DStamped ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity); + + /** + * @brief Helper method to transform a given pose to the local costmap frame. + */ + robot_nav_2d_msgs::Pose2DStamped transformPoseToLocal(const robot_nav_2d_msgs::Pose2DStamped &pose); + + // Plugin handling + std::function traj_gen_loader_; + score_algorithm::TrajectoryGenerator::Ptr traj_generator_; + + std::function nav_algorithm_loader_; + score_algorithm::ScoreAlgorithm::Ptr nav_algorithm_; + std::function rotate_algorithm_loader_; + score_algorithm::ScoreAlgorithm::Ptr rotate_algorithm_; + + std::function goal_checker_loader_; + score_algorithm::GoalChecker::Ptr goal_checker_; + + bool initialized_; + TFListenerPtr tf_; + std::string name_; + robot::NodeHandle parent_, planner_nh_; + robot_nav_2d_msgs::Path2D global_plan_; ///< Saved Global Plan + robot_nav_2d_msgs::Path2D transformed_global_plan_; + robot_nav_2d_msgs::Path2D local_plan_; + robot_nav_2d_msgs::Pose2DStamped goal_pose_; ///< Saved Goal Pose + + robot_costmap_2d::Costmap2D *costmap_; + robot_costmap_2d::Costmap2DROBOT *costmap_robot_; + nav_grid::NavGridInfo info_; + boost::recursive_mutex configuration_mutex_; + bool update_costmap_before_planning_; + + bool ret_angle_, ret_nav_; + double yaw_goal_tolerance_, xy_goal_tolerance_; + bool lock_; + + }; // PNKXLocalPlanner + +} // namespace pnkx_local_planner + +#endif // _PNKX_LOCAL_PLANNER_H_INCLUDED_ \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_rotate_local_planner.h b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_rotate_local_planner.h new file mode 100644 index 0000000..8e3cf8a --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/pnkx_rotate_local_planner.h @@ -0,0 +1,85 @@ +#ifndef _PNKX_ROTATE_LOCAL_PLANNER_H_INCLUDED_ +#define _PNKX_ROTATE_LOCAL_PLANNER_H_INCLUDED_ + +#include + +namespace pnkx_local_planner +{ + /** + * @class PNKXRotateLocalPlanner + * @brief Plugin-based flexible local_planner + */ + class PNKXRotateLocalPlanner : public pnkx_local_planner::PNKXLocalPlanner + { + public: + /** + * @brief Constructor that brings up pluginlib loaders + */ + PNKXRotateLocalPlanner(); + + virtual ~PNKXRotateLocalPlanner(); + + /** + * @brief robot_nav_core2 initialization + * @param name Namespace for this planner + * @param tf TFListener pointer + * @param costmap_robot Costmap pointer + */ + void initialize(robot::NodeHandle &parent, const std::string &name, + TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) override; + + /** + * @brief robot_nav_core2 computeVelocityCommands - calculates the best command given the current pose and velocity + * + * It is presumed that the global plan is already set. + * + * This is mostly a wrapper for the protected computeVelocityCommands + * function which has additional debugging info. + * + * @param pose Current robot pose + * @param velocity Current robot velocity + * @return The best command for the robot to drive + */ + robot_nav_2d_msgs::Twist2DStamped computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief robot_nav_core2 isGoalReached - Check whether the robot has reached its goal, given the current pose & velocity. + * + * The pose that it checks against is the last pose in the current global plan. + * The calculation is delegated to the goal_checker plugin. + * + * @param pose Current pose + * @param velocity Current velocity + * @return True if the robot should be considered as having reached the goal. + */ + bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Create a new instance of the PNKXRotateLocalPlanner + * @return A shared pointer to the new instance + */ + static robot_nav_core2::LocalPlanner::Ptr create(); + + protected: + /** + * @brief robot_nav_core2 reset other + */ + virtual void reset() override; + + /** + * @brief Helper method for preparing for the core scoring algorithm + * + * Runs the prepare method on all the critics with freshly transformed data + */ + void prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + /** + * @brief Iterate through all the twists and find the best one + */ + robot_nav_2d_msgs::Twist2DStamped ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) override; + + }; +} + +#endif // _PNKX_ROTATE_LOCAL_PLANNER_H_INCLUDED_ diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/transforms.h b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/transforms.h new file mode 100644 index 0000000..4c7cd12 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/include/pnkx_local_planner/transforms.h @@ -0,0 +1,50 @@ +#ifndef _MKT_LOCAL_PLANNER_TRANSFORMS_CHECKER_H_INCLUDED__ +#define _MKT_LOCAL_PLANNER_TRANSFORMS_CHECKER_H_INCLUDED__ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +namespace pnkx_local_planner +{ + bool getPose(TFListenerPtr tf, std::string base_frame_id, std::string global_frame, + robot_nav_2d_msgs::Pose2DStamped &global_pose, double transform_tolerance = 2.0); + + bool transformGlobalPose(TFListenerPtr tf, const std::string &global_frame, + const robot_nav_2d_msgs::Pose2DStamped &stamped_pose, robot_nav_2d_msgs::Pose2DStamped &newer_pose); + + double getSquareDistance(const robot_geometry_msgs::Pose2D &pose_a, const robot_geometry_msgs::Pose2D &pose_b); + + /** + * @brief Transforms the global plan of the robot from the planner frame to the local frame (modified). + * + * The method replaces transformGlobalPlan as defined in base_local_planner/goal_functions.h + * such that the index of the current goal pose is returned as well as + * the transformation between the global plan and the planning frame. + * @param tf A reference to a tf buffer + * @param global_plan The plan to be transformed + * @param pose The pose of the robot + * @param costmap A reference to the costmap being used so the window size for transforming can be computed + * @param global_frame The frame to transform the plan to + * @param max_plan_length Specify maximum length (cumulative Euclidean distances) of the transformed plan [if <=0: disabled; the length is also bounded by the local costmap size!] + * @param[out] transformed_plan Populated with the transformed plan + * @return \c true if the global plan is transformed, \c false otherwise + */ + bool transformGlobalPlan( + TFListenerPtr tf, const robot_nav_2d_msgs::Path2D &global_plan, const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_costmap_2d::Costmap2DROBOT *costmap, const std::string &global_frame, double max_plan_length, + robot_nav_2d_msgs::Path2D &transformed_plan, const bool from_global_frame = false); + +} + +#endif \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/package.xml b/src/Algorithms/Packages/local_planners/pnkx_local_planner/package.xml new file mode 100644 index 0000000..f2495cd --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/package.xml @@ -0,0 +1,67 @@ + + pnkx_local_planner + 0.7.10 + + pnkx_local_planner is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. pnkx_local_planner + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/pnkx_local_planner + + catkin + + robot_geometry_msgs + robot_geometry_msgs + + robot_nav_msgs + robot_nav_msgs + + robot_std_msgs + robot_std_msgs + + robot_visualization_msgs + robot_visualization_msgs + + robot_nav_2d_msgs + robot_nav_2d_msgs + + robot_nav_2d_utils + robot_nav_2d_utils + + robot_nav_core2 + robot_nav_core2 + + mkt_msgs + mkt_msgs + + score_algorithm + score_algorithm + + robot_costmap_2d + robot_costmap_2d + + + + + robot_tf3_geometry_msgs + robot_tf3_geometry_msgs + + data_convert + data_convert + + robot_cpp + robot_cpp + + angles + angles + + \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_docking_local_planner.cpp b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_docking_local_planner.cpp new file mode 100644 index 0000000..f09d811 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_docking_local_planner.cpp @@ -0,0 +1,835 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +pnkx_local_planner::PNKXDockingLocalPlanner::PNKXDockingLocalPlanner() + : PNKXLocalPlanner(), + start_docking_(false), + original_xy_goal_tolerance_(0.0), + original_yaw_goal_tolerance_(0.0) +{ +} + +pnkx_local_planner::PNKXDockingLocalPlanner::~PNKXDockingLocalPlanner() +{ + if (traj_generator_) + traj_generator_.reset(); + + if (nav_algorithm_) + nav_algorithm_.reset(); + + if (rotate_algorithm_) + rotate_algorithm_.reset(); + + if (goal_checker_) + goal_checker_.reset(); +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::initialize(robot::NodeHandle &parent, const std::string &name, + TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) +{ + if (!initialized_) + { + tf_ = tf; + name_ = name; + costmap_robot_ = costmap_robot; + costmap_ = costmap_robot_->getCostmap(); + + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); + + parent_ = parent; + planner_nh_ = robot::NodeHandle(parent_, name); + robot::log_info_at(__FILE__, __LINE__, "Planner namespace: %s, parent namespace: %s", planner_nh_.getNamespace().c_str(), parent_.getNamespace().c_str()); + this->getParams(planner_nh_); + + std::string traj_generator_name; + planner_nh_.param("trajectory_generator_name", traj_generator_name, std::string("StandardTrajectoryGenerator")); + robot::log_info_at(__FILE__, __LINE__, "Using Trajectory Generator \"%s\"", traj_generator_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(traj_generator_name); + traj_gen_loader_ = boost::dll::import_alias( + path_file_so, traj_generator_name, boost::dll::load_mode::append_decorations); + traj_generator_ = traj_gen_loader_(); + if (!traj_generator_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create trajectory generator \"%s\": returned null pointer", traj_generator_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + robot::NodeHandle nh_traj_gen = robot::NodeHandle(parent_, traj_generator_name); + traj_generator_->initialize(nh_traj_gen); + robot::log_info_at(__FILE__, __LINE__, "Successfully initialized trajectory generator \"%s\"", traj_generator_name.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s traj_generator, are you sure it is properly registered and that the containing library is built? Exception: %s", traj_generator_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + + std::string algorithm_nav_name; + planner_nh_.getParam("algorithm_nav_name", algorithm_nav_name, std::string("pnkx_local_planner::PTA")); + robot::log_info_at(__FILE__, __LINE__, "Using Algorithm \"%s\"", algorithm_nav_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(algorithm_nav_name); + nav_algorithm_loader_ = boost::dll::import_alias( + path_file_so, algorithm_nav_name, boost::dll::load_mode::append_decorations); + nav_algorithm_ = nav_algorithm_loader_(); + if (!nav_algorithm_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to load algorithm %s", algorithm_nav_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + nav_algorithm_->initialize(parent_, algorithm_nav_name, tf, costmap_robot_, traj_generator_); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s algorithm , are you sure it is properly registered and that the containing library is built? Exception: %s", algorithm_nav_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + + std::string algorithm_rotate_name; + planner_nh_.param("algorithm_rotate_name", algorithm_rotate_name, std::string("MKTAlgorithmDiffRotateToGoal")); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(algorithm_rotate_name); + rotate_algorithm_loader_ = boost::dll::import_alias( + path_file_so, algorithm_rotate_name, boost::dll::load_mode::append_decorations); + rotate_algorithm_ = rotate_algorithm_loader_(); + if (!rotate_algorithm_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create rotate algorithm \"%s\": returned null pointer", algorithm_rotate_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create rotate algorithm"); + } + rotate_algorithm_->initialize(parent_, algorithm_rotate_name, tf, costmap_robot_, traj_generator_); + robot::log_info_at(__FILE__, __LINE__, "Successfully initialized rotate algorithm \"%s\"", algorithm_rotate_name.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s rotate algorithm, are you sure it is properly registered and that the containing library is built? Exception: %s", algorithm_rotate_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create rotate algorithm"); + } + + std::string goal_checker_name; + planner_nh_.param("goal_checker_name", goal_checker_name, std::string("dwb_plugins::SimpleGoalChecker")); + robot::log_info_at(__FILE__, __LINE__, "goal_checker_name: %s", goal_checker_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(goal_checker_name); + goal_checker_loader_ = boost::dll::import_alias( + path_file_so, goal_checker_name, boost::dll::load_mode::append_decorations); + goal_checker_ = goal_checker_loader_(); + if (!goal_checker_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create goal checker \"%s\": returned null pointer", goal_checker_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + goal_checker_->initialize(parent_); + robot::log_info_at(__FILE__, __LINE__, "Successfully initialized goal checker \"%s\"", goal_checker_name.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Unexpected exception while creating goal checker \"%s\": %s", goal_checker_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + + this->initializeOthers(); + this->getMaker(); + robot::log_info_at(__FILE__, __LINE__, "%s is sucessed", name.c_str()); + initialized_ = true; + } +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::getMaker() +{ + std::string maker_name, maker_sources; + parent_.param("maker_name", maker_name, std::string("")); + parent_.param("maker_sources", maker_sources, std::string("")); + robot::log_info_at(__FILE__, __LINE__, "maker_name: %s", maker_name.c_str()); + robot::log_info_at(__FILE__, __LINE__, "maker_sources: %s", maker_sources.c_str()); + std::stringstream ss(maker_sources); + std::string source; + + while (ss >> source) + { + if (maker_name == source) + { + robot::NodeHandle source_node(parent_, source); + + if (source_node.hasParam("plugins")) + { + robot_xmlrpcpp::XmlRpcValue plugins; + source_node.getParam("plugins", plugins); + + if (plugins.getType() == robot_xmlrpcpp::XmlRpcValue::TypeArray) + { + for (int i = 0; i < plugins.size(); ++i) + { + if (plugins[i].getType() == robot_xmlrpcpp::XmlRpcValue::TypeStruct) + { + std::stringstream name; + name << source << "/" << static_cast(plugins[i]["name"]); + std::string docking_planner_name = static_cast(plugins[i]["docking_planner"]); + std::string docking_nav_name = static_cast(plugins[i]["docking_nav"]); + // std::shared_ptr dkpl = std::make_shared(name.str()); + DockingPlanner* dkpl = new DockingPlanner(name.str()); + dkpl->docking_planner_name_ = docking_planner_name; + dkpl->docking_nav_name_ = docking_nav_name; + dkpl_.push_back(dkpl); + } + } + } + else + { + robot::log_warning_at(__FILE__, __LINE__, "Expected 'plugins' to be an array under namespace [%s]", source.c_str()); + } + } + else + { + robot::log_warning_at(__FILE__, __LINE__, "No 'plugins' found under namespace [%s]", source.c_str()); + } + break; + } + } +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::initializeOthers() +{ + std::string algorithm_nav_name; + planner_nh_.param("algorithm_nav_name", algorithm_nav_name, std::string("pnkx_local_planner::PTA")); + if (!parent_.getParam(algorithm_nav_name, original_papams_)) + robot::log_warning_at(__FILE__, __LINE__, "No found in %s in yaml-file, please check configuration", algorithm_nav_name.c_str()); + original_xy_goal_tolerance_ = xy_goal_tolerance_; + original_yaw_goal_tolerance_ = yaw_goal_tolerance_; +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::getParams(robot::NodeHandle &nh) +{ + // This is needed when using the CostmapAdapter to ensure that the costmap's info matches the rolling window + nh.param("update_costmap_before_planning", update_costmap_before_planning_, true); + if (!nh.param("xy_goal_tolerance", xy_goal_tolerance_, 0.1)) + { + xy_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "xy_goal_tolerance", 0.1); + } + if (!nh.param("yaw_goal_tolerance", yaw_goal_tolerance_, 0.1)) + { + yaw_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "yaw_goal_tolerance", 0.1); + } +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::reset() +{ + robot::log_info_at(__FILE__, __LINE__, "New Docking Goal Received."); + this->unlock(); + if(traj_generator_) traj_generator_->reset(); + if(goal_checker_) goal_checker_->reset(); + if(nav_algorithm_) nav_algorithm_->reset(); + if(rotate_algorithm_) rotate_algorithm_->reset(); + ret_nav_ = ret_angle_ = false; + + std::string algorithm_nav_name; + planner_nh_.param("algorithm_nav_name", algorithm_nav_name, std::string("pnkx_local_planner::PTA")); + + parent_.setParam(algorithm_nav_name, original_papams_); + robot::NodeHandle nh_algorithm = robot::NodeHandle(parent_, algorithm_nav_name); + nh_algorithm.setParam("allow_rotate", false); +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + this->getParams(planner_nh_); + if (update_costmap_before_planning_) + { + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); + } + + // Update time stamp of goal pose + // goal_pose_.header.stamp = pose.header.stamp; + robot_nav_2d_msgs::Pose2DStamped local_start_pose = this->transformPoseToLocal(pose), + local_goal_pose = this->transformPoseToLocal(goal_pose_); + if (start_docking_) + { + local_goal_pose = goal_pose_; + } + + try + { + if (!pnkx_local_planner::transformGlobalPlan(tf_, global_plan_, local_start_pose, costmap_robot_, costmap_robot_->getGlobalFrameID(), 2.0, transformed_global_plan_)) + robot::log_warning_at(__FILE__, __LINE__, "Transform global plan is failed"); + } + catch(const robot_nav_core2::LocalPlannerException& e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } + + double x_direction, y_direction, theta_direction; + if (!ret_nav_) + { + if (!nav_algorithm_->prepare(local_start_pose, velocity, local_goal_pose, transformed_global_plan_, x_direction, y_direction, theta_direction)) + { + robot::log_warning_at(__FILE__, __LINE__, "Algorithm \"%s\" failed to prepare", nav_algorithm_->getName().c_str()); + throw robot_nav_core2::LocalPlannerException("Algorithm failed to prepare"); + } + // else + // ROS_INFO_THROTTLE(0.2, "chieu %f %f %f", x_direction, y_direction, theta_direction); + + if (!dkpl_.empty() && dkpl_.front()->initialized_ && dkpl_.front()->is_detected_ && !dkpl_.front()->is_goal_reached_) + { + this->lock(); + robot_geometry_msgs::Vector3 linear = dkpl_.front()->linear_; + traj_generator_->setTwistLinear(linear); + linear.x *= (-1); + traj_generator_->setTwistLinear(linear); + traj_generator_->setTwistAngular(dkpl_.front()->angular_); + + std::string algorithm_nav_name; + planner_nh_.param("algorithm_nav_name", algorithm_nav_name, std::string("pnkx_local_planner::PTA")); + robot::NodeHandle nh_algorithm = robot::NodeHandle(parent_, algorithm_nav_name); + nh_algorithm.setParam("allow_rotate", dkpl_.front()->allow_rotate_); + nh_algorithm.setParam("min_lookahead_dist", dkpl_.front()->min_lookahead_dist_); + nh_algorithm.setParam("max_lookahead_dist", dkpl_.front()->max_lookahead_dist_); + nh_algorithm.setParam("lookahead_time", dkpl_.front()->lookahead_time_); + nh_algorithm.setParam("angle_threshold", dkpl_.front()->angle_threshold_); + + parent_.setParam("xy_goal_tolerance", dkpl_.front()->xy_goal_tolerance_); + parent_.setParam("yaw_goal_tolerance", dkpl_.front()->yaw_goal_tolerance_); + + if (dkpl_.front()->docking_nav_ && !dkpl_.front()->docking_planner_) + { + + if (dkpl_.front()->following_) + { + robot_nav_2d_msgs::Pose2DStamped follow_pose; + if (dkpl_.front()->geLocalGoal(local_goal_pose)) + { + local_goal_pose = follow_pose; + } + } + if (!dkpl_.front()->docking_nav_->prepare(local_start_pose, velocity, local_goal_pose, transformed_global_plan_, x_direction, y_direction, theta_direction)) + { + throw robot_nav_core2::LocalPlannerException("Algorithm failed to prepare"); + robot::log_warning_at(__FILE__, __LINE__, "Algorithm \"%s\" failed to prepare", nav_algorithm_->getName().c_str()); + } + } + } + } + else + { + if (!rotate_algorithm_->prepare(local_start_pose, velocity, local_goal_pose, transformed_global_plan_, x_direction, y_direction, theta_direction)) + { + throw robot_nav_core2::LocalPlannerException("Algorithm failed to prepare"); + robot::log_warning_at(__FILE__, __LINE__, "Algorithm \"%s\" failed to prepare", rotate_algorithm_->getName().c_str()); + } + // else + // ROS_INFO("chieu %f %f %f", x_direction, y_direction, theta_direction); + } + + int xytheta_direct[3]; + xytheta_direct[0] = x_direction != 0 ? fabs(x_direction) / x_direction : 0; + xytheta_direct[1] = y_direction != 0 ? fabs(y_direction) / y_direction : 0; + xytheta_direct[2] = theta_direction != 0 ? fabs(theta_direction) / theta_direction : 0; + traj_generator_->setDirect(xytheta_direct); +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXDockingLocalPlanner::computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_nav_2d_msgs::Twist2D &velocity) +{ + // boost::recursive_mutex::scoped_lock l(configuration_mutex_); + robot::log_error("DEBUG 300"); + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + try + { + if (global_plan_.poses.empty()) + return cmd_vel; + this->prepare(pose, velocity); + cmd_vel = this->ScoreAlgorithm(pose, velocity); + return cmd_vel; + } + catch (const robot_nav_core2::PlannerException &e) + { + robot::log_warning_at(__FILE__, __LINE__, "%s", e.what()); + throw robot_nav_core2::LocalPlannerException(e.what()); + } +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXDockingLocalPlanner::ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + robot_nav_2d_msgs::Twist2D twist; + mkt_msgs::Trajectory2D traj; + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + cmd_vel.header.stamp = robot::Time::now(); + + if (ret_nav_ && ret_angle_) + return cmd_vel; + else if (!ret_nav_) + { + traj = nav_algorithm_->calculator(pose, velocity); + if (!dkpl_.empty() && dkpl_.front()->initialized_ && dkpl_.front()->is_detected_ && !dkpl_.front()->is_goal_reached_) + { + if (dkpl_.front()->docking_nav_ && !dkpl_.front()->docking_planner_) + { + traj = dkpl_.front()->docking_nav_->calculator(pose, velocity); + } + } + local_plan_.header.stamp = robot::Time::now(); + robot_nav_msgs::Path path = robot_nav_2d_utils::poses2DToPath(traj.poses, costmap_robot_->getBaseFrameID(), robot::Time::now()); + local_plan_ = robot_nav_2d_utils::pathToPath(path); + } + else + { + traj = rotate_algorithm_->calculator(pose, velocity); + local_plan_.header.stamp = robot::Time::now(); + robot_nav_msgs::Path path = robot_nav_2d_utils::poses2DToPath(traj.poses, costmap_robot_->getBaseFrameID(), robot::Time::now()); + local_plan_ = robot_nav_2d_utils::pathToPath(path); + } + + cmd_vel.velocity = traj.velocity; + return cmd_vel; +} + +bool pnkx_local_planner::PNKXDockingLocalPlanner::isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + if (goal_pose_.header.frame_id == "") + { + robot::log_warning_at(__FILE__, __LINE__, "Cannot check if the goal is reached without the goal being set!"); + return false; + } + robot::log_error("DEBUG 400.1"); + bool dock_ok = dockingHanlde(pose, velocity); + robot::log_error("DEBUG 400.2"); + // Update time stamp of goal pose + // goal_pose_.header.stamp = pose.header.stamp; + robot_nav_2d_msgs::Pose2DStamped local_pose = this->transformPoseToLocal(pose); + robot_nav_2d_msgs::Pose2DStamped local_goal = this->transformPoseToLocal(goal_pose_); + robot_nav_2d_msgs::Path2D plan = transformed_global_plan_; + if (start_docking_) + { + local_goal = goal_pose_; + if (!dkpl_.empty() && dkpl_.front()->initialized_) + { + if (dkpl_.front()->allow_rotate_) + plan = robot_nav_2d_msgs::Path2D(); + } + } + + if (!ret_nav_) + { + ret_nav_ = goal_checker_->isGoalReached(local_pose, local_goal, plan, velocity); + + if (ret_nav_) + { + robot::log_info_at(__FILE__, __LINE__, "local_pose %f %f %f", local_pose.pose.x, local_pose.pose.y, local_pose.pose.theta); + robot::log_info_at(__FILE__, __LINE__, "local_goal %f %f %f", local_goal.pose.x, local_goal.pose.y, local_goal.pose.theta); + } + } + + if (ret_nav_ && !ret_angle_ && !dock_ok) + { + double delta_orient = + fabs(angles::normalize_angle(local_goal.pose.theta - local_pose.pose.theta)); + ret_angle_ = (bool)(delta_orient <= yaw_goal_tolerance_); + if(ret_angle_) + robot::log_warning_at(__FILE__, __LINE__, "xy_goal_tolerance %f yaw_goal_tolerance %f",xy_goal_tolerance_, yaw_goal_tolerance_); + } + + if (start_docking_) + { + double dx = local_goal.pose.x - local_pose.pose.x; + double dy = local_goal.pose.y - local_pose.pose.y; + double dtheta = local_goal.pose.theta - local_pose.pose.theta; + } + if (ret_nav_ && ret_angle_ && dock_ok) + { + // nh_.setParam("xy_goal_tolerance", original_xy_goal_tolerance_); + // nh_.setParam("yaw_goal_tolerance", original_yaw_goal_tolerance_); + std::string algorithm_nav_name; + planner_nh_.param("algorithm_nav_name", algorithm_nav_name, std::string("pnkx_local_planner::PTA")); + robot::NodeHandle nh_algorithm = robot::NodeHandle(parent_, algorithm_nav_name); + parent_.setParam(algorithm_nav_name, original_papams_); + nh_algorithm.setParam("allow_rotate", false); + } + return ret_nav_ && ret_angle_ && dock_ok; +} + +bool pnkx_local_planner::PNKXDockingLocalPlanner::dockingHanlde(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + if (!dkpl_.empty()) + { + if (ret_nav_ && ret_angle_) + { + if (!dkpl_.front()->is_detected_) + { + if (!dkpl_.front()->initialized_) + { + dkpl_.front()->initialize(parent_, tf_, costmap_robot_, traj_generator_); + dkpl_.front()->initialized_ = true; + } + else + { + if (dkpl_.front()->docking_planner_ && !dkpl_.front()->docking_nav_) + { + robot_nav_2d_msgs::Pose2DStamped local_goal; + try + { + if (dkpl_.front()->geLocalGoal(local_goal)) + { + robot::log_error("DEBUG 100"); + dkpl_.front()->is_detected_ = true; + start_docking_ = true; + robot_nav_msgs::Path path; + robot_nav_2d_msgs::Pose2DStamped local_pose = this->transformPoseToLocal(pose); + dkpl_.front()->getLocalPath(local_pose, local_goal, path); + this->setPlan(robot_nav_2d_utils::pathToPath(path)); + this->setGoalPose(local_goal); + } + } + catch (const std::exception &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } + } + else if (!dkpl_.front()->docking_planner_ && dkpl_.front()->docking_nav_) + { + robot_nav_2d_msgs::Pose2DStamped local_goal; + try + { + if (dkpl_.front()->geLocalGoal(local_goal)) + { + robot::log_error("DEBUG 200"); + dkpl_.front()->is_detected_ = true; + start_docking_ = true; + robot_nav_2d_msgs::Path2D path; + robot_nav_2d_msgs::Pose2DStamped local_pose = this->transformPoseToLocal(pose); + path.header.stamp = robot::Time::now(); + path.header.frame_id = costmap_robot_->getGlobalFrameID(); + path.poses.push_back(local_pose); + path.poses.push_back(local_goal); + this->setPlan(path); + this->setGoalPose(local_goal); + } + } + catch (const std::exception &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } + } + } + } + else + { + if (dkpl_.front()->initialized_ && !dkpl_.front()->is_goal_reached_) + { + dkpl_.front()->is_goal_reached_ = true; + robot::log_info_at(__FILE__, __LINE__, "%s is goal reached", dkpl_.front()->name_.c_str()); + } + + if (dkpl_.front()->initialized_ && dkpl_.front()->is_goal_reached_) + { + if(!dkpl_.empty()) + { + // if(dkpl_.front()) delete(dkpl_.front()); + dkpl_.erase(dkpl_.begin()); + } + start_docking_ = false; + } + } + } + } + bool result = false; + if (dkpl_.empty()) + { + robot::log_info_at(__FILE__, __LINE__, "Goal reached!"); + result = true; + this->getMaker(); + } + return result; +} + +pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::DockingPlanner(const std::string &name) + : initialized_(false), + is_detected_(false), + is_goal_reached_(false), + following_(false), + allow_rotate_(false), + xy_goal_tolerance_(0.05), + yaw_goal_tolerance_(0.05), + min_lookahead_dist_(0.4), + max_lookahead_dist_(1.0), + lookahead_time_(1.5), + angle_threshold_(0.4), + name_(name), + docking_planner_name_(), + docking_nav_name_(), + docking_planner_(nullptr), + docking_nav_(nullptr), + linear_(), + angular_(), + nh_(), + nh_priv_(), + tf_(nullptr), + costmap_robot_(nullptr), + traj_generator_(), + docking_planner_loader_(), + docking_nav_loader_(), + detected_timeout_wt_(), + delayed_wt_(), + delayed_(false), + detected_timeout_(false), + robot_base_frame_(), + maker_goal_frame_() +{ +} + +pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::~DockingPlanner() +{ + detected_timeout_wt_.stop(); + delayed_wt_.stop(); + if (docking_planner_ != nullptr) { + docking_planner_.reset(); + } + if (docking_nav_ != nullptr) { + docking_nav_.reset(); + } +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::initialize(robot::NodeHandle &nh, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot, + score_algorithm::TrajectoryGenerator::Ptr traj_generator) +{ + nh_ = nh; + nh_priv_ = robot::NodeHandle(nh_, name_); + tf_ = tf; + costmap_robot_ = costmap_robot; + traj_generator_ = traj_generator; + + if (docking_planner_name_ != std::string("")) + { + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(docking_planner_name_); + docking_planner_loader_ = boost::dll::import_alias( + path_file_so, docking_planner_name_, boost::dll::load_mode::append_decorations); + docking_planner_ = docking_planner_loader_(); + if (!docking_planner_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create global planner \"%s\": returned null pointer", docking_planner_name_.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create global planner"); + } + docking_planner_->initialize(name_, costmap_robot_); + robot::log_info_at(__FILE__, __LINE__, "Created global_planner %s", docking_planner_name_.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s planner, are you sure it is properly registered and that the containing library is built? Exception: %s", + docking_planner_name_.c_str(), ex.what()); + } + } + + if (docking_nav_name_ != std::string("")) + { + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(docking_nav_name_); + docking_nav_loader_ = boost::dll::import_alias( + path_file_so, docking_nav_name_, boost::dll::load_mode::append_decorations); + docking_nav_ = docking_nav_loader_(); + if (!docking_nav_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create docking nav \"%s\": returned null pointer", docking_nav_name_.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create docking nav"); + } + robot::NodeHandle nh_docking_nav = robot::NodeHandle(nh_priv_, docking_nav_name_); + docking_nav_->initialize(nh_docking_nav, docking_nav_name_, tf_, costmap_robot_, traj_generator_); + robot::log_info_at(__FILE__, __LINE__, "Created docking nav %s", docking_nav_name_.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s planner, are you sure it is properly registered and that the containing library is built? Exception: %s", + docking_nav_name_.c_str(), ex.what()); + } + } + + robot_base_frame_ = robot_nav_2d_utils::searchAndGetParam(nh_priv_, "robot_base_frame", std::string("base_link")); + if (!nh_priv_.param("maker_goal_frame", maker_goal_frame_, std::string(""))) + { + std::stringstream re; + re << "Can not get 'maker_goal_frame' in " << name_; + robot::log_info_at(__FILE__, __LINE__, "%s", re.str().c_str()); + throw robot_nav_core2::LocalPlannerException(re.str()); + } + + nh_priv_.param("vel_x", linear_.x, 0.5); + nh_priv_.param("vel_theta", angular_.z, 0.5); + nh_priv_.param("following", following_, false); + nh_priv_.param("allow_rotate", allow_rotate_, false); + + double delay_time, time_out; + nh_priv_.param("delay", delay_time, 1.0); + nh_priv_.param("timeout", time_out, 1.0); + + nh_priv_.param("xy_goal_tolerance", xy_goal_tolerance_, 0.05); + nh_priv_.param("yaw_goal_tolerance", yaw_goal_tolerance_, 0.05); + + nh_priv_.param("min_lookahead_dist", min_lookahead_dist_, 0.4); + nh_priv_.param("max_lookahead_dist", max_lookahead_dist_, 1.0); + nh_priv_.param("lookahead_time", lookahead_time_, 1.5); + nh_priv_.param("angle_threshold", angle_threshold_, 0.4); + + robot::log_info("delay: %f", delay_time); + robot::log_info("timeout: %f", time_out); + robot::log_info("xy_goal_tolerance: %f", xy_goal_tolerance_); + robot::log_info("yaw_goal_tolerance: %f", yaw_goal_tolerance_); + robot::log_info("min_lookahead_dist: %f", min_lookahead_dist_); + robot::log_info("max_lookahead_dist: %f", max_lookahead_dist_); + robot::log_info("lookahead_time: %f", lookahead_time_); + robot::log_info("angle_threshold: %f", angle_threshold_); + + detected_timeout_wt_ = ::robot::WallTimer( + ::robot::WallDuration(time_out + delay_time), &pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::detectedTimeOutCb, this, false, false); + detected_timeout_wt_.start(); + robot::log_warning_at(__FILE__, __LINE__, "%s %f time_out start %f", name_.c_str(), delay_time, robot::Time::now().toSec()); + + delayed_wt_ = ::robot::WallTimer( + ::robot::WallDuration(delay_time), &pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::delayCb, this, false, false); + delayed_wt_.start(); + robot::log_warning_at(__FILE__, __LINE__, "%s %f delay start %f", name_.c_str(), delay_time, robot::Time::now().toSec()); + + initialized_ = true; +} + +bool pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::getMakerGoal(robot_nav_2d_msgs::Pose2DStamped &maker_goal) +{ + if (!delayed_) + return false; + + bool get_pose_result = false; + try + { + if (pnkx_local_planner::getPose(tf_, maker_goal_frame_, robot_base_frame_, maker_goal, 2.0)) + { + get_pose_result = true; + detected_timeout_wt_.stop(); + } + + if (get_pose_result) + return true; + } + catch (const std::exception &e) + { + if (detected_timeout_) + { + std::stringstream re; + re << "No detected " << maker_goal_frame_; + robot::log_info_at(__FILE__, __LINE__, "%s", re.str().c_str()); + throw robot_nav_core2::LocalPlannerException(re.str()); + } + } + return false; +} + +bool pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::geLocalGoal(robot_nav_2d_msgs::Pose2DStamped &local_goal) +{ + if (!delayed_) + return false; + bool get_pose_result = false; + try + { + robot_nav_2d_msgs::Pose2DStamped maker_goal_on_robot; + if (pnkx_local_planner::getPose(tf_, maker_goal_frame_, robot_base_frame_, maker_goal_on_robot, 2.0)) + { + if (robot_nav_2d_utils::transformPose(tf_, costmap_robot_->getGlobalFrameID(), maker_goal_on_robot, local_goal)) + { + get_pose_result = true; + detected_timeout_wt_.stop(); + } + } + + if (get_pose_result) + return true; + } + catch (const std::exception &e) + { + if (detected_timeout_) + { + std::stringstream re; + re << "No detected " << maker_goal_frame_; + robot::log_info_at(__FILE__, __LINE__, "%s", re.str().c_str()); + throw robot_nav_core2::LocalPlannerException(re.str()); + } + } + return false; +} + +bool pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::getLocalPath( + const robot_nav_2d_msgs::Pose2DStamped &local_pose, const robot_nav_2d_msgs::Pose2DStamped &local_goal, robot_nav_msgs::Path &local_path) +{ + robot_geometry_msgs::PoseStamped start = robot_nav_2d_utils::pose2DToPoseStamped(local_pose); + robot_geometry_msgs::PoseStamped goal = robot_nav_2d_utils::pose2DToPoseStamped(local_goal); + std::vector docking_plan; + robot::log_info_at(__FILE__, __LINE__, "start %s %f %f", start.header.frame_id.c_str(), start.pose.position.x, start.pose.position.y); + robot::log_info_at(__FILE__, __LINE__, "goal %s %f %f", goal.header.frame_id.c_str(), goal.pose.position.x, goal.pose.position.y); + if (!docking_planner_->makePlan(start, goal, docking_plan)) + { + throw robot_nav_core2::LocalPlannerException("Making plan from goal maker is failed"); + return false; + } + else + { + local_path = robot_nav_2d_utils::posesToPath(docking_plan); + return true; + } +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::detectedTimeOutCb(const ::robot::WallTimerEvent &timer_event) +{ + detected_timeout_ = true; + detected_timeout_wt_.stop(); + robot::log_warning_at(__FILE__, __LINE__, "%s time_out end %f", name_.c_str(), robot::Time::now().toSec()); +} + +void pnkx_local_planner::PNKXDockingLocalPlanner::DockingPlanner::delayCb(const ::robot::WallTimerEvent &timer_event) +{ + delayed_ = true; + delayed_wt_.stop(); + robot::log_warning_at(__FILE__, __LINE__, "%s delay end %f", name_.c_str(), robot::Time::now().toSec()); +} + +robot_nav_core2::LocalPlanner::Ptr pnkx_local_planner::PNKXDockingLocalPlanner::create() +{ + return std::make_shared(); +} + +// register this planner as a LocalPlanner plugin +BOOST_DLL_ALIAS(pnkx_local_planner::PNKXDockingLocalPlanner::create, PNKXDockingLocalPlanner) diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_go_straight_local_planner.cpp b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_go_straight_local_planner.cpp new file mode 100644 index 0000000..4e11876 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_go_straight_local_planner.cpp @@ -0,0 +1,260 @@ +#include +#include +#include +#include +#include +#include + +// #include +// #include +// #include +#include +#include +#include "pnkx_local_planner/pnkx_go_straight_local_planner.h" +#include +#include + +pnkx_local_planner::PNKXGoStraightLocalPlanner::PNKXGoStraightLocalPlanner() + : PNKXLocalPlanner() +{ +} + +pnkx_local_planner::PNKXGoStraightLocalPlanner::~PNKXGoStraightLocalPlanner() +{ + if (traj_generator_) + traj_generator_.reset(); + + if (nav_algorithm_) + nav_algorithm_.reset(); + + if (goal_checker_) + goal_checker_.reset(); +} + +void pnkx_local_planner::PNKXGoStraightLocalPlanner::initialize(robot::NodeHandle& parent, const std::string& name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT* costmap_robot) +{ + if (!initialized_) + { + robot::log_info_at(__FILE__, __LINE__, "Using parent name \"%s\"", name.c_str()); + if(costmap_robot == nullptr) + { + robot::log_error_at(__FILE__, __LINE__, "Costmap2DROBOT is nullptr"); + throw robot_nav_core2::LocalPlannerException("Costmap2DROBOT is nullptr"); + } + if(tf == nullptr) + { + robot::log_error_at(__FILE__, __LINE__, "TFListener is nullptr"); + throw robot_nav_core2::LocalPlannerException("TFListener is nullptr"); + } + tf_ = tf; + costmap_robot_ = costmap_robot; + costmap_ = costmap_robot_->getCostmap(); + + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); + + parent_ = parent; + planner_nh_ = robot::NodeHandle(parent_, name); + robot::log_info_at(__FILE__, __LINE__, "Planner namespace: %s, parent namespace: %s", planner_nh_.getNamespace().c_str(), parent_.getNamespace().c_str()); + this->getParams(planner_nh_); + + // This is needed when using the CostmapAdapter to ensure that the costmap's info matches the rolling window + std::string traj_generator_name; + planner_nh_.param("trajectory_generator_name", traj_generator_name, std::string("nav_plugins::StandardTrajectoryGenerator")); + robot::log_info_at(__FILE__, __LINE__, "Using Trajectory Generator \"%s\"", traj_generator_name.c_str()); + + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(traj_generator_name); + traj_gen_loader_ = boost::dll::import_alias( + path_file_so, traj_generator_name, boost::dll::load_mode::append_decorations); + traj_generator_ = traj_gen_loader_(); + if (!traj_generator_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create trajectory generator \"%s\": returned null pointer", traj_generator_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + robot::NodeHandle nh_traj_gen = robot::NodeHandle(parent_, traj_generator_name); + traj_generator_->initialize(nh_traj_gen); + } + catch (const std::exception& ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s traj_generator, are you sure it is properly registered and that the containing library is built? Exception: %s", traj_generator_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + + std::string algorithm_nav_name = std::string("pnkx_local_planner::GoStraight"); + planner_nh_.param("algorithm_nav_name", algorithm_nav_name, std::string("pnkx_local_planner::GoStraight")); + robot::log_info_at(__FILE__, __LINE__, "Using Algorithm \"%s\"", algorithm_nav_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(algorithm_nav_name); + nav_algorithm_loader_ = boost::dll::import_alias( + path_file_so, algorithm_nav_name, boost::dll::load_mode::append_decorations); + nav_algorithm_ = nav_algorithm_loader_(); + if (!nav_algorithm_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create algorithm \"%s\": returned null pointer", algorithm_nav_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + nav_algorithm_->initialize(parent_, algorithm_nav_name, tf, costmap_robot_, traj_generator_); + } + catch (const std::exception& ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s algorithm , are you sure it is properly registered and that the containing library is built? Exception: %s", algorithm_nav_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + + std::string goal_checker_name; + planner_nh_.param("goal_checker_name", goal_checker_name, std::string("score_algorithm::GoalChecker")); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(goal_checker_name); + goal_checker_loader_ = boost::dll::import_alias( + path_file_so, goal_checker_name, boost::dll::load_mode::append_decorations); + goal_checker_ = goal_checker_loader_(); + if (!goal_checker_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create goal checker \"%s\": returned null pointer", goal_checker_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + robot::NodeHandle nh_goal_checker = robot::NodeHandle(parent_, goal_checker_name); + goal_checker_->initialize(nh_goal_checker); + } + catch (const std::exception& ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s Goal checker , are you sure it is properly registered and that the containing library is built? Exception: %s", goal_checker_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + + robot::log_info_at(__FILE__, __LINE__, "%s is initialized", name.c_str()); + initialized_ = true; + } +} + +void pnkx_local_planner::PNKXGoStraightLocalPlanner::reset() +{ + robot::log_info_at(__FILE__, __LINE__, "New Goal Received."); + this->unlock(); + traj_generator_->reset(); + goal_checker_->reset(); + nav_algorithm_->reset(); + ret_nav_ = ret_angle_ = false; +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXGoStraightLocalPlanner::computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped& pose, + const robot_nav_2d_msgs::Twist2D& velocity) +{ + // boost::recursive_mutex::scoped_lock l(configuration_mutex_); + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + try + { + if (global_plan_.poses.empty()) + return cmd_vel; + this->prepare(pose, velocity); + cmd_vel = this->ScoreAlgorithm(pose, velocity); + return cmd_vel; + } + catch (const robot_nav_core2::PlannerException &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } +} + +void pnkx_local_planner::PNKXGoStraightLocalPlanner::prepare(const robot_nav_2d_msgs::Pose2DStamped& pose, const robot_nav_2d_msgs::Twist2D& velocity) +{ + this->getParams(planner_nh_); + if (update_costmap_before_planning_) + { + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); + } + // Update time stamp of goal pose + // goal_pose_.header.stamp = pose.header.stamp; + robot_nav_2d_msgs::Pose2DStamped local_start_pose = this->transformPoseToLocal(pose), + local_goal_pose = this->transformPoseToLocal(goal_pose_); + + try + { + if (!pnkx_local_planner::transformGlobalPlan(tf_, global_plan_, local_start_pose, costmap_robot_, costmap_robot_->getGlobalFrameID(), 2.0, transformed_global_plan_)) + throw robot_nav_core2::LocalPlannerException("Transform global plan is failed"); + } + catch(const robot_nav_core2::LocalPlannerException& e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } + + double x_direction, y_direction, theta_direction; + if (!nav_algorithm_->prepare(local_start_pose, velocity, local_goal_pose, transformed_global_plan_, x_direction, y_direction, theta_direction)) + { + throw robot_nav_core2::LocalPlannerException("Algorithm failed to prepare"); + } + + int xytheta_direct[3]; + xytheta_direct[0] = x_direction != 0 ? fabs(x_direction) / x_direction : 0; + xytheta_direct[1] = y_direction != 0 ? fabs(y_direction) / y_direction : 0; + xytheta_direct[2] = theta_direction != 0 ? fabs(theta_direction) / theta_direction : 0; + traj_generator_->setDirect(xytheta_direct); +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXGoStraightLocalPlanner::ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped& pose, const robot_nav_2d_msgs::Twist2D& velocity) +{ + robot_nav_2d_msgs::Twist2D twist; + mkt_msgs::Trajectory2D traj; + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + cmd_vel.header.stamp = robot::Time::now(); + + if (ret_nav_) + { + local_plan_.poses.clear(); + return cmd_vel; + } + + traj = nav_algorithm_->calculator(pose, velocity); + local_plan_.header.stamp = robot::Time::now(); + robot_nav_msgs::Path path = robot_nav_2d_utils::poses2DToPath(traj.poses, costmap_robot_->getBaseFrameID(), robot::Time::now()); + local_plan_ = robot_nav_2d_utils::pathToPath(path); + cmd_vel.velocity = traj.velocity; + return cmd_vel; +} + +bool pnkx_local_planner::PNKXGoStraightLocalPlanner::isGoalReached(const robot_nav_2d_msgs::Pose2DStamped& pose, const robot_nav_2d_msgs::Twist2D& velocity) +{ + if (goal_pose_.header.frame_id == "") + { + robot::log_warning_at(__FILE__, __LINE__, "Cannot check if the goal is reached without the goal being set!"); + return false; + } + // Update time stamp of goal pose + // goal_pose_.header.stamp = pose.header.stamp; + ret_nav_ = goal_checker_->isGoalReached(transformPoseToLocal(pose), transformPoseToLocal(goal_pose_), transformed_global_plan_, velocity); + + if (ret_nav_) + robot::log_info_at(__FILE__, __LINE__, "Goal reached!"); + return ret_nav_; +} + +robot_nav_core2::LocalPlanner::Ptr pnkx_local_planner::PNKXGoStraightLocalPlanner::create() +{ + return std::make_shared(); +} + +// register this planner as a LocalPlanner plugin +BOOST_DLL_ALIAS(pnkx_local_planner::PNKXGoStraightLocalPlanner::create, PNKXGoStraightLocalPlanner) \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_local_planner.cpp b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_local_planner.cpp new file mode 100644 index 0000000..c595656 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_local_planner.cpp @@ -0,0 +1,494 @@ +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +pnkx_local_planner::PNKXLocalPlanner::PNKXLocalPlanner() + : initialized_(false), + traj_generator_(nullptr), + nav_algorithm_(nullptr), + rotate_algorithm_(nullptr), + goal_checker_(nullptr), + tf_(nullptr), + costmap_(nullptr), + costmap_robot_(nullptr), + info_(), + update_costmap_before_planning_(false), + ret_angle_(false), + ret_nav_(false), + yaw_goal_tolerance_(0.0), + xy_goal_tolerance_(0.0), + lock_(false) +{ +} + +pnkx_local_planner::PNKXLocalPlanner::~PNKXLocalPlanner() +{ + if (traj_generator_) + traj_generator_.reset(); + + if (nav_algorithm_) + nav_algorithm_.reset(); + + if (rotate_algorithm_) + rotate_algorithm_.reset(); + + if (goal_checker_) + goal_checker_.reset(); +} + +void pnkx_local_planner::PNKXLocalPlanner::initialize(robot::NodeHandle &parent, const std::string &name, + TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) +{ + if (!initialized_) + { + tf_ = tf; + name_ = name; + costmap_robot_ = costmap_robot; + costmap_ = costmap_robot_->getCostmap(); + + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); + + parent_ = parent; + planner_nh_ = robot::NodeHandle(parent_, name); + robot::log_info_at(__FILE__, __LINE__, "Planner namespace: %s, parent namespace: %s", planner_nh_.getNamespace().c_str(), parent_.getNamespace().c_str()); + this->getParams(planner_nh_); + + std::string traj_generator_name; + planner_nh_.param("trajectory_generator_name", traj_generator_name, std::string("StandardTrajectoryGenerator")); + robot::log_info_at(__FILE__, __LINE__, "Using Trajectory Generator \"%s\"", traj_generator_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(traj_generator_name); + traj_gen_loader_ = boost::dll::import_alias( + path_file_so, traj_generator_name, boost::dll::load_mode::append_decorations); + traj_generator_ = traj_gen_loader_(); + if (!traj_generator_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create trajectory generator \"%s\": returned null pointer", traj_generator_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + robot::NodeHandle nh_traj_gen = robot::NodeHandle(parent_, traj_generator_name); + traj_generator_->initialize(nh_traj_gen); + robot::log_info_at(__FILE__, __LINE__, "Successfully initialized trajectory generator \"%s\"", traj_generator_name.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s traj_generator, are you sure it is properly registered and that the containing library is built? Exception: %s", traj_generator_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + + std::string algorithm_nav_name; + planner_nh_.getParam("algorithm_nav_name", algorithm_nav_name, std::string("pnkx_local_planner::PTA")); + robot::log_info_at(__FILE__, __LINE__, "Using Algorithm \"%s\"", algorithm_nav_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(algorithm_nav_name); + robot::log_info_at(__FILE__, __LINE__, "path_file_so: %s", path_file_so.c_str()); + nav_algorithm_loader_ = boost::dll::import_alias( + path_file_so, algorithm_nav_name, boost::dll::load_mode::append_decorations); + nav_algorithm_ = nav_algorithm_loader_(); + if (!nav_algorithm_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to load algorithm %s", algorithm_nav_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + nav_algorithm_->initialize(parent_, algorithm_nav_name, tf, costmap_robot_, traj_generator_); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s algorithm , are you sure it is properly registered and that the containing library is built? Exception: %s", algorithm_nav_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + + std::string algorithm_rotate_name; + planner_nh_.param("algorithm_rotate_name", algorithm_rotate_name, std::string("MKTAlgorithmDiffRotateToGoal")); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(algorithm_rotate_name); + rotate_algorithm_loader_ = boost::dll::import_alias( + path_file_so, algorithm_rotate_name, boost::dll::load_mode::append_decorations); + rotate_algorithm_ = rotate_algorithm_loader_(); + if (!rotate_algorithm_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create rotate algorithm \"%s\": returned null pointer", algorithm_rotate_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create rotate algorithm"); + } + rotate_algorithm_->initialize(parent_, algorithm_rotate_name, tf, costmap_robot_, traj_generator_); + robot::log_info_at(__FILE__, __LINE__, "Successfully initialized rotate algorithm \"%s\"", algorithm_rotate_name.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s rotate algorithm, are you sure it is properly registered and that the containing library is built? Exception: %s", algorithm_rotate_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create rotate algorithm"); + } + + std::string goal_checker_name; + planner_nh_.param("goal_checker_name", goal_checker_name, std::string("dwb_plugins::SimpleGoalChecker")); + robot::log_info_at(__FILE__, __LINE__, "goal_checker_name: %s", goal_checker_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(goal_checker_name); + goal_checker_loader_ = boost::dll::import_alias( + path_file_so, goal_checker_name, boost::dll::load_mode::append_decorations); + goal_checker_ = goal_checker_loader_(); + if (!goal_checker_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create goal checker \"%s\": returned null pointer", goal_checker_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + goal_checker_->initialize(parent_); + robot::log_info_at(__FILE__, __LINE__, "Successfully initialized goal checker \"%s\"", goal_checker_name.c_str()); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Unexpected exception while creating goal checker \"%s\": %s", goal_checker_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + + this->initializeOthers(); + robot::log_info("[%s:%d]\n %s is sucessed", __FILE__, __LINE__, name.c_str()); + initialized_ = true; + } +} + +void pnkx_local_planner::PNKXLocalPlanner::initializeOthers() +{ +} + +void pnkx_local_planner::PNKXLocalPlanner::getParams(robot::NodeHandle &nh) +{ + // This is needed when using the CostmapAdapter to ensure that the costmap's info matches the rolling window + nh.param("update_costmap_before_planning", update_costmap_before_planning_, true); + if (!nh.param("xy_goal_tolerance", xy_goal_tolerance_, 0.1)) + { + xy_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "xy_goal_tolerance", 0.1); + } + if (!nh.param("yaw_goal_tolerance", yaw_goal_tolerance_, 0.1)) + { + yaw_goal_tolerance_ = robot_nav_2d_utils::searchAndGetParam(nh, "yaw_goal_tolerance", 0.1); + } +} + +void pnkx_local_planner::PNKXLocalPlanner::reset() +{ + this->unlock(); + if(traj_generator_) traj_generator_->reset(); + if(goal_checker_) goal_checker_->reset(); + if(nav_algorithm_) nav_algorithm_->reset(); + if(rotate_algorithm_) rotate_algorithm_->reset(); + ret_nav_ = ret_angle_ = false; +} + +void pnkx_local_planner::PNKXLocalPlanner::setGoalPose(const robot_nav_2d_msgs::Pose2DStamped &goal_pose) +{ + // boost::recursive_mutex::scoped_lock l(configuration_mutex_); + robot::log_error("[PNKXLocalPlanner] Receive new goal(%f, %f)!", goal_pose.pose.x, goal_pose.pose.y); + reset(); + goal_pose_ = goal_pose; +} + +void pnkx_local_planner::PNKXLocalPlanner::setPlan(const robot_nav_2d_msgs::Path2D &path) +{ + robot::log_error("[PNKXLocalPlanner] size path: %d", (int)path.poses.size()); + // boost::recursive_mutex::scoped_lock l(configuration_mutex_); + costmap_robot_->resetLayers(); + global_plan_ = path; + if((unsigned int)global_plan_.poses.size() > 2) + global_plan_.poses.erase(global_plan_.poses.begin()); + for (unsigned int i = 0; i < (unsigned int)global_plan_.poses.size(); i++) + { + global_plan_.poses[i].header.seq = i; + } +} + +void pnkx_local_planner::PNKXLocalPlanner::getPlan(robot_nav_2d_msgs::Path2D &path) +{ + if (local_plan_.poses.empty()) + { + return; + } + path = local_plan_; + +} + +void pnkx_local_planner::PNKXLocalPlanner::getGlobalPlan(robot_nav_2d_msgs::Path2D &path) +{ + if (global_plan_.poses.empty()) + { + return; + } + path = global_plan_; +} + +void pnkx_local_planner::PNKXLocalPlanner::prepare(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + this->getParams(planner_nh_); + if (update_costmap_before_planning_) + { + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); + } + + // Update time stamp of goal pose + robot_nav_2d_msgs::Pose2DStamped local_start_pose = this->transformPoseToLocal(pose), + local_goal_pose = this->transformPoseToLocal(goal_pose_); + + if (!pnkx_local_planner::transformGlobalPlan( + tf_, global_plan_, local_start_pose, costmap_robot_, costmap_robot_->getGlobalFrameID(), 2.0, transformed_global_plan_)) + { + robot::log_warning_at(__FILE__, __LINE__, "Transform global plan is failed"); + throw robot_nav_core2::LocalPlannerException("Transform global plan is failed"); + } + + double x_direction, y_direction, theta_direction; + if (!ret_nav_) + { + if (nav_algorithm_ && !nav_algorithm_->prepare(local_start_pose, velocity, local_goal_pose, transformed_global_plan_, x_direction, y_direction, theta_direction)) + { + robot::log_warning_at(__FILE__, __LINE__, "Algorithm \"%s\" failed to prepare", nav_algorithm_->getName().c_str()); + throw robot_nav_core2::LocalPlannerException("Algorithm failed to prepare"); + } + } + else + { + if (rotate_algorithm_ && !rotate_algorithm_->prepare(local_start_pose, velocity, local_goal_pose, transformed_global_plan_, x_direction, y_direction, theta_direction)) + { + robot::log_warning_at(__FILE__, __LINE__, "Algorithm \"%s\" failed to prepare", rotate_algorithm_->getName().c_str()); + throw robot_nav_core2::LocalPlannerException("Algorithm failed to prepare"); + } + } + + int xytheta_direct[3]; + xytheta_direct[0] = x_direction != 0 ? fabs(x_direction) / x_direction : 0; + xytheta_direct[1] = y_direction != 0 ? fabs(y_direction) / y_direction : 0; + xytheta_direct[2] = theta_direction != 0 ? fabs(theta_direction) / theta_direction : 0; + if(traj_generator_) traj_generator_->setDirect(xytheta_direct); +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXLocalPlanner::computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_nav_2d_msgs::Twist2D &velocity) +{ + // boost::recursive_mutex::scoped_lock l(configuration_mutex_); + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + try + { + if (global_plan_.poses.empty()) + return cmd_vel; + this->prepare(pose, velocity); + cmd_vel = this->ScoreAlgorithm(pose, velocity); + return cmd_vel; + } + catch (const robot_nav_core2::PlannerException &e) + { + robot::log_warning_at(__FILE__, __LINE__, "PNKXLocalPlanner computing velocity commands has been broken: %s", e.what()); + throw robot_nav_core2::LocalPlannerException("computing velocity commands has been broken"); + return cmd_vel; + } +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXLocalPlanner::ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + robot_nav_2d_msgs::Twist2D twist; + mkt_msgs::Trajectory2D traj; + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + cmd_vel.header.stamp = robot::Time::now(); + + if (ret_nav_ && ret_angle_) + { + return cmd_vel; + local_plan_.poses.clear(); + } + else if (!ret_nav_) + { + if(nav_algorithm_) traj = nav_algorithm_->calculator(pose, velocity); + local_plan_.header.stamp = robot::Time::now(); + robot_nav_msgs::Path path = robot_nav_2d_utils::poses2DToPath(traj.poses, costmap_robot_->getBaseFrameID(), robot::Time::now()); + local_plan_ = robot_nav_2d_utils::pathToPath(path); + } + else + { + if(rotate_algorithm_) traj = rotate_algorithm_->calculator(pose, velocity); + local_plan_.header.stamp = robot::Time::now(); + robot_nav_msgs::Path path = robot_nav_2d_utils::poses2DToPath(traj.poses, costmap_robot_->getBaseFrameID(), robot::Time::now()); + local_plan_ = robot_nav_2d_utils::pathToPath(path); + } + + cmd_vel.velocity = traj.velocity; + return cmd_vel; +} + +bool pnkx_local_planner::PNKXLocalPlanner::setTwistLinear(robot_geometry_msgs::Vector3 linear) +{ + try + { + if (linear.x == 0.0 && linear.y == 0.0 && linear.z == 0.0) + { + if (nav_algorithm_) + nav_algorithm_->stop(); + if (rotate_algorithm_) + rotate_algorithm_->stop(); + } + else + { + if (nav_algorithm_) + nav_algorithm_->resume(); + if (rotate_algorithm_) + rotate_algorithm_->resume(); + } + + if (traj_generator_) + return traj_generator_->setTwistLinear(linear); + else + throw robot_nav_core2::LocalPlannerException("Failed to set linear"); + } + catch (const std::exception &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + return false; + } +} + +robot_geometry_msgs::Vector3 pnkx_local_planner::PNKXLocalPlanner::getTwistLinear(bool direct) +{ + try + { + if (traj_generator_) + return traj_generator_->getTwistLinear(direct); + else + throw robot_nav_core2::LocalPlannerException("Failed to get linear"); + } + catch (const std::exception &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } +} + +bool pnkx_local_planner::PNKXLocalPlanner::setTwistAngular(robot_geometry_msgs::Vector3 angular) +{ + try + { + if (traj_generator_) + return traj_generator_->setTwistAngular(angular); + else + throw robot_nav_core2::LocalPlannerException("Failed to set angular"); + } + catch (const std::exception &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + return false; + } +} + +robot_geometry_msgs::Vector3 pnkx_local_planner::PNKXLocalPlanner::getTwistAngular(bool direct) +{ + try + { + if (traj_generator_) + return traj_generator_->getTwistAngular(direct); + else + throw robot_nav_core2::LocalPlannerException("Failed to get angular"); + } + catch (const std::exception &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } +} + +bool pnkx_local_planner::PNKXLocalPlanner::islock() +{ + return lock_; +} + +void pnkx_local_planner::PNKXLocalPlanner::lock() +{ + lock_ = true; +} + +void pnkx_local_planner::PNKXLocalPlanner::unlock() +{ + lock_ = false; +} + +bool pnkx_local_planner::PNKXLocalPlanner::isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) +{ + if (goal_pose_.header.frame_id == "") + { + robot::log_warning_at(__FILE__, __LINE__, "Cannot check if the goal is reached without the goal being set!"); + return false; + } + // Update time stamp of goal pose + // goal_pose_.header.stamp = pose.header.stamp; + robot_nav_2d_msgs::Pose2DStamped local_pose = this->transformPoseToLocal(pose); + robot_nav_2d_msgs::Pose2DStamped local_goal = this->transformPoseToLocal(goal_pose_); + robot_nav_2d_msgs::Path2D plan = transformed_global_plan_; + if (!ret_nav_) + { + ret_nav_ = goal_checker_->isGoalReached(local_pose, local_goal, plan, velocity); + } + else + { + double delta_orient = fabs(angles::normalize_angle(local_goal.pose.theta - local_pose.pose.theta)); + ret_angle_ = (bool)(delta_orient <= yaw_goal_tolerance_); + } + + if (ret_nav_ && ret_angle_) + { + robot::log_info_throttle(1.0, "Goal reached!"); + } + return ret_nav_ && ret_angle_; +} + +inline double getSquareDistance(const robot_nav_2d_msgs::Pose2DStamped &pose_a, const robot_nav_2d_msgs::Pose2DStamped &pose_b) +{ + double x_diff = pose_a.pose.x - pose_b.pose.x; + double y_diff = pose_a.pose.y - pose_b.pose.y; + return x_diff * x_diff + y_diff * y_diff; +} + +robot_nav_2d_msgs::Pose2DStamped pnkx_local_planner::PNKXLocalPlanner::transformPoseToLocal(const robot_nav_2d_msgs::Pose2DStamped &pose) +{ + robot_nav_2d_msgs::Pose2DStamped local_pose; + robot_nav_2d_utils::transformPose(tf_, costmap_robot_->getGlobalFrameID(), pose, local_pose); + return local_pose; +} + +robot_nav_core2::LocalPlanner::Ptr pnkx_local_planner::PNKXLocalPlanner::create() +{ + return std::make_shared(); +} + +// register this planner as a LocalPlanner plugin +BOOST_DLL_ALIAS(pnkx_local_planner::PNKXLocalPlanner::create, PNKXLocalPlanner) \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_rotate_local_planner.cpp b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_rotate_local_planner.cpp new file mode 100644 index 0000000..f0b5718 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/pnkx_rotate_local_planner.cpp @@ -0,0 +1,247 @@ +#include "pnkx_local_planner/pnkx_rotate_local_planner.h" +#include "pnkx_local_planner/transforms.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +pnkx_local_planner::PNKXRotateLocalPlanner::PNKXRotateLocalPlanner() + : PNKXLocalPlanner() +{ +} + +pnkx_local_planner::PNKXRotateLocalPlanner::~PNKXRotateLocalPlanner() +{ + if (traj_generator_) + traj_generator_.reset(); + + if (nav_algorithm_) + nav_algorithm_.reset(); + + if (goal_checker_) + goal_checker_.reset(); +} + +void pnkx_local_planner::PNKXRotateLocalPlanner::initialize(robot::NodeHandle& parent, const std::string& name, TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT* costmap_robot) +{ + if (!initialized_) + { + robot::log_info_at(__FILE__, __LINE__, "Using parent name \"%s\"", name.c_str()); + tf_ = tf; + costmap_robot_ = costmap_robot; + costmap_ = costmap_robot_->getCostmap(); + + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + parent_ = parent; + planner_nh_ = robot::NodeHandle(parent_, name); + + this->getParams(planner_nh_); + + std::string traj_generator_name; + planner_nh_.param("trajectory_generator_name", traj_generator_name, std::string("nav_plugins::StandardTrajectoryGenerator")); + robot::log_info_at(__FILE__, __LINE__, "Using Trajectory Generator \"%s\"", traj_generator_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(traj_generator_name); + traj_gen_loader_ = boost::dll::import_alias( + path_file_so, traj_generator_name, boost::dll::load_mode::append_decorations); + traj_generator_ = traj_gen_loader_(); + if (!traj_generator_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create trajectory generator \"%s\": returned null pointer", traj_generator_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + robot::NodeHandle nh_traj_gen = robot::NodeHandle(parent_, traj_generator_name); + traj_generator_->initialize(nh_traj_gen); + } + catch (const std::exception& ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s traj_generator, are you sure it is properly registered and that the containing library is built? Exception: %s", traj_generator_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create traj_generator"); + } + + std::string algorithm_rotate_name = std::string("nav_algorithm::Rotate"); + planner_nh_.param("algorithm_rotate_name", algorithm_rotate_name, std::string("nav_algorithm::Rotate")); + robot::log_info_at(__FILE__, __LINE__, "Using Algorithm \"%s\"", algorithm_rotate_name.c_str()); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(algorithm_rotate_name); + nav_algorithm_loader_ = boost::dll::import_alias( + path_file_so, algorithm_rotate_name, boost::dll::load_mode::append_decorations); + nav_algorithm_ = nav_algorithm_loader_(); + if (!nav_algorithm_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create algorithm \"%s\": returned null pointer", algorithm_rotate_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + robot::NodeHandle nh_algorithm = robot::NodeHandle(parent_, algorithm_rotate_name); + nav_algorithm_->initialize(nh_algorithm, algorithm_rotate_name, tf, costmap_robot_, traj_generator_); + } + catch (const std::exception& ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s algorithm , are you sure it is properly registered and that the containing library is built? Exception: %s", algorithm_rotate_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create algorithm"); + } + + std::string goal_checker_name; + planner_nh_.param("goal_checker_name", goal_checker_name, std::string("nav_algorithm::GoalChecker")); + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(goal_checker_name); + goal_checker_loader_ = boost::dll::import_alias( + path_file_so, goal_checker_name, boost::dll::load_mode::append_decorations); + goal_checker_ = goal_checker_loader_(); + if (!goal_checker_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create goal checker \"%s\": returned null pointer", goal_checker_name.c_str()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + robot::NodeHandle nh_goal_checker = robot::NodeHandle(parent_, goal_checker_name); + goal_checker_->initialize(nh_goal_checker); + } + catch (const std::exception& ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to create the %s Goal checker , are you sure it is properly registered and that the containing library is built? Exception: %s", goal_checker_name.c_str(), ex.what()); + throw robot_nav_core2::LocalPlannerException("Failed to create goal checker"); + } + + robot::log_info_at(__FILE__, __LINE__, "%s is sucessed", name.c_str()); + initialized_ = true; + } +} + +void pnkx_local_planner::PNKXRotateLocalPlanner::reset() +{ + robot::log_info_at(__FILE__, __LINE__, "New Goal Received."); + this->unlock(); + if (traj_generator_) + traj_generator_->reset(); + if (goal_checker_) + goal_checker_->reset(); + if (nav_algorithm_) + nav_algorithm_->reset(); + ret_nav_ = ret_angle_ = false; +} + +void pnkx_local_planner::PNKXRotateLocalPlanner::prepare(const robot_nav_2d_msgs::Pose2DStamped& pose, const robot_nav_2d_msgs::Twist2D& velocity) +{ + this->getParams(planner_nh_); + if (update_costmap_before_planning_) + { + info_.width = costmap_->getSizeInCellsX(); + info_.height = costmap_->getSizeInCellsY(); + info_.resolution = costmap_->getResolution(); + info_.frame_id = costmap_robot_->getGlobalFrameID(); + info_.origin_x = costmap_->getOriginX(); + info_.origin_y = costmap_->getOriginY(); + + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); + } + // Update time stamp of goal pose + // goal_pose_.header.stamp = pose.header.stamp; + robot_nav_2d_msgs::Pose2DStamped local_start_pose = this->transformPoseToLocal(pose), + local_goal_pose = this->transformPoseToLocal(goal_pose_); + try + { + if (!pnkx_local_planner::transformGlobalPlan(tf_, global_plan_, local_start_pose, costmap_robot_, costmap_robot_->getGlobalFrameID(), 2.0, transformed_global_plan_)) + throw robot_nav_core2::LocalPlannerException("Transform global plan is failed"); + } + catch(const robot_nav_core2::LocalPlannerException& e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } + + double x_direction, y_direction, theta_direction; + if (!nav_algorithm_->prepare(local_start_pose, velocity, local_goal_pose, transformed_global_plan_, x_direction, y_direction, theta_direction)) + { + throw robot_nav_core2::LocalPlannerException("Algorithm failed to prepare"); + } + + int xytheta_direct[3]; + xytheta_direct[0] = x_direction != 0 ? fabs(x_direction) / x_direction : 0; + xytheta_direct[1] = y_direction != 0 ? fabs(y_direction) / y_direction : 0; + xytheta_direct[2] = theta_direction != 0 ? fabs(theta_direction) / theta_direction : 0; + traj_generator_->setDirect(xytheta_direct); +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXRotateLocalPlanner::computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped& pose, const robot_nav_2d_msgs::Twist2D& velocity) +{ + // boost::recursive_mutex::scoped_lock l(configuration_mutex_); + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + try + { + if (global_plan_.poses.empty()) + return cmd_vel; + this->prepare(pose, velocity); + cmd_vel = this->ScoreAlgorithm(pose, velocity); + return cmd_vel; + } + catch (const robot_nav_core2::PlannerException &e) + { + throw robot_nav_core2::LocalPlannerException(e.what()); + } +} + +robot_nav_2d_msgs::Twist2DStamped pnkx_local_planner::PNKXRotateLocalPlanner::ScoreAlgorithm(const robot_nav_2d_msgs::Pose2DStamped& pose, const robot_nav_2d_msgs::Twist2D& velocity) +{ + robot_nav_2d_msgs::Twist2D twist; + mkt_msgs::Trajectory2D traj; + robot_nav_2d_msgs::Twist2DStamped cmd_vel; + cmd_vel.header.stamp = robot::Time::now(); + if (ret_nav_) + { + local_plan_.poses.clear(); + return cmd_vel; + } + + traj = nav_algorithm_->calculator(pose, velocity); + local_plan_.header.stamp = robot::Time::now(); + robot_nav_msgs::Path path = robot_nav_2d_utils::poses2DToPath(traj.poses, costmap_robot_->getBaseFrameID(), robot::Time::now()); + local_plan_ = robot_nav_2d_utils::pathToPath(path); + cmd_vel.velocity = traj.velocity; + return cmd_vel; +} + +bool pnkx_local_planner::PNKXRotateLocalPlanner::isGoalReached(const robot_nav_2d_msgs::Pose2DStamped& pose, const robot_nav_2d_msgs::Twist2D& velocity) +{ + if (goal_pose_.header.frame_id == "") + { + robot::log_warning_at(__FILE__, __LINE__, "Cannot check if the goal is reached without the goal being set!"); + return false; + } + // Update time stamp of goal pose + // goal_pose_.header.stamp = pose.header.stamp; + robot_nav_2d_msgs::Path2D empty; + ret_nav_ = goal_checker_->isGoalReached( + this->transformPoseToLocal(pose), this->transformPoseToLocal(goal_pose_), empty, velocity); + + if (ret_nav_) + robot::log_info_at(__FILE__, __LINE__, "Goal reached!"); + return ret_nav_; +} + +robot_nav_core2::LocalPlanner::Ptr pnkx_local_planner::PNKXRotateLocalPlanner::create() +{ + return std::make_shared(); +} + +// register this planner as a LocalPlanner plugin +BOOST_DLL_ALIAS(pnkx_local_planner::PNKXRotateLocalPlanner::create, PNKXRotateLocalPlanner) \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/transforms.cpp b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/transforms.cpp new file mode 100644 index 0000000..ef1a911 --- /dev/null +++ b/src/Algorithms/Packages/local_planners/pnkx_local_planner/src/transforms.cpp @@ -0,0 +1,206 @@ +#include +#include +#include +#include +#include +#include + +bool pnkx_local_planner::getPose(TFListenerPtr tf, std::string base_frame_id, std::string global_frame, robot_nav_2d_msgs::Pose2DStamped& global_pose, double transform_tolerance) +{ + if (!tf) + return false; + + robot_geometry_msgs::PoseStamped global_pose_stamped; + tf3::toMsg(tf3::Transform::getIdentity(), global_pose_stamped.pose); + robot_geometry_msgs::PoseStamped robot_pose; + tf3::toMsg(tf3::Transform::getIdentity(), robot_pose.pose); + robot_pose.header.frame_id = base_frame_id; + robot_pose.header.stamp = robot::Time(); + robot::Time current_time = robot::Time::now(); // save time for checking tf delay later + + // Convert robot::Time to tf3::Time + tf3::Time tf3_current_time = data_convert::convertTime(current_time); + tf3::Time tf3_zero_time = data_convert::convertTime(robot::Time()); + + // get the global pose of the robot + try + { + // use current time if possible (makes sure it's not in the future) + std::string error_msg; + if (tf->canTransform(global_frame, base_frame_id, tf3_current_time, &error_msg)) + { + // Transform is available at current time + tf3::TransformStampedMsg transform = tf->lookupTransform(global_frame, base_frame_id, tf3_current_time); + tf3::doTransform(robot_pose, global_pose_stamped, transform); + } + // use the latest otherwise (tf3::Time() means latest available) + else + { + // Try to get latest transform + tf3::TransformStampedMsg transform = tf->lookupTransform(global_frame, base_frame_id, tf3_zero_time); + tf3::doTransform(robot_pose, global_pose_stamped, transform); + } + global_pose = robot_nav_2d_utils::poseStampedToPose2D(global_pose_stamped); + } + catch (tf3::LookupException& ex) + { + robot::log_warning_throttle(1.0, "No Transform available Error looking up robot pose: %s\n", ex.what()); + return false; + // throw robot_nav_core2::LocalPlannerException(ex.what()); + } + catch (tf3::ConnectivityException& ex) + { + robot::log_warning_throttle(1.0, "Connectivity Error looking up robot pose: %s\n", ex.what()); + return false; + // throw robot_nav_core2::LocalPlannerException(ex.what()); + } + catch (tf3::ExtrapolationException& ex) + { + robot::log_warning_throttle(1.0, "Extrapolation Error looking up robot pose: %s\n", ex.what()); + return false; + // throw robot_nav_core2::LocalPlannerException(ex.what()); + } + // check global_pose timeout + if (!global_pose_stamped.header.stamp.isZero() && current_time.toSec() - global_pose_stamped.header.stamp.toSec() > transform_tolerance) + { + robot::log_warning_throttle(1.0, "Local Planner transform %s %s timeout. Current time: %.4f, global_pose stamp: %.4f, tolerance: %.4f", base_frame_id.c_str(), global_frame.c_str(), + current_time.toSec(), global_pose_stamped.header.stamp.toSec(), transform_tolerance); + return false; + } + return true; +} + +bool pnkx_local_planner::transformGlobalPose(TFListenerPtr tf, const std::string& global_frame, + const robot_nav_2d_msgs::Pose2DStamped& stamped_pose, robot_nav_2d_msgs::Pose2DStamped& newer_pose) +{ + if (tf == nullptr) + return false; + bool result = robot_nav_2d_utils::transformPose(tf, global_frame, stamped_pose, newer_pose); + newer_pose.header.seq = stamped_pose.header.seq; + return result; +} + +double pnkx_local_planner::getSquareDistance(const robot_geometry_msgs::Pose2D& pose_a, const robot_geometry_msgs::Pose2D& pose_b) +{ + double x_diff = pose_a.x - pose_b.x; + double y_diff = pose_a.y - pose_b.y; + return x_diff * x_diff + y_diff * y_diff; +} + +bool pnkx_local_planner::transformGlobalPlan( + TFListenerPtr tf, const robot_nav_2d_msgs::Path2D& global_plan, const robot_nav_2d_msgs::Pose2DStamped& pose, + const robot_costmap_2d::Costmap2DROBOT* costmap, const std::string& global_frame, double max_plan_length, + robot_nav_2d_msgs::Path2D& transformed_plan, const bool from_global_frame) +{ + if (global_plan.poses.size() == 0) + { + robot::log_warning("Received plan with zero length"); + throw robot_nav_core2::PlannerException("Received plan with zero length"); + } + + transformed_plan.poses.clear(); + if (tf == nullptr) + throw robot_nav_core2::PlannerException("TFListenerPtr is null"); + + if (global_plan.poses.empty()) + throw robot_nav_core2::PlannerException("Received plan with zero length"); + + try + { + // let's get the pose of the robot in the frame of the plan + robot_nav_2d_msgs::Pose2DStamped robot_pose; + if (!robot_nav_2d_utils::transformPose(tf, global_plan.header.frame_id, pose, robot_pose)) + { + throw robot_nav_core2::PlannerTFException("transformGlobalPlan: Unable to transform robot pose into global plan's frame"); + } + + transformed_plan.header.frame_id = costmap->getGlobalFrameID(); + transformed_plan.header.stamp = pose.header.stamp; + + robot_nav_2d_msgs::Pose2DStamped new_pose; + robot_nav_2d_msgs::Pose2DStamped stamped_pose; + stamped_pose.header.frame_id = global_plan.header.frame_id; + + for (unsigned int i = 0; i < global_plan.poses.size(); i++) + { + // now we'll transform until points are outside of our distance threshold + stamped_pose = global_plan.poses[i]; + if (pnkx_local_planner::transformGlobalPose(tf, global_frame, global_plan.poses[i], new_pose)) + { + transformed_plan.poses.push_back(new_pose); + } + } + + // Prune both plans based on robot position + // Note that this part of the algorithm assumes that the global plan starts near the robot (at one point) + // Otherwise it may take a few iterations to converge to the proper behavior + + // let's get the pose of the robot in the frame of the transformed_plan/costmap + robot_nav_2d_msgs::Pose2DStamped costmap_pose; + if (!robot_nav_2d_utils::transformPose(tf, transformed_plan.header.frame_id, pose, costmap_pose)) + { + throw robot_nav_core2::PlannerTFException("Unable to transform robot pose into costmap's frame"); + } + + robot::log_assert(global_plan.poses.size() >= transformed_plan.poses.size(), "Global plan size is less than transformed plan size"); + + std::vector::iterator it = transformed_plan.poses.begin(); + + double sq_prune_dist = 0.1; + + std::vector footprint = costmap->getRobotFootprint(); + size_t n = footprint.size(); + if (n > 1) + { + double max_length = 0.0; + for (size_t i = 0; i < n; ++i) + { + const robot_geometry_msgs::Point& p1 = footprint[i]; + const robot_geometry_msgs::Point& p2 = footprint[(i + 1) % n]; // wrap around to first point + double len = std::hypot(p2.x - p1.x, p2.y - p1.y); + if (len > max_length) + { + max_length = len; + } + } + sq_prune_dist += max_length; + } + // if(from_global_frame) sq_prune_dist = 0; + while (it != transformed_plan.poses.end()) + { + const robot_nav_2d_msgs::Pose2DStamped& w = *it; + // Fixed error bound of 1 meter for now. Can reduce to a portion of the map size or based on the resolution + if (pnkx_local_planner::getSquareDistance(costmap_pose.pose, w.pose) < sq_prune_dist) + { + // robot::log_debug_at(__FILE__, __LINE__, "Nearest waypoint to <%f, %f> is <%f, %f>\n", + // costmap_pose.pose.x, costmap_pose.pose.y, w.pose.x, w.pose.y); + break; + } + + it = transformed_plan.poses.erase(it); + } + + if (transformed_plan.poses.size() == 0) + { + throw robot_nav_core2::PlannerTFException("Resulting plan has 0 poses in it."); + } + } + catch (tf3::LookupException& ex) + { + robot::log_error_at(__FILE__, __LINE__, "No Transform available Error: %s\n", ex.what()); + return false; + } + catch (tf3::ConnectivityException& ex) + { + robot::log_error("Connectivity Error: %s\n", ex.what()); + return false; + } + catch (tf3::ExtrapolationException& ex) + { + robot::log_error("Extrapolation Error: %s\n", ex.what()); + if (global_plan.poses.size() > 0) + robot::log_error("[%s:%d]\n Robot Frame: %s Plan Frame size %d: %s\n", __FILE__, __LINE__, global_frame.c_str(), (unsigned int)global_plan.poses.size(), global_plan.header.frame_id.c_str()); + return false; + } + return true; +} \ No newline at end of file diff --git a/src/Algorithms/Packages/local_planners/priest_local_planner b/src/Algorithms/Packages/local_planners/priest_local_planner new file mode 160000 index 0000000..86be89f --- /dev/null +++ b/src/Algorithms/Packages/local_planners/priest_local_planner @@ -0,0 +1 @@ +Subproject commit 86be89fec7e53b9b5e7d6a9c0ca97760dcb68186 diff --git a/src/Algorithms/Packages/recoveries/sbpl_recovery b/src/Algorithms/Packages/recoveries/sbpl_recovery new file mode 160000 index 0000000..d1fd723 --- /dev/null +++ b/src/Algorithms/Packages/recoveries/sbpl_recovery @@ -0,0 +1 @@ +Subproject commit d1fd7230c0addfaeac0e523b0e376facfcbff441 diff --git a/src/Libraries/action_core b/src/Libraries/action_core new file mode 160000 index 0000000..a6bc3df --- /dev/null +++ b/src/Libraries/action_core @@ -0,0 +1 @@ +Subproject commit a6bc3dfa3d2205502a6d1e3cd9f797a54d1b23e9 diff --git a/src/Libraries/angles b/src/Libraries/angles new file mode 160000 index 0000000..9357e88 --- /dev/null +++ b/src/Libraries/angles @@ -0,0 +1 @@ +Subproject commit 9357e884d5cd93ca12578e244fc218b0745253b3 diff --git a/src/Libraries/common_msgs b/src/Libraries/common_msgs new file mode 160000 index 0000000..a07145a --- /dev/null +++ b/src/Libraries/common_msgs @@ -0,0 +1 @@ +Subproject commit a07145a8d6ef95ee7fb21ea8d2ce3db8f089c0f8 diff --git a/src/Libraries/costmap_2d b/src/Libraries/costmap_2d new file mode 160000 index 0000000..af66991 --- /dev/null +++ b/src/Libraries/costmap_2d @@ -0,0 +1 @@ +Subproject commit af66991a3e86ac950639cd6bed03b2b901503f0a diff --git a/src/Libraries/data_convert b/src/Libraries/data_convert new file mode 160000 index 0000000..6708cdf --- /dev/null +++ b/src/Libraries/data_convert @@ -0,0 +1 @@ +Subproject commit 6708cdf702b64d95748882a02ab8b315c3513e9a diff --git a/src/Libraries/depth_image_proc b/src/Libraries/depth_image_proc new file mode 160000 index 0000000..5871e0c --- /dev/null +++ b/src/Libraries/depth_image_proc @@ -0,0 +1 @@ +Subproject commit 5871e0c73847a31a7662168260e51a3869d06673 diff --git a/src/Libraries/dock_pattern_detector b/src/Libraries/dock_pattern_detector new file mode 160000 index 0000000..00e5f3e --- /dev/null +++ b/src/Libraries/dock_pattern_detector @@ -0,0 +1 @@ +Subproject commit 00e5f3e2cb1908bd26871763c0fbcbb5a9470397 diff --git a/src/Libraries/geometry2 b/src/Libraries/geometry2 new file mode 160000 index 0000000..c0406ef --- /dev/null +++ b/src/Libraries/geometry2 @@ -0,0 +1 @@ +Subproject commit c0406efbda168c554bc5380b01a8539466fecd26 diff --git a/src/Libraries/grid_map_core b/src/Libraries/grid_map_core new file mode 160000 index 0000000..4d76ddc --- /dev/null +++ b/src/Libraries/grid_map_core @@ -0,0 +1 @@ +Subproject commit 4d76ddc0c553b3631fb5458372b6cf2e097526f9 diff --git a/src/Libraries/image_geometry b/src/Libraries/image_geometry new file mode 160000 index 0000000..a37cabd --- /dev/null +++ b/src/Libraries/image_geometry @@ -0,0 +1 @@ +Subproject commit a37cabd18e9bf28e1e385ed7ce40298b0d4b43d7 diff --git a/src/Libraries/laser_filter b/src/Libraries/laser_filter new file mode 160000 index 0000000..db25b6b --- /dev/null +++ b/src/Libraries/laser_filter @@ -0,0 +1 @@ +Subproject commit db25b6bb2845d7389d86824b5221ade1c6538bb3 diff --git a/src/Libraries/laser_geometry b/src/Libraries/laser_geometry new file mode 160000 index 0000000..5ba4f5a --- /dev/null +++ b/src/Libraries/laser_geometry @@ -0,0 +1 @@ +Subproject commit 5ba4f5a44b85a7172530791dcebb4b7f471d87a4 diff --git a/src/Libraries/mission_adapters b/src/Libraries/mission_adapters new file mode 160000 index 0000000..ec11dc4 --- /dev/null +++ b/src/Libraries/mission_adapters @@ -0,0 +1 @@ +Subproject commit ec11dc42ed463e7d56fd57835f70df960e7cbfeb diff --git a/src/Libraries/recovery_core b/src/Libraries/recovery_core new file mode 160000 index 0000000..c03d16f --- /dev/null +++ b/src/Libraries/recovery_core @@ -0,0 +1 @@ +Subproject commit c03d16f98c0fda0a9c1a96cb5796b5c8c944948e diff --git a/src/Libraries/robot_cpp/CMakeLists.txt b/src/Libraries/robot_cpp/CMakeLists.txt new file mode 100644 index 0000000..3b941ee --- /dev/null +++ b/src/Libraries/robot_cpp/CMakeLists.txt @@ -0,0 +1,269 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_cpp VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_cpp with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_cpp with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(yaml-cpp REQUIRED) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_xmlrpcpp + robot_time + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_xmlrpcpp + robot_time + ) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS robot_xmlrpcpp robot_time + # Note: yaml-cpp are system dependencies, + # linked via target_link_libraries, not via catkin_package DEPENDS + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ) +endif() + +# Use yaml-cpp target if available (modern CMake) +if(TARGET yaml-cpp::yaml-cpp) + set(YAML_CPP_TARGET yaml-cpp::yaml-cpp) + message(STATUS "Using yaml-cpp target: yaml-cpp::yaml-cpp") +elseif(TARGET yaml-cpp) + set(YAML_CPP_TARGET yaml-cpp) + message(STATUS "Using yaml-cpp target: yaml-cpp") +elseif(yaml-cpp_LIBRARIES) + # Fallback to library variable if target not available + set(YAML_CPP_TARGET ${yaml-cpp_LIBRARIES}) + message(STATUS "Using yaml-cpp library: ${YAML_CPP_TARGET}") +else() + # Last resort: use library name + set(YAML_CPP_TARGET yaml-cpp) + message(STATUS "Using yaml-cpp library name: yaml-cpp") +endif() + +# Compiler flags +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Warning flags - disabled to suppress warnings during build + # add_compile_options(-Wall -Wextra -Wpedantic -fPIC) + add_compile_options(-w -fPIC) # -w suppresses all warnings +endif() + +# Libraries +add_library(${PROJECT_NAME} SHARED + src/console.cpp + src/node_handle.cpp + src/plugin_loader_helper.cpp + src/init.cpp +) + +# Enable C++17 filesystem feature +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + # Link filesystem library if needed (for GCC < 9 or Clang) + set(FILESYSTEM_LIB "") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0") + set(FILESYSTEM_LIB "stdc++fs") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + find_library(FILESYSTEM_LIB c++fs) + endif() + + target_link_libraries(${PROJECT_NAME} + PUBLIC ${catkin_LIBRARIES} + PRIVATE ${YAML_CPP_TARGET} + PRIVATE dl # Required for dladdr() function used in plugin_loader_helper.cpp + ) + + if(FILESYSTEM_LIB) + target_link_libraries(${PROJECT_NAME} PRIVATE ${FILESYSTEM_LIB}) + endif() + +else() + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + + # Link filesystem library if needed (for GCC < 9 or Clang) + set(FILESYSTEM_LIB "") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0") + set(FILESYSTEM_LIB "stdc++fs") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + find_library(FILESYSTEM_LIB c++fs) + endif() + + target_link_libraries(${PROJECT_NAME} + PUBLIC + ${PACKAGES_DIR} + ${YAML_CPP_TARGET} + PRIVATE + dl # Required for dladdr() function used in plugin_loader_helper.cpp + ) + + if(FILESYSTEM_LIB) + target_link_libraries(${PROJECT_NAME} PRIVATE ${FILESYSTEM_LIB}) + endif() + + set_target_properties(${PROJECT_NAME} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +# Define CMAKE_BINARY_DIR as compile definition so it's available at runtime +target_compile_definitions(${PROJECT_NAME} + PRIVATE + PNKX_NAV_CORE_BUILD_DIR="${CMAKE_BINARY_DIR}" +) + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # ======================================================== + # Install CMake Config File for find_package() + # ======================================================== + # Generate config file from template + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/robot_cppConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/robot_cppConfig.cmake + @ONLY + ) + + # Install config file + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/robot_cppConfig.cmake + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Dependencies: robot_xmlrpcpp, robot_time, yaml-cpp") + message(STATUS "=================================") +endif() + +# ======================================================== +# Test executable +# ======================================================== +option(BUILD_TESTS "Build test programs" OFF) + +if(BUILD_TESTS) + add_executable(test_node_handle + test/test_node_handle.cpp + ) + + target_include_directories(test_node_handle + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/include + ) + + target_link_libraries(test_node_handle + PRIVATE + ${PROJECT_NAME} + ${YAML_CPP_TARGET} + ) + + set_target_properties(test_node_handle PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + + # Link filesystem library if needed + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0") + target_link_libraries(test_node_handle PRIVATE stdc++fs) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + find_library(FILESYSTEM_LIB c++fs) + if(FILESYSTEM_LIB) + target_link_libraries(test_node_handle PRIVATE ${FILESYSTEM_LIB}) + endif() + endif() + + # Add test to CTest + add_test(NAME NodeHandleTest COMMAND test_node_handle) + + message(STATUS "Test executable 'test_node_handle' will be built") +endif() diff --git a/src/Libraries/robot_cpp/INIT_USAGE.md b/src/Libraries/robot_cpp/INIT_USAGE.md new file mode 100644 index 0000000..992ae38 --- /dev/null +++ b/src/Libraries/robot_cpp/INIT_USAGE.md @@ -0,0 +1,483 @@ +# robot::ok() - Hướng dẫn sử dụng + +## Tổng quan + +`robot::ok()` và các hàm liên quan cung cấp cơ chế quản lý vòng đời của robot system, tương tự như `ros::ok()` trong ROS. Chúng cho phép bạn kiểm tra trạng thái system và xử lý shutdown một cách graceful. + +## API Reference + +### `bool robot::ok()` + +Kiểm tra xem robot system có đang chạy không. + +- **Trả về `true`**: System đang chạy bình thường +- **Trả về `false`**: System đã shutdown hoàn toàn + +### `bool robot::isShuttingDown()` + +Kiểm tra xem shutdown đã được yêu cầu chưa. + +- **Trả về `true`**: Shutdown đã được yêu cầu (ngay lập tức) +- **Trả về `false`**: System vẫn đang chạy + +### `void robot::shutdown()` + +Bắt đầu quá trình shutdown system. + +### `void robot::init(int& argc, char** argv, const std::string& node_name = "", bool install_sigint_handler = true)` + +Khởi tạo robot system. + +- `argc`, `argv`: Command line arguments (có thể được modify) +- `node_name`: Tên node (optional, dùng cho logging) +- `install_sigint_handler`: Nếu `true`, tự động xử lý Ctrl-C (default: `true`) + +### `void robot::init(const std::string& node_name = "", bool install_sigint_handler = true)` + +Khởi tạo robot system không cần command line arguments. + +## Cách sử dụng cơ bản + +### 1. Main Loop với Rate + +```cpp +#include +#include + +int main(int argc, char** argv) +{ + // Initialize robot system + robot::init(argc, argv, "my_node"); + + robot::Rate rate(10); // 10 Hz + + // Main loop + while (robot::ok()) + { + // Do work here + std::cout << "Running..." << std::endl; + + rate.sleep(); + } + + return 0; +} +``` + +### 2. Main Loop không dùng Rate + +```cpp +#include +#include + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "my_node"); + + while (robot::ok()) + { + // Do work + robot::Duration(0.1).sleep(); // Sleep 100ms + } + + return 0; +} +``` + +### 3. Thread Loop + +```cpp +#include +#include +#include + +std::atomic stop_flag_(false); + +void myThread() +{ + while (robot::ok() && !stop_flag_) + { + // Do work in thread + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } +} + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "my_node"); + + std::thread t(myThread); + + // Main loop + while (robot::ok()) + { + // Do main work + robot::Duration(1.0).sleep(); + } + + stop_flag_ = true; + t.join(); + + return 0; +} +``` + +### 4. Long-running Callback với Early Exit + +```cpp +#include + +void processLargeData(const std::vector& data) +{ + for (size_t i = 0; i < data.size(); i++) + { + // Check if shutdown requested + if (robot::isShuttingDown()) + { + std::cout << "Shutdown requested, exiting early" << std::endl; + return; // Exit early + } + + // Process data[i]... + processItem(data[i]); + } +} + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "my_node"); + + std::vector large_data(1000000); + // ... fill data ... + + while (robot::ok()) + { + processLargeData(large_data); + robot::Duration(1.0).sleep(); + } + + return 0; +} +``` + +### 5. Custom SIGINT Handler + +```cpp +#include +#include +#include + +void mySigintHandler(int sig) +{ + (void)sig; + + // Do custom cleanup + std::cout << "Custom cleanup before shutdown..." << std::endl; + + // Publish stop message, save state, etc. + + // Call shutdown + robot::shutdown(); +} + +int main(int argc, char** argv) +{ + // Initialize without SIGINT handler + robot::init(argc, argv, "my_node", false); + + // Install custom handler + signal(SIGINT, mySigintHandler); + + while (robot::ok()) + { + // Do work + robot::Duration(0.1).sleep(); + } + + return 0; +} +``` + +### 6. Nested Loops + +```cpp +#include +#include + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "my_node"); + + while (robot::ok()) // Outer loop + { + // Setup connection + bool connected = connectToDevice(); + + while (robot::ok() && connected) // Inner loop + { + // Do work with device + if (!deviceIsAlive()) + { + connected = false; + break; + } + + robot::Duration(0.1).sleep(); + } + + // Reconnect after delay + robot::Duration(1.0).sleep(); + } + + return 0; +} +``` + +### 7. Multiple Conditions + +```cpp +#include +#include +#include + +std::atomic cancel_(false); +std::atomic connected_(false); + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "my_node"); + + while (robot::ok() && !cancel_ && connected_) + { + // Do work only if all conditions are met + processData(); + + robot::Duration(0.1).sleep(); + } + + return 0; +} +``` + +## So sánh với ROS + +### Tương đương với ROS: + +| ROS | robot:: | Mô tả | +|-----|---------|-------| +| `ros::ok()` | `robot::ok()` | Kiểm tra system đang chạy | +| `ros::isShuttingDown()` | `robot::isShuttingDown()` | Kiểm tra shutdown được yêu cầu | +| `ros::shutdown()` | `robot::shutdown()` | Bắt đầu shutdown | +| `ros::init(argc, argv, "node")` | `robot::init(argc, argv, "node")` | Khởi tạo system | + +### Ví dụ chuyển đổi từ ROS: + +**ROS Code:** +```cpp +#include + +int main(int argc, char** argv) +{ + ros::init(argc, argv, "my_node"); + ros::NodeHandle nh; + ros::Rate rate(10); + + while (ros::ok()) + { + ros::spinOnce(); + rate.sleep(); + } + + return 0; +} +``` + +**robot:: Code:** +```cpp +#include +#include + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "my_node"); + robot::Rate rate(10); + + while (robot::ok()) + { + // Do work (no ros::spinOnce() equivalent needed) + rate.sleep(); + } + + return 0; +} +``` + +## Best Practices + +### ✅ Nên làm: + +1. **Luôn gọi `robot::init()` trước khi dùng các hàm khác** + ```cpp + int main(int argc, char** argv) + { + robot::init(argc, argv, "my_node"); + // ... rest of code + } + ``` + +2. **Luôn kiểm tra `robot::ok()` trong vòng lặp chính** + ```cpp + while (robot::ok()) + { + // Do work + } + ``` + +3. **Kiểm tra trong thread loops** + ```cpp + while (robot::ok() && !stop_flag_) + { + // Thread work + } + ``` + +4. **Dùng `robot::isShuttingDown()` trong callback dài** + ```cpp + if (robot::isShuttingDown()) return; + ``` + +5. **Kết hợp với các điều kiện khác** + ```cpp + while (robot::ok() && connected && !cancel_) + { + // Work + } + ``` + +### ❌ Không nên: + +1. **Không bỏ qua kiểm tra trong thread** + - Thread có thể chạy mãi nếu không kiểm tra + +2. **Không dùng `robot::ok()` trong callback ngắn** + - Callback ngắn sẽ chạy xong trước khi shutdown + - Dùng `robot::isShuttingDown()` thay vì + +3. **Không gọi `robot::shutdown()` trong callback** + - Có thể gây deadlock + - Để shutdown tự nhiên hoặc dùng flag + +## Shutdown Process + +### Quy trình shutdown: + +1. **SIGINT (Ctrl-C) được gửi** hoặc `robot::shutdown()` được gọi +2. **`robot::isShuttingDown()`** → `true` (ngay lập tức) +3. **`robot::ok()`** → vẫn `true` (chưa shutdown hoàn toàn) +4. **Resources được cleanup** (nếu có) +5. **`robot::ok()`** → `false` (shutdown hoàn tất) + +### Timeline: + +``` +Time | Event | ok() | isShuttingDown() +--------|--------------------------|------|------------------ +T0 | System running | true | false +T1 | Ctrl-C pressed | true | false +T2 | shutdown() called | true | true ← isShuttingDown() = true +T3 | Cleanup in progress | true | true +T4 | Cleanup complete | false| true ← ok() = false +``` + +## Ví dụ thực tế trong move_base + +Bạn có thể sử dụng trong `planThread()`: + +```cpp +#include + +void move_base::MoveBase::planThread() +{ + robot::Timer timer; + bool wait_for_wake = false; + boost::unique_lock lock(planner_mutex_); + + while (robot::ok()) // ← Thêm kiểm tra này + { + // ... existing code ... + + while (wait_for_wake || !runPlanner_) + { + if (!robot::ok()) // ← Kiểm tra trước khi wait + break; + + planner_cond_.wait(lock); + wait_for_wake = false; + } + + // ... rest of code ... + } +} +``` + +## Troubleshooting + +### Vấn đề: Thread không dừng khi shutdown + +**Nguyên nhân**: Không kiểm tra `robot::ok()` trong thread loop + +**Giải pháp**: +```cpp +void myThread() +{ + while (robot::ok() && !stop_flag_) // ← Thêm robot::ok() + { + // Work + } +} +``` + +### Vấn đề: Callback dài không exit khi shutdown + +**Nguyên nhân**: Không kiểm tra `robot::isShuttingDown()` + +**Giải pháp**: +```cpp +void longCallback() +{ + for (int i = 0; i < 1000000; i++) + { + if (robot::isShuttingDown()) // ← Thêm kiểm tra + return; + // Work + } +} +``` + +### Vấn đề: Shutdown không hoạt động + +**Nguyên nhân**: Chưa gọi `robot::init()` + +**Giải pháp**: +```cpp +int main(int argc, char** argv) +{ + robot::init(argc, argv, "my_node"); // ← Phải gọi init() trước + // ... +} +``` + +## Tóm tắt + +- **`robot::ok()`**: Kiểm tra system đã shutdown hoàn toàn chưa → dùng trong loops +- **`robot::isShuttingDown()`**: Kiểm tra shutdown đã được yêu cầu chưa → dùng trong callback dài +- **`robot::shutdown()`**: Bắt đầu shutdown process +- **`robot::init()`**: Khởi tạo system (phải gọi trước khi dùng các hàm khác) +- **Luôn kiểm tra** trong vòng lặp chính và thread loops +- **Mặc định** tự động xử lý SIGINT (Ctrl-C) + +## Tài liệu tham khảo + +- [ROS Wiki - Initialization and Shutdown](https://wiki.ros.org/roscpp/Overview/Initialization%20and%20Shutdown) +- `robot_time/ROS_OK_EXPLANATION.md` - Giải thích chi tiết về `ros::ok()` + diff --git a/src/Libraries/robot_cpp/LICENSE b/src/Libraries/robot_cpp/LICENSE new file mode 100644 index 0000000..0b8ae76 --- /dev/null +++ b/src/Libraries/robot_cpp/LICENSE @@ -0,0 +1,5 @@ +Copyright (C) YEAR by AUTHOR EMAIL + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/src/Libraries/robot_cpp/PLUGIN_LOADER_README.md b/src/Libraries/robot_cpp/PLUGIN_LOADER_README.md new file mode 100644 index 0000000..5232f26 --- /dev/null +++ b/src/Libraries/robot_cpp/PLUGIN_LOADER_README.md @@ -0,0 +1,133 @@ +# Plugin Loader Helper - Hướng dẫn sử dụng + +## Tổng quan + +`PluginLoaderHelper` là một utility class giúp tìm đường dẫn library file (.so) từ tên symbol (export name) được sử dụng với `BOOST_DLL_ALIAS`. Tương tự như `plugins.xml` trong ROS pluginlib, nhưng dành cho boost::dll. + +## Cách hoạt động + +1. **File config YAML** (`boost_dll_plugins.yaml`): Map tên symbol → đường dẫn library +2. **PluginLoaderHelper class**: Đọc config và cung cấp hàm `findLibraryPath()` + +## Cài đặt + +### 1. Thêm file vào CMakeLists.txt + +Thêm `plugin_loader_helper.cpp` vào build: + +```cmake +add_library(${PROJECT_NAME} SHARED + src/console.cpp + src/node_handle.cpp + src/plugin_loader_helper.cpp # <-- Thêm dòng này +) +``` + +### 2. Cấu hình file YAML + +File `config/boost_dll_plugins.yaml` đã được tạo với các mapping mặc định. Bạn có thể chỉnh sửa để thêm/bớt plugins. + +## Cách sử dụng + +### Ví dụ 1: Tìm library path từ symbol name + +```cpp +#include + +// Tạo helper instance +robot::PluginLoaderHelper loader; + +// Tìm library path từ symbol name +std::string lib_path = loader.findLibraryPath("CustomPlanner"); +if (!lib_path.empty()) { + // Sử dụng với boost::dll::import_alias + auto planner_loader = boost::dll::import_alias( + lib_path, "CustomPlanner", boost::dll::load_mode::append_decorations); + planner_ = planner_loader(); +} +``` + +### Ví dụ 2: Sử dụng trong move_base.cpp + +Thay vì hardcode đường dẫn: + +```cpp +// CŨ (hardcode): +std::string path_file_so = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build/libcustom_planner.so"; + +// MỚI (từ config): +robot::PluginLoaderHelper loader; +std::string path_file_so = loader.findLibraryPath(global_planner); +if (path_file_so.empty()) { + // Fallback nếu không tìm thấy + path_file_so = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build/libcustom_planner.so"; +} +``` + +### Ví dụ 3: Kiểm tra symbol có tồn tại không + +```cpp +robot::PluginLoaderHelper loader; +if (loader.hasSymbol("CustomPlanner")) { + std::string lib_path = loader.findLibraryPath("CustomPlanner"); + // ... +} +``` + +### Ví dụ 4: Reload config + +```cpp +robot::PluginLoaderHelper loader; +// ... sử dụng ... + +// Reload config nếu file thay đổi +loader.reloadConfig("boost_dll_plugins.yaml"); +``` + +## Cấu trúc file config + +File `config/boost_dll_plugins.yaml`: + +```yaml +plugin_libraries: + CustomPlanner: + library_path: "/path/to/libcustom_planner.so" + + PNKXLocalPlanner: + library_path: "/path/to/libpnkx_local_planner.so" + +search_paths: + - "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build" + - "/path/to/other/libraries" +``` + +## Tìm kiếm library + +Helper sẽ tìm library theo thứ tự: + +1. **Trong config file**: Tìm trong `plugin_libraries` section +2. **Resolve path**: + - Nếu absolute path → kiểm tra file có tồn tại + - Nếu relative path → tìm trong `search_paths` +3. **LD_LIBRARY_PATH**: Fallback nếu không tìm thấy trong config +4. **Return empty**: Nếu không tìm thấy + +## Lợi ích + +✅ **Không hardcode đường dẫn**: Tất cả đường dẫn trong file config +✅ **Dễ maintain**: Chỉ cần sửa file YAML khi thay đổi library +✅ **Tương tự plugins.xml**: Quen thuộc với ROS developers +✅ **Flexible**: Hỗ trợ cả absolute và relative paths +✅ **Fallback**: Tự động tìm trong LD_LIBRARY_PATH nếu không có trong config + +## Lưu ý + +- File config sẽ được tìm trong: + 1. Đường dẫn trực tiếp (nếu absolute) + 2. `$PNKX_NAV_CORE_CONFIG_DIR/boost_dll_plugins.yaml` + 3. `$PNKX_NAV_CORE_DIR/config/boost_dll_plugins.yaml` + 4. `/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/config/boost_dll_plugins.yaml` + 5. `../config/boost_dll_plugins.yaml` (relative paths) + +- Symbol name có thể có namespace (ví dụ: `custom_planner::CustomPlanner`), helper sẽ tự động thử tìm cả tên đầy đủ và tên ngắn (`CustomPlanner`). + diff --git a/src/Libraries/robot_cpp/README.md b/src/Libraries/robot_cpp/README.md new file mode 100644 index 0000000..3f23eb7 --- /dev/null +++ b/src/Libraries/robot_cpp/README.md @@ -0,0 +1,252 @@ +# robot_cpp + +## Tổng quan + +`robot_cpp` là một thư viện C++ cung cấp các công cụ tiện ích cốt lõi cho phát triển ứng dụng robot, tương tự như các utilities trong ROS nhưng hoàn toàn độc lập, không phụ thuộc vào ROS. Thư viện này cung cấp nền tảng cơ bản cho việc xây dựng các hệ thống robot tự động. + +## Mục đích và phạm vi ứng dụng + +Thư viện `robot_cpp` được thiết kế để giải quyết các nhu cầu cơ bản trong phát triển ứng dụng robot: + +- **Logging và Debugging**: Cung cấp hệ thống logging với màu sắc để dễ dàng phân biệt các loại thông điệp +- **Quản lý cấu hình**: Hỗ trợ quản lý tham số từ file YAML, tương tự ROS parameter server +- **Quản lý vòng đời**: Cung cấp cơ chế quản lý lifecycle của hệ thống robot, xử lý shutdown graceful +- **Plugin Loading**: Hỗ trợ tìm kiếm và load các dynamic plugins sử dụng boost::dll + +## Các thành phần chính + +### 1. Console Module - Hệ thống Logging + +Module Console cung cấp hệ thống logging với hỗ trợ màu sắc ANSI để phân biệt các loại thông điệp. + +**Đặc điểm:** +- Hỗ trợ nhiều mức độ logging: info, success, warning, error, debug +- Tự động phát hiện khả năng hỗ trợ màu của terminal +- Throttle logging để giới hạn tần suất log, tránh spam console +- Hỗ trợ logging với thông tin file và line number để debug +- Tự động reset màu sau khi in để tránh ảnh hưởng đến output tiếp theo +- Có thể bật/tắt màu sắc tùy theo môi trường + +**Cơ chế hoạt động:** +- Kiểm tra biến môi trường `NO_COLOR` và `TERM` để xác định hỗ trợ màu +- Sử dụng static variables để lưu timestamp cho throttle logging +- Tự động thêm newline nếu format string không kết thúc bằng newline +- Hỗ trợ nhiều màu sắc: red, green, yellow, blue, cyan, magenta, white và các biến thể bright + +**Ứng dụng:** +- Debug và monitoring trong quá trình phát triển +- Hiển thị trạng thái hệ thống với màu sắc dễ phân biệt +- Logging có điều kiện với throttle để tránh spam +- Tích hợp vào các hệ thống logging lớn hơn + +### 2. NodeHandle Module - Quản lý Tham số + +Module NodeHandle cung cấp interface quản lý tham số giống ROS parameter server, sử dụng YAML files làm backend. + +**Đặc điểm:** +- Hỗ trợ namespace phân cấp giống ROS +- Tự động load YAML files từ config directory +- Hỗ trợ nhiều kiểu dữ liệu: bool, int, double, float, string, vector, map +- Merge nhiều YAML files vào một parameter tree +- Thread-safe parameter access +- Hỗ trợ nested parameters với cấu trúc phân cấp + +**Cơ chế hoạt động:** +- Sử dụng `YAML::Node` để lưu trữ tham số trong memory +- Static `root_` node chứa toàn bộ parameter tree, được chia sẻ giữa tất cả NodeHandle instances +- Mỗi NodeHandle instance scope vào một namespace cụ thể +- Tự động tìm và load YAML files từ config directory khi khởi tạo +- Hỗ trợ remapping parameters tương tự ROS + +**Namespace System:** +- Root namespace (`""` hoặc `"/"`): Truy cập toàn bộ parameter tree +- Private namespace (`"~"`): Map tới config directory của node hiện tại +- Nested namespaces: Sử dụng `/` separator (ví dụ: `"robot/base/velocity"`) +- Tất cả NodeHandle instances chia sẻ cùng một static parameter tree + +**Ứng dụng:** +- Quản lý cấu hình robot từ file YAML +- Truyền tham số giữa các modules +- Runtime configuration changes +- Testing với các bộ tham số khác nhau + +### 3. Init Module - Quản lý Vòng đời Hệ thống + +Module Init quản lý vòng đời của robot system, tương tự `ros::init()` và `ros::ok()` trong ROS. + +**Đặc điểm:** +- Quản lý trạng thái system (đang chạy hay đã shutdown) +- Xử lý shutdown graceful với signal handling +- Tự động xử lý SIGINT (Ctrl-C) để shutdown an toàn +- Hỗ trợ custom signal handler +- Thread-safe với `std::atomic` + +**Cơ chế hoạt động:** +- Sử dụng `std::atomic` để đảm bảo thread-safety +- Tự động cài đặt SIGINT handler để xử lý Ctrl-C +- Quản lý trạng thái shutdown với 2 flags: `shutdown_requested` và `shutdown_complete` +- Hỗ trợ custom signal handler nếu cần xử lý đặc biệt + +**Các trạng thái:** +- **Running**: System đang chạy bình thường +- **Shutdown Requested**: Shutdown đã được yêu cầu (ngay lập tức khi gọi `shutdown()`) +- **Shutdown Complete**: System đã shutdown hoàn toàn + +**Ứng dụng:** +- Main loops với kiểm tra `robot::ok()` +- Thread loops cần kiểm tra trạng thái system +- Long-running callbacks cần early exit khi shutdown +- Graceful shutdown với cleanup resources + +### 4. PluginLoaderHelper Module - Tìm kiếm Plugin Libraries + +Module PluginLoaderHelper giúp tìm đường dẫn library file (.so) từ tên symbol (export name) được sử dụng với `BOOST_DLL_ALIAS`. + +**Đặc điểm:** +- Map tên symbol (export name) sang đường dẫn library file +- Đọc cấu hình từ YAML file hoặc NodeHandle +- Tự động tìm build directory tại runtime +- Hỗ trợ nhiều cách tìm kiếm: từ config, từ build directory, từ system paths + +**Cơ chế hoạt động:** +- Đọc file YAML (`boost_dll_plugins.yaml`) hoặc từ NodeHandle +- Map symbol names (ví dụ: "CustomPlanner") sang library paths +- Tự động tìm build directory từ environment variables hoặc config +- Hỗ trợ fallback mechanisms nếu không tìm thấy trong config + +**Ứng dụng:** +- Dynamic loading của global planners, local planners, recovery behaviors +- Plugin discovery trong runtime +- Tích hợp với boost::dll để load plugins +- Quản lý plugin registry + +## Kiến trúc + +### Cấu trúc thư mục + +``` +robot_cpp/ +├── include/robot/ +│ ├── console.h # Console logging API +│ ├── node_handle.h # NodeHandle parameter management API +│ ├── init.h # System initialization and shutdown API +│ └── plugin_loader_helper.h # Plugin loader helper API +├── src/ +│ ├── console.cpp # Console implementation +│ ├── node_handle.cpp # NodeHandle implementation +│ ├── init.cpp # Init implementation +│ └── plugin_loader_helper.cpp # PluginLoaderHelper implementation +├── test/ +│ └── test_node_handle.cpp # Unit tests +├── INIT_USAGE.md # Hướng dẫn chi tiết về Init module +├── PLUGIN_LOADER_README.md # Hướng dẫn về PluginLoaderHelper +└── CMakeLists.txt +``` + +### Mối quan hệ giữa các modules + +- **Console** là module độc lập, không phụ thuộc vào modules khác +- **NodeHandle** sử dụng yaml-cpp để parse YAML files +- **Init** quản lý lifecycle chung của system, được sử dụng bởi tất cả modules khác +- **PluginLoaderHelper** sử dụng NodeHandle để đọc cấu hình plugins + +## Dependencies + +- **yaml-cpp**: Thư viện parse YAML files (cho NodeHandle và PluginLoaderHelper) +- **robot_xmlrpcpp**: Hỗ trợ XmlRpcValue conversion (optional, cho NodeHandle) +- **robot_time**: Thư viện quản lý thời gian (cho Init module với Rate/Duration) +- **C++17**: Yêu cầu C++ standard 17 trở lên +- **Boost.DLL**: Được sử dụng bởi PluginLoaderHelper (thông qua boost::dll) + +## Build và Installation + +Thư viện hỗ trợ cả Catkin và Standalone CMake: + +- **Với Catkin**: Tích hợp vào catkin workspace và build như các ROS packages khác +- **Với Standalone CMake**: Có thể build độc lập, không cần ROS + +## Use Cases + +### Configuration Management +Sử dụng NodeHandle để quản lý tất cả cấu hình robot từ file YAML, cho phép thay đổi cấu hình mà không cần recompile. + +### System Logging +Sử dụng Console module để log thông tin, cảnh báo, và lỗi với màu sắc, giúp dễ dàng debug và monitor hệ thống. + +### Lifecycle Management +Sử dụng Init module để quản lý vòng đời của ứng dụng, đảm bảo shutdown graceful khi nhận Ctrl-C hoặc signal khác. + +### Plugin Discovery +Sử dụng PluginLoaderHelper để tìm và load các plugins động tại runtime, cho phép mở rộng hệ thống mà không cần recompile. + +### Multi-threaded Applications +Tất cả các modules đều thread-safe, cho phép sử dụng an toàn trong các ứng dụng đa luồng. + +## Best Practices + +1. **Sử dụng NodeHandle cho tất cả cấu hình**: Tránh hardcode parameters, sử dụng YAML files + +2. **Sử dụng Console logging thay vì printf/cout**: Có màu sắc và throttle logging tự động + +3. **Luôn kiểm tra robot::ok() trong loops**: Đảm bảo có thể shutdown gracefully + +4. **Sử dụng throttle logging cho frequent messages**: Tránh spam console với các messages lặp lại + +5. **Namespace organization**: Sử dụng namespace phân cấp để tổ chức parameters một cách logic + +6. **Plugin configuration**: Sử dụng PluginLoaderHelper thay vì hardcode library paths + +## Tính năng nổi bật + +### 1. Color Support với Auto-detection +Console module tự động phát hiện khả năng hỗ trợ màu của terminal và tự động tắt màu nếu: +- Biến môi trường `NO_COLOR` được set +- Terminal không hỗ trợ ANSI colors +- Output được redirect vào file + +### 2. Throttle Logging +Mỗi hàm throttle sử dụng static variable riêng để lưu timestamp, cho phép: +- Giới hạn tần suất log của các messages lặp lại +- Tránh spam console với các messages thường xuyên +- Tự động reset sau một khoảng thời gian + +### 3. YAML Auto-loading +NodeHandle tự động tìm và load YAML files từ config directory khi khởi tạo: +- Tìm tất cả `.yaml` và `.yml` files trong config directory +- Merge tất cả files vào một parameter tree +- Hỗ trợ nested structures và arrays + +### 4. Thread-safe Operations +Tất cả các operations đều thread-safe: +- NodeHandle sử dụng static parameter tree với thread-safe access +- Init module sử dụng `std::atomic` cho flags +- Console logging thread-safe với static variables + +### 5. Graceful Shutdown +Init module cung cấp cơ chế shutdown graceful: +- Tự động xử lý SIGINT (Ctrl-C) +- Hỗ trợ custom signal handlers +- Phân biệt giữa "shutdown requested" và "shutdown complete" +- Cho phép early exit trong long-running callbacks + +## Lưu ý quan trọng + +- **NodeHandle static tree**: Tất cả NodeHandle instances chia sẻ cùng một static parameter tree, thay đổi từ một instance sẽ ảnh hưởng đến tất cả instances khác + +- **YAML loading order**: YAML files được load và merge theo thứ tự filesystem, file sau sẽ override parameters của file trước nếu có conflict + +- **Throttle logging scope**: Mỗi hàm throttle sử dụng static variable riêng, các lời gọi từ cùng một vị trí code sẽ chia sẻ cùng một throttle counter + +- **Plugin path resolution**: PluginLoaderHelper tìm library paths theo thứ tự: config file → build directory → system paths + +- **Init timing**: Cần gọi `robot::init()` trước khi sử dụng các modules khác, đặc biệt là `robot::Time::now()` + +## Tài liệu tham khảo + +- `INIT_USAGE.md` - Hướng dẫn chi tiết về Init module với các use cases và best practices +- `PLUGIN_LOADER_README.md` - Hướng dẫn về PluginLoaderHelper và cách cấu hình plugins +- `README.md` (file này) - Tổng quan về toàn bộ thư viện + +## License + +BSD License - Xem file LICENSE trong thư mục gốc. diff --git a/src/Libraries/robot_cpp/include/robot/console.h b/src/Libraries/robot_cpp/include/robot/console.h new file mode 100644 index 0000000..f70d864 --- /dev/null +++ b/src/Libraries/robot_cpp/include/robot/console.h @@ -0,0 +1,525 @@ +#ifndef ROBOT_CONSOLE_H +#define ROBOT_CONSOLE_H + +#include +#include + +namespace robot +{ + + /** + * @namespace color + * @brief ANSI color code constants for terminal output formatting. + * + * This namespace provides ANSI escape sequences for colored terminal output. + * All color codes are compatible with terminals that support ANSI escape codes. + * Colors are automatically disabled if the terminal doesn't support them or if + * the NO_COLOR environment variable is set. + */ + namespace color + { + /** + * @brief ANSI escape code to reset all formatting. + * + * Resets text color, background color, and all text styles to default. + */ + static const char *RESET = "\033[0m"; + + // Text colors + /** + * @brief ANSI escape code for black text color. + */ + static const char *BLACK = "\033[30m"; + + /** + * @brief ANSI escape code for red text color. + */ + static const char *RED = "\033[31m"; + + /** + * @brief ANSI escape code for green text color. + */ + static const char *GREEN = "\033[32m"; + + /** + * @brief ANSI escape code for yellow text color. + */ + static const char *YELLOW = "\033[33m"; + + /** + * @brief ANSI escape code for blue text color. + */ + static const char *BLUE = "\033[34m"; + + /** + * @brief ANSI escape code for magenta text color. + */ + static const char *MAGENTA = "\033[35m"; + + /** + * @brief ANSI escape code for cyan text color. + */ + static const char *CYAN = "\033[36m"; + + /** + * @brief ANSI escape code for white text color. + */ + static const char *WHITE = "\033[37m"; + + // Bright text colors + /** + * @brief ANSI escape code for bright black text color. + */ + static const char *BRIGHT_BLACK = "\033[90m"; + + /** + * @brief ANSI escape code for bright red text color. + */ + static const char *BRIGHT_RED = "\033[91m"; + + /** + * @brief ANSI escape code for bright green text color. + */ + static const char *BRIGHT_GREEN = "\033[92m"; + + /** + * @brief ANSI escape code for bright yellow text color. + */ + static const char *BRIGHT_YELLOW = "\033[93m"; + + /** + * @brief ANSI escape code for bright blue text color. + */ + static const char *BRIGHT_BLUE = "\033[94m"; + + /** + * @brief ANSI escape code for bright magenta text color. + */ + static const char *BRIGHT_MAGENTA = "\033[95m"; + + /** + * @brief ANSI escape code for bright cyan text color. + */ + static const char *BRIGHT_CYAN = "\033[96m"; + + /** + * @brief ANSI escape code for bright white text color. + */ + static const char *BRIGHT_WHITE = "\033[97m"; + + // Background colors + /** + * @brief ANSI escape code for black background color. + */ + static const char *BG_BLACK = "\033[40m"; + + /** + * @brief ANSI escape code for red background color. + */ + static const char *BG_RED = "\033[41m"; + + /** + * @brief ANSI escape code for green background color. + */ + static const char *BG_GREEN = "\033[42m"; + + /** + * @brief ANSI escape code for yellow background color. + */ + static const char *BG_YELLOW = "\033[43m"; + + /** + * @brief ANSI escape code for blue background color. + */ + static const char *BG_BLUE = "\033[44m"; + + /** + * @brief ANSI escape code for magenta background color. + */ + static const char *BG_MAGENTA = "\033[45m"; + + /** + * @brief ANSI escape code for cyan background color. + */ + static const char *BG_CYAN = "\033[46m"; + + /** + * @brief ANSI escape code for white background color. + */ + static const char *BG_WHITE = "\033[47m"; + + // Text styles + /** + * @brief ANSI escape code for bold text style. + */ + static const char *BOLD = "\033[1m"; + + /** + * @brief ANSI escape code for dim text style. + */ + static const char *DIM = "\033[2m"; + + /** + * @brief ANSI escape code for italic text style. + */ + static const char *ITALIC = "\033[3m"; + + /** + * @brief ANSI escape code for underlined text style. + */ + static const char *UNDERLINE = "\033[4m"; + + /** + * @brief ANSI escape code for blinking text style. + */ + static const char *BLINK = "\033[5m"; + + /** + * @brief ANSI escape code for reverse video (swap foreground/background). + */ + static const char *REVERSE = "\033[7m"; + } + + /** + * @brief Check if the terminal supports color output. + * + * Checks various conditions to determine if the terminal supports ANSI color codes: + * - Checks if NO_COLOR environment variable is set (disables colors) + * - Checks TERM environment variable for common color-capable terminals + * - Defaults to true for most modern terminals + * + * @return true if colors are supported, false otherwise. + */ + bool is_color_supported(); + + /** + * @brief Enable or disable color output. + * + * Sets whether color output should be used. This is useful for redirecting output + * to files or non-terminal outputs where color codes would be unwanted. + * + * @param enabled true to enable colors (if supported), false to disable. + * + * @note Colors are only enabled if both this flag is true AND the terminal supports colors. + */ + void set_color_enabled(bool enabled); + + /** + * @brief Check if color output is currently enabled. + * + * Returns true only if both color_enabled flag is true AND the terminal supports colors. + * + * @return true if colors are enabled and supported, false otherwise. + */ + bool is_color_enabled(); + + /** + * @brief Print formatted text in red color. + * + * Prints formatted text using printf-style formatting with red text color. + * Automatically resets color after printing. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * printf_red("Error: %s\n", error_message); + * @endcode + */ + void printf_red(const char *format, ...); + + /** + * @brief Print formatted text in green color. + * + * Prints formatted text using printf-style formatting with green text color. + * Automatically resets color after printing. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void printf_green(const char *format, ...); + + /** + * @brief Print formatted text in yellow color. + * + * Prints formatted text using printf-style formatting with yellow text color. + * Automatically resets color after printing. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void printf_yellow(const char *format, ...); + + /** + * @brief Print formatted text in blue color. + * + * Prints formatted text using printf-style formatting with blue text color. + * Automatically resets color after printing. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void printf_blue(const char *format, ...); + + /** + * @brief Print formatted text in cyan color. + * + * Prints formatted text using printf-style formatting with cyan text color. + * Automatically resets color after printing. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void printf_cyan(const char *format, ...); + + /** + * @brief Print formatted text in magenta color. + * + * Prints formatted text using printf-style formatting with magenta text color. + * Automatically resets color after printing. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void printf_magenta(const char *format, ...); + + /** + * @brief Print formatted text in white color. + * + * Prints formatted text using printf-style formatting with white text color. + * Automatically resets color after printing. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void printf_white(const char *format, ...); + + /** + * @brief Print formatted text with a custom color code. + * + * Prints formatted text using printf-style formatting with a custom ANSI color code. + * Useful when you want to use a color from the color namespace or combine styles. + * Automatically resets color after printing. + * + * @param color_code ANSI escape code for the desired color/style (e.g., color::RED, color::BOLD). + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * printf_color(color::BRIGHT_RED, "Critical: %s\n", message); + * printf_color(color::BOLD, "Important message\n"); + * @endcode + */ + void printf_color(const char *color_code, const char *format, ...); + + /** + * @brief Log an informational message (blue color). + * + * Logs an informational message with blue text color. Use for general information + * that doesn't indicate success, warning, or error. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * log_info("Processing %d items\n", count); + * @endcode + */ + void log_info(const char *format, ...); + + /** + * @brief Log a success message (green color). + * + * Logs a success message with green text color. Use for successful operations + * or positive status updates. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * log_success("Operation completed successfully\n"); + * @endcode + */ + void log_success(const char *format, ...); + + /** + * @brief Log a warning message (yellow color). + * + * Logs a warning message with yellow text color. Use for warnings that don't + * prevent operation but should be noted. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * log_warning("Low battery: %d%%\n", battery_level); + * @endcode + */ + void log_warning(const char *format, ...); + + /** + * @brief Log an error message (red color). + * + * Logs an error message with red text color. Use for errors that indicate + * problems or failures. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * log_error("Failed to open file: %s\n", filename); + * @endcode + */ + void log_error(const char *format, ...); + + /** + * @brief Log a debug message (cyan color). + * + * Logs a debug message with cyan text color. Use for debugging information + * that is typically only needed during development. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * log_debug("Variable value: %d\n", value); + * @endcode + */ + void log_debug(const char *format, ...); + + /** + * @brief Log an informational message with file and line information. + * + * Logs an informational message with blue color, including the source file + * and line number where the log was called. Useful for debugging and tracing. + * + * @param file Source file name (typically use __FILE__ macro). + * @param line Line number (typically use __LINE__ macro). + * @param format printf-style format string. + * @param ... Variable arguments for format string. + * + * @code + * log_info_at(__FILE__, __LINE__, "Processing started\n"); + * @endcode + */ + void log_info_at(const char *file, int line, const char *format, ...); + + /** + * @brief Log a success message with file and line information. + * + * Logs a success message with green color, including the source file and line number. + * + * @param file Source file name (typically use __FILE__ macro). + * @param line Line number (typically use __LINE__ macro). + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_success_at(const char *file, int line, const char *format, ...); + + /** + * @brief Log a warning message with file and line information. + * + * Logs a warning message with yellow color, including the source file and line number. + * + * @param file Source file name (typically use __FILE__ macro). + * @param line Line number (typically use __LINE__ macro). + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_warning_at(const char *file, int line, const char *format, ...); + + /** + * @brief Log an error message with file and line information. + * + * Logs an error message with red color, including the source file and line number. + * + * @param file Source file name (typically use __FILE__ macro). + * @param line Line number (typically use __LINE__ macro). + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_error_at(const char *file, int line, const char *format, ...); + + /** + * @brief Log a debug message with file and line information. + * + * Logs a debug message with cyan color, including the source file and line number. + * + * @param file Source file name (typically use __FILE__ macro). + * @param line Line number (typically use __LINE__ macro). + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_debug_at(const char *file, int line, const char *format, ...); + + + /** + * @brief Log an error message with throttle. + * + * Logs an error message with red text color. Use for errors that indicate + * problems or failures. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_error_throttle(double throttle, const char *format, ...); + + /** + * @brief Log a debug message with throttle. + * + * Logs a debug message with cyan text color. Use for debugging information + * that is typically only needed during development. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_info_throttle(double throttle, const char *format, ...); + + /** + * @brief Log a success message with throttle. + * + * Logs a success message with green text color. Use for successful operations + * or positive status updates. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_success_throttle(double throttle, const char *format, ...); + + /** + * @brief Log a warning message with throttle. + * + * Logs a warning message with yellow text color. Use for warnings that don't + * prevent operation but should be noted. + * + * @param format printf-style format string. + * @param ... Variable arguments for format string. + */ + void log_warning_throttle(double throttle, const char *format, ...); + + /** + * @brief Assert a condition and log error if it fails. + * + * Checks if a condition is true. If the condition is false, logs an error + * message with red text color and terminates the program by calling abort(). + * This is useful for debugging and catching logic errors during development. + * + * @param condition The condition to check (must evaluate to true). + * @param format Optional printf-style format string for error message. + * @param ... Variable arguments for format string. + * + * @note In release builds, assertions may be disabled. Use this for conditions + * that should never be false (logic errors), not for runtime error handling. + * + * @code + * log_assert(ptr != nullptr, "Pointer is null!"); + * log_assert(index < size, "Index %d out of bounds (size: %d)", index, size); + * log_assert(velocity > 0, "Velocity must be positive, got: %f", velocity); + * @endcode + */ + void log_assert(bool condition, const char *format = nullptr, ...); + + +} // namespace robot + +#endif // ROBOT_CONSOLE_H diff --git a/src/Libraries/robot_cpp/include/robot/init.h b/src/Libraries/robot_cpp/include/robot/init.h new file mode 100644 index 0000000..1358fa8 --- /dev/null +++ b/src/Libraries/robot_cpp/include/robot/init.h @@ -0,0 +1,134 @@ +#ifndef ROBOT_INIT_H_INCLUDED +#define ROBOT_INIT_H_INCLUDED + +#include +#include +#include + +namespace robot +{ + +/** + * @brief Check if the robot system is still running + * + * Similar to ros::ok(), this function returns false when the system + * has finished shutting down. Use this in main loops and thread loops + * to check if the system should continue running. + * + * @return true if system is running, false if shutdown is complete + * + * @note This returns false only after shutdown is complete, not when + * shutdown is requested. Use isShuttingDown() to check if shutdown + * has been requested. + * + * Example: + * @code + * while (robot::ok()) + * { + * // Do work + * } + * @endcode + */ +bool ok(); + +/** + * @brief Check if shutdown has been requested + * + * Similar to ros::isShuttingDown(), this function returns true as soon + * as shutdown() is called, not when shutdown is complete. Use this in + * long-running callbacks to check if they should exit early. + * + * @return true if shutdown has been requested, false otherwise + * + * @note This returns true immediately when shutdown() is called, while + * ok() returns false only after shutdown is complete. + * + * Example: + * @code + * void longCallback() + * { + * for (int i = 0; i < 1000000; i++) + * { + * if (robot::isShuttingDown()) + * return; // Exit early + * // Do work... + * } + * } + * @endcode + */ +bool isShuttingDown(); + +/** + * @brief Shutdown the robot system + * + * Similar to ros::shutdown(), this function initiates the shutdown process. + * After calling this: + * - isShuttingDown() will return true immediately + * - ok() will return false after shutdown is complete + * + * @note This function is thread-safe and can be called multiple times. + * Subsequent calls have no effect. + * + * Example: + * @code + * // Custom signal handler + * void mySigintHandler(int sig) + * { + * // Do custom cleanup + * robot::shutdown(); + * } + * @endcode + */ +void shutdown(); + +/** + * @brief Initialize the robot system + * + * Similar to ros::init(), this function initializes the robot system. + * It sets up signal handlers and initializes internal state. + * + * @param argc Number of command line arguments (can be modified) + * @param argv Command line arguments (can be modified) + * @param node_name Name of the node (optional, for logging purposes) + * @param install_sigint_handler If true, install SIGINT handler (default: true) + * + * @note If install_sigint_handler is true, Ctrl-C will automatically + * call shutdown(). Set to false if you want custom signal handling. + * + * Example: + * @code + * int main(int argc, char** argv) + * { + * robot::init(argc, argv, "my_node"); + * // ... use robot system ... + * return 0; + * } + * @endcode + */ +void init(int& argc, char** argv, const std::string& node_name = "", bool install_sigint_handler = true); + +/** + * @brief Initialize the robot system without command line arguments + * + * Simplified version of init() that doesn't require argc/argv. + * + * @param node_name Name of the node (optional, for logging purposes) + * @param install_sigint_handler If true, install SIGINT handler (default: true) + */ +void init(const std::string& node_name = "", bool install_sigint_handler = true); + +namespace detail +{ + /** + * @brief Internal signal handler for SIGINT + * + * This is called automatically when SIGINT is received (Ctrl-C). + * It calls shutdown() to gracefully shut down the system. + */ + void sigintHandler(int sig); +} + +} // namespace robot + +#endif // ROBOT_INIT_H_INCLUDED + diff --git a/src/Libraries/robot_cpp/include/robot/node_handle.h b/src/Libraries/robot_cpp/include/robot/node_handle.h new file mode 100644 index 0000000..9931e3f --- /dev/null +++ b/src/Libraries/robot_cpp/include/robot/node_handle.h @@ -0,0 +1,657 @@ +#ifndef ROBOT_NODE_H_INCLUDED_H +#define ROBOT_NODE_H_INCLUDED_H + +#include +#include +#include +#include +#include +#include + + +namespace robot +{ + /** + * @class NodeHandle + * @brief Main interface for accessing and setting parameters using YAML-based parameter server. + * + * NodeHandle provides a ROS-like interface for parameter management, using YAML files as the backend. + * It supports namespaces, nested parameters, and automatic loading of YAML configuration files. + * + * @note This class uses YAML::Node internally to store and manage parameters, providing a hierarchical + * parameter structure similar to ROS parameter server. + */ + class NodeHandle + { + public: + /** + * @brief Type alias for remappings (map of string to string). + * + * Used for topic and parameter name remapping, similar to ROS remapping mechanism. + */ + using M_string = std::map; + + /** + * @brief Type alias for shared pointer to NodeHandle. + * + * Convenience type for managing NodeHandle instances with shared ownership. + */ + using Ptr = std::shared_ptr; + + /** + * @brief Default constructor with optional namespace and remappings. + * + * Creates a root-level NodeHandle or one scoped to the specified namespace. + * If namespace is "~" or empty, operates at root level. Automatically loads + * YAML configuration files from the config directory if available. + * + * @param ns The namespace for this NodeHandle (default: root). + * Use "~" for private namespace (maps to config directory). + * @param remappings Map of parameter name remappings (default: empty). + */ + NodeHandle(const std::string &ns = std::string(), const M_string &remappings = M_string()); + + /** + * @brief Constructor from parent NodeHandle with new namespace. + * + * Creates a new NodeHandle that is scoped to a child namespace of the parent. + * The new NodeHandle will have access to parameters under the specified namespace. + * + * @param parent The parent NodeHandle to inherit from. + * @param ns The namespace to scope this NodeHandle to (relative to parent). + * Leading '/' is automatically stripped. + */ + NodeHandle(const NodeHandle &parent, const std::string &ns); + + /** + * @brief Constructor from parent NodeHandle with new namespace and remappings. + * + * Creates a new NodeHandle with a child namespace and optional remappings. + * + * @param parent The parent NodeHandle to inherit from. + * @param ns The namespace to scope this NodeHandle to (relative to parent). + * Leading '/' is automatically stripped. + * @param remappings Map of parameter name remappings (currently not fully implemented). + */ + NodeHandle(const NodeHandle &parent, const std::string &ns, const M_string &remappings); + + /** + * @brief Copy constructor. + * + * Creates a copy of the NodeHandle with the same namespace scope. + * Both instances will reference the same underlying parameter tree. + * + * @param parent The NodeHandle to copy from. + */ + NodeHandle(const NodeHandle &parent); + + /** + * @brief Assignment operator. + * + * Assigns the namespace and parameter scope from another NodeHandle. + * + * @param parent The NodeHandle to assign from. + * @return Reference to this NodeHandle. + */ + NodeHandle &operator=(const NodeHandle &parent); + + /** + * @brief Destructor. + * + * Cleans up the NodeHandle instance. Note that static members (root_ and config_directory_) + * persist across NodeHandle instances. + */ + ~NodeHandle(); + + /** + * @brief Check if a parameter exists. + * + * Checks whether a parameter with the given key exists in the parameter server. + * Supports nested keys using '/' separator (e.g., "parent/child"). + * + * @param key The parameter key to check. Can be nested using '/' separator. + * @return true if the parameter exists, false otherwise. + */ + bool hasParam(const std::string &key) const; + + /** + * @brief Get a boolean value from the parameter server. + * + * Retrieves a boolean parameter value. Supports string-to-boolean conversion + * for values like "true", "false", "1", "0", "yes", "no", "on", "off". + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param b Storage for the retrieved value. Set to default_value if key not found. + * @param default_value Default value to use if parameter doesn't exist (default: false). + * @return true if the parameter value was retrieved successfully, false otherwise. + * + * @note If you want to provide a default value in case the key does not exist, use param() instead. + */ + bool getParam(const std::string &key, bool &b, bool default_value = false) const; + + /** + * @brief Get a double value from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param d Storage for the retrieved value. Set to default_value if key not found. + * @param default_value Default value to use if parameter doesn't exist (default: 0.0). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam(const std::string &key, double &d, double default_value = 0.0) const; + + /** + * @brief Get a float value from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param f Storage for the retrieved value. Set to default_value if key not found. + * @param default_value Default value to use if parameter doesn't exist (default: 0.0). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, float &f, float default_value = 0.0) const; + + /** + * @brief Get an integer value from the parameter server. + * + * Supports hexadecimal format (e.g., "0x10"). + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param i Storage for the retrieved value. Set to default_value if key not found. + * @param default_value Default value to use if parameter doesn't exist (default: 0). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, int &i, int default_value = 0) const; + + /** + * @brief Get a map of string-to-bool from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map Storage for the retrieved map. Set to default_value if key not found. + * @param default_value Default map to use if parameter doesn't exist (default: empty map). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::map< std::string, bool > &map, std::map< std::string, bool > default_value = std::map< std::string, bool >()) const; + + /** + * @brief Get a map of string-to-double from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map Storage for the retrieved map. Set to default_value if key not found. + * @param default_value Default map to use if parameter doesn't exist (default: empty map). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::map< std::string, double > &map, std::map< std::string, double > default_value = std::map< std::string, double >()) const; + + /** + * @brief Get a map of string-to-float from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map Storage for the retrieved map. Set to default_value if key not found. + * @param default_value Default map to use if parameter doesn't exist (default: empty map). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::map< std::string, float > &map, std::map< std::string, float > default_value = std::map< std::string, float >()) const; + + /** + * @brief Get a map of string-to-int from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map Storage for the retrieved map. Set to default_value if key not found. + * @param default_value Default map to use if parameter doesn't exist (default: empty map). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::map< std::string, int > &map, std::map< std::string, int > default_value = std::map< std::string, int >()) const; + + /** + * @brief Get a map of string-to-string from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map Storage for the retrieved map. Set to default_value if key not found. + * @param default_value Default map to use if parameter doesn't exist (default: empty map). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::map< std::string, std::string > &map, std::map< std::string, std::string > default_value = std::map< std::string, std::string >()) const; + + /** + * @brief Get a string value from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param s Storage for the retrieved value. Set to default_value if key not found. + * @param default_value Default value to use if parameter doesn't exist (default: empty string). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::string &s, std::string default_value = "") const; + + /** + * @brief Get a vector of boolean values from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec Storage for the retrieved vector. Set to default_value if key not found. + * @param default_value Default vector to use if parameter doesn't exist (default: empty vector). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::vector< bool > &vec, std::vector< bool > default_value = std::vector< bool >()) const; + + /** + * @brief Get a vector of double values from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec Storage for the retrieved vector. Set to default_value if key not found. + * @param default_value Default vector to use if parameter doesn't exist (default: empty vector). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::vector< double > &vec, std::vector< double > default_value = std::vector< double >()) const; + + /** + * @brief Get a vector of float values from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec Storage for the retrieved vector. Set to default_value if key not found. + * @param default_value Default vector to use if parameter doesn't exist (default: empty vector). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::vector< float > &vec, std::vector< float > default_value = std::vector< float >()) const; + + /** + * @brief Get a vector of integer values from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec Storage for the retrieved vector. Set to default_value if key not found. + * @param default_value Default vector to use if parameter doesn't exist (default: empty vector). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::vector< int > &vec, std::vector< int > default_value = std::vector< int >()) const; + + /** + * @brief Get a vector of string values from the parameter server. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec Storage for the retrieved vector. Set to default_value if key not found. + * @param default_value Default vector to use if parameter doesn't exist (default: empty vector). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, std::vector< std::string > &vec, std::vector< std::string > default_value = std::vector< std::string >()) const; + + /** + * @brief Get a YAML::Node value from the parameter server. + * + * Returns the raw YAML node, which can represent any YAML structure (scalar, sequence, map). + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param v Storage for the retrieved YAML node. Set to default_value if key not found. + * @param default_value Default YAML node to use if parameter doesn't exist (default: empty node). + * @return true if the parameter value was retrieved successfully, false otherwise. + */ + bool getParam (const std::string &key, YAML::Node &v, YAML::Node default_value = YAML::Node()) const; + + /** + * @brief Get a parameter as robot_xmlrpcpp::XmlRpcValue (converted from YAML). + * @param key The parameter key (supports nested keys with '/' separator). + * @param v Storage for the retrieved value. Left unchanged if key not found. + * @return true if the parameter was retrieved and converted successfully, false otherwise. + */ + bool getParam (const std::string &key, robot_xmlrpcpp::XmlRpcValue &v) const; + + /** + * @brief Template method to get a parameter value (without default). + * + * Gets a parameter value. If the parameter doesn't exist, returns a default-constructed value. + * Use hasParam() to check existence before calling this method. + * + * @tparam T The type of the parameter (must be supported by getParam). + * @param param_name The parameter key (supports nested keys with '/' separator). + * @return The parameter value if found, otherwise a default-constructed value of type T. + * + * @code + * if (nh.hasParam("my_param")) { + * double value = nh.param("my_param"); + * } + * @endcode + */ + template + T param (const std::string ¶m_name) const; + + /** + * @brief Template method to get a parameter value with default. + * + * Convenience method that returns the parameter value directly, or the default if not found. + * This is the recommended way to get parameters when you have a default value. + * + * @tparam T The type of the parameter (must be supported by getParam). + * @param param_name The parameter key (supports nested keys with '/' separator). + * @param default_val The default value to return if parameter doesn't exist. + * @return The parameter value if found, otherwise default_val. + * + * @code + * int max_iterations = nh.param("max_iterations", 100); + * std::string frame_id = nh.param("frame_id", std::string("base_link")); + * @endcode + */ + template + T param (const std::string ¶m_name, const T &default_val) const; + + /** + * @brief Template method to get a parameter value with default (output parameter version). + * + * Similar to param() but uses an output parameter instead of return value. + * + * @tparam T The type of the parameter (must be supported by getParam). + * @param param_name The parameter key (supports nested keys with '/' separator). + * @param param_val Output parameter to store the retrieved value. + * @param default_val The default value to use if parameter doesn't exist. + * @return true if the parameter was found, false if default was used. + */ + template + bool param (const std::string ¶m_name, T ¶m_val, const T &default_val) const; + + /** + * @brief Search for a parameter and return the result. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param result The result of the search. + * @return true if the parameter was found, false otherwise. + */ + bool searchParam (const std::string &key, std::string &result) const; + + /** + * @brief Set a parameter from a YAML::Node. + * + * Sets a parameter value using a YAML node. This is the most flexible setParam method + * as it can handle any YAML structure (scalar, sequence, map). + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param value The YAML node containing the value to set. + */ + void setParam(const std::string &key, const YAML::Node &value); + + /** + * @brief Set a boolean parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param b The boolean value to set. + */ + void setParam (const std::string &key, bool b) const; + + /** + * @brief Set a string parameter from C-style string. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param s The C-style string value to set. + */ + void setParam (const std::string &key, const char *s) const; + + /** + * @brief Set a map of string-to-bool parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map The map of string-to-bool values to set. + */ + void setParam (const std::string &key, const std::map< std::string, bool > &map) const; + + /** + * @brief Set a map of string-to-double parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map The map of string-to-double values to set. + */ + void setParam (const std::string &key, const std::map< std::string, double > &map) const; + + /** + * @brief Set a map of string-to-float parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map The map of string-to-float values to set. + */ + void setParam (const std::string &key, const std::map< std::string, float > &map) const; + + /** + * @brief Set a map of string-to-int parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map The map of string-to-int values to set. + */ + void setParam (const std::string &key, const std::map< std::string, int > &map) const; + + /** + * @brief Set a map of string-to-string parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param map The map of string-to-string values to set. + */ + void setParam (const std::string &key, const std::map< std::string, std::string > &map) const; + + /** + * @brief Set a string parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param s The string value to set. + */ + void setParam (const std::string &key, const std::string &s) const; + + /** + * @brief Set a vector of boolean values parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec The vector of boolean values to set. + */ + void setParam (const std::string &key, const std::vector< bool > &vec) const; + + /** + * @brief Set a vector of double values parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec The vector of double values to set. + */ + void setParam (const std::string &key, const std::vector< double > &vec) const; + + /** + * @brief Set a vector of float values parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec The vector of float values to set. + */ + void setParam (const std::string &key, const std::vector< float > &vec) const; + + /** + * @brief Set a vector of integer values parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec The vector of integer values to set. + */ + void setParam (const std::string &key, const std::vector< int > &vec) const; + + /** + * @brief Set a vector of string values parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param vec The vector of string values to set. + */ + void setParam (const std::string &key, const std::vector< std::string > &vec) const; + + /** + * @brief Set a parameter from robot_xmlrpcpp::XmlRpcValue. + * + * Converts an XmlRpcValue to YAML format and sets it as a parameter. + * Supports boolean, int, double, string, array, and struct types. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param v The XmlRpcValue to convert and set. + */ + void setParam (const std::string &key, const robot_xmlrpcpp::XmlRpcValue &v) const; + + /** + * @brief Set a double parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param d The double value to set. + */ + void setParam (const std::string &key, double d) const; + + /** + * @brief Set an integer parameter. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param i The integer value to set. + */ + void setParam (const std::string &key, int i) const; + + /** + * @brief Get a nested parameter value by key path. + * + * Retrieves a YAML node from the parameter tree using a key path. + * Supports nested keys using '/' separator (e.g., "parent/child/grandchild"). + * + * @param key The parameter key path (supports nested keys with '/' separator). + * @return YAML::Node containing the parameter value, or empty node if not found. + */ + YAML::Node getParamValue(const std::string &key) const; + + /** + * @brief Get the underlying YAML node handle. + * + * Returns a const reference to the internal YAML node that stores all parameters + * for this NodeHandle's namespace scope. + * + * @return Const reference to the YAML node handle. + */ + const YAML::Node &getNodeHandle() const; + + /** + * @brief Merge a YAML node into another node (recursively merges maps). + * + * Recursively merges the source YAML node into the output node. + * If both nodes contain maps with the same key, the maps are merged recursively. + * Scalar values and sequences are overwritten. + * + * @param source The source YAML node to merge from. + * @param output The output YAML node to merge into (modified in place). + */ + void mergeYamlNode(const YAML::Node &source, YAML::Node &output); + + /** + * @brief Load all YAML files from a directory and merge them. + * + * Scans the specified directory for .yaml and .yml files, loads them, + * and merges them into the root parameter tree. Files are processed in + * filesystem order. + * + * @param directory_path Path to the directory containing YAML files. + * @return Number of files successfully loaded. + */ + int loadYamlFilesFromDirectory(const std::string &directory_path); + + /** + * @brief Get the namespace of this NodeHandle. + * + * Returns the namespace string that this NodeHandle is scoped to. + * If the namespace was "~" or empty, returns "/" (root namespace). + * + * @return The namespace string (e.g., "/robot/base" or "/" for root). + */ + std::string getNamespace() const; + + /** + * @brief Print all parameters in the current namespace scope (debug method). + * + * Debug utility that prints all parameters in the node_handle_ to stdout. + * Shows the hierarchical structure with indentation. Useful for debugging + * parameter loading and namespace scoping. + */ + void printParams() const; + + private: + /** + * @brief Helper method to split key path and get nested value. + * + * Internal method that traverses the parameter tree using a key path + * (e.g., "parent/child") and returns the nested YAML node. + * + * @param key The parameter key path (supports nested keys with '/' separator). + * @return YAML::Node containing the nested value, or empty node if not found. + */ + YAML::Node getNestedValue(const std::string &key) const; + + /** + * @brief Debug version of getNestedValue with verbose output. + * + * Same as getNestedValue() but with additional debug output for troubleshooting. + * + * @param key The parameter key path (supports nested keys with '/' separator). + * @return YAML::Node containing the nested value, or empty node if not found. + */ + YAML::Node getNestedValueDebug(const std::string &key) const; + + /** + * @brief Helper method to set parameter with type checking. + * + * Internal method that sets a parameter value with optional type checking. + * If the key already exists with a different type, it will be overwritten. + * + * @param key The parameter key (supports nested keys with '/' separator). + * @param value The YAML node value to set. + * @param expected_type The expected YAML node type (for type checking). + */ + void setParamInternal(const std::string &key, const YAML::Node &value, YAML::NodeType::value expected_type); + + /** + * @brief Helper method to find config directory automatically. + * + * Static method that attempts to locate the config directory using various + * strategies: environment variables, relative paths from executable, hardcoded paths. + * + * @return The config directory path if found, empty string otherwise. + */ + static std::string findConfigDirectory(); + + /** + * @brief Auto-load YAML files from config directory. + * + * Internal method that automatically loads all YAML files from the config + * directory and merges them into the root_ parameter tree. Called during + * NodeHandle construction if config_directory_ is set. + */ + void autoLoadConfigFiles(); + + /** + * @brief Debug method to print all parameters in a YAML node. + * + * Recursive helper method that prints the structure and values of a YAML node + * with indentation to show hierarchy. Used by printAllParams(). + * + * @param node The YAML node to print. + */ + void printParams(YAML::Node node) const; + + /** + * @brief The namespace this NodeHandle is scoped to. + * + * Stores the namespace string. If namespace is "~" or empty, it's set to "/" (root). + */ + std::string namespace_; + + /** + * @brief Mutable storage for parameters in this namespace scope. + * + * YAML node that contains all parameters accessible through this NodeHandle. + * This is a reference into the static root_ tree, scoped to the namespace_. + */ + // YAML::Node node_handle_; + + /** + * @brief Static root parameter tree shared by all NodeHandle instances. + * + * The root YAML node containing the entire parameter tree. All NodeHandle + * instances share this static tree, with each instance scoped to a namespace. + */ + static YAML::Node root_; + + /** + * @brief Static config directory path for automatic YAML loading. + * + * Directory path from which YAML configuration files are automatically loaded. + * Set via setConfigDirectory() or found automatically via findConfigDirectory(). + */ + static std::string config_directory_; + }; +} // namespace robot + +#endif // ROBOT_NODE_H_INCLUDED_H \ No newline at end of file diff --git a/src/Libraries/robot_cpp/include/robot/plugin_loader_helper.h b/src/Libraries/robot_cpp/include/robot/plugin_loader_helper.h new file mode 100644 index 0000000..8660328 --- /dev/null +++ b/src/Libraries/robot_cpp/include/robot/plugin_loader_helper.h @@ -0,0 +1,106 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Plugin Loader Helper for Boost.DLL + * Maps symbol names (export names) to library file paths + * Similar to plugins.xml but for boost::dll + *********************************************************************/ +#ifndef ROBOT_PLUGIN_LOADER_HELPER_H_ +#define ROBOT_PLUGIN_LOADER_HELPER_H_ + +#include +#include +#include +#include +#include +#include + +namespace robot +{ + +/** + * @class PluginLoaderHelper + * @brief Helper class to find library paths from symbol names (export names) + * + * This class reads a YAML configuration file (similar to plugins.xml) that maps + * symbol names (export names used in BOOST_DLL_ALIAS) to library file paths. + * + * Usage: + * PluginLoaderHelper loader; + * std::string lib_path = loader.findLibraryPath("CustomPlanner"); + * if (!lib_path.empty()) { + * // Use lib_path with boost::dll::import_alias + * } + */ +class PluginLoaderHelper +{ +public: + /** + * @brief Constructor + */ + PluginLoaderHelper(); + + /** + * @brief Constructor + * @param nh NodeHandle to read parameters from + * @param config_namespace Namespace in NodeHandle where plugins are stored (default: root) + */ + PluginLoaderHelper(robot::NodeHandle nh, const std::string& config_namespace = ""); + + /** + * @brief Find library path from symbol name (export name) + * @param symbol_name The export name (e.g., "CustomPlanner", "PNKXLocalPlanner") + * @return Full path to the library file, or empty string if not found + */ + std::string findLibraryPath(const std::string& symbol_name); + + /** + * @brief Check if a symbol is registered + * @param symbol_name The export name + * @return True if symbol is found in config + */ + bool hasSymbol(const std::string& symbol_name) const; + + /** + * @brief Set NodeHandle and namespace for reading plugins + * @param nh NodeHandle to read parameters from + * @param config_namespace Namespace in NodeHandle where plugins are stored + */ + void setNodeHandle(robot::NodeHandle nh, const std::string& config_namespace = ""); + + /** + * @brief Get all registered symbol names + * @return Vector of all symbol names + */ + std::vector getRegisteredSymbols() const; + + /** + * @brief Get build directory (CMAKE_BINARY_DIR) at runtime + * @return Build directory path, or empty if not found + */ + static std::string getBuildDirectory(); + + /** + * @brief Get workspace path at runtime + * @return Workspace path (e.g., /home/robotics/AGV/Diff_Wheel_Prj/t800_v2_ws), or empty if not found + */ + static std::string getWorkspacePath(); + +private: + /** + * @brief Resolve library path (absolute, then PNKX_NAV_CORE_LIBRARY_PATH, search_paths_, cwd) + * @param library_path Path from config (may be relative or absolute) + * @return Resolved absolute path, or empty if not found + */ + std::string resolveLibraryPath(const std::string& library_path) const; + + robot::NodeHandle nh_; // NodeHandle to read parameters + std::string config_namespace_; // Namespace for plugins in NodeHandle + std::vector search_paths_; // Search paths for libraries +}; + +} // namespace robot + +#endif // ROBOT_PLUGIN_LOADER_HELPER_H_ + diff --git a/src/Libraries/robot_cpp/include/robot/robot.h b/src/Libraries/robot_cpp/include/robot/robot.h new file mode 100644 index 0000000..bf829ff --- /dev/null +++ b/src/Libraries/robot_cpp/include/robot/robot.h @@ -0,0 +1,18 @@ +#ifndef ROBOT_ROBOT_H +#define ROBOT_ROBOT_H + +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#endif \ No newline at end of file diff --git a/src/Libraries/robot_cpp/package.xml b/src/Libraries/robot_cpp/package.xml new file mode 100644 index 0000000..afa55e3 --- /dev/null +++ b/src/Libraries/robot_cpp/package.xml @@ -0,0 +1,30 @@ + + robot_cpp + 0.7.10 + + robot_cpp provides core utilities for robot application development, including: + - Console: Colored logging system with ANSI color support and throttle logging + - NodeHandle: ROS-like parameter management using YAML files as backend + - Init: System lifecycle management (init, ok, shutdown) with graceful shutdown handling + - PluginLoaderHelper: Helper to find library paths from symbol names for boost::dll plugins + + The library is designed to be independent of ROS and provides a foundation for + building robot applications with configuration management, logging, and plugin loading. + All operations are thread-safe and support both Catkin and Standalone CMake builds. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_cpp + + catkin + + robot_xmlrpcpp + robot_time + robot_xmlrpcpp + robot_time + + \ No newline at end of file diff --git a/src/Libraries/robot_cpp/robot_cppConfig.cmake.in b/src/Libraries/robot_cpp/robot_cppConfig.cmake.in new file mode 100644 index 0000000..6a99dd7 --- /dev/null +++ b/src/Libraries/robot_cpp/robot_cppConfig.cmake.in @@ -0,0 +1,20 @@ +# robot_cppConfig.cmake +# CMake configuration file for robot_cpp package + +# Get the directory containing this file +get_filename_component(robot_cpp_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + +# Include the targets file +include("${robot_cpp_CMAKE_DIR}/robot_cpp-targets.cmake") + +# Set variables for compatibility +set(robot_cpp_FOUND TRUE) +set(robot_cpp_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") +set(robot_cpp_LIBRARIES robot_cpp) + +# Check if all required components are available +if(NOT TARGET robot_cpp) + set(robot_cpp_FOUND FALSE) + message(FATAL_ERROR "robot_cpp target not found") +endif() + diff --git a/src/Libraries/robot_cpp/src/console.cpp b/src/Libraries/robot_cpp/src/console.cpp new file mode 100644 index 0000000..1e7f66e --- /dev/null +++ b/src/Libraries/robot_cpp/src/console.cpp @@ -0,0 +1,476 @@ +#include "robot/console.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace robot +{ + + // Global flag to enable/disable colors + static bool color_enabled = true; + + static inline bool format_ends_with_newline(const char *format) + { + if (format == nullptr) + { + return false; + } + const size_t n = std::strlen(format); + return (n > 0 && format[n - 1] == '\n'); + } + + bool is_color_supported() + { + // Check if NO_COLOR environment variable is set + const char *no_color = std::getenv("NO_COLOR"); + if (no_color != nullptr && strlen(no_color) > 0) + { + return false; + } + + // Check if TERM environment variable suggests color support + const char *term = std::getenv("TERM"); + if (term != nullptr) + { + // Common terminals that support colors + if (strstr(term, "xterm") != nullptr || + strstr(term, "color") != nullptr || + strstr(term, "256") != nullptr || + strstr(term, "screen") != nullptr || + strstr(term, "tmux") != nullptr) + { + return true; + } + } + + // Default to true for most modern terminals + return true; + } + + void set_color_enabled(bool enabled) + { + color_enabled = enabled && is_color_supported(); + } + + bool is_color_enabled() + { + return color_enabled && is_color_supported(); + } + + // Helper function to format timestamp as "sec.nsec" + static std::string format_timestamp() + { + try + { + // Use WallTime instead of Time to avoid initialization issues + // WallTime::now() doesn't require Time::init() and is always available + robot::WallTime now = robot::WallTime::now(); + std::ostringstream oss; + oss << now.sec << "." << std::setfill('0') << std::setw(9) << now.nsec; + return oss.str(); + } + catch (...) + { + // If WallTime::now() fails, return empty string + return ""; + } + } + + // Helper function that accepts va_list + static void vprintf_color(const char *color_code, const char *format, va_list args) + { + // Print timestamp first + std::string timestamp = format_timestamp(); + if (!timestamp.empty()) + { + std::printf("[%s] ", timestamp.c_str()); + } + + if (is_color_enabled()) + { + std::printf("%s", color_code); + } + + std::vprintf(format, args); + + // Auto newline unless caller already provided one in format string. + if (!format_ends_with_newline(format)) + { + std::printf("\n"); + } + + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + } + + void printf_color(const char *color_code, const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color_code, format, args); + va_end(args); + } + + void printf_red(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::RED, format, args); + va_end(args); + } + + void printf_green(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::GREEN, format, args); + va_end(args); + } + + void printf_yellow(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::YELLOW, format, args); + va_end(args); + } + + void printf_blue(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::BLUE, format, args); + va_end(args); + } + + void printf_cyan(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::CYAN, format, args); + va_end(args); + } + + void printf_magenta(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::MAGENTA, format, args); + va_end(args); + } + + void printf_white(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::WHITE, format, args); + va_end(args); + } + + void log_info(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::BRIGHT_BLUE, format, args); + va_end(args); + } + + void log_success(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::GREEN, format, args); + va_end(args); + } + + void log_warning(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::YELLOW, format, args); + va_end(args); + } + + void log_error(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::RED, format, args); + va_end(args); + } + + void log_debug(const char *format, ...) + { + va_list args; + va_start(args, format); + vprintf_color(color::CYAN, format, args); + va_end(args); + } + + void log_info_at(const char *file, int line, const char *format, ...) + { + va_list args; + va_start(args, format); + std::string timestamp = format_timestamp(); + if (!timestamp.empty()) + { + std::printf("[%s] ", timestamp.c_str()); + } + if (is_color_enabled()) + { + std::printf("%s[INFO] [%s:%d] ", color::BRIGHT_BLUE, file, line); + } + else + { + std::printf("[INFO] [%s:%d] ", file, line); + } + std::vprintf(format, args); + if (!format_ends_with_newline(format)) + { + std::printf("\n"); + } + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + va_end(args); + } + + void log_success_at(const char *file, int line, const char *format, ...) + { + va_list args; + va_start(args, format); + std::string timestamp = format_timestamp(); + if (!timestamp.empty()) + { + std::printf("[%s] ", timestamp.c_str()); + } + if (is_color_enabled()) + { + std::printf("%s[SUCCESS] [%s:%d] ", color::GREEN, file, line); + } + else + { + std::printf("[SUCCESS] [%s:%d] ", file, line); + } + std::vprintf(format, args); + if (!format_ends_with_newline(format)) + { + std::printf("\n"); + } + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + va_end(args); + } + + void log_warning_at(const char *file, int line, const char *format, ...) + { + va_list args; + va_start(args, format); + std::string timestamp = format_timestamp(); + if (!timestamp.empty()) + { + std::printf("[%s] ", timestamp.c_str()); + } + if (is_color_enabled()) + { + std::printf("%s[WARNING] [%s:%d] ", color::YELLOW, file, line); + } + else + { + std::printf("[WARNING] [%s:%d] ", file, line); + } + std::vprintf(format, args); + if (!format_ends_with_newline(format)) + { + std::printf("\n"); + } + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + va_end(args); + } + + void log_error_at(const char *file, int line, const char *format, ...) + { + va_list args; + va_start(args, format); + std::string timestamp = format_timestamp(); + if (!timestamp.empty()) + { + std::printf("[%s] ", timestamp.c_str()); + } + if (is_color_enabled()) + { + std::printf("%s[ERROR] [%s:%d] ", color::RED, file, line); + } + else + { + std::printf("[ERROR] [%s:%d] ", file, line); + } + std::vprintf(format, args); + if (!format_ends_with_newline(format)) + { + std::printf("\n"); + } + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + va_end(args); + } + + void log_debug_at(const char *file, int line, const char *format, ...) + { + va_list args; + va_start(args, format); + std::string timestamp = format_timestamp(); + if (!timestamp.empty()) + { + std::printf("[%s] ", timestamp.c_str()); + } + if (is_color_enabled()) + { + std::printf("%s[DEBUG] [%s:%d] ", color::CYAN, file, line); + } + else + { + std::printf("[DEBUG] [%s:%d] ", file, line); + } + std::vprintf(format, args); + if (!format_ends_with_newline(format)) + { + std::printf("\n"); + } + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + va_end(args); + } + + void log_error_throttle(double throttle, const char *format, ...) + { + static auto last_log_time = std::chrono::steady_clock::time_point{}; + auto now = std::chrono::steady_clock::now(); + auto elapsed = std::chrono::duration(now - last_log_time).count(); + + if (elapsed >= throttle) + { + last_log_time = now; + va_list args; + va_start(args, format); + vprintf_color(color::RED, format, args); + va_end(args); + } + } + + void log_info_throttle(double throttle, const char *format, ...) + { + static auto last_log_time = std::chrono::steady_clock::time_point{}; + auto now = std::chrono::steady_clock::now(); + auto elapsed = std::chrono::duration(now - last_log_time).count(); + + if (elapsed >= throttle) + { + last_log_time = now; + va_list args; + va_start(args, format); + vprintf_color(color::BRIGHT_BLUE, format, args); + va_end(args); + } + } + + void log_success_throttle(double throttle, const char *format, ...) + { + static auto last_log_time = std::chrono::steady_clock::time_point{}; + auto now = std::chrono::steady_clock::now(); + auto elapsed = std::chrono::duration(now - last_log_time).count(); + + if (elapsed >= throttle) + { + last_log_time = now; + va_list args; + va_start(args, format); + vprintf_color(color::GREEN, format, args); + va_end(args); + } + } + + void log_warning_throttle(double throttle, const char *format, ...) + { + static auto last_log_time = std::chrono::steady_clock::time_point{}; + auto now = std::chrono::steady_clock::now(); + auto elapsed = std::chrono::duration(now - last_log_time).count(); + + if (elapsed >= throttle) + { + last_log_time = now; + va_list args; + va_start(args, format); + vprintf_color(color::YELLOW, format, args); + va_end(args); + } + } + + void log_assert(bool condition, const char *format, ...) + { + if (!condition) + { + // Print timestamp first + std::string timestamp = format_timestamp(); + if (!timestamp.empty()) + { + std::printf("[%s] ", timestamp.c_str()); + } + + // Print error message if provided + if (format != nullptr) + { + va_list args; + va_start(args, format); + if (is_color_enabled()) + { + std::printf("%s", color::RED); + } + std::vprintf(format, args); + if (!format_ends_with_newline(format)) + { + std::printf("\n"); + } + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + va_end(args); + } + else + { + // Default error message + if (is_color_enabled()) + { + std::printf("%s", color::RED); + } + std::printf("Assertion failed!\n"); + if (is_color_enabled()) + { + std::printf("%s", color::RESET); + } + } + + // Terminate the program + std::abort(); + } + } + +} // namespace robot diff --git a/src/Libraries/robot_cpp/src/init.cpp b/src/Libraries/robot_cpp/src/init.cpp new file mode 100644 index 0000000..8b4ec2e --- /dev/null +++ b/src/Libraries/robot_cpp/src/init.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include + +namespace robot +{ + +namespace detail +{ + // Internal state for shutdown management + std::atomic g_shutdown_requested(false); + std::atomic g_shutdown_complete(false); + std::atomic g_initialized(false); + std::mutex g_shutdown_mutex; + bool g_sigint_handler_installed = false; + + // Original SIGINT handler (if any) + void (*g_original_sigint_handler)(int) = nullptr; +} + +void detail::sigintHandler(int sig) +{ + (void)sig; // Suppress unused parameter warning + + // Call shutdown + robot::shutdown(); + + // If there was an original handler, call it too + if (detail::g_original_sigint_handler && + detail::g_original_sigint_handler != SIG_DFL && + detail::g_original_sigint_handler != SIG_IGN) + { + detail::g_original_sigint_handler(sig); + } +} + +bool ok() +{ + // Return false if shutdown is complete + return !detail::g_shutdown_complete.load(std::memory_order_acquire); +} + +bool isShuttingDown() +{ + // Return true if shutdown has been requested + return detail::g_shutdown_requested.load(std::memory_order_acquire); +} + +void shutdown() +{ + std::lock_guard lock(detail::g_shutdown_mutex); + + // If already shutting down, do nothing + if (detail::g_shutdown_requested.load(std::memory_order_acquire)) + { + return; + } + + // Mark shutdown as requested + detail::g_shutdown_requested.store(true, std::memory_order_release); + + // Log shutdown + robot::log_info("Shutting down robot system..."); + + // TODO: Add cleanup of resources here if needed + // For example: + // - Close all subscriptions/publications + // - Stop all timers + // - Cleanup threads + + // Mark shutdown as complete + // In a more complex system, you might want to wait for resources to cleanup + detail::g_shutdown_complete.store(true, std::memory_order_release); + + robot::log_info("Robot system shutdown complete"); +} + +void init(int& argc, char** argv, const std::string& node_name, bool install_sigint_handler) +{ + (void)argc; // Suppress unused parameter warning + (void)argv; // Suppress unused parameter warning + + std::lock_guard lock(detail::g_shutdown_mutex); + + // If already initialized, do nothing + if (detail::g_initialized.load(std::memory_order_acquire)) + { + robot::log_warning("robot::init() called multiple times, ignoring"); + return; + } + + // Reset shutdown state + detail::g_shutdown_requested.store(false, std::memory_order_release); + detail::g_shutdown_complete.store(false, std::memory_order_release); + + // Install SIGINT handler if requested + if (install_sigint_handler) + { + // Save original handler + detail::g_original_sigint_handler = std::signal(SIGINT, detail::sigintHandler); + detail::g_sigint_handler_installed = true; + + if (!node_name.empty()) + { + robot::log_info("Initialized robot system for node: %s", node_name.c_str()); + } + else + { + robot::log_info("Initialized robot system"); + } + } + else + { + if (!node_name.empty()) + { + robot::log_info("Initialized robot system for node: %s (no SIGINT handler)", node_name.c_str()); + } + else + { + robot::log_info("Initialized robot system (no SIGINT handler)"); + } + } + + // Mark as initialized + detail::g_initialized.store(true, std::memory_order_release); +} + +void init(const std::string& node_name, bool install_sigint_handler) +{ + // Dummy argc/argv for the other init() function + int dummy_argc = 0; + char** dummy_argv = nullptr; + init(dummy_argc, dummy_argv, node_name, install_sigint_handler); +} + +} // namespace robot + diff --git a/src/Libraries/robot_cpp/src/node_handle.cpp b/src/Libraries/robot_cpp/src/node_handle.cpp new file mode 100644 index 0000000..3345288 --- /dev/null +++ b/src/Libraries/robot_cpp/src/node_handle.cpp @@ -0,0 +1,2062 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __linux__ +#include +#endif +#include + +namespace +{ + + static YAML::Node xmlRpcToYaml(robot_xmlrpcpp::XmlRpcValue v) + { + using robot_xmlrpcpp::XmlRpcValue; + switch (v.getType()) + { + case XmlRpcValue::TypeBoolean: + { + bool b = v; + return YAML::Node(b); + } + case XmlRpcValue::TypeInt: + { + int i = v; + return YAML::Node(i); + } + case XmlRpcValue::TypeDouble: + { + double d = v; + return YAML::Node(d); + } + case XmlRpcValue::TypeString: + { + std::string s = v; + return YAML::Node(s); + } + case XmlRpcValue::TypeArray: + { + YAML::Node seq(YAML::NodeType::Sequence); + for (int i = 0; i < v.size(); ++i) + seq.push_back(xmlRpcToYaml(v[i])); + return seq; + } + case XmlRpcValue::TypeStruct: + { + YAML::Node map(YAML::NodeType::Map); + const XmlRpcValue::ValueStruct *members = v.getStructMembers(); + if (members) + { + for (const auto &kv : *members) + map[kv.first] = xmlRpcToYaml(kv.second); + } + return map; + } + default: + return YAML::Node(); + } + } + + static YAML::NodeType::value yamlNodeCategory(const YAML::Node &n) + { + if (n.IsMap()) + return YAML::NodeType::Map; + if (n.IsSequence()) + return YAML::NodeType::Sequence; + if (n.IsScalar()) + return YAML::NodeType::Scalar; + return YAML::NodeType::Null; + } + +} // namespace + +namespace robot +{ + + NodeHandle::~NodeHandle() {} + + // Constructor with namespace and optional remappings + NodeHandle::NodeHandle(const std::string &ns, const M_string &remappings) + { + // Apply remappings if provided + (void)remappings; // Suppress unused parameter warning for now + + // Step 1: If root_ is not defined, load config files into root_ + if (!root_.IsDefined() || !root_.IsMap() || root_.size() == 0) + { + // Find and set config directory first + if (config_directory_.empty()) + { + std::string config_dir = findConfigDirectory(); + if (!config_dir.empty()) + { + config_directory_ = config_dir; + } + } + + // Initialize root_ as empty map + root_ = YAML::Node(YAML::NodeType::Map); + + // Auto-load config files and merge into root_ + if (!config_directory_.empty() && std::filesystem::exists(config_directory_) && std::filesystem::is_directory(config_directory_)) + { + int loaded_count = loadYamlFilesFromDirectory(config_directory_); + if (loaded_count > 0) + { + std::cout << "[NodeHandle] Auto-loaded " << loaded_count + << " YAML file(s) from: " << config_directory_ << std::endl; + } + } + } + + // Step 2: Update node_handle_ from root_ based on namespace_ + // Normalize namespace: strip leading '/' if present + std::string ns_normalized = ns; + if (!ns_normalized.empty() && ns_normalized.front() == '/') + { + ns_normalized = ns_normalized.substr(1); + } + if (ns_normalized == "~" || ns_normalized.empty()) + { + // If namespace is root, node_handle_ should be the full root_ (direct reference) + // node_handle_ = root_; + namespace_ = "/"; + } + else + { + // Try to scope node_handle_ to namespace_ from root_ + std::stringstream ns_ss(ns_normalized); + std::string ns_segment; + std::vector segs; + + while (std::getline(ns_ss, ns_segment, '/')) + { + if (!ns_segment.empty()) + { + segs.push_back(ns_segment); + } + } + if (!segs.empty()) + { + std::vector curs; + curs.push_back(root_); + bool ns_found = true; + for (int i = 0; i < segs.size() - 1; i++) + { + const auto &k = segs[i]; + if (k.empty()) + continue; + if (!curs.back()[k].IsDefined() || !curs.back()[k].IsMap()) + { + ns_found = false; + break; + } + curs.push_back(curs.back()[k]); + } + if (ns_found && curs.back().IsDefined()) + { + // Scope node_handle_ to the found namespace (direct reference, syncs with root_) + // node_handle_ = curs.back(); + namespace_ = ns_normalized; + } + else + { + // Namespace not found: use root_ as fallback + // node_handle_ = root_; + namespace_ = "/"; // indicate root when ns not found + } + } + else + { + // Namespace not found: use root_ as fallback + // node_handle_ = root_; + namespace_ = "/"; // indicate root when ns not found + } + } + } + + // Constructor from parent NodeHandle with new namespace (2 parameters - delegates to 3 parameter version) + // This is needed to ensure the symbol is exported correctly in the shared library + NodeHandle::NodeHandle(const NodeHandle &parent, const std::string &ns) + : NodeHandle(parent, ns, M_string()) + { + } + + // Constructor from parent NodeHandle with new namespace and remappings + NodeHandle::NodeHandle(const NodeHandle &parent, const std::string &ns, const M_string &remappings) + { + // Apply remappings if provided + (void)remappings; // Suppress unused parameter warning for now + + // Step 1: If root_ is not defined, load config files into root_ + if (!root_.IsDefined() || !root_.IsMap() || root_.size() == 0) + { + // Find and set config directory first + if (config_directory_.empty()) + { + std::string config_dir = findConfigDirectory(); + if (!config_dir.empty()) + { + config_directory_ = config_dir; + } + } + + // Initialize root_ as empty map + root_ = YAML::Node(YAML::NodeType::Map); + log_warning("Root is not defined, initializing root_ as empty map"); + + // Auto-load config files and merge into root_ + if (!config_directory_.empty() && std::filesystem::exists(config_directory_) && std::filesystem::is_directory(config_directory_)) + { + int loaded_count = loadYamlFilesFromDirectory(config_directory_); + if (loaded_count > 0) + { + std::cout << "[NodeHandle] Auto-loaded " << loaded_count + << " YAML file(s) from: " << config_directory_ << std::endl; + } + } + } + // Normalize child namespace (remove leading '/') + std::string child_ns = ns; + while (!child_ns.empty() && child_ns.front() == '/') + { + child_ns.erase(child_ns.begin()); + } + std::string parent_ns = parent.getNamespace(); + while (!parent_ns.empty() && parent_ns.front() == '/') + { + parent_ns.erase(parent_ns.begin()); + } + std::string ns_normalized = parent_ns + "/" + child_ns; + if (ns_normalized != "~" && !ns_normalized.empty()) + { + // Try to scope node_handle_ to namespace_ from root_ + std::stringstream ns_ss(ns_normalized); + std::string ns_segment; + std::vector segs; + while (std::getline(ns_ss, ns_segment, '/')) + { + if (!ns_segment.empty()) + { + segs.push_back(ns_segment); + } + } + if (!segs.empty()) + { + std::vector curs = {root_}; + bool ns_found = true; + for (int i = 0; i < segs.size() - 1; i++) + { + const auto k = segs[i]; + if (k.empty()) + continue; + if (!curs.back()[k].IsDefined() || !curs.back()[k].IsMap()) + { + robot::log_warning_at(__FILE__, __LINE__, "%s %x %x", k.c_str(), curs.back()[k].IsDefined(), curs.back()[k].IsMap()); + ns_found = false; + break; + } + curs.push_back(curs.back()[k]); + } + + if (ns_found && curs.back().IsDefined() && curs.size() >= 1) + { + // Scope node_handle_ to the found namespace (direct reference, syncs with root_) + // node_handle_ = curs.back()[segs.back()]; + namespace_ = ns_normalized; + } + else + { + // Namespace not found: use root_ as fallback + // node_handle_ = parent.getNodeHandle(); + namespace_ = parent.getNamespace(); // indicate root when ns not found + } + } + } + } + + // Copy constructor + NodeHandle::NodeHandle(const NodeHandle &parent) + { + this->namespace_ = parent.namespace_; + if(!namespace_.empty() && namespace_ != "/") + { + // Try to scope node_handle_ to namespace_ from root_ + std::stringstream ns_ss(namespace_); + std::string ns_segment; + std::vector segs; + while (std::getline(ns_ss, ns_segment, '/')) + { + if (!ns_segment.empty()) + { + segs.push_back(ns_segment); + } + } + if (!segs.empty()) + { + std::vector curs; + curs.push_back(parent.root_); + bool ns_found = true; + for (int i = 0; i < segs.size() - 1; i++) + { + + const auto &k = segs[i]; + if (k.empty()) + continue; + if (!curs.back()[k].IsDefined() || !curs.back()[k].IsMap()) + { + ns_found = false; + break; + } + curs.push_back(curs.back()[k]); + } + if (ns_found && curs.back().IsDefined() && curs.size() >= 1) + { + // Scope node_handle_ to the found namespace (direct reference, syncs with root_) + // node_handle_[segs.back()] = curs.back()[segs.back()]; + } + else + { + // Namespace not found: use root_ as fallback + // node_handle_ = parent.getNodeHandle(); + } + } + } + } + + // Assignment operator + NodeHandle &NodeHandle::operator=(const NodeHandle &parent) + { + if (this != &parent) + { + namespace_ = parent.getNamespace(); + // node_handle_ = parent.getNodeHandle(); + } + + return *this; + } + + bool NodeHandle::hasParam(const std::string &key) const + { + // Safety check: validate key parameter + if (key.empty()) + { + return false; + } + + std::string full_key = namespace_ + "/" + key; + if (!root_.IsDefined() || !root_.IsMap()) + { + return false; + } + + // Split key by '/' to handle nested keys + std::stringstream ss(full_key); + std::string segment; + std::vector segments; + + while (std::getline(ss, segment, '/')) + { + if (!segment.empty()) + { + segments.push_back(segment); + } + } + + if (segments.empty()) + { + // Empty key refers to the whole tree; treat as existing only if map is non-empty + return false; + } + + const YAML::Node *current = &root_; + + for (size_t i = 0; i < segments.size(); ++i) + { + // Safety check: ensure current is valid + if (!current || !current->IsDefined()) + { + return false; + } + + if (current->IsMap()) + { + // Search for the segment without inserting default nodes + const YAML::Node *found_child = nullptr; + + try + { + for (YAML::const_iterator it = current->begin(); it != current->end(); ++it) + { + try + { + // Safety check: validate iterator nodes + if (!it->first.IsDefined()) + { + continue; + } + + // Safely convert key to string + std::string key_str; + try + { + key_str = it->first.as(); + } + catch (...) + { + // Skip nodes that can't be converted to string + continue; + } + + if (key_str == segments[i]) + { + // Safety check: validate value node + if (it->second.IsDefined()) + { + found_child = &(it->second); + break; + } + } + } + catch (...) + { + // Skip invalid nodes and continue iteration + continue; + } + } + } + catch (...) + { + // If iteration fails, return false + return false; + } + + if (!found_child || !found_child->IsDefined()) + { + return false; + } + current = found_child; + continue; + } + + if (current->IsSequence()) + { + // For sequences, interpret segment as index if possible + try + { + size_t idx = static_cast(std::stoul(segments[i])); + if (idx >= current->size()) + { + return false; + } + const YAML::Node &child = (*current)[idx]; + if (!child.IsDefined()) + { + return false; + } + current = &child; + continue; + } + catch (...) + { + // Segment is not an index + return false; + } + } + + // Neither map nor sequence: cannot traverse further + return false; + } + + // Safety check: ensure current is valid before returning + return current && current->IsDefined(); + } + + YAML::Node NodeHandle::getNestedValue(const std::string &key) const + { + // Safety check: validate key parameter + if (key.empty()) + { + return YAML::Node(); + } + + // Safety check: validate root node + if (!root_.IsDefined() || !root_.IsMap()) + { + return YAML::Node(); + } + + // Split key by '/' to handle nested keys + std::stringstream ss(namespace_ + "/" + key); + std::string segment; + std::vector segments; + + while (std::getline(ss, segment, '/')) + { + if (!segment.empty()) + { + segments.push_back(segment); + } + } + + if (segments.empty()) + { + return YAML::Node(); + } + + // Traverse the tree without modifying node_handle_ + // Use const reference to the original node_handle_ to avoid any modifications + const YAML::Node *current = &root_; + + for (size_t i = 0; i < segments.size(); ++i) + { + // Safety check: ensure current is valid + if (!current || !current->IsDefined() || !current->IsMap()) + { + return YAML::Node(); + } + + // Access child node without mutating the map (avoid operator[] default insertion) + const YAML::Node *found_child = nullptr; + + try + { + for (YAML::const_iterator it = current->begin(); it != current->end(); ++it) + { + try + { + // Safety check: validate iterator nodes + if (!it->first.IsDefined()) + { + continue; + } + + // Safely convert key to string + std::string key_str; + try + { + key_str = it->first.as(); + } + catch (...) + { + // Skip nodes that can't be converted to string + continue; + } + + if (key_str == segments[i]) + { + // Safety check: validate value node + if (it->second.IsDefined()) + { + found_child = &(it->second); + break; + } + } + } + catch (...) + { + // Skip invalid nodes and continue iteration + continue; + } + } + } + catch (...) + { + // If iteration fails, return empty node + return YAML::Node(); + } + + if (!found_child || !found_child->IsDefined()) + { + return YAML::Node(); + } + + // Move to next level + current = found_child; + } + + // Safety check: ensure current is valid before cloning + if (!current || !current->IsDefined()) + { + return YAML::Node(); + } + + // Return a clone of the final node to ensure it's independent + try + { + return YAML::Clone(*current); + } + catch (...) + { + // If cloning fails, return empty node + return YAML::Node(); + } + } + + YAML::Node NodeHandle::getNestedValueDebug(const std::string &key) const + { + std::string full_key = namespace_ + "/" + key; + if (!root_.IsDefined() || !root_.IsMap()) + { + return YAML::Node(); + } + + // Split key by '/' to handle nested keys + std::stringstream ss(key); + std::string segment; + std::vector segments; + + while (std::getline(ss, segment, '/')) + { + if (!segment.empty()) + { + segments.push_back(segment); + } + } + + if (segments.empty()) + { + return YAML::Node(); + } + + const YAML::Node *current = &root_; + + for (size_t i = 0; i < segments.size(); ++i) + { + if (!current->IsMap()) + { + return YAML::Node(); + } + + // Access child node without mutating the map (avoid operator[] default insertion) + YAML::Node segment_node; + bool found_child = false; + for (auto it = current->begin(); it != current->end(); ++it) + { + if (it->first.as() == segments[i]) + { + segment_node = it->second; + found_child = true; + break; + } + } + if (!found_child) + { + return YAML::Node(); + } + if (!segment_node.IsDefined()) + { + return YAML::Node(); + } + + current = &segment_node; + } + return YAML::Clone(*current); + } + + YAML::Node NodeHandle::getParamValue(const std::string &key) const + { + return getNestedValue(key); + } + + std::string NodeHandle::getNamespace() const + { + // namespace_ is already set to config directory path if name was "~" or "" + return namespace_; + } + + void NodeHandle::printParams() const + { + log_info("\n[NodeHandle] ========== Root Parameters =========="); + log_info("Namespace: %s", this->getNamespace().c_str()); + printParams(root_); + } + + void NodeHandle::printParams(YAML::Node node) const + { + if (!node.IsDefined()) + { + std::cout << "[NodeHandle] Node is not defined!" << std::endl; + return; + } + + if (!node.IsMap()) + { + std::cout << "[NodeHandle] Node is not a map!" << std::endl; + return; + } + + std::cout << "[NodeHandle] Total top-level keys: " << node.size() << std::endl; + std::cout << std::endl; + + // Helper lambda to print nested structure with indentation + std::function printNode = + [&printNode](const YAML::Node &node, const std::string &prefix, int depth) + { + if (depth > 10) + return; // Limit depth to avoid infinite recursion + + std::string indent(depth * 2, ' '); // 2 spaces per depth level + + if (node.IsMap()) + { + for (auto it = node.begin(); it != node.end(); ++it) + { + std::string key = it->first.as(); + const YAML::Node &value = it->second; + std::string full_key = prefix.empty() ? key : prefix + "/" + key; + if(full_key.find("MKTAlgorithmDiffPredictiveTrajectory") == std::string::npos) + continue; + if (value.IsMap()) + { + std::cout << "[NodeHandle] " << indent << full_key << ":" << std::endl; + printNode(value, full_key, depth + 1); + } + else if (value.IsSequence()) + { + std::cout << "[NodeHandle] " << indent << full_key << " (sequence, " << value.size() << " items):" << std::endl; + // Print sequence items + for (size_t i = 0; i < value.size(); ++i) + { + const YAML::Node &item = value[i]; + if (item.IsMap()) + { + std::cout << "[NodeHandle] " << indent << " [" << i << "]:" << std::endl; + printNode(item, full_key + "[" + std::to_string(i) + "]", depth + 2); + } + else if (item.IsScalar()) + { + std::cout << "[NodeHandle] " << indent << " [" << i << "] = " << item.as() << std::endl; + } + } + } + else if (value.IsScalar()) + { + try + { + std::cout << "[NodeHandle] " << indent << full_key << " = " << value.as() << std::endl; + } + catch (...) + { + std::cout << "[NodeHandle] " << indent << full_key << " = (unable to convert to string)" << std::endl; + } + } + else if (value.IsNull()) + { + std::cout << "[NodeHandle] " << indent << full_key << " = null" << std::endl; + } + } + } + }; + + printNode(node, "", 0); + std::cout << "[NodeHandle] ================================================\n" + << std::endl; + } + + void NodeHandle::mergeYamlNode(const YAML::Node &source, YAML::Node &output) + { + if (!source.IsDefined()) + { + return; + } + + // If source is not a map, just replace node_handle_ + if (!source.IsMap()) + { + output = source; + return; + } + + // Initialize node_handle_ as a map if it's not already + if (!output.IsDefined() || !output.IsMap()) + { + output = YAML::Node(YAML::NodeType::Map); + } + + // Helper lambda to recursively merge two YAML nodes + // Note: yaml-cpp's operator[] returns YAML::Node (not reference), so we need to work with copies + std::function mergeRecursive = + [&mergeRecursive](YAML::Node &dest, const YAML::Node &src) + { + if (!src.IsMap()) + { + dest = src; + return; + } + + // Ensure dest is a map + if (!dest.IsMap()) + { + dest = YAML::Node(YAML::NodeType::Map); + } + + for (auto it = src.begin(); it != src.end(); ++it) + { + std::string key = it->first.as(); + const YAML::Node &src_value = it->second; + + // Get current value in dest (if exists) + YAML::Node dest_current = dest[key]; + + // Check if key exists in dest and if both are maps + if (dest_current.IsDefined() && dest_current.IsMap() && src_value.IsMap()) + { + // Both are maps, recursively merge + // Create a copy of dest[key] to work with, then assign back + YAML::Node dest_value = dest_current; + mergeRecursive(dest_value, src_value); + dest[key] = dest_value; + } + else + { + // Overwrite with source value (or add if doesn't exist) + dest[key] = src_value; + } + } + }; + + // Merge source into output + mergeRecursive(output, source); + } + + int NodeHandle::loadYamlFilesFromDirectory(const std::string &directory_path) + { + int loaded_count = 0; + + try + { + // Check if directory exists + if (!std::filesystem::exists(directory_path) || !std::filesystem::is_directory(directory_path)) + { + std::cerr << "Directory does not exist or is not a directory: " << directory_path << std::endl; + return 0; + } + + // Iterate through all files in the directory + for (const auto &entry : std::filesystem::directory_iterator(directory_path)) + { + if (entry.is_regular_file()) + { + std::string file_path = entry.path().string(); + std::string extension = entry.path().extension().string(); + + // Only process .yaml and .yml files + if (extension == ".yaml" || extension == ".yml") + { + try + { + YAML::Node file_node = YAML::LoadFile(file_path); + if (file_node.IsDefined()) + { + mergeYamlNode(file_node, root_); + loaded_count++; + } + } + catch (const YAML::Exception &e) + { + std::cerr << "Error loading YAML file " << file_path << ": " << e.what() << std::endl; + } + } + } + } + } + catch (const std::exception &e) + { + std::cerr << "Error reading directory " << directory_path << ": " << e.what() << std::endl; + } + + return loaded_count; + } + + std::string NodeHandle::findConfigDirectory() + { + // If config directory is already set, use it + if (!config_directory_.empty() && std::filesystem::exists(config_directory_)) + { + return config_directory_; + } + + // Try environment variable first + const char *env_config = std::getenv("PNKX_NAV_CORE_CONFIG_DIR"); + if (env_config && std::filesystem::exists(env_config)) + { + config_directory_ = std::string(env_config); + return config_directory_; + } + + // Try workspace path + /config + const char *workspace_path = std::getenv("PNKX_NAV_CORE_DIR"); + if (workspace_path) + { + std::string config_path = std::string(workspace_path) + "/config"; + if (std::filesystem::exists(config_path)) + { + config_directory_ = config_path; + return config_directory_; + } + } + + // Try to find config relative to executable path + try + { + char exe_path[PATH_MAX]; + ssize_t count = readlink("/proc/self/exe", exe_path, PATH_MAX); + if (count != -1) + { + exe_path[count] = '\0'; + std::filesystem::path exe_dir = std::filesystem::path(exe_path).parent_path(); + + // Try paths relative to executable: ../../config, ../config, etc. + std::vector relative_paths = { + exe_dir / "../../config", + exe_dir / "../config", + exe_dir / "config", + exe_dir.parent_path() / "config", + exe_dir.parent_path().parent_path() / "config"}; + + for (const auto &rel_path : relative_paths) + { + if (std::filesystem::exists(rel_path) && std::filesystem::is_directory(rel_path)) + { + config_directory_ = std::filesystem::canonical(rel_path).string(); + return config_directory_; + } + } + } + } + catch (const std::exception &) + { + // Ignore errors when trying to find executable path + } + + // Try hardcoded fallback paths + std::vector possible_paths = { + "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/config", + "../config", + "../../config", + "./config"}; + + for (const auto &path : possible_paths) + { + if (std::filesystem::exists(path) && std::filesystem::is_directory(path)) + { + try + { + config_directory_ = std::filesystem::canonical(path).string(); + return config_directory_; + } + catch (const std::exception &) + { + // If canonical fails, try the path as-is + config_directory_ = path; + return config_directory_; + } + } + } + + // Return empty string if not found + return ""; + } + + void NodeHandle::autoLoadConfigFiles() + { + // Auto-load if config_directory_ is set (regardless of namespace) + // This ensures root_ always contains the full merged YAML tree + if (config_directory_.empty()) + { + // Config directory not set, can't auto-load + return; + } + + if (!std::filesystem::exists(config_directory_) || !std::filesystem::is_directory(config_directory_)) + { + // Config directory doesn't exist, can't auto-load + return; + } + + std::string config_dir_to_load = config_directory_; + + // Load all YAML files from config directory + int loaded_count = loadYamlFilesFromDirectory(config_dir_to_load); + if (loaded_count <= 0) + { + std::cout << "[NodeHandle] No YAML files found or loaded from: " << config_dir_to_load << std::endl; + } + } + + void NodeHandle::setParamInternal(const std::string &key, const YAML::Node &value, YAML::NodeType::value expected_type) + { + YAML::Node existing = getNestedValue(key); + + // If key doesn't exist, create it + if (!existing.IsDefined()) + { + setParam(key, value); + return; + } + // If key exists, check type compatibility + // For scalar types, we allow conversion between compatible types + if (expected_type == YAML::NodeType::Scalar && existing.IsScalar()) + { + // Scalar types are compatible, just update the value + setParam(key, value); + } + else if (existing.Type() == expected_type) + { + // Same type, update value + setParam(key, value); + } + else + { + // Type mismatch - overwrite with new type (as per requirement) + setParam(key, value); + } + } + + void NodeHandle::setParam(const std::string &key, const YAML::Node &value) + { + // Split key by '/' to handle nested keys + std::stringstream ss(namespace_ + "/" + key); + std::string segment; + std::vector segments; + + while (std::getline(ss, segment, '/')) + { + if (!segment.empty()) + { + segments.push_back(segment); + } + } + + if (segments.empty()) + { + return; + } + + // Step 1: Calculate full key path in root_ (namespace_ + "/" + key) + std::string full_key = key; + if (!namespace_.empty() && namespace_ != "/") + { + if (full_key.empty()) + { + full_key = namespace_; + } + else + { + full_key = namespace_ + "/" + full_key; + } + } + + std::stringstream s(full_key); + std::string seg; + std::vector segs; + while (std::getline(s, seg, '/')) + { + if (!seg.empty()) + segs.push_back(seg); + } + + // Step 2: Update root_ with the full_key (preserve existing data) + std::vector curs = {root_}; + if (!segs.empty()) + { + for (size_t i = 0; i < segs.size() - 1; ++i) + { + const auto &k = segs[i]; + if (!curs.back()[k].IsDefined() || !curs.back()[k].IsMap()) + { + curs.back()[k] = YAML::Node(YAML::NodeType::Map); + } + curs.push_back(curs.back()[k]); + } + curs.back()[segs.back()] = value; + } + } + + void NodeHandle::setParam(const std::string &key, bool b) const + { + const_cast(this)->setParamInternal(key, YAML::Node(b), YAML::NodeType::Scalar); + } + + void NodeHandle::setParam(const std::string &key, const char *s) const + { + const_cast(this)->setParamInternal(key, YAML::Node(std::string(s)), YAML::NodeType::Scalar); + } + + void NodeHandle::setParam(const std::string &key, const std::string &s) const + { + const_cast(this)->setParamInternal(key, YAML::Node(s), YAML::NodeType::Scalar); + } + + void NodeHandle::setParam(const std::string &key, int i) const + { + const_cast(this)->setParamInternal(key, YAML::Node(i), YAML::NodeType::Scalar); + } + + void NodeHandle::setParam(const std::string &key, double d) const + { + const_cast(this)->setParamInternal(key, YAML::Node(d), YAML::NodeType::Scalar); + } + + void NodeHandle::setParam(const std::string &key, const std::vector &vec) const + { + YAML::Node node(YAML::NodeType::Sequence); + for (bool b : vec) + { + node.push_back(YAML::Node(b)); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Sequence); + } + + void NodeHandle::setParam(const std::string &key, const std::vector &vec) const + { + YAML::Node node(YAML::NodeType::Sequence); + for (int i : vec) + { + node.push_back(YAML::Node(i)); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Sequence); + } + + void NodeHandle::setParam(const std::string &key, const std::vector &vec) const + { + YAML::Node node(YAML::NodeType::Sequence); + for (float f : vec) + { + node.push_back(YAML::Node(static_cast(f))); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Sequence); + } + + void NodeHandle::setParam(const std::string &key, const std::vector &vec) const + { + YAML::Node node(YAML::NodeType::Sequence); + for (double d : vec) + { + node.push_back(YAML::Node(d)); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Sequence); + } + + void NodeHandle::setParam(const std::string &key, const std::vector &vec) const + { + YAML::Node node(YAML::NodeType::Sequence); + for (const std::string &s : vec) + { + node.push_back(YAML::Node(s)); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Sequence); + } + + void NodeHandle::setParam(const std::string &key, const std::map &map) const + { + YAML::Node node(YAML::NodeType::Map); + for (const auto &pair : map) + { + node[pair.first] = YAML::Node(pair.second); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Map); + } + + void NodeHandle::setParam(const std::string &key, const std::map &map) const + { + YAML::Node node(YAML::NodeType::Map); + for (const auto &pair : map) + { + node[pair.first] = YAML::Node(pair.second); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Map); + } + + void NodeHandle::setParam(const std::string &key, const std::map &map) const + { + YAML::Node node(YAML::NodeType::Map); + for (const auto &pair : map) + { + node[pair.first] = YAML::Node(static_cast(pair.second)); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Map); + } + + void NodeHandle::setParam(const std::string &key, const std::map &map) const + { + YAML::Node node(YAML::NodeType::Map); + for (const auto &pair : map) + { + node[pair.first] = YAML::Node(pair.second); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Map); + } + + void NodeHandle::setParam(const std::string &key, const std::map &map) const + { + YAML::Node node(YAML::NodeType::Map); + for (const auto &pair : map) + { + node[pair.first] = YAML::Node(pair.second); + } + const_cast(this)->setParamInternal(key, node, YAML::NodeType::Map); + } + + void NodeHandle::setParam(const std::string &key, const robot_xmlrpcpp::XmlRpcValue &v) const + { + try + { + robot_xmlrpcpp::XmlRpcValue v_copy = v; + YAML::Node node = xmlRpcToYaml(v_copy); + const_cast(this)->setParamInternal(key, node, yamlNodeCategory(node)); + } + catch (...) + { + const_cast(this)->setParamInternal(key, YAML::Node(), YAML::NodeType::Null); + } + } + + bool NodeHandle::getParam(const std::string &key, bool &b, bool default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined()) + { + b = default_value; + return false; + } + + if (value.IsScalar()) + { + try + { + if (value.Type() == YAML::NodeType::Scalar) + { + std::string str = value.as(); + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + if (str == "true" || str == "1" || str == "yes" || str == "on") + { + b = true; + return true; + } + else if (str == "false" || str == "0" || str == "no" || str == "off") + { + b = false; + return true; + } + } + b = value.as(); + return true; + } + catch (...) + { + b = default_value; + return false; + } + } + + b = default_value; + return false; + } + + bool NodeHandle::getParam(const std::string &key, double &d, double default_value) const + { + // Safety check: validate key parameter + if (key.empty()) + { + d = default_value; + return false; + } + YAML::Node value = getNestedValue(key); + if (!value.IsDefined() || !value.IsScalar()) + { + d = default_value; + return false; + } + if(key == "local_costmap/inscribed_radius") + { + robot::log_warning_at(__FILE__, __LINE__, "3"); + } + if(!value.IsDefined() || !value.IsScalar()) + if(key == "local_costmap/inscribed_radius") + { + robot::log_warning_at(__FILE__, __LINE__, "Inscribed radius: %f", default_value); + } + if(key == "local_costmap/inscribed_radius") + { + robot::log_warning_at(__FILE__, __LINE__, "4"); + } + try + { + d = value.as(); + return true; + } + catch (...) + { + d = default_value; + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, float &f, float default_value) const + { + double d; + if (getParam(key, d, static_cast(default_value))) + { + f = static_cast(d); + return true; + } + f = default_value; + return false; + } + + bool NodeHandle::getParam(const std::string &key, int &i, int default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsScalar()) + { + i = default_value; + return false; + } + + try + { + std::string str = value.as(); + // Handle hex format + if (str.length() > 2 && str.substr(0, 2) == "0x") + { + i = std::stoi(str, nullptr, 16); + } + else + { + i = value.as(); + } + return true; + } + catch (...) + { + i = default_value; + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::string &s, std::string default_value) const + { + YAML::Node value = getNestedValue(key); + + // If key doesn't exist or is not a scalar, return default value + if (!value.IsDefined() || !value.IsScalar()) + { + s = default_value; + return false; + } + + try + { + s = value.as(); + return true; + } + catch (...) + { + s = default_value; + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::vector &vec, std::vector default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsSequence()) + { + vec = default_value; + return false; + } + + vec.clear(); + try + { + for (size_t i = 0; i < value.size(); ++i) + { + if (value[i].IsScalar()) + { + try + { + bool b = value[i].as(); + vec.push_back(b); + } + catch (...) + { + // Try as string and convert + std::string str = value[i].as(); + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + if (str == "true" || str == "1" || str == "yes" || str == "on") + { + vec.push_back(true); + } + else if (str == "false" || str == "0" || str == "no" || str == "off") + { + vec.push_back(false); + } + else + { + return false; + } + } + } + else + { + return false; + } + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::vector &vec, std::vector default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsSequence()) + { + vec = default_value; + return false; + } + + vec.clear(); + try + { + for (size_t i = 0; i < value.size(); ++i) + { + vec.push_back(value[i].as()); + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::vector &vec, std::vector default_value) const + { + std::vector dvec; + std::vector ddefault; + ddefault.reserve(default_value.size()); + for (float f : default_value) + { + ddefault.push_back(static_cast(f)); + } + + if (getParam(key, dvec, ddefault)) + { + vec.clear(); + vec.reserve(dvec.size()); + for (double d : dvec) + { + vec.push_back(static_cast(d)); + } + return true; + } + vec = default_value; + return false; + } + + bool NodeHandle::getParam(const std::string &key, std::vector &vec, std::vector default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsSequence()) + { + vec = default_value; + return false; + } + + vec.clear(); + try + { + for (size_t i = 0; i < value.size(); ++i) + { + vec.push_back(value[i].as()); + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::vector &vec, std::vector default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsSequence()) + { + vec = default_value; + return false; + } + + vec.clear(); + try + { + for (size_t i = 0; i < value.size(); ++i) + { + vec.push_back(value[i].as()); + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::map &map, std::map default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsMap()) + { + map = default_value; + return false; + } + + map.clear(); + try + { + for (auto it = value.begin(); it != value.end(); ++it) + { + std::string key_str = it->first.as(); + if (it->second.IsScalar()) + { + try + { + bool b = it->second.as(); + map[key_str] = b; + } + catch (...) + { + // Try as string and convert + std::string str = it->second.as(); + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + if (str == "true" || str == "1" || str == "yes" || str == "on") + { + map[key_str] = true; + } + else if (str == "false" || str == "0" || str == "no" || str == "off") + { + map[key_str] = false; + } + else + { + return false; + } + } + } + else + { + return false; + } + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::map &map, std::map default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsMap()) + { + map = default_value; + return false; + } + + map.clear(); + try + { + for (auto it = value.begin(); it != value.end(); ++it) + { + std::string key_str = it->first.as(); + if (it->second.IsScalar()) + { + map[key_str] = it->second.as(); + } + else + { + return false; + } + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::map &map, std::map default_value) const + { + std::map dmap; + std::map ddefault; + for (const auto &pair : default_value) + { + ddefault[pair.first] = static_cast(pair.second); + } + + if (getParam(key, dmap, ddefault)) + { + map.clear(); + for (const auto &pair : dmap) + { + map[pair.first] = static_cast(pair.second); + } + return true; + } + map = default_value; + return false; + } + + bool NodeHandle::getParam(const std::string &key, std::map &map, std::map default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsMap()) + { + map = default_value; + return false; + } + + map.clear(); + try + { + for (auto it = value.begin(); it != value.end(); ++it) + { + std::string key_str = it->first.as(); + if (it->second.IsScalar()) + { + map[key_str] = it->second.as(); + } + else + { + return false; + } + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, std::map &map, std::map default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined() || !value.IsMap()) + { + map = default_value; + return false; + } + + map.clear(); + try + { + for (auto it = value.begin(); it != value.end(); ++it) + { + std::string key_str = it->first.as(); + if (it->second.IsScalar()) + { + map[key_str] = it->second.as(); + } + else + { + return false; + } + } + return true; + } + catch (...) + { + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, YAML::Node &v, YAML::Node default_value) const + { + YAML::Node value = getNestedValue(key); + + if (!value.IsDefined()) + { + v = default_value; + return false; + } + + v = value; + return true; + } + + namespace + { + bool yamlToXmlRpc(const YAML::Node &y, robot_xmlrpcpp::XmlRpcValue &out) + { + if (!y.IsDefined()) + return false; + if (y.IsScalar()) + { + try + { + std::string s = y.as(); + std::string lower = s; + std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); + if (lower == "true" || lower == "1" || lower == "yes" || lower == "on") + { + out = robot_xmlrpcpp::XmlRpcValue(true); + return true; + } + if (lower == "false" || lower == "0" || lower == "no" || lower == "off") + { + out = robot_xmlrpcpp::XmlRpcValue(false); + return true; + } + try + { + int i = y.as(); + out = robot_xmlrpcpp::XmlRpcValue(i); + return true; + } + catch (...) {} + try + { + double d = y.as(); + out = robot_xmlrpcpp::XmlRpcValue(d); + return true; + } + catch (...) {} + out = robot_xmlrpcpp::XmlRpcValue(s); + return true; + } + catch (...) + { + return false; + } + } + if (y.IsSequence()) + { + out = robot_xmlrpcpp::XmlRpcValue(); + out.setSize(static_cast(y.size())); + for (size_t i = 0; i < y.size(); ++i) + { + robot_xmlrpcpp::XmlRpcValue item; + if (yamlToXmlRpc(y[i], item)) + out[static_cast(i)] = item; + } + return true; + } + if (y.IsMap()) + { + out = robot_xmlrpcpp::XmlRpcValue(); + for (YAML::const_iterator it = y.begin(); it != y.end(); ++it) + { + std::string k = it->first.as(); + robot_xmlrpcpp::XmlRpcValue item; + if (yamlToXmlRpc(it->second, item)) + out[k] = item; + } + return true; + } + return false; + } + } + + bool NodeHandle::getParam(const std::string &key, robot_xmlrpcpp::XmlRpcValue &v) const + { + YAML::Node value = getNestedValue(key); + if (!value.IsDefined()) + return false; + return yamlToXmlRpc(value, v); + } + + template + T NodeHandle::param(const std::string ¶m_name) const + { + T param_val; + T default_val = T{}; // Default-constructed value + if (param(param_name, param_val, default_val)) + { + return param_val; + } + return default_val; + } + + template + T NodeHandle::param(const std::string ¶m_name, const T &default_val) const + { + T param_val; + if (param(param_name, param_val, default_val)) + { + return param_val; + } + return default_val; + } + + template + bool NodeHandle::param(const std::string ¶m_name, T ¶m_val, const T &default_val) const + { + return getParam(param_name, param_val, default_val); + } + + bool NodeHandle::searchParam(const std::string &key, std::string &result) const + { + result.clear(); + if (key.empty()) + { + return false; + } + + auto splitPath = [](const std::string &path) -> std::vector + { + std::vector parts; + std::stringstream ss(path); + std::string seg; + while (std::getline(ss, seg, '/')) + { + if (!seg.empty()) + { + parts.push_back(seg); + } + } + return parts; + }; + + auto joinPath = [](const std::vector &parts) -> std::string + { + std::string out; + for (size_t i = 0; i < parts.size(); ++i) + { + if (i) + out += "/"; + out += parts[i]; + } + return out; + }; + + auto existsInRoot = [&](const std::string &full_key_no_leading_slash) -> bool + { + // Prefer searching in the global tree if available; otherwise fall back to + // this NodeHandle's scoped view. + const YAML::Node *search_root = nullptr; + if (root_.IsDefined() && root_.IsMap()) + { + search_root = &root_; + } + else + { + return false; + } + + const std::vector segments = splitPath(full_key_no_leading_slash); + if (segments.empty()) + { + return false; + } + + const YAML::Node *current = search_root; + for (const auto &seg : segments) + { + // Safety check: ensure current is valid + if (!current || !current->IsDefined() || !current->IsMap()) + { + return false; + } + + const YAML::Node *found_child = nullptr; + + try + { + for (YAML::const_iterator it = current->begin(); it != current->end(); ++it) + { + try + { + // Safety check: validate iterator nodes + if (!it->first.IsDefined()) + { + continue; + } + + // Safely convert key to string + std::string key_str; + try + { + key_str = it->first.as(); + } + catch (...) + { + // Skip nodes that can't be converted to string + continue; + } + + if (key_str == seg) + { + // Safety check: validate value node + if (it->second.IsDefined()) + { + found_child = &(it->second); + break; + } + } + } + catch (...) + { + // Skip invalid nodes and continue iteration + continue; + } + } + } + catch (...) + { + // If iteration fails, return false + return false; + } + + if (!found_child || !found_child->IsDefined()) + { + return false; + } + + current = found_child; + } + + // Safety check: ensure current is valid before returning + return current && current->IsDefined(); + }; + + auto stripLeadingSlash = [](const std::string &s) -> std::string + { + std::string out = s; + while (!out.empty() && out.front() == '/') + { + out.erase(out.begin()); + } + return out; + }; + + const std::string key_no_slash = stripLeadingSlash(key); + if (key_no_slash.empty()) + { + return false; + } + + // If caller passed an absolute key (started with '/'), we only check that exact path. + // Use the key as-is (without adding this NodeHandle's namespace). + if (!key.empty() && key.front() == '/') + { + if (existsInRoot(key_no_slash)) + { + result = "/" + key_no_slash; + return true; + } + return false; + } + + // Search up the namespace tree. Example: + // existing: a/b + // namespace: a/c/d + // search "b" -> check a/c/d/b, a/c/b, a/b + std::vector ns_parts; + if (!namespace_.empty() && namespace_ != "/") + { + ns_parts = splitPath(stripLeadingSlash(namespace_)); + } + const std::vector key_parts = splitPath(key_no_slash); + + for (int depth = static_cast(ns_parts.size()); depth >= 0; --depth) + { + std::vector candidate_parts; + candidate_parts.reserve(static_cast(depth) + key_parts.size()); + + // Safety check: ensure depth doesn't exceed ns_parts size + size_t safe_depth = static_cast(depth); + if (safe_depth > ns_parts.size()) + { + safe_depth = ns_parts.size(); + } + + for (size_t i = 0; i < safe_depth; ++i) + { + candidate_parts.push_back(ns_parts[i]); + } + for (const auto &kp : key_parts) + { + candidate_parts.push_back(kp); + } + + const std::string candidate = joinPath(candidate_parts); + if (existsInRoot(candidate)) + { + result = "/" + candidate; + return true; + } + } + return false; + } + + const YAML::Node &NodeHandle::getNodeHandle() const + { + return root_; + } + + // Explicit template instantiations for param function + // String instantiations + template std::string NodeHandle::param(const std::string ¶m_name) const; + template std::string NodeHandle::param(const std::string ¶m_name, const std::string &default_val) const; + template bool NodeHandle::param(const std::string ¶m_name, std::string ¶m_val, const std::string &default_val) const; + + // Bool instantiations + template bool NodeHandle::param(const std::string ¶m_name) const; + template bool NodeHandle::param(const std::string ¶m_name, const bool &default_val) const; + template bool NodeHandle::param(const std::string ¶m_name, bool ¶m_val, const bool &default_val) const; + + // Int instantiations + template int NodeHandle::param(const std::string ¶m_name) const; + template int NodeHandle::param(const std::string ¶m_name, const int &default_val) const; + template bool NodeHandle::param(const std::string ¶m_name, int ¶m_val, const int &default_val) const; + + // Double instantiations + template double NodeHandle::param(const std::string ¶m_name) const; + template double NodeHandle::param(const std::string ¶m_name, const double &default_val) const; + template bool NodeHandle::param(const std::string ¶m_name, double ¶m_val, const double &default_val) const; + + // Float instantiations + template float NodeHandle::param(const std::string ¶m_name) const; + template float NodeHandle::param(const std::string ¶m_name, const float &default_val) const; + template bool NodeHandle::param(const std::string ¶m_name, float ¶m_val, const float &default_val) const; + + // Vector instantiations + template std::vector NodeHandle::param>(const std::string ¶m_name) const; + template std::vector NodeHandle::param>(const std::string ¶m_name, const std::vector &default_val) const; + template bool NodeHandle::param>(const std::string ¶m_name, std::vector ¶m_val, const std::vector &default_val) const; + + // Static member initialization + std::string NodeHandle::config_directory_; + YAML::Node NodeHandle::root_; + +} // namespace robot diff --git a/src/Libraries/robot_cpp/src/plugin_loader_helper.cpp b/src/Libraries/robot_cpp/src/plugin_loader_helper.cpp new file mode 100644 index 0000000..7049a61 --- /dev/null +++ b/src/Libraries/robot_cpp/src/plugin_loader_helper.cpp @@ -0,0 +1,443 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Plugin Loader Helper for Boost.DLL + * Implementation + *********************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __linux__ +#include +#endif + +// CMAKE_BINARY_DIR được define trong CMakeLists.txt +#ifndef PNKX_NAV_CORE_BUILD_DIR +#define PNKX_NAV_CORE_BUILD_DIR "" +#endif + +namespace robot +{ + +PluginLoaderHelper::PluginLoaderHelper() + : PluginLoaderHelper(robot::NodeHandle(), "") +{ + // Delegate to the other constructor with default NodeHandle +} + +PluginLoaderHelper::PluginLoaderHelper(robot::NodeHandle nh, const std::string& config_namespace) + : nh_(nh), config_namespace_(config_namespace) +{ + std::string build_dir = getBuildDirectory(); + if (!build_dir.empty()) { + search_paths_.push_back(build_dir); + } + + // Thêm các subdirectories thường dùng từ workspace path + std::string workspace_path = getWorkspacePath(); + if (!workspace_path.empty()) { + search_paths_.push_back(workspace_path + "/install/lib"); + search_paths_.push_back(workspace_path + "/devel/lib"); + } +} + +void PluginLoaderHelper::setNodeHandle(robot::NodeHandle nh, const std::string& config_namespace) +{ + nh_ = nh; + config_namespace_ = config_namespace; +} + +std::string PluginLoaderHelper::findLibraryPath(const std::string& symbol_name) +{ + // Build parameter path: {config_namespace}/{symbol_name}/library_path + std::string param_path; + if (!config_namespace_.empty()) { + param_path = config_namespace_ + "/" + symbol_name + "/library_path"; + } else { + param_path = symbol_name + "/library_path"; + } + // Try to read from NodeHandle + std::string library_path; + robot::log_info_at(__FILE__, __LINE__, "%s", symbol_name.c_str()); + if (nh_.hasParam(param_path)) { + nh_.getParam(param_path, library_path, std::string("")); + if (!library_path.empty()) { + std::string resolved_path = resolveLibraryPath(library_path); + if (!resolved_path.empty()) { + return resolved_path; + } + } + } + + // Try without namespace in symbol name (e.g., "custom_planner::CustomPlanner" -> "CustomPlanner") + size_t ns_pos = symbol_name.find_last_of("::"); + if (ns_pos != std::string::npos) { + std::string short_name = symbol_name.substr(ns_pos + 1); + std::string short_param_path; + if (!config_namespace_.empty()) { + short_param_path = config_namespace_ + "/" + short_name + "/library_path"; + } else { + short_param_path = short_name + "/library_path"; + } + + if (nh_.hasParam(short_param_path)) { + nh_.getParam(short_param_path, library_path, std::string("")); + if (!library_path.empty()) { + std::string resolved_path = resolveLibraryPath(library_path); + if (!resolved_path.empty()) { + return resolved_path; + } + } + } + } + // Try LD_LIBRARY_PATH as fallback + const char* ld_path = std::getenv("LD_LIBRARY_PATH"); + if (ld_path) { + std::string ld_path_str(ld_path); + std::stringstream ss(ld_path_str); + std::string path; + + while (std::getline(ss, path, ':')) { + if (!path.empty()) { + // Try different naming conventions + std::vector possible_names = { + "lib" + library_path + ".so", + library_path + ".so" + }; + + // Also try without namespace + if (ns_pos != std::string::npos) { + std::string short_name = symbol_name.substr(ns_pos + 1); + possible_names.push_back("lib" + short_name + ".so"); + possible_names.push_back(short_name + ".so"); + } + + for (const auto& name : possible_names) { + std::filesystem::path full_path = std::filesystem::path(path) / name; + if (std::filesystem::exists(full_path)) { + log_info("[PluginLoaderHelper] Found library in LD_LIBRARY_PATH: %s", + full_path.string().c_str()); + return full_path.string(); + } + } + } + } + } + + log_warning("[PluginLoaderHelper] Library not found for symbol: %s", symbol_name.c_str()); + return ""; +} + +bool PluginLoaderHelper::hasSymbol(const std::string& symbol_name) const +{ + // Build parameter path: {config_namespace}/{symbol_name}/library_path + std::string param_path; + if (!config_namespace_.empty()) { + param_path = config_namespace_ + "/" + symbol_name + "/library_path"; + } else { + param_path = symbol_name + "/library_path"; + } + + if (nh_.hasParam(param_path)) { + return true; + } + + // Check without namespace + size_t ns_pos = symbol_name.find_last_of("::"); + if (ns_pos != std::string::npos) { + std::string short_name = symbol_name.substr(ns_pos + 1); + std::string short_param_path; + if (!config_namespace_.empty()) { + short_param_path = config_namespace_ + "/" + short_name + "/library_path"; + } else { + short_param_path = short_name + "/library_path"; + } + return nh_.hasParam(short_param_path); + } + + return false; +} + +std::vector PluginLoaderHelper::getRegisteredSymbols() const +{ + // Note: This is a simplified implementation. + // To get all registered symbols, we would need to iterate through NodeHandle's parameter tree. + // For now, return empty vector as this requires more complex implementation. + // Users should know which symbols are available from their config files. + return std::vector(); +} + +std::string PluginLoaderHelper::resolveLibraryPath(const std::string& library_path) const +{ + // If absolute path and exists, return it directly + if (std::filesystem::path(library_path).is_absolute()) { + if (std::filesystem::exists(library_path)) { + try { + return std::filesystem::canonical(library_path).string(); + } catch (...) { + return library_path; + } + } + // Try to resolve (follow symlinks) + try { + std::filesystem::path resolved = std::filesystem::canonical(library_path); + if (std::filesystem::exists(resolved)) { + return resolved.string(); + } + } catch (...) { + // Ignore errors + } + return ""; + } + + // If relative path, search under PNKX_NAV_CORE_LIBRARY_PATH (':'-separated, like LD_LIBRARY_PATH) + const char* nav_lib_path_env = std::getenv("PNKX_NAV_CORE_LIBRARY_PATH"); + if (nav_lib_path_env) { + std::string lib_path_with_ext = library_path; + if (lib_path_with_ext.find(".so") == std::string::npos) { + lib_path_with_ext += ".so"; + } + std::string nav_lib_paths(nav_lib_path_env); + std::stringstream ss(nav_lib_paths); + std::string base_dir; + while (std::getline(ss, base_dir, ':')) { + if (base_dir.empty()) { + continue; + } + std::filesystem::path full_path = std::filesystem::path(base_dir) / lib_path_with_ext; + if (std::filesystem::exists(full_path)) { + try { + return std::filesystem::canonical(full_path).string(); + } catch (...) { + return full_path.string(); + } + } + } + } + + // Try in search_paths + for (const auto& base_path : search_paths_) { + std::filesystem::path full_path = std::filesystem::path(base_path) / library_path; + if (std::filesystem::exists(full_path)) { + try { + return std::filesystem::canonical(full_path).string(); + } catch (...) { + return full_path.string(); + } + } + } + + // Try in current directory + if (std::filesystem::exists(library_path)) { + try { + return std::filesystem::canonical(library_path).string(); + } catch (...) { + return std::filesystem::absolute(library_path).string(); + } + } + + return ""; +} + +std::string PluginLoaderHelper::getBuildDirectory() +{ + // Method 1: Từ compile definition (CMAKE_BINARY_DIR) + #ifdef PNKX_NAV_CORE_BUILD_DIR + std::string build_dir = PNKX_NAV_CORE_BUILD_DIR; + if (!build_dir.empty() && std::filesystem::exists(build_dir)) { + return build_dir; + } + #endif + + // Method 2: Từ environment variable + const char* env_build_dir = std::getenv("PNKX_NAV_CORE_BUILD_DIR"); + if (env_build_dir && std::filesystem::exists(env_build_dir)) { + return std::string(env_build_dir); + } + + // Method 3: Tự động detect từ library path (librobot_cpp.so) + // Lấy đường dẫn của chính library này + Dl_info dl_info; + if (dladdr(reinterpret_cast(&PluginLoaderHelper::getBuildDirectory), &dl_info) != 0) { + if (dl_info.dli_fname) { + std::filesystem::path lib_path(dl_info.dli_fname); + std::filesystem::path lib_dir = lib_path.parent_path(); + + // Nếu library nằm trong build directory, lấy parent + // Ví dụ: /path/to/build/librobot_cpp.so -> /path/to/build + if (lib_dir.filename() == "lib" || lib_dir.filename().string().find("lib") == 0) { + // Có thể là build/lib/ hoặc build/src/.../lib/ + std::filesystem::path parent = lib_dir.parent_path(); + if (std::filesystem::exists(parent) && std::filesystem::is_directory(parent)) { + // Kiểm tra xem có phải build directory không (có CMakeCache.txt) + if (std::filesystem::exists(parent / "CMakeCache.txt")) { + return parent.string(); + } + } + } else { + // Library nằm trực tiếp trong build directory + if (std::filesystem::exists(lib_dir / "CMakeCache.txt")) { + return lib_dir.string(); + } + } + } + } + + // Method 4: Từ workspace path + /build + const char* workspace_path = std::getenv("PNKX_NAV_CORE_DIR"); + if (workspace_path) { + std::string build_path = std::string(workspace_path) + "/build"; + if (std::filesystem::exists(build_path) && std::filesystem::is_directory(build_path)) { + return build_path; + } + } + + // Method 5: Từ executable path (tương tự NodeHandle) + try { + char exe_path[PATH_MAX]; + ssize_t count = readlink("/proc/self/exe", exe_path, PATH_MAX); + if (count != -1) { + exe_path[count] = '\0'; + std::filesystem::path exe_dir = std::filesystem::path(exe_path).parent_path(); + + // Thử các relative paths: ../build, ../../build, etc. + std::vector relative_paths = { + exe_dir / "../build", + exe_dir / "../../build", + exe_dir.parent_path() / "build", + exe_dir.parent_path().parent_path() / "build" + }; + + for (const auto& rel_path : relative_paths) { + if (std::filesystem::exists(rel_path) && + std::filesystem::is_directory(rel_path) && + std::filesystem::exists(rel_path / "CMakeCache.txt")) { + try { + return std::filesystem::canonical(rel_path).string(); + } catch (...) { + return rel_path.string(); + } + } + } + } + } catch (const std::exception&) { + // Ignore errors + } + + // Method 6: Hardcoded fallback + std::string fallback = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build"; + if (std::filesystem::exists(fallback)) { + return fallback; + } + + return ""; +} + +std::string PluginLoaderHelper::getWorkspacePath() +{ + // Method 1: Từ environment variable PNKX_NAV_CORE_DIR + const char* workspace_path = std::getenv("PNKX_NAV_CORE_LIBRARY_PATH"); + if (workspace_path && std::filesystem::exists(workspace_path)) { + return std::string(workspace_path); + } + + // Method 2: Từ environment variable ROS_WORKSPACE hoặc CATKIN_WS + const char* ros_workspace = std::getenv("ROS_WORKSPACE"); + if (ros_workspace && std::filesystem::exists(ros_workspace)) { + return std::string(ros_workspace); + } + + const char* catkin_ws = std::getenv("CATKIN_WS"); + if (catkin_ws && std::filesystem::exists(catkin_ws)) { + return std::string(catkin_ws); + } + + // Method 3: Từ build directory (lấy parent directory) + std::string build_dir = getBuildDirectory(); + if (!build_dir.empty()) { + std::filesystem::path build_path(build_dir); + std::filesystem::path parent = build_path.parent_path(); + // Kiểm tra xem có phải workspace không (có thư mục src/) + if (std::filesystem::exists(parent / "src") && std::filesystem::is_directory(parent / "src")) { + return parent.string(); + } + } + + // Method 4: Từ executable path và tìm workspace + try { + char exe_path[PATH_MAX]; + ssize_t count = readlink("/proc/self/exe", exe_path, PATH_MAX); + if (count != -1) { + exe_path[count] = '\0'; + std::filesystem::path exe_dir = std::filesystem::path(exe_path).parent_path(); + + // Thử các relative paths: ../.., ../../.., etc. để tìm workspace + std::vector relative_paths = { + exe_dir.parent_path().parent_path(), // ../.. + exe_dir.parent_path().parent_path().parent_path(), // ../../.. + exe_dir.parent_path().parent_path().parent_path().parent_path() // ../../../.. + }; + + for (const auto& rel_path : relative_paths) { + // Kiểm tra xem có phải workspace không (có thư mục src/ hoặc build/) + if (std::filesystem::exists(rel_path) && + std::filesystem::is_directory(rel_path) && + (std::filesystem::exists(rel_path / "src") || + std::filesystem::exists(rel_path / "build"))) { + try { + return std::filesystem::canonical(rel_path).string(); + } catch (...) { + return rel_path.string(); + } + } + } + } + } catch (const std::exception&) { + // Ignore errors + } + + // Method 5: Từ library path (librobot_cpp.so) và tìm workspace + Dl_info dl_info; + if (dladdr(reinterpret_cast(&PluginLoaderHelper::getWorkspacePath), &dl_info) != 0) { + if (dl_info.dli_fname) { + std::filesystem::path lib_path(dl_info.dli_fname); + std::filesystem::path lib_dir = lib_path.parent_path(); + + // Tìm workspace từ library path + std::filesystem::path current = lib_dir; + for (int i = 0; i < 5; ++i) { // Tối đa 5 levels up + if (std::filesystem::exists(current / "src") || + std::filesystem::exists(current / "build")) { + try { + return std::filesystem::canonical(current).string(); + } catch (...) { + return current.string(); + } + } + current = current.parent_path(); + if (current == current.parent_path()) { // Reached root + break; + } + } + } + } + + // Method 6: Hardcoded fallback (nếu các phương pháp trên không hoạt động) + std::string fallback = "/home/robotics/AGV/Diff_Wheel_Prj/t800_v2_ws"; + if (std::filesystem::exists(fallback)) { + return fallback; + } + + return ""; +} + +} // namespace robot + diff --git a/src/Libraries/robot_cpp/test/test_node_handle.cpp b/src/Libraries/robot_cpp/test/test_node_handle.cpp new file mode 100644 index 0000000..3a84cf9 --- /dev/null +++ b/src/Libraries/robot_cpp/test/test_node_handle.cpp @@ -0,0 +1,839 @@ +/********************************************************************* + * + * Test program for robot::NodeHandle + * Tests all functionality including YAML loading, getParam, setParam, etc. + * + *********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +// Test helper macros +#define TEST_ASSERT(condition, message) \ + do { \ + if (!(condition)) { \ + std::cerr << "FAIL: " << message << std::endl; \ + return false; \ + } \ + } while(0) + +#define TEST_PASS(message) \ + std::cout << "PASS: " << message << std::endl + +bool testBasicGetParam() +{ + std::cout << "\n=== Test 1: Basic getParam ===" << std::endl; + + robot::NodeHandle nh("~"); + + // Test scalar values + double controller_freq = 0.0; + if (nh.getParam("controller_frequency", controller_freq, 0.0)) + { + TEST_PASS("controller_frequency = " << controller_freq); + TEST_ASSERT(std::abs(controller_freq - 20.0) < 0.001, "controller_frequency should be 20.0"); + } + else + { + std::cout << "WARN: controller_frequency not found" << std::endl; + } + + double planner_freq = 0.0; + if (nh.getParam("planner_frequency", planner_freq, 0.0)) + { + TEST_PASS("planner_frequency = " << planner_freq); + TEST_ASSERT(std::abs(planner_freq - 0.0) < 0.001, "planner_frequency should be 0.0"); + } + else + { + std::cout << "WARN: planner_frequency not found" << std::endl; + } + + bool recovery_enabled = false; + if (nh.getParam("recovery_behavior_enabled", recovery_enabled, false)) + { + TEST_PASS("recovery_behavior_enabled = " << (recovery_enabled ? "true" : "false")); + TEST_ASSERT(recovery_enabled == true, "recovery_behavior_enabled should be true"); + } + else + { + std::cout << "WARN: recovery_behavior_enabled not found" << std::endl; + } + + // Test string + std::string base_planner; + if (nh.getParam("base_global_planner", base_planner, std::string(""))) + { + TEST_PASS("base_global_planner = " << base_planner); + } + else + { + std::cout << "WARN: base_global_planner not found" << std::endl; + } + + return true; +} + +bool testNestedKeys() +{ + std::cout << "\n=== Test 2: Nested Keys ===" << std::endl; + + robot::NodeHandle nh("~"); + + // Test nested keys + std::string global_frame; + if (nh.getParam("global_costmap/global_frame", global_frame, std::string(""))) + { + TEST_PASS("global_costmap/global_frame = " << global_frame); + TEST_ASSERT(global_frame == "map", "global_frame should be 'map'"); + } + else + { + std::cout << "WARN: global_costmap/global_frame not found" << std::endl; + } + + double resolution = 0.0; + if (nh.getParam("global_costmap/resolution", resolution, 0.0)) + { + TEST_PASS("global_costmap/resolution = " << resolution); + TEST_ASSERT(std::abs(resolution - 0.05) < 0.001, "resolution should be 0.05"); + } + else + { + std::cout << "WARN: global_costmap/resolution not found" << std::endl; + } + + // Test deeply nested + double cost_scaling = 0.0; + if (nh.getParam("global_costmap/inflation/cost_scaling_factor", cost_scaling, 0.0)) + { + TEST_PASS("global_costmap/inflation/cost_scaling_factor = " << cost_scaling); + TEST_ASSERT(std::abs(cost_scaling - 10.0) < 0.001, "cost_scaling_factor should be 10.0"); + } + else + { + std::cout << "WARN: global_costmap/inflation/cost_scaling_factor not found" << std::endl; + } + + return true; +} + +bool testSequences() +{ + std::cout << "\n=== Test 3: Sequences ===" << std::endl; + + robot::NodeHandle nh("~"); + + // Test recovery_behaviors sequence + YAML::Node behaviors = nh.getParamValue("recovery_behaviors"); + if (behaviors.IsDefined() && behaviors.IsSequence()) + { + TEST_PASS("recovery_behaviors found (sequence with " << behaviors.size() << " items)"); + TEST_ASSERT(behaviors.size() >= 2, "recovery_behaviors should have at least 2 items"); + + for (size_t i = 0; i < behaviors.size(); ++i) + { + if (behaviors[i].IsMap()) + { + std::string name = behaviors[i]["name"].as(); + std::string type = behaviors[i]["type"].as(); + std::cout << " Item [" << i << "]: name=" << name << ", type=" << type << std::endl; + } + } + } + else + { + std::cout << "WARN: recovery_behaviors not found or not a sequence" << std::endl; + } + + // Test vector of doubles + std::vector vec_double; + if (nh.getParam("local_costmap/plugins", vec_double, std::vector())) + { + // This might not be a vector of doubles, so just check if it exists + std::cout << "INFO: local_costmap/plugins found" << std::endl; + } + + return true; +} + +bool testSetParam() +{ + std::cout << "\n=== Test 4: setParam ===" << std::endl; + + // Create NodeHandle with a custom namespace to avoid auto-loading + robot::NodeHandle nh("test_namespace"); + + // Use unique prefix to avoid conflicts (node_handle_ is static) + std::string prefix = "test4_"; + + // Test setting various types + YAML::Node bool_node(true); + std::cout << "DEBUG: Before setParam - bool_node IsScalar: " << bool_node.IsScalar() + << ", Type: " << (int)bool_node.Type() << std::endl; + + nh.setParam(prefix + "test_bool", true); + nh.setParam(prefix + "test_int", 42); + nh.setParam(prefix + "test_double", 3.14); + nh.setParam(prefix + "test_string", std::string("hello")); + nh.setParam(prefix + "test_float", 2.5f); + + // Verify they can be retrieved + bool b = false; + TEST_ASSERT(nh.getParam(prefix + "test_bool", b, false), "getParam test_bool should succeed"); + TEST_ASSERT(b == true, "test_bool should be true"); + TEST_PASS("setParam/getParam bool works"); + + int i = 0; + TEST_ASSERT(nh.getParam(prefix + "test_int", i, 0), "getParam test_int should succeed"); + TEST_ASSERT(i == 42, "test_int should be 42"); + TEST_PASS("setParam/getParam int works"); + + double d = 0.0; + TEST_ASSERT(nh.getParam(prefix + "test_double", d, 0.0), "getParam test_double should succeed"); + TEST_ASSERT(std::abs(d - 3.14) < 0.001, "test_double should be 3.14"); + TEST_PASS("setParam/getParam double works"); + + std::string s; + TEST_ASSERT(nh.getParam(prefix + "test_string", s, std::string("")), "getParam test_string should succeed"); + TEST_ASSERT(s == "hello", "test_string should be 'hello'"); + TEST_PASS("setParam/getParam string works"); + + float f = 0.0f; + TEST_ASSERT(nh.getParam(prefix + "test_float", f, 0.0f), "getParam test_float should succeed"); + TEST_ASSERT(std::abs(f - 2.5f) < 0.001f, "test_float should be 2.5"); + TEST_PASS("setParam/getParam float works"); + + // Test nested setParam with unique prefix + nh.setParam(prefix + "nested/test/value", 100); + int nested_val = 0; + TEST_ASSERT(nh.getParam(prefix + "nested/test/value", nested_val, 0), "getParam nested/test/value should succeed"); + TEST_ASSERT(nested_val == 100, "nested/test/value should be 100"); + TEST_PASS("setParam/getParam nested keys works"); + + return true; +} + +bool testLoadYamlFile() +{ + std::cout << "\n=== Test 5: loadYamlFile ===" << std::endl; + + robot::NodeHandle nh; + + // Try to load a specific YAML file + std::string config_dir = robot::NodeHandle::getConfigDirectory(); + if (!config_dir.empty()) + { + std::string test_file = config_dir + "/move_base_common_params.yaml"; + if (nh.loadYamlFile(test_file)) + { + TEST_PASS("loadYamlFile succeeded for " << test_file); + + // Verify we can read from it + double controller_freq = 0.0; + if (nh.getParam("controller_frequency", controller_freq, 0.0)) + { + TEST_PASS("Can read controller_frequency from loaded file: " << controller_freq); + } + } + else + { + std::cout << "WARN: loadYamlFile failed for " << test_file << std::endl; + } + } + else + { + std::cout << "WARN: Config directory not found, skipping loadYamlFile test" << std::endl; + } + + return true; +} + +bool testMaps() +{ + std::cout << "\n=== Test 6: Maps ===" << std::endl; + + robot::NodeHandle nh("~"); + + // Test map of strings + std::map map_str; + // Note: Most YAML files don't have map structures at top level + // This is just to test the function exists and works + + // Test map of doubles (if exists) + std::map map_double; + // This might not exist, so we just test the function call doesn't crash + + return true; +} + +bool testGetParamValue() +{ + std::cout << "\n=== Test 7: getParamValue ===" << std::endl; + + robot::NodeHandle nh("~"); + + // Test getting a nested node + YAML::Node global_costmap = nh.getParamValue("global_costmap"); + if (global_costmap.IsDefined() && global_costmap.IsMap()) + { + TEST_PASS("getParamValue('global_costmap') returned a map with " << global_costmap.size() << " keys"); + + // Access nested values directly + if (global_costmap["resolution"].IsDefined()) + { + double res = global_costmap["resolution"].as(); + std::cout << " Direct access: global_costmap['resolution'] = " << res << std::endl; + } + } + else + { + std::cout << "WARN: global_costmap not found or not a map" << std::endl; + } + + return true; +} + +bool testNamespace() +{ + std::cout << "\n=== Test 8: Namespace ===" << std::endl; + + // Test default constructor + robot::NodeHandle nh1; + std::string ns1 = nh1.getNamespace(); + std::cout << "Default constructor namespace: '" << ns1 << "'" << std::endl; + + // Test with "~" + robot::NodeHandle nh2("~"); + std::string ns2 = nh2.getNamespace(); + std::cout << "NodeHandle('~') namespace: '" << ns2 << "'" << std::endl; + // Should be config directory path + if (!ns2.empty() && ns2 != "~") + { + TEST_PASS("NodeHandle('~') namespace is config directory: " << ns2); + } + + // Test with custom namespace + robot::NodeHandle nh3("custom_namespace"); + std::string ns3 = nh3.getNamespace(); + TEST_ASSERT(ns3 == "custom_namespace", "Custom namespace should be preserved"); + TEST_PASS("Custom namespace works: " << ns3); + + return true; +} + +bool testConfigDirectory() +{ + std::cout << "\n=== Test 9: Config Directory ===" << std::endl; + + std::string config_dir = robot::NodeHandle::getConfigDirectory(); + if (!config_dir.empty()) + { + TEST_PASS("Config directory found: " << config_dir); + + // Test setting custom config directory + robot::NodeHandle::setConfigDirectory("/tmp/test_config"); + std::string custom_dir = robot::NodeHandle::getConfigDirectory(); + std::cout << "After setConfigDirectory('/tmp/test_config'): " << custom_dir << std::endl; + + // Reset to original + robot::NodeHandle::setConfigDirectory(config_dir); + } + else + { + std::cout << "WARN: Config directory not found" << std::endl; + } + + return true; +} + +bool testSetParamAllTypes() +{ + std::cout << "\n=== Test 10: setParam All Types ===" << std::endl; + + robot::NodeHandle nh("test_setparam"); + + // Test bool + nh.setParam("test_bool", true); + bool b = false; + TEST_ASSERT(nh.getParam("test_bool", b, false), "getParam bool should succeed"); + TEST_ASSERT(b == true, "test_bool should be true"); + TEST_PASS("setParam/getParam bool works"); + + // Test const char* + nh.setParam("test_cstring", "test_string"); + std::string s1; + TEST_ASSERT(nh.getParam("test_cstring", s1, std::string("")), "getParam const char* should succeed"); + TEST_ASSERT(s1 == "test_string", "test_cstring should be 'test_string'"); + TEST_PASS("setParam/getParam const char* works"); + + // Test string + nh.setParam("test_string", std::string("hello_world")); + std::string s2; + TEST_ASSERT(nh.getParam("test_string", s2, std::string("")), "getParam string should succeed"); + TEST_ASSERT(s2 == "hello_world", "test_string should be 'hello_world'"); + TEST_PASS("setParam/getParam string works"); + + // Test int + nh.setParam("test_int", 123); + int i = 0; + TEST_ASSERT(nh.getParam("test_int", i, 0), "getParam int should succeed"); + TEST_ASSERT(i == 123, "test_int should be 123"); + TEST_PASS("setParam/getParam int works"); + + // Test double + nh.setParam("test_double", 3.14159); + double d = 0.0; + TEST_ASSERT(nh.getParam("test_double", d, 0.0), "getParam double should succeed"); + TEST_ASSERT(std::abs(d - 3.14159) < 0.0001, "test_double should be 3.14159"); + TEST_PASS("setParam/getParam double works"); + + return true; +} + +bool testSetParamVectors() +{ + std::cout << "\n=== Test 11: setParam Vectors ===" << std::endl; + + robot::NodeHandle nh("test_vectors"); + + // Test vector + std::vector vec_bool = {true, false, true}; + nh.setParam("test_vec_bool", vec_bool); + std::vector vec_bool_read; + TEST_ASSERT(nh.getParam("test_vec_bool", vec_bool_read, std::vector()), + "getParam vector should succeed"); + TEST_ASSERT(vec_bool_read.size() == 3, "vector should have 3 elements"); + TEST_ASSERT(vec_bool_read[0] == true && vec_bool_read[1] == false && vec_bool_read[2] == true, + "vector values should match"); + TEST_PASS("setParam/getParam vector works"); + + // Test vector + std::vector vec_int = {1, 2, 3, 4, 5}; + nh.setParam("test_vec_int", vec_int); + std::vector vec_int_read; + TEST_ASSERT(nh.getParam("test_vec_int", vec_int_read, std::vector()), + "getParam vector should succeed"); + TEST_ASSERT(vec_int_read.size() == 5, "vector should have 5 elements"); + TEST_ASSERT(vec_int_read[0] == 1 && vec_int_read[4] == 5, "vector values should match"); + TEST_PASS("setParam/getParam vector works"); + + // Test vector + std::vector vec_float = {1.1f, 2.2f, 3.3f}; + nh.setParam("test_vec_float", vec_float); + std::vector vec_float_read; + TEST_ASSERT(nh.getParam("test_vec_float", vec_float_read, std::vector()), + "getParam vector should succeed"); + TEST_ASSERT(vec_float_read.size() == 3, "vector should have 3 elements"); + TEST_PASS("setParam/getParam vector works"); + + // Test vector + std::vector vec_double = {1.5, 2.5, 3.5, 4.5}; + nh.setParam("test_vec_double", vec_double); + std::vector vec_double_read; + TEST_ASSERT(nh.getParam("test_vec_double", vec_double_read, std::vector()), + "getParam vector should succeed"); + TEST_ASSERT(vec_double_read.size() == 4, "vector should have 4 elements"); + TEST_PASS("setParam/getParam vector works"); + + // Test vector + std::vector vec_string = {"one", "two", "three"}; + nh.setParam("test_vec_string", vec_string); + std::vector vec_string_read; + TEST_ASSERT(nh.getParam("test_vec_string", vec_string_read, std::vector()), + "getParam vector should succeed"); + TEST_ASSERT(vec_string_read.size() == 3, "vector should have 3 elements"); + TEST_ASSERT(vec_string_read[0] == "one" && vec_string_read[2] == "three", + "vector values should match"); + TEST_PASS("setParam/getParam vector works"); + + return true; +} + +bool testSetParamMaps() +{ + std::cout << "\n=== Test 12: setParam Maps ===" << std::endl; + + robot::NodeHandle nh("test_maps"); + + // Test map + std::map map_bool = {{"key1", true}, {"key2", false}, {"key3", true}}; + nh.setParam("test_map_bool", map_bool); + std::map map_bool_read; + TEST_ASSERT(nh.getParam("test_map_bool", map_bool_read, std::map()), + "getParam map should succeed"); + TEST_ASSERT(map_bool_read.size() == 3, "map should have 3 elements"); + TEST_ASSERT(map_bool_read["key1"] == true && map_bool_read["key2"] == false, + "map values should match"); + TEST_PASS("setParam/getParam map works"); + + // Test map + std::map map_int = {{"a", 10}, {"b", 20}, {"c", 30}}; + nh.setParam("test_map_int", map_int); + std::map map_int_read; + TEST_ASSERT(nh.getParam("test_map_int", map_int_read, std::map()), + "getParam map should succeed"); + TEST_ASSERT(map_int_read.size() == 3, "map should have 3 elements"); + TEST_ASSERT(map_int_read["a"] == 10 && map_int_read["c"] == 30, + "map values should match"); + TEST_PASS("setParam/getParam map works"); + + // Test map + std::map map_double = {{"x", 1.1}, {"y", 2.2}, {"z", 3.3}}; + nh.setParam("test_map_double", map_double); + std::map map_double_read; + TEST_ASSERT(nh.getParam("test_map_double", map_double_read, std::map()), + "getParam map should succeed"); + TEST_ASSERT(map_double_read.size() == 3, "map should have 3 elements"); + TEST_PASS("setParam/getParam map works"); + + // Test map + std::map map_float = {{"f1", 1.5f}, {"f2", 2.5f}}; + nh.setParam("test_map_float", map_float); + std::map map_float_read; + TEST_ASSERT(nh.getParam("test_map_float", map_float_read, std::map()), + "getParam map should succeed"); + TEST_ASSERT(map_float_read.size() == 2, "map should have 2 elements"); + TEST_PASS("setParam/getParam map works"); + + // Test map + std::map map_string = {{"name", "test"}, {"value", "123"}}; + nh.setParam("test_map_string", map_string); + std::map map_string_read; + TEST_ASSERT(nh.getParam("test_map_string", map_string_read, std::map()), + "getParam map should succeed"); + TEST_ASSERT(map_string_read.size() == 2, "map should have 2 elements"); + TEST_ASSERT(map_string_read["name"] == "test" && map_string_read["value"] == "123", + "map values should match"); + TEST_PASS("setParam/getParam map works"); + + return true; +} + +bool testSetParamTypeChecking() +{ + std::cout << "\n=== Test 13: setParam Type Checking ===" << std::endl; + + robot::NodeHandle nh("test_type_check"); + + // Test 1: Set key with one type, then change to another type (should overwrite) + nh.setParam("test_type_change", 42); + int i = 0; + TEST_ASSERT(nh.getParam("test_type_change", i, 0), "Should get int value"); + TEST_ASSERT(i == 42, "Value should be 42"); + + // Change to string type + nh.setParam("test_type_change", std::string("changed")); + std::string s; + TEST_ASSERT(nh.getParam("test_type_change", s, std::string("")), "Should get string value"); + TEST_ASSERT(s == "changed", "Value should be 'changed'"); + TEST_PASS("Type change (int -> string) works"); + + // Test 2: Set key that doesn't exist (should create it) + nh.setParam("test_new_key", 100); + int new_val = 0; + TEST_ASSERT(nh.getParam("test_new_key", new_val, 0), "New key should be created"); + TEST_ASSERT(new_val == 100, "New key value should be 100"); + TEST_PASS("Creating new key works"); + + // Test 3: Set same type again (should update value) + nh.setParam("test_new_key", 200); + int updated_val = 0; + TEST_ASSERT(nh.getParam("test_new_key", updated_val, 0), "Should get updated value"); + TEST_ASSERT(updated_val == 200, "Updated value should be 200"); + TEST_PASS("Updating existing key with same type works"); + + return true; +} + +bool testGetParamAllTypes() +{ + std::cout << "\n=== Test 14: getParam All Types ===" << std::endl; + + robot::NodeHandle nh("test_getparam"); + + // Set up test data + nh.setParam("test_bool", true); + nh.setParam("test_int", 42); + nh.setParam("test_double", 3.14); + nh.setParam("test_float", 2.5f); + nh.setParam("test_string", std::string("test")); + + // Test getParam + bool b = false; + TEST_ASSERT(nh.getParam("test_bool", b, false), "getParam should succeed"); + TEST_ASSERT(b == true, "bool value should be true"); + TEST_PASS("getParam works"); + + // Test getParam + int i = 0; + TEST_ASSERT(nh.getParam("test_int", i, 0), "getParam should succeed"); + TEST_ASSERT(i == 42, "int value should be 42"); + TEST_PASS("getParam works"); + + // Test getParam + double d = 0.0; + TEST_ASSERT(nh.getParam("test_double", d, 0.0), "getParam should succeed"); + TEST_ASSERT(std::abs(d - 3.14) < 0.001, "double value should be 3.14"); + TEST_PASS("getParam works"); + + // Test getParam + float f = 0.0f; + TEST_ASSERT(nh.getParam("test_float", f, 0.0f), "getParam should succeed"); + TEST_ASSERT(std::abs(f - 2.5f) < 0.001f, "float value should be 2.5"); + TEST_PASS("getParam works"); + + // Test getParam + std::string s; + TEST_ASSERT(nh.getParam("test_string", s, std::string("")), "getParam should succeed"); + TEST_ASSERT(s == "test", "string value should be 'test'"); + TEST_PASS("getParam works"); + + // Test getParam with non-existent key (should return default) + int default_val = 999; + TEST_ASSERT(!nh.getParam("non_existent_key", default_val, 999), + "getParam for non-existent key should return false"); + TEST_ASSERT(default_val == 999, "Default value should be used"); + TEST_PASS("getParam with default value works"); + + return true; +} + +bool testGetParamYAMLNode() +{ + std::cout << "\n=== Test 15: getParam YAML::Node ===" << std::endl; + + robot::NodeHandle nh("test_yaml_node"); + + // Use a unique key to avoid conflicts with other tests (node_handle_ is static) + std::string unique_key = "test15_unique/level1/level2/value"; + + // Set up nested structure + nh.setParam(unique_key, 100); + + // Test getParam + YAML::Node node; + TEST_ASSERT(nh.getParam(unique_key, node, YAML::Node()), + "getParam should succeed"); + TEST_ASSERT(node.IsDefined(), "Node should be defined"); + + // Try to get value - if it's scalar, great; if not, try to convert anyway + int value = 0; + if (node.IsScalar()) + { + value = node.as(); + TEST_ASSERT(value == 100, "Node value should be 100"); + TEST_PASS("getParam works (scalar)"); + } + else + { + // If not scalar, it might be stored differently due to static node_handle_ sharing + // Try to get value using getParam instead + int direct_value = 0; + if (nh.getParam(unique_key, direct_value, 0)) + { + TEST_ASSERT(direct_value == 100, "Node value should be 100"); + TEST_PASS("getParam works (using getParam as fallback)"); + } + else + { + // If both fail, that's a problem + TEST_ASSERT(false, "Node should be retrievable either as YAML::Node or int"); + } + } + + // Test getParamValue with a simpler nested structure + nh.setParam("test15_simple/nested", 42); + YAML::Node nested = nh.getParamValue("test15_simple"); + TEST_ASSERT(nested.IsDefined(), "getParamValue should return defined node"); + TEST_ASSERT(nested.IsMap(), "Nested node should be a map"); + TEST_PASS("getParamValue works"); + + return true; +} + +bool testMergeYamlNode() +{ + std::cout << "\n=== Test 16: mergeYamlNode ===" << std::endl; + + robot::NodeHandle nh("test_merge"); + + // Use unique prefix to avoid conflicts with other tests (node_handle_ is static) + std::string prefix = "test16_"; + + // Create first YAML node + YAML::Node node1; + node1[prefix + "key1"] = "value1"; + node1[prefix + "key2"] = 42; + node1[prefix + "nested"]["a"] = 1; + node1[prefix + "nested"]["b"] = 2; + + // Merge first node + // nh.mergeYamlNode(node1); + + // Debug: Print all params after first merge + std::cout << "DEBUG: After first merge:" << std::endl; + nh.printAllParams(); + + // Verify merged values + std::string s; + bool key1_exists = nh.getParam(prefix + "key1", s, std::string("")); + std::cout << "DEBUG: key1 exists: " << key1_exists << ", value: " << s << std::endl; + TEST_ASSERT(key1_exists, "key1 should exist"); + TEST_ASSERT(s == "value1", "key1 should be 'value1'"); + + // Try getParamValue first to see what we get + YAML::Node key2_node = nh.getParamValue(prefix + "key2"); + std::cout << "DEBUG: key2_node from getParamValue:" << std::endl; + std::cout << " IsDefined: " << key2_node.IsDefined() << std::endl; + std::cout << " IsScalar: " << key2_node.IsScalar() << std::endl; + std::cout << " Type: " << (int)key2_node.Type() << std::endl; + + // Try getParam - if it fails, the value might be stored but getParam can't read it + // This could be due to static node_handle_ sharing issues + int i = 0; + bool key2_exists = nh.getParam(prefix + "key2", i, 0); + if (!key2_exists) + { + // If getParam failed, check if we can at least verify the value exists via printAllParams + // For now, we'll mark this as a known issue with static node_handle_ + std::cout << "WARN: getParam failed for key2, but value exists in node_handle_ (static sharing issue)" << std::endl; + // Try to verify via getParamValue and manual conversion + if (key2_node.IsDefined()) + { + try { + // Try to dump and parse + std::string dumped = YAML::Dump(key2_node); + std::cout << "DEBUG: key2_node dumped: " << dumped << std::endl; + // For now, just verify the node exists + TEST_PASS("key2 exists in node_handle_ (getParam has issue with static node_handle_)"); + return true; // Skip the strict check + } catch (...) { + } + } + } + std::cout << "DEBUG: key2 exists: " << key2_exists << ", value: " << i << std::endl; + if (key2_exists) + { + TEST_ASSERT(i == 42, "key2 should be 42"); + } + else + { + // If getParam fails, we'll accept it as a known limitation + TEST_PASS("key2 verified via printAllParams (getParam limitation with static node_handle_)"); + } + + // Create second YAML node with overlapping keys + YAML::Node node2; + node2[prefix + "key2"] = 100; // Overwrite key2 + node2[prefix + "key3"] = "new_value"; // New key + node2[prefix + "nested"]["c"] = 3; // Add to nested + + // Merge second node + // nh.mergeYamlNode(node2); + + // Verify merged values + TEST_ASSERT(nh.getParam(prefix + "key2", i, 0), "key2 should still exist"); + TEST_ASSERT(i == 100, "key2 should be overwritten to 100"); + + TEST_ASSERT(nh.getParam(prefix + "key3", s, std::string("")), "key3 should exist"); + TEST_ASSERT(s == "new_value", "key3 should be 'new_value'"); + + TEST_PASS("mergeYamlNode works correctly"); + + return true; +} + +bool testLoadYamlFilesFromDirectory() +{ + std::cout << "\n=== Test 17: loadYamlFilesFromDirectory ===" << std::endl; + + robot::NodeHandle nh("test_load_dir"); + + std::string config_dir = robot::NodeHandle::getConfigDirectory(); + if (!config_dir.empty()) + { + int count = nh.loadYamlFilesFromDirectory(config_dir); + std::cout << "Loaded " << count << " YAML files from " << config_dir << std::endl; + TEST_ASSERT(count > 0, "Should load at least one YAML file"); + TEST_PASS("loadYamlFilesFromDirectory works"); + } + else + { + std::cout << "WARN: Config directory not found, skipping test" << std::endl; + } + + return true; +} + +bool testPrintAllParams() +{ + std::cout << "\n=== Test 18: printAllParams ===" << std::endl; + + robot::NodeHandle nh("test_print"); + + // Set up some test data + nh.setParam("test1", 1); + nh.setParam("test2", std::string("value2")); + nh.setParam("nested/test3", 3.14); + + // Call printAllParams (should not crash) + nh.printAllParams(); + TEST_PASS("printAllParams executed without errors"); + + return true; +} + +int main(int /*argc*/, char** /*argv*/) +{ + std::cout << "========================================" << std::endl; + std::cout << "NodeHandle Test Suite" << std::endl; + std::cout << "========================================" << std::endl; + + bool all_passed = true; + + try + { + all_passed &= testBasicGetParam(); + all_passed &= testNestedKeys(); + all_passed &= testSequences(); + all_passed &= testSetParam(); + all_passed &= testLoadYamlFile(); + all_passed &= testMaps(); + all_passed &= testGetParamValue(); + all_passed &= testNamespace(); + all_passed &= testConfigDirectory(); + all_passed &= testSetParamAllTypes(); + all_passed &= testSetParamVectors(); + all_passed &= testSetParamMaps(); + all_passed &= testSetParamTypeChecking(); + all_passed &= testGetParamAllTypes(); + all_passed &= testGetParamYAMLNode(); + all_passed &= testMergeYamlNode(); + all_passed &= testLoadYamlFilesFromDirectory(); + all_passed &= testPrintAllParams(); + } + catch (const std::exception& e) + { + std::cerr << "EXCEPTION: " << e.what() << std::endl; + return 1; + } + + std::cout << "\n========================================" << std::endl; + if (all_passed) + { + std::cout << "All tests PASSED!" << std::endl; + return 0; + } + else + { + std::cout << "Some tests FAILED!" << std::endl; + return 1; + } +} diff --git a/src/Libraries/robot_line_extraction b/src/Libraries/robot_line_extraction new file mode 160000 index 0000000..8df353d --- /dev/null +++ b/src/Libraries/robot_line_extraction @@ -0,0 +1 @@ +Subproject commit 8df353ded6ba93abe6aed856a7c603e5012afaa5 diff --git a/src/Libraries/robot_nav_2d_msgs/CMakeLists.txt b/src/Libraries/robot_nav_2d_msgs/CMakeLists.txt new file mode 100755 index 0000000..42db3eb --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/CMakeLists.txt @@ -0,0 +1,149 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_nav_2d_msgs VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_nav_2d_msgs with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_nav_2d_msgs with Standalone CMake") +endif() + +if (NOT BUILDING_WITH_CATKIN) + + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_std_msgs + robot_geometry_msgs + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_std_msgs + robot_geometry_msgs + ) + + catkin_package( + INCLUDE_DIRS include + # LIBRARIES không cần vì đây là header-only library + # CATKIN_DEPENDS không cần vì dependencies không phải Catkin packages + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/robot_nav_2d_msgs/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + ) + + # Add include directories from dependencies explicitly for Catkin build + # Use relative paths from current source directory + target_include_directories(${PROJECT_NAME} INTERFACE + $ + $ + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PACKAGES_DIR} + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: robot_std_msgs, geometry_msgs") + message(STATUS "=================================") +endif() diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/ComplexPolygon2D.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/ComplexPolygon2D.h new file mode 100644 index 0000000..535bfe4 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/ComplexPolygon2D.h @@ -0,0 +1,74 @@ +// Generated by gencpp from file robot_nav_2d_msgs/ComplexPolygon2D.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_COMPLEXPOLYGON2D_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_COMPLEXPOLYGON2D_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct ComplexPolygon2D_ +{ + typedef ComplexPolygon2D_ Type; + + ComplexPolygon2D_() + : outer() + , inner() { + } + ComplexPolygon2D_(const ContainerAllocator& _alloc) + : outer(_alloc) + , inner(_alloc) { + (void)_alloc; + } + + + + typedef ::robot_nav_2d_msgs::Polygon2D_ _outer_type; + _outer_type outer; + + typedef std::vector< ::robot_nav_2d_msgs::Polygon2D_ , typename std::allocator_traits::template rebind_alloc< ::robot_nav_2d_msgs::Polygon2D_ >> _inner_type; + _inner_type inner; + + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::ComplexPolygon2D_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::ComplexPolygon2D_ const> ConstPtr; + +}; // struct ComplexPolygon2D_ + +typedef ::robot_nav_2d_msgs::ComplexPolygon2D_ > ComplexPolygon2D; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::ComplexPolygon2D > ComplexPolygon2DPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::ComplexPolygon2D const> ComplexPolygon2DConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::ComplexPolygon2D_ & lhs, const ::robot_nav_2d_msgs::ComplexPolygon2D_ & rhs) +{ + return lhs.outer == rhs.outer && + lhs.inner == rhs.inner; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::ComplexPolygon2D_ & lhs, const ::robot_nav_2d_msgs::ComplexPolygon2D_ & rhs) +{ + return !(lhs == rhs); +} + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_COMPLEXPOLYGON2D_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridInfo.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridInfo.h new file mode 100644 index 0000000..b1da6e2 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridInfo.h @@ -0,0 +1,94 @@ +// Generated by gencpp from file robot_nav_2d_msgs/NavGridInfo.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDINFO_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDINFO_H + +#include +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct NavGridInfo_ +{ + typedef NavGridInfo_ Type; + + NavGridInfo_() + : width(0) + , height(0) + , resolution(0.0) + , frame_id() + , origin_x(0.0) + , origin_y(0.0) { + } + NavGridInfo_(const ContainerAllocator& _alloc) + : width(0) + , height(0) + , resolution(0.0) + , frame_id(_alloc) + , origin_x(0.0) + , origin_y(0.0) { + (void)_alloc; + } + + + + typedef uint32_t _width_type; + _width_type width; + + typedef uint32_t _height_type; + _height_type height; + + typedef double _resolution_type; + _resolution_type resolution; + + typedef std::basic_string, typename std::allocator_traits::template rebind_alloc> _frame_id_type; + _frame_id_type frame_id; + + typedef double _origin_x_type; + _origin_x_type origin_x; + + typedef double _origin_y_type; + _origin_y_type origin_y; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridInfo_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridInfo_ const> ConstPtr; + +}; // struct NavGridInfo_ + +typedef ::robot_nav_2d_msgs::NavGridInfo_ > NavGridInfo; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridInfo > NavGridInfoPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridInfo const> NavGridInfoConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::NavGridInfo_ & lhs, const ::robot_nav_2d_msgs::NavGridInfo_ & rhs) +{ + return lhs.width == rhs.width && + lhs.height == rhs.height && + lhs.resolution == rhs.resolution && + lhs.frame_id == rhs.frame_id && + lhs.origin_x == rhs.origin_x && + lhs.origin_y == rhs.origin_y; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::NavGridInfo_ & lhs, const ::robot_nav_2d_msgs::NavGridInfo_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDINFO_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfChars.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfChars.h new file mode 100644 index 0000000..c3ca50e --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfChars.h @@ -0,0 +1,80 @@ +// Generated by gencpp from file robot_nav_2d_msgs/NavGridOfChars.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFCHARS_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFCHARS_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct NavGridOfChars_ +{ + typedef NavGridOfChars_ Type; + + NavGridOfChars_() + : stamp() + , info() + , data() { + } + NavGridOfChars_(const ContainerAllocator& _alloc) + : stamp() + , info(_alloc) + , data(_alloc) { + (void)_alloc; + } + + + + typedef robot::Time _stamp_type; + _stamp_type stamp; + + typedef ::robot_nav_2d_msgs::NavGridInfo_ _info_type; + _info_type info; + + typedef std::vector::template rebind_alloc> _data_type; + _data_type data; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfChars_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfChars_ const> ConstPtr; + +}; // struct NavGridOfChars_ + +typedef ::robot_nav_2d_msgs::NavGridOfChars_ > NavGridOfChars; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfChars > NavGridOfCharsPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfChars const> NavGridOfCharsConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::NavGridOfChars_ & lhs, const ::robot_nav_2d_msgs::NavGridOfChars_ & rhs) +{ + return lhs.stamp == rhs.stamp && + lhs.info == rhs.info && + lhs.data == rhs.data; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::NavGridOfChars_ & lhs, const ::robot_nav_2d_msgs::NavGridOfChars_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFCHARS_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfCharsUpdate.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfCharsUpdate.h new file mode 100644 index 0000000..d9ade13 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfCharsUpdate.h @@ -0,0 +1,80 @@ +// Generated by gencpp from file robot_nav_2d_msgs/NavGridOfCharsUpdate.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFCHARSUPDATE_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFCHARSUPDATE_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct NavGridOfCharsUpdate_ +{ + typedef NavGridOfCharsUpdate_ Type; + + NavGridOfCharsUpdate_() + : stamp() + , bounds() + , data() { + } + NavGridOfCharsUpdate_(const ContainerAllocator& _alloc) + : stamp() + , bounds(_alloc) + , data(_alloc) { + (void)_alloc; + } + + + + typedef robot::Time _stamp_type; + _stamp_type stamp; + + typedef ::robot_nav_2d_msgs::UIntBounds_ _bounds_type; + _bounds_type bounds; + + typedef std::vector::template rebind_alloc> _data_type; + _data_type data; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfCharsUpdate_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfCharsUpdate_ const> ConstPtr; + +}; // struct NavGridOfCharsUpdate_ + +typedef ::robot_nav_2d_msgs::NavGridOfCharsUpdate_ > NavGridOfCharsUpdate; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfCharsUpdate > NavGridOfCharsUpdatePtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfCharsUpdate const> NavGridOfCharsUpdateConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::NavGridOfCharsUpdate_ & lhs, const ::robot_nav_2d_msgs::NavGridOfCharsUpdate_ & rhs) +{ + return lhs.stamp == rhs.stamp && + lhs.bounds == rhs.bounds && + lhs.data == rhs.data; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::NavGridOfCharsUpdate_ & lhs, const ::robot_nav_2d_msgs::NavGridOfCharsUpdate_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFCHARSUPDATE_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoubles.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoubles.h new file mode 100644 index 0000000..e0360a6 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoubles.h @@ -0,0 +1,80 @@ +// Generated by gencpp from file robot_nav_2d_msgs/NavGridOfDoubles.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFDOUBLES_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFDOUBLES_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct NavGridOfDoubles_ +{ + typedef NavGridOfDoubles_ Type; + + NavGridOfDoubles_() + : stamp() + , info() + , data() { + } + NavGridOfDoubles_(const ContainerAllocator& _alloc) + : stamp() + , info(_alloc) + , data(_alloc) { + (void)_alloc; + } + + + + typedef robot::Time _stamp_type; + _stamp_type stamp; + + typedef ::robot_nav_2d_msgs::NavGridInfo_ _info_type; + _info_type info; + + typedef std::vector::template rebind_alloc> _data_type; + _data_type data; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoubles_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoubles_ const> ConstPtr; + +}; // struct NavGridOfDoubles_ + +typedef ::robot_nav_2d_msgs::NavGridOfDoubles_ > NavGridOfDoubles; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoubles > NavGridOfDoublesPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoubles const> NavGridOfDoublesConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::NavGridOfDoubles_ & lhs, const ::robot_nav_2d_msgs::NavGridOfDoubles_ & rhs) +{ + return lhs.stamp == rhs.stamp && + lhs.info == rhs.info && + lhs.data == rhs.data; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::NavGridOfDoubles_ & lhs, const ::robot_nav_2d_msgs::NavGridOfDoubles_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFDOUBLES_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoublesUpdate.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoublesUpdate.h new file mode 100644 index 0000000..2fa99e8 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/NavGridOfDoublesUpdate.h @@ -0,0 +1,80 @@ +// Generated by gencpp from file robot_nav_2d_msgs/NavGridOfDoublesUpdate.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFDOUBLESUPDATE_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFDOUBLESUPDATE_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct NavGridOfDoublesUpdate_ +{ + typedef NavGridOfDoublesUpdate_ Type; + + NavGridOfDoublesUpdate_() + : stamp() + , bounds() + , data() { + } + NavGridOfDoublesUpdate_(const ContainerAllocator& _alloc) + : stamp() + , bounds(_alloc) + , data(_alloc) { + (void)_alloc; + } + + + + typedef robot::Time _stamp_type; + _stamp_type stamp; + + typedef ::robot_nav_2d_msgs::UIntBounds_ _bounds_type; + _bounds_type bounds; + + typedef std::vector::template rebind_alloc> _data_type; + _data_type data; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoublesUpdate_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoublesUpdate_ const> ConstPtr; + +}; // struct NavGridOfDoublesUpdate_ + +typedef ::robot_nav_2d_msgs::NavGridOfDoublesUpdate_ > NavGridOfDoublesUpdate; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoublesUpdate > NavGridOfDoublesUpdatePtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::NavGridOfDoublesUpdate const> NavGridOfDoublesUpdateConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::NavGridOfDoublesUpdate_ & lhs, const ::robot_nav_2d_msgs::NavGridOfDoublesUpdate_ & rhs) +{ + return lhs.stamp == rhs.stamp && + lhs.bounds == rhs.bounds && + lhs.data == rhs.data; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::NavGridOfDoublesUpdate_ & lhs, const ::robot_nav_2d_msgs::NavGridOfDoublesUpdate_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_NAVGRIDOFDOUBLESUPDATE_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Path2D.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Path2D.h new file mode 100644 index 0000000..e964e23 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Path2D.h @@ -0,0 +1,69 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Path2D.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_PATH2D_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_PATH2D_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct Path2D_ +{ + typedef Path2D_ Type; + + Path2D_() + : header() + , poses() { + } + Path2D_(const ContainerAllocator& _alloc) + : header() + , poses(_alloc) { + (void)_alloc; + } + + typedef ::robot_std_msgs::Header _header_type; + _header_type header; + + typedef std::vector< ::robot_nav_2d_msgs::Pose2DStamped_ , typename std::allocator_traits::template rebind_alloc< ::robot_nav_2d_msgs::Pose2DStamped_ >> _poses_type; + _poses_type poses; + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Path2D_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Path2D_ const> ConstPtr; + +}; // struct Path2D_ + +typedef ::robot_nav_2d_msgs::Path2D_ > Path2D; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Path2D > Path2DPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Path2D const> Path2DConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Path2D_ & lhs, const ::robot_nav_2d_msgs::Path2D_ & rhs) +{ + return lhs.header == rhs.header && + lhs.poses == rhs.poses; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Path2D_ & lhs, const ::robot_nav_2d_msgs::Path2D_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_PATH2D_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Point2D.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Point2D.h new file mode 100644 index 0000000..b607ff5 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Point2D.h @@ -0,0 +1,72 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Point2D.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_POINT2D_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_POINT2D_H + + +#include +#include +#include + + +namespace robot_nav_2d_msgs +{ +template +struct Point2D_ +{ + typedef Point2D_ Type; + + Point2D_() + : x(0.0) + , y(0.0) { + } + Point2D_(const ContainerAllocator& _alloc) + : x(0.0) + , y(0.0) { + (void)_alloc; + } + + + + typedef double _x_type; + _x_type x; + + typedef double _y_type; + _y_type y; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Point2D_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Point2D_ const> ConstPtr; + +}; // struct Point2D_ + +typedef ::robot_nav_2d_msgs::Point2D_ > Point2D; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Point2D > Point2DPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Point2D const> Point2DConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Point2D_ & lhs, const ::robot_nav_2d_msgs::Point2D_ & rhs) +{ + return lhs.x == rhs.x && + lhs.y == rhs.y; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Point2D_ & lhs, const ::robot_nav_2d_msgs::Point2D_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_POINT2D_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2D.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2D.h new file mode 100644 index 0000000..bd3e5e9 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2D.h @@ -0,0 +1,67 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Polygon2D.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2D_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2D_H + + +#include +#include +#include + +#include + +namespace robot_nav_2d_msgs +{ +template +struct Polygon2D_ +{ + typedef Polygon2D_ Type; + + Polygon2D_() + : points() { + } + Polygon2D_(const ContainerAllocator& _alloc) + : points(_alloc) { + (void)_alloc; + } + + + + typedef std::vector< ::robot_nav_2d_msgs::Point2D_ , typename std::allocator_traits::template rebind_alloc< ::robot_nav_2d_msgs::Point2D_ >> _points_type; + _points_type points; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2D_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2D_ const> ConstPtr; + +}; // struct Polygon2D_ + +typedef ::robot_nav_2d_msgs::Polygon2D_ > Polygon2D; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2D > Polygon2DPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2D const> Polygon2DConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Polygon2D_ & lhs, const ::robot_nav_2d_msgs::Polygon2D_ & rhs) +{ + return lhs.points == rhs.points; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Polygon2D_ & lhs, const ::robot_nav_2d_msgs::Polygon2D_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2D_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DCollection.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DCollection.h new file mode 100644 index 0000000..0b1239a --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DCollection.h @@ -0,0 +1,81 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Polygon2DCollection.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2DCOLLECTION_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2DCOLLECTION_H + + +#include +#include +#include + +#include +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct Polygon2DCollection_ +{ + typedef Polygon2DCollection_ Type; + + Polygon2DCollection_() + : header() + , polygons() + , colors() { + } + Polygon2DCollection_(const ContainerAllocator& _alloc) + : header() + , polygons(_alloc) + , colors(_alloc) { + (void)_alloc; + } + + + + typedef ::robot_std_msgs::Header _header_type; + _header_type header; + + typedef std::vector< ::robot_nav_2d_msgs::ComplexPolygon2D_ , typename std::allocator_traits::template rebind_alloc< ::robot_nav_2d_msgs::ComplexPolygon2D_ >> _polygons_type; + _polygons_type polygons; + + typedef std::vector< ::robot_std_msgs::ColorRGBA , typename std::allocator_traits::template rebind_alloc< ::robot_std_msgs::ColorRGBA >> _colors_type; + _colors_type colors; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DCollection_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DCollection_ const> ConstPtr; + +}; // struct Polygon2DCollection_ + +typedef ::robot_nav_2d_msgs::Polygon2DCollection_ > Polygon2DCollection; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DCollection > Polygon2DCollectionPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DCollection const> Polygon2DCollectionConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Polygon2DCollection_ & lhs, const ::robot_nav_2d_msgs::Polygon2DCollection_ & rhs) +{ + return lhs.header == rhs.header && + lhs.polygons == rhs.polygons && + lhs.colors == rhs.colors; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Polygon2DCollection_ & lhs, const ::robot_nav_2d_msgs::Polygon2DCollection_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2DCOLLECTION_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DStamped.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DStamped.h new file mode 100644 index 0000000..aaa9e71 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Polygon2DStamped.h @@ -0,0 +1,74 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Polygon2DStamped.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2DSTAMPED_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2DSTAMPED_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct Polygon2DStamped_ +{ + typedef Polygon2DStamped_ Type; + + Polygon2DStamped_() + : header() + , polygon() { + } + Polygon2DStamped_(const ContainerAllocator& _alloc) + : header() + , polygon(_alloc) { + (void)_alloc; + } + + + + typedef ::robot_std_msgs::Header _header_type; + _header_type header; + + typedef ::robot_nav_2d_msgs::Polygon2D_ _polygon_type; + _polygon_type polygon; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DStamped_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DStamped_ const> ConstPtr; + +}; // struct Polygon2DStamped_ + +typedef ::robot_nav_2d_msgs::Polygon2DStamped_ > Polygon2DStamped; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DStamped > Polygon2DStampedPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Polygon2DStamped const> Polygon2DStampedConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Polygon2DStamped_ & lhs, const ::robot_nav_2d_msgs::Polygon2DStamped_ & rhs) +{ + return lhs.header == rhs.header && + lhs.polygon == rhs.polygon; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Polygon2DStamped_ & lhs, const ::robot_nav_2d_msgs::Polygon2DStamped_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_POLYGON2DSTAMPED_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2D32.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2D32.h new file mode 100644 index 0000000..c8c013e --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2D32.h @@ -0,0 +1,78 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Pose2D32.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_POSE2D32_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_POSE2D32_H + + +#include +#include +#include + + +namespace robot_nav_2d_msgs +{ +template +struct Pose2D32_ +{ + typedef Pose2D32_ Type; + + Pose2D32_() + : x(0.0) + , y(0.0) + , theta(0.0) { + } + Pose2D32_(const ContainerAllocator& _alloc) + : x(0.0) + , y(0.0) + , theta(0.0) { + (void)_alloc; + } + + + + typedef float _x_type; + _x_type x; + + typedef float _y_type; + _y_type y; + + typedef float _theta_type; + _theta_type theta; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2D32_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2D32_ const> ConstPtr; + +}; // struct Pose2D32_ + +typedef ::robot_nav_2d_msgs::Pose2D32_ > Pose2D32; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2D32 > Pose2D32Ptr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2D32 const> Pose2D32ConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Pose2D32_ & lhs, const ::robot_nav_2d_msgs::Pose2D32_ & rhs) +{ + return lhs.x == rhs.x && + lhs.y == rhs.y && + lhs.theta == rhs.theta; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Pose2D32_ & lhs, const ::robot_nav_2d_msgs::Pose2D32_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_POSE2D32_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2DStamped.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2DStamped.h new file mode 100644 index 0000000..5d53334 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Pose2DStamped.h @@ -0,0 +1,74 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Pose2DStamped.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_POSE2DSTAMPED_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_POSE2DSTAMPED_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct Pose2DStamped_ +{ + typedef Pose2DStamped_ Type; + + Pose2DStamped_() + : header() + , pose() { + } + Pose2DStamped_(const ContainerAllocator& _alloc) + : header() + , pose() { + (void)_alloc; + } + + + + typedef ::robot_std_msgs::Header _header_type; + _header_type header; + + typedef ::robot_geometry_msgs::Pose2D _pose_type; + _pose_type pose; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2DStamped_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2DStamped_ const> ConstPtr; + +}; // struct Pose2DStamped_ + +typedef ::robot_nav_2d_msgs::Pose2DStamped_ > Pose2DStamped; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2DStamped > Pose2DStampedPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Pose2DStamped const> Pose2DStampedConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Pose2DStamped_ & lhs, const ::robot_nav_2d_msgs::Pose2DStamped_ & rhs) +{ + return lhs.header == rhs.header && + lhs.pose == rhs.pose; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Pose2DStamped_ & lhs, const ::robot_nav_2d_msgs::Pose2DStamped_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_POSE2DSTAMPED_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPlugin.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPlugin.h new file mode 100644 index 0000000..dd2e2e3 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPlugin.h @@ -0,0 +1,30 @@ +// Generated by gencpp from file robot_nav_2d_msgs/SwitchPlugin.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGIN_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGIN_H + + +#include +#include + + +namespace robot_nav_2d_msgs +{ + +struct SwitchPlugin +{ + +typedef SwitchPluginRequest Request; +typedef SwitchPluginResponse Response; +Request request; +Response response; + +typedef Request RequestType; +typedef Response ResponseType; + +}; // struct SwitchPlugin +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGIN_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginRequest.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginRequest.h new file mode 100644 index 0000000..5c611bc --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginRequest.h @@ -0,0 +1,66 @@ +// Generated by gencpp from file robot_nav_2d_msgs/SwitchPluginRequest.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGINREQUEST_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGINREQUEST_H + + +#include +#include +#include + + +namespace robot_nav_2d_msgs +{ +template +struct SwitchPluginRequest_ +{ + typedef SwitchPluginRequest_ Type; + + SwitchPluginRequest_() + : new_plugin() { + } + SwitchPluginRequest_(const ContainerAllocator& _alloc) + : new_plugin(_alloc) { + (void)_alloc; + } + + + + typedef std::basic_string, typename std::allocator_traits::template rebind_alloc> _new_plugin_type; + _new_plugin_type new_plugin; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginRequest_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginRequest_ const> ConstPtr; + +}; // struct SwitchPluginRequest_ + +typedef ::robot_nav_2d_msgs::SwitchPluginRequest_ > SwitchPluginRequest; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginRequest > SwitchPluginRequestPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginRequest const> SwitchPluginRequestConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::SwitchPluginRequest_ & lhs, const ::robot_nav_2d_msgs::SwitchPluginRequest_ & rhs) +{ + return lhs.new_plugin == rhs.new_plugin; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::SwitchPluginRequest_ & lhs, const ::robot_nav_2d_msgs::SwitchPluginRequest_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGINREQUEST_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginResponse.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginResponse.h new file mode 100644 index 0000000..4d275e3 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/SwitchPluginResponse.h @@ -0,0 +1,72 @@ +// Generated by gencpp from file robot_nav_2d_msgs/SwitchPluginResponse.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGINRESPONSE_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGINRESPONSE_H + + +#include +#include +#include + + +namespace robot_nav_2d_msgs +{ +template +struct SwitchPluginResponse_ +{ + typedef SwitchPluginResponse_ Type; + + SwitchPluginResponse_() + : success(false) + , message() { + } + SwitchPluginResponse_(const ContainerAllocator& _alloc) + : success(false) + , message(_alloc) { + (void)_alloc; + } + + + + typedef uint8_t _success_type; + _success_type success; + + typedef std::basic_string, typename std::allocator_traits::template rebind_alloc> _message_type; + _message_type message; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginResponse_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginResponse_ const> ConstPtr; + +}; // struct SwitchPluginResponse_ + +typedef ::robot_nav_2d_msgs::SwitchPluginResponse_ > SwitchPluginResponse; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginResponse > SwitchPluginResponsePtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::SwitchPluginResponse const> SwitchPluginResponseConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::SwitchPluginResponse_ & lhs, const ::robot_nav_2d_msgs::SwitchPluginResponse_ & rhs) +{ + return lhs.success == rhs.success && + lhs.message == rhs.message; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::SwitchPluginResponse_ & lhs, const ::robot_nav_2d_msgs::SwitchPluginResponse_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_SWITCHPLUGINRESPONSE_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D.h new file mode 100644 index 0000000..dee7817 --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D.h @@ -0,0 +1,78 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Twist2D.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2D_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2D_H + + +#include +#include +#include + + +namespace robot_nav_2d_msgs +{ +template +struct Twist2D_ +{ + typedef Twist2D_ Type; + + Twist2D_() + : x(0.0) + , y(0.0) + , theta(0.0) { + } + Twist2D_(const ContainerAllocator& _alloc) + : x(0.0) + , y(0.0) + , theta(0.0) { + (void)_alloc; + } + + + + typedef double _x_type; + _x_type x; + + typedef double _y_type; + _y_type y; + + typedef double _theta_type; + _theta_type theta; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D_ const> ConstPtr; + +}; // struct Twist2D_ + +typedef ::robot_nav_2d_msgs::Twist2D_ > Twist2D; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D > Twist2DPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D const> Twist2DConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Twist2D_ & lhs, const ::robot_nav_2d_msgs::Twist2D_ & rhs) +{ + return lhs.x == rhs.x && + lhs.y == rhs.y && + lhs.theta == rhs.theta; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Twist2D_ & lhs, const ::robot_nav_2d_msgs::Twist2D_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2D_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D32.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D32.h new file mode 100644 index 0000000..0ea3b6b --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2D32.h @@ -0,0 +1,78 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Twist2D32.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2D32_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2D32_H + + +#include +#include +#include + + +namespace robot_nav_2d_msgs +{ +template +struct Twist2D32_ +{ + typedef Twist2D32_ Type; + + Twist2D32_() + : x(0.0) + , y(0.0) + , theta(0.0) { + } + Twist2D32_(const ContainerAllocator& _alloc) + : x(0.0) + , y(0.0) + , theta(0.0) { + (void)_alloc; + } + + + + typedef float _x_type; + _x_type x; + + typedef float _y_type; + _y_type y; + + typedef float _theta_type; + _theta_type theta; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D32_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D32_ const> ConstPtr; + +}; // struct Twist2D32_ + +typedef ::robot_nav_2d_msgs::Twist2D32_ > Twist2D32; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D32 > Twist2D32Ptr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2D32 const> Twist2D32ConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Twist2D32_ & lhs, const ::robot_nav_2d_msgs::Twist2D32_ & rhs) +{ + return lhs.x == rhs.x && + lhs.y == rhs.y && + lhs.theta == rhs.theta; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Twist2D32_ & lhs, const ::robot_nav_2d_msgs::Twist2D32_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2D32_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2DStamped.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2DStamped.h new file mode 100644 index 0000000..1372dfc --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/Twist2DStamped.h @@ -0,0 +1,74 @@ +// Generated by gencpp from file robot_nav_2d_msgs/Twist2DStamped.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2DSTAMPED_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2DSTAMPED_H + + +#include +#include +#include + +#include +#include + +namespace robot_nav_2d_msgs +{ +template +struct Twist2DStamped_ +{ + typedef Twist2DStamped_ Type; + + Twist2DStamped_() + : header() + , velocity() { + } + Twist2DStamped_(const ContainerAllocator& _alloc) + : header() + , velocity(_alloc) { + (void)_alloc; + } + + + + typedef ::robot_std_msgs::Header _header_type; + _header_type header; + + typedef ::robot_nav_2d_msgs::Twist2D_ _velocity_type; + _velocity_type velocity; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2DStamped_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2DStamped_ const> ConstPtr; + +}; // struct Twist2DStamped_ + +typedef ::robot_nav_2d_msgs::Twist2DStamped_ > Twist2DStamped; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2DStamped > Twist2DStampedPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::Twist2DStamped const> Twist2DStampedConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::Twist2DStamped_ & lhs, const ::robot_nav_2d_msgs::Twist2DStamped_ & rhs) +{ + return lhs.header == rhs.header && + lhs.velocity == rhs.velocity; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::Twist2DStamped_ & lhs, const ::robot_nav_2d_msgs::Twist2DStamped_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_TWIST2DSTAMPED_H diff --git a/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/UIntBounds.h b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/UIntBounds.h new file mode 100644 index 0000000..d2a074f --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/include/robot_nav_2d_msgs/UIntBounds.h @@ -0,0 +1,84 @@ +// Generated by gencpp from file robot_nav_2d_msgs/UIntBounds.msg +// DO NOT EDIT! + + +#ifndef ROBOT_NAV_2D_MSGS_MESSAGE_UINTBOUNDS_H +#define ROBOT_NAV_2D_MSGS_MESSAGE_UINTBOUNDS_H + + +#include +#include +#include + + +namespace robot_nav_2d_msgs +{ +template +struct UIntBounds_ +{ + typedef UIntBounds_ Type; + + UIntBounds_() + : min_x(0) + , min_y(0) + , max_x(0) + , max_y(0) { + } + UIntBounds_(const ContainerAllocator& _alloc) + : min_x(0) + , min_y(0) + , max_x(0) + , max_y(0) { + (void)_alloc; + } + + + + typedef uint32_t _min_x_type; + _min_x_type min_x; + + typedef uint32_t _min_y_type; + _min_y_type min_y; + + typedef uint32_t _max_x_type; + _max_x_type max_x; + + typedef uint32_t _max_y_type; + _max_y_type max_y; + + + + + typedef std::shared_ptr< ::robot_nav_2d_msgs::UIntBounds_ > Ptr; + typedef std::shared_ptr< ::robot_nav_2d_msgs::UIntBounds_ const> ConstPtr; + +}; // struct UIntBounds_ + +typedef ::robot_nav_2d_msgs::UIntBounds_ > UIntBounds; + +typedef std::shared_ptr< ::robot_nav_2d_msgs::UIntBounds > UIntBoundsPtr; +typedef std::shared_ptr< ::robot_nav_2d_msgs::UIntBounds const> UIntBoundsConstPtr; + +// constants requiring out of line definition + + + +template +bool operator==(const ::robot_nav_2d_msgs::UIntBounds_ & lhs, const ::robot_nav_2d_msgs::UIntBounds_ & rhs) +{ + return lhs.min_x == rhs.min_x && + lhs.min_y == rhs.min_y && + lhs.max_x == rhs.max_x && + lhs.max_y == rhs.max_y; +} + +template +bool operator!=(const ::robot_nav_2d_msgs::UIntBounds_ & lhs, const ::robot_nav_2d_msgs::UIntBounds_ & rhs) +{ + return !(lhs == rhs); +} + + +} // namespace robot_nav_2d_msgs + +#endif // ROBOT_NAV_2D_MSGS_MESSAGE_UINTBOUNDS_H diff --git a/src/Libraries/robot_nav_2d_msgs/package.xml b/src/Libraries/robot_nav_2d_msgs/package.xml new file mode 100755 index 0000000..03d59ed --- /dev/null +++ b/src/Libraries/robot_nav_2d_msgs/package.xml @@ -0,0 +1,26 @@ + + robot_nav_2d_msgs + 0.7.10 + + robot_nav_2d_msgs is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. robot_nav_2d_msgs + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_nav_2d_msgs + + catkin + + robot_std_msgs + robot_geometry_msgs + robot_std_msgs + robot_geometry_msgs + \ No newline at end of file diff --git a/src/Libraries/robot_nav_2d_utils/CMakeLists.txt b/src/Libraries/robot_nav_2d_utils/CMakeLists.txt new file mode 100755 index 0000000..b188e59 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/CMakeLists.txt @@ -0,0 +1,261 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_nav_2d_utils VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_nav_2d_utils with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_nav_2d_utils with Standalone CMake") +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS system thread) + +if (NOT BUILDING_WITH_CATKIN) + +# Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_nav_2d_msgs + robot_geometry_msgs + robot_nav_msgs + nav_grid + robot_nav_core2 + tf3 + robot_tf3_geometry_msgs + robot_cpp + data_convert + ) + + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_nav_2d_msgs + robot_geometry_msgs + robot_nav_msgs + nav_grid + robot_nav_core2 + robot_tf3_geometry_msgs + robot_cpp + ) + +# Find dependencies + find_package(Boost REQUIRED COMPONENTS system thread) + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME}_conversions ${PROJECT_NAME}_path_ops ${PROJECT_NAME}_polygons ${PROJECT_NAME}_bounds ${PROJECT_NAME}_tf_help ${PROJECT_NAME} + CATKIN_DEPENDS robot_cpp robot_geometry_msgs robot_nav_2d_msgs robot_nav_msgs nav_grid robot_nav_core2 + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${TF3_INCLUDE_DIR} + ) +endif() + +# Libraries +add_library(${PROJECT_NAME}_conversions src/conversions.cpp) +add_library(${PROJECT_NAME}_path_ops src/path_ops.cpp) +add_library(${PROJECT_NAME}_polygons src/polygons.cpp src/footprint.cpp) +add_library(${PROJECT_NAME}_bounds src/bounds.cpp) +add_library(${PROJECT_NAME}_tf_help src/tf_help.cpp) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME}_conversions ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(${PROJECT_NAME}_path_ops ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(${PROJECT_NAME}_polygons ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(${PROJECT_NAME}_bounds ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(${PROJECT_NAME}_tf_help ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_link_libraries(${PROJECT_NAME}_conversions ${PACKAGES_DIR} ${Boost_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_path_ops ${PACKAGES_DIR} ${Boost_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_polygons ${PACKAGES_DIR} ${Boost_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_bounds ${PACKAGES_DIR} ${Boost_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_tf_help ${PACKAGES_DIR} ${Boost_LIBRARIES}) + target_link_libraries(${PROJECT_NAME} INTERFACE ${PACKAGES_DIR} ${Boost_LIBRARIES}) + +else() + + target_link_libraries(${PROJECT_NAME}_conversions + PUBLIC + ${PACKAGES_DIR} + ${Boost_LIBRARIES} + ${TF3_LIBRARY} + ) + target_link_libraries(${PROJECT_NAME}_path_ops + PUBLIC + ${PACKAGES_DIR} + ${Boost_LIBRARIES} + ${TF3_LIBRARY} + ) + target_link_libraries(${PROJECT_NAME}_polygons + PUBLIC + ${PACKAGES_DIR} + ${Boost_LIBRARIES} + ${TF3_LIBRARY} + ) + target_link_libraries(${PROJECT_NAME}_bounds + PUBLIC + ${PACKAGES_DIR} + ${Boost_LIBRARIES} + ${TF3_LIBRARY} + ) + target_link_libraries(${PROJECT_NAME}_tf_help + PUBLIC + ${PACKAGES_DIR} + ${Boost_LIBRARIES} + ${TF3_LIBRARY} + ) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PROJECT_NAME}_conversions + ${PROJECT_NAME}_path_ops + ${PROJECT_NAME}_polygons + ${PROJECT_NAME}_bounds + ${PROJECT_NAME}_tf_help + ${PACKAGES_DIR} + ${Boost_LIBRARIES} + ${TF3_LIBRARY} + ) + + set_target_properties(${PROJECT_NAME}_conversions PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + set_target_properties(${PROJECT_NAME}_path_ops PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + set_target_properties(${PROJECT_NAME}_polygons PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + set_target_properties(${PROJECT_NAME}_bounds PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + set_target_properties(${PROJECT_NAME}_tf_help PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + # Note: ${PROJECT_NAME} is an INTERFACE library, so it cannot have LIBRARY_OUTPUT_DIRECTORY + + target_include_directories(${PROJECT_NAME}_conversions + PUBLIC + $ + $ + ${TF3_INCLUDE_DIR} + ) + target_include_directories(${PROJECT_NAME}_path_ops + PUBLIC + $ + $ + ${TF3_INCLUDE_DIR} + ) + target_include_directories(${PROJECT_NAME}_polygons + PUBLIC + $ + $ + ${TF3_INCLUDE_DIR} + ) + target_include_directories(${PROJECT_NAME}_bounds + PUBLIC + $ + $ + ${TF3_INCLUDE_DIR} + ) + target_include_directories(${PROJECT_NAME}_tf_help + PUBLIC + $ + $ + ${TF3_INCLUDE_DIR} + ) + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ${TF3_INCLUDE_DIR} + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_conversions ${PROJECT_NAME}_path_ops ${PROJECT_NAME}_polygons ${PROJECT_NAME}_bounds ${PROJECT_NAME}_tf_help + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ include/mapbox + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" + PATTERN ".svn" EXCLUDE + ) +else() + + install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_conversions ${PROJECT_NAME}_path_ops ${PROJECT_NAME}_polygons ${PROJECT_NAME}_bounds ${PROJECT_NAME}_tf_help + EXPORT ${PROJECT_NAME}-targets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ include/mapbox + DESTINATION include + FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Libraries: ${PROJECT_NAME}_conversions, ${PROJECT_NAME}_path_ops, ${PROJECT_NAME}_polygons, ${PROJECT_NAME}_bounds, ${PROJECT_NAME}_tf_help") + message(STATUS "Dependencies: robot_nav_2d_msgs, robot_geometry_msgs, robot_nav_msgs, nav_grid, robot_nav_core2, Boost") + message(STATUS "=================================") +endif() + + + + + diff --git a/src/Libraries/robot_nav_2d_utils/README.md b/src/Libraries/robot_nav_2d_utils/README.md new file mode 100755 index 0000000..7ad4dc3 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/README.md @@ -0,0 +1,10 @@ +# robot_nav_2d_utils +A handful of useful utility functions for robot_nav_core2 packages. + * Bounds - Utilities for `robot_nav_core2::Bounds` objects interacting with other messages/types and for dividing a `UIntBounds` into multiple smaller bounds. + * [Conversions](doc/Conversions.md) - Tools for converting between `robot_nav_2d_msgs` and other types. + * OdomSubscriber - subscribes to the standard `robot_nav_msgs::Odometry` message and provides access to the velocity component as a `robot_nav_2d_msgs::Twist` + * Parameters - a couple ROS parameter patterns + * PathOps - functions for working with `robot_nav_2d_msgs::Path2D` objects (beyond strict conversion) + * [Plugin Mux](doc/PluginMux.md) - tool for switching between multiple `pluginlib` plugins + * [Polygons and Footprints](doc/PolygonsAndFootprints.md) - functions for working with `Polygon2D` objects + * TF Help - Tools for transforming `robot_nav_2d_msgs` and other common operations. diff --git a/src/Libraries/robot_nav_2d_utils/doc/Conversions.md b/src/Libraries/robot_nav_2d_utils/doc/Conversions.md new file mode 100755 index 0000000..6491f41 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/doc/Conversions.md @@ -0,0 +1,54 @@ +# robot_nav_2d_utils Conversions + +(note: exact syntax differs from below for conciseness, leaving out `const` and `&`) + +## Twist Transformations +| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` | +| -- | -- | +| `Twist2D twist3Dto2D(robot_geometry_msgs::Twist)` | `robot_geometry_msgs::Twist twist2Dto3D(Twist2D cmd_vel_2d)` + +## Point Transformations +| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` | +| -- | -- | +| `Point2D pointToPoint2D(robot_geometry_msgs::Point)` | `robot_geometry_msgs::Point pointToPoint3D(Point2D)` +| `Point2D pointToPoint2D(robot_geometry_msgs::Point32)` | `robot_geometry_msgs::Point32 pointToPoint32(Point2D)` + +## Pose Transformations +| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` | +| -- | -- | +| `Pose2DStamped poseStampedToPose2D(robot_geometry_msgs::PoseStamped)` | `robot_geometry_msgs::PoseStamped pose2DToPoseStamped(Pose2DStamped)` +||`robot_geometry_msgs::PoseStamped pose2DToPoseStamped(robot_geometry_msgs::Pose2D, std::string, robot::Time)`| +||`robot_geometry_msgs::Pose pose2DToPose(robot_geometry_msgs::Pose2D)`| +| `Pose2DStamped stampedPoseToPose2D(tf::Stamped)` | | + +## Path Transformations +| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` | +| -- | -- | +| `Path2D pathToPath(robot_nav_msgs::Path)` |`robot_nav_msgs::Path pathToPath(Path2D)` +| `Path2D posesToPath2D(std::vector)` | `robot_nav_msgs::Path poses2DToPath(std::vector, std::string, robot::Time)` + +Also, `robot_nav_msgs::Path posesToPath(std::vector)` + +## Polygon Transformations +| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` | +| -- | -- | +| `Polygon2D polygon3Dto2D(robot_geometry_msgs::Polygon)` |`robot_geometry_msgs::Polygon polygon2Dto3D(Polygon2D)` +| `Polygon2DStamped polygon3Dto2D(robot_geometry_msgs::PolygonStamped)` | `robot_geometry_msgs::PolygonStamped polygon2Dto3D(Polygon2DStamped)` + +## Info Transformations +| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` | +| -- | -- | +|`robot_nav_2d_msgs::NavGridInfo toMsg(nav_grid::NavGridInfo)`|`nav_grid::NavGridInfo fromMsg(robot_nav_2d_msgs::NavGridInfo)`| + +| to `nav_grid` info | from `nav_grid` info | +| -- | -- | +|`nav_grid::NavGridInfo infoToInfo(robot_nav_msgs::MapMetaData, std::string)` | `robot_nav_msgs::MapMetaData infoToInfo(nav_grid::NavGridInfo)` + +| to two dimensional pose | to three dimensional pose | +| -- | -- | +| `Pose2D getOrigin2D(nav_grid::NavGridInfo)` | `robot_geometry_msgs::Pose getOrigin3D(nav_grid::NavGridInfo)`| + +## Bounds Transformations +| to `robot_nav_2d_msgs` | from `robot_nav_2d_msgs` | +| -- | -- | +|`robot_nav_2d_msgs::UIntBounds toMsg(robot_nav_core2::UIntBounds)`|`robot_nav_core2::UIntBounds fromMsg(robot_nav_2d_msgs::UIntBounds)`| diff --git a/src/Libraries/robot_nav_2d_utils/doc/PluginMux.md b/src/Libraries/robot_nav_2d_utils/doc/PluginMux.md new file mode 100755 index 0000000..e1a6dc0 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/doc/PluginMux.md @@ -0,0 +1,39 @@ + +# Plugin Mux +`PluginMux` is an organizer for switching between multiple different plugins of the same type. It may be easiest to see how it operates through an example. Let's say we have multiple global planners we would like to use at different times, with only one being active at a given time. + +This means we have multiple `pluginlib` plugins to load that extend the `BaseGlobalPlanner` interface from the `robot_nav_core2` package. We define multiple namespaces in the `global_planner_namespaces` and load each of them. Here's an example parameter config. + +``` +global_planner_namespaces: + - boring_nav_fn + - wacky_global_planner +boring_nav_fn: + allow_unknown: true + plugin_class: navfn/NavfnROS +wacky_global_planner: + allow_unknown: false + # default value commented out + # plugin_class: global_planner/GlobalPlanner +``` + +The namespaces are arbitrary strings, and need not reflect the name of the planner. The package and class name for the plugin will be specified by the `plugin_class` parameter. By default, the first namespace will be loaded as the current plugin. + +To advertise which plugin is active, we publish the namespace on a latched topic and set a parameter with the same name (`~/current_global_planner`). We can then switch among them with a `SetString` ROS service call, or the `usePlugin` C++ method. + +This configuration is all created by creating a plugin mux with the following parameters (parameter names shown for convenience): +``` +PluginMux(plugin_package = "robot_nav_core2", + plugin_class = "BaseGlobalPlanner", + parameter_name = "global_planner_namespaces", + default_value = "global_planner/GlobalPlanner", + ros_name = "current_global_planner", + switch_service_name = "switch_global_planner"); +``` + +If the parameter is not set or is an empty list, a namespace will be derived from the `default_value` and be loaded as the only plugin available. +``` +global_planner_namespaces: [] +GlobalPlanner: + allow_unknown: true +``` diff --git a/src/Libraries/robot_nav_2d_utils/doc/PolygonsAndFootprints.md b/src/Libraries/robot_nav_2d_utils/doc/PolygonsAndFootprints.md new file mode 100755 index 0000000..e44a8e4 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/doc/PolygonsAndFootprints.md @@ -0,0 +1,52 @@ +# robot_nav_2d_utils Polygons and Footprints +This library represents a replacement for [robot_costmap_2d/footprint.h](https://github.com/ros-planning/navigation/blob/a2837b5a9dc6dd4b4da176fca7d899d6a3722bf8/robot_costmap_2d/include/robot_costmap_2d/footprint.h) and deals with manipulating polygons. Note that implicitly all polygons here are assumed to be [simple polygons](https://en.wikipedia.org/wiki/Simple_polygon) without "holes." + +## Polygons and the Parameter Server +There have historically been three primary ways to specify a polygon/footprint on the parameter server. The first is to simply specify a radius which is converted to a hexadecagon, i.e. polygon with sixteen sides. This can be read with +``` +robot_nav_2d_msgs::Polygon2D polygonFromRadius(const double radius, const unsigned int num_points = 16); +``` + +The second two ways involve specifying the points of the polygon individually. This can be done with either a string representing a bracketed array of arrays of doubles, `"[[1.0, 2.2], [3.3, 4.2], ...]"`. This can be read with + +``` +robot_nav_2d_msgs::Polygon2D polygonFromString(const std::string& polygon_string); +``` + +Alternatively, with ROS, you can read the points directly from the parameter server in the form of an `XmlRpcValue`, which should be an array of arrays of doubles, which is read with + +``` +robot_nav_2d_msgs::Polygon2D polygonFromXMLRPC(XmlRpc::XmlRpcValue& polygon_xmlrpc); +``` + +If the `XmlRpcValue` is a string, it will call the `polygonFromString` method. + +The above are the traditional methods that were supported by the original `robot_costmap_2d` code. However, we add a fourth method that requires two parallel arrays of x and y coordinates. + +``` +robot_nav_2d_msgs::Polygon2D polygonFromParallelArrays(const std::vector& xs, const std::vector& ys); +``` + +All of the above methods (except the radius one) can be loaded as appropriate from the parameter server with +``` +robot_nav_2d_msgs::Polygon2D polygonFromParams(const YAML::Node& nh, const std::string parameter_name, + bool search = true); +``` +to include the radius, use the logic in `footprint.h` which either uses "footprint" or "robot_radius" +``` +robot_nav_2d_msgs::Polygon2D footprintFromParams(YAML::Node& nh, bool write = true); +``` + +Polygons can be written to parameters with +``` +void polygontoParams(const robot_nav_2d_msgs::Polygon2D& polygon, const YAML::Node& nh, const std::string parameter_name, + bool array_of_arrays = true); +``` + +## Polygon Operations +There are also a handful of methods for examining/manipulating polygons + * `equals` - check if two polygons are equal + * `movePolygonToPose` - translate and rotate a polygon + * `isInside` - check if a point is inside a polygon + * `calculateMinAndMaxDistances` - Calculate the minimum and maximum distance from the origin of a polygon + * `triangulate` - Decompose a polygon into a set of non-overlapping triangles using an open source implementation of the [earcut algorithm](https://github.com/mapbox/earcut.hpp) diff --git a/src/Libraries/robot_nav_2d_utils/include/mapbox/LICENSE b/src/Libraries/robot_nav_2d_utils/include/mapbox/LICENSE new file mode 100755 index 0000000..8bafb57 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/mapbox/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2015, Mapbox + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/src/Libraries/robot_nav_2d_utils/include/mapbox/NOTES b/src/Libraries/robot_nav_2d_utils/include/mapbox/NOTES new file mode 100755 index 0000000..5c1e99a --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/mapbox/NOTES @@ -0,0 +1,2 @@ +A C++ port of earcut.js, a fast, header-only polygon triangulation library. +https://github.com/mapbox/earcut.hpp diff --git a/src/Libraries/robot_nav_2d_utils/include/mapbox/earcut.hpp b/src/Libraries/robot_nav_2d_utils/include/mapbox/earcut.hpp new file mode 100755 index 0000000..68319c1 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/mapbox/earcut.hpp @@ -0,0 +1,776 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace mapbox { + +namespace util { + +template struct nth { + inline static typename std::tuple_element::type + get(const T& t) { return std::get(t); }; +}; + +} + +namespace detail { + +template +class Earcut { +public: + std::vector indices; + std::size_t vertices = 0; + + template + void operator()(const Polygon& points); + +private: + struct Node { + Node(N index, double x_, double y_) : i(index), x(x_), y(y_) {} + Node(const Node&) = delete; + Node& operator=(const Node&) = delete; + Node(Node&&) = delete; + Node& operator=(Node&&) = delete; + + const N i; + const double x; + const double y; + + // previous and next vertice nodes in a polygon ring + Node* prev = nullptr; + Node* next = nullptr; + + // z-order curve value + int32_t z = 0; + + // previous and next nodes in z-order + Node* prevZ = nullptr; + Node* nextZ = nullptr; + + // indicates whether this is a steiner point + bool steiner = false; + }; + + template Node* linkedList(const Ring& points, const bool clockwise); + Node* filterPoints(Node* start, Node* end = nullptr); + void earcutLinked(Node* ear, int pass = 0); + bool isEar(Node* ear); + bool isEarHashed(Node* ear); + Node* cureLocalIntersections(Node* start); + void splitEarcut(Node* start); + template Node* eliminateHoles(const Polygon& points, Node* outerNode); + void eliminateHole(Node* hole, Node* outerNode); + Node* findHoleBridge(Node* hole, Node* outerNode); + void indexCurve(Node* start); + Node* sortLinked(Node* list); + int32_t zOrder(const double x_, const double y_); + Node* getLeftmost(Node* start); + bool pointInTriangle(double ax, double ay, double bx, double by, double cx, double cy, double px, double py) const; + bool isValidDiagonal(Node* a, Node* b); + double area(const Node* p, const Node* q, const Node* r) const; + bool equals(const Node* p1, const Node* p2); + bool intersects(const Node* p1, const Node* q1, const Node* p2, const Node* q2); + bool intersectsPolygon(const Node* a, const Node* b); + bool locallyInside(const Node* a, const Node* b); + bool middleInside(const Node* a, const Node* b); + Node* splitPolygon(Node* a, Node* b); + template Node* insertNode(std::size_t i, const Point& p, Node* last); + void removeNode(Node* p); + + bool hashing; + double minX, maxX; + double minY, maxY; + double inv_size = 0; + + template > + class ObjectPool { + public: + ObjectPool() { } + ObjectPool(std::size_t blockSize_) { + reset(blockSize_); + } + ~ObjectPool() { + clear(); + } + template + T* construct(Args&&... args) { + if (currentIndex >= blockSize) { + currentBlock = alloc_traits::allocate(alloc, blockSize); + allocations.emplace_back(currentBlock); + currentIndex = 0; + } + T* object = ¤tBlock[currentIndex++]; + alloc_traits::construct(alloc, object, std::forward(args)...); + return object; + } + void reset(std::size_t newBlockSize) { + for (auto allocation : allocations) { + alloc_traits::deallocate(alloc, allocation, blockSize); + } + allocations.clear(); + blockSize = std::max(1, newBlockSize); + currentBlock = nullptr; + currentIndex = blockSize; + } + void clear() { reset(blockSize); } + private: + T* currentBlock = nullptr; + std::size_t currentIndex = 1; + std::size_t blockSize = 1; + std::vector allocations; + Alloc alloc; + typedef typename std::allocator_traits alloc_traits; + }; + ObjectPool nodes; +}; + +template template +void Earcut::operator()(const Polygon& points) { + // reset + indices.clear(); + vertices = 0; + + if (points.empty()) return; + + double x; + double y; + int threshold = 80; + std::size_t len = 0; + + for (size_t i = 0; threshold >= 0 && i < points.size(); i++) { + threshold -= static_cast(points[i].size()); + len += points[i].size(); + } + + //estimate size of nodes and indices + nodes.reset(len * 3 / 2); + indices.reserve(len + points[0].size()); + + Node* outerNode = linkedList(points[0], true); + if (!outerNode || outerNode->prev == outerNode->next) return; + + if (points.size() > 1) outerNode = eliminateHoles(points, outerNode); + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + hashing = threshold < 0; + if (hashing) { + Node* p = outerNode->next; + minX = maxX = outerNode->x; + minY = maxY = outerNode->y; + do { + x = p->x; + y = p->y; + minX = std::min(minX, x); + minY = std::min(minY, y); + maxX = std::max(maxX, x); + maxY = std::max(maxY, y); + p = p->next; + } while (p != outerNode); + + // minX, minY and size are later used to transform coords into integers for z-order calculation + inv_size = std::max(maxX - minX, maxY - minY); + inv_size = inv_size != .0 ? (1. / inv_size) : .0; + } + + earcutLinked(outerNode); + + nodes.clear(); +} + +// create a circular doubly linked list from polygon points in the specified winding order +template template +typename Earcut::Node* +Earcut::linkedList(const Ring& points, const bool clockwise) { + using Point = typename Ring::value_type; + double sum = 0; + const std::size_t len = points.size(); + std::size_t i, j; + Node* last = nullptr; + + // calculate original winding order of a polygon ring + for (i = 0, j = len > 0 ? len - 1 : 0; i < len; j = i++) { + const auto& p1 = points[i]; + const auto& p2 = points[j]; + const double p20 = util::nth<0, Point>::get(p2); + const double p10 = util::nth<0, Point>::get(p1); + const double p11 = util::nth<1, Point>::get(p1); + const double p21 = util::nth<1, Point>::get(p2); + sum += (p20 - p10) * (p11 + p21); + } + + // link points into circular doubly-linked list in the specified winding order + if (clockwise == (sum > 0)) { + for (i = 0; i < len; i++) last = insertNode(vertices + i, points[i], last); + } else { + for (i = len; i-- > 0;) last = insertNode(vertices + i, points[i], last); + } + + if (last && equals(last, last->next)) { + removeNode(last); + last = last->next; + } + + vertices += len; + + return last; +} + +// eliminate colinear or duplicate points +template +typename Earcut::Node* +Earcut::filterPoints(Node* start, Node* end) { + if (!end) end = start; + + Node* p = start; + bool again; + do { + again = false; + + if (!p->steiner && (equals(p, p->next) || area(p->prev, p, p->next) == 0)) { + removeNode(p); + p = end = p->prev; + + if (p == p->next) break; + again = true; + + } else { + p = p->next; + } + } while (again || p != end); + + return end; +} + +// main ear slicing loop which triangulates a polygon (given as a linked list) +template +void Earcut::earcutLinked(Node* ear, int pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && hashing) indexCurve(ear); + + Node* stop = ear; + Node* prev; + Node* next; + + int iterations = 0; + + // iterate through ears, slicing them one by one + while (ear->prev != ear->next) { + iterations++; + prev = ear->prev; + next = ear->next; + + if (hashing ? isEarHashed(ear) : isEar(ear)) { + // cut off the triangle + indices.emplace_back(prev->i); + indices.emplace_back(ear->i); + indices.emplace_back(next->i); + + removeNode(ear); + + // skipping the next vertice leads to less sliver triangles + ear = next->next; + stop = next->next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear == stop) { + // try filtering points and slicing again + if (!pass) earcutLinked(filterPoints(ear), 1); + + // if this didn't work, try curing all small self-intersections locally + else if (pass == 1) { + ear = cureLocalIntersections(ear); + earcutLinked(ear, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass == 2) splitEarcut(ear); + + break; + } + } +} + +// check whether a polygon node forms a valid ear with adjacent nodes +template +bool Earcut::isEar(Node* ear) { + const Node* a = ear->prev; + const Node* b = ear; + const Node* c = ear->next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + Node* p = ear->next->next; + + while (p != ear->prev) { + if (pointInTriangle(a->x, a->y, b->x, b->y, c->x, c->y, p->x, p->y) && + area(p->prev, p, p->next) >= 0) return false; + p = p->next; + } + + return true; +} + +template +bool Earcut::isEarHashed(Node* ear) { + const Node* a = ear->prev; + const Node* b = ear; + const Node* c = ear->next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + const double minTX = std::min(a->x, std::min(b->x, c->x)); + const double minTY = std::min(a->y, std::min(b->y, c->y)); + const double maxTX = std::max(a->x, std::max(b->x, c->x)); + const double maxTY = std::max(a->y, std::max(b->y, c->y)); + + // z-order range for the current triangle bbox; + const int32_t minZ = zOrder(minTX, minTY); + const int32_t maxZ = zOrder(maxTX, maxTY); + + // first look for points inside the triangle in increasing z-order + Node* p = ear->nextZ; + + while (p && p->z <= maxZ) { + if (p != ear->prev && p != ear->next && + pointInTriangle(a->x, a->y, b->x, b->y, c->x, c->y, p->x, p->y) && + area(p->prev, p, p->next) >= 0) return false; + p = p->nextZ; + } + + // then look for points in decreasing z-order + p = ear->prevZ; + + while (p && p->z >= minZ) { + if (p != ear->prev && p != ear->next && + pointInTriangle(a->x, a->y, b->x, b->y, c->x, c->y, p->x, p->y) && + area(p->prev, p, p->next) >= 0) return false; + p = p->prevZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +template +typename Earcut::Node* +Earcut::cureLocalIntersections(Node* start) { + Node* p = start; + do { + Node* a = p->prev; + Node* b = p->next->next; + + // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2]) + if (!equals(a, b) && intersects(a, p, p->next, b) && locallyInside(a, b) && locallyInside(b, a)) { + indices.emplace_back(a->i); + indices.emplace_back(p->i); + indices.emplace_back(b->i); + + // remove two nodes involved + removeNode(p); + removeNode(p->next); + + p = start = b; + } + p = p->next; + } while (p != start); + + return p; +} + +// try splitting polygon into two and triangulate them independently +template +void Earcut::splitEarcut(Node* start) { + // look for a valid diagonal that divides the polygon into two + Node* a = start; + do { + Node* b = a->next->next; + while (b != a->prev) { + if (a->i != b->i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + Node* c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a->next); + c = filterPoints(c, c->next); + + // run earcut on each half + earcutLinked(a); + earcutLinked(c); + return; + } + b = b->next; + } + a = a->next; + } while (a != start); +} + +// link every hole into the outer loop, producing a single-ring polygon without holes +template template +typename Earcut::Node* +Earcut::eliminateHoles(const Polygon& points, Node* outerNode) { + const size_t len = points.size(); + + std::vector queue; + for (size_t i = 1; i < len; i++) { + Node* list = linkedList(points[i], false); + if (list) { + if (list == list->next) list->steiner = true; + queue.push_back(getLeftmost(list)); + } + } + std::sort(queue.begin(), queue.end(), [](const Node* a, const Node* b) { + return a->x < b->x; + }); + + // process holes from left to right + for (size_t i = 0; i < queue.size(); i++) { + eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode->next); + } + + return outerNode; +} + +// find a bridge between vertices that connects hole with an outer ring and and link it +template +void Earcut::eliminateHole(Node* hole, Node* outerNode) { + outerNode = findHoleBridge(hole, outerNode); + if (outerNode) { + Node* b = splitPolygon(outerNode, hole); + filterPoints(b, b->next); + } +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +template +typename Earcut::Node* +Earcut::findHoleBridge(Node* hole, Node* outerNode) { + Node* p = outerNode; + double hx = hole->x; + double hy = hole->y; + double qx = -std::numeric_limits::infinity(); + Node* m = nullptr; + + // find a segment intersected by a ray from the hole's leftmost Vertex to the left; + // segment's endpoint with lesser x will be potential connection Vertex + do { + if (hy <= p->y && hy >= p->next->y && p->next->y != p->y) { + double x = p->x + (hy - p->y) * (p->next->x - p->x) / (p->next->y - p->y); + if (x <= hx && x > qx) { + qx = x; + if (x == hx) { + if (hy == p->y) return p; + if (hy == p->next->y) return p->next; + } + m = p->x < p->next->x ? p : p->next; + } + } + p = p->next; + } while (p != outerNode); + + if (!m) return 0; + + if (hx == qx) return m->prev; + + // look for points inside the triangle of hole Vertex, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the Vertex of the minimum angle with the ray as connection Vertex + + const Node* stop = m; + double tanMin = std::numeric_limits::infinity(); + double tanCur = 0; + + p = m->next; + double mx = m->x; + double my = m->y; + + while (p != stop) { + if (hx >= p->x && p->x >= mx && hx != p->x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p->x, p->y)) { + + tanCur = std::abs(hy - p->y) / (hx - p->x); // tangential + + if ((tanCur < tanMin || (tanCur == tanMin && p->x > m->x)) && locallyInside(p, hole)) { + m = p; + tanMin = tanCur; + } + } + + p = p->next; + } + + return m; +} + +// interlink polygon nodes in z-order +template +void Earcut::indexCurve(Node* start) { + assert(start); + Node* p = start; + + do { + p->z = p->z ? p->z : zOrder(p->x, p->y); + p->prevZ = p->prev; + p->nextZ = p->next; + p = p->next; + } while (p != start); + + p->prevZ->nextZ = nullptr; + p->prevZ = nullptr; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +template +typename Earcut::Node* +Earcut::sortLinked(Node* list) { + assert(list); + Node* p; + Node* q; + Node* e; + Node* tail; + int i, numMerges, pSize, qSize; + int inSize = 1; + + for (;;) { + p = list; + list = nullptr; + tail = nullptr; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q->nextZ; + if (!q) break; + } + + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize == 0) { + e = q; + q = q->nextZ; + qSize--; + } else if (qSize == 0 || !q) { + e = p; + p = p->nextZ; + pSize--; + } else if (p->z <= q->z) { + e = p; + p = p->nextZ; + pSize--; + } else { + e = q; + q = q->nextZ; + qSize--; + } + + if (tail) tail->nextZ = e; + else list = e; + + e->prevZ = tail; + tail = e; + } + + p = q; + } + + tail->nextZ = nullptr; + + if (numMerges <= 1) return list; + + inSize *= 2; + } +} + +// z-order of a Vertex given coords and size of the data bounding box +template +int32_t Earcut::zOrder(const double x_, const double y_) { + // coords are transformed into non-negative 15-bit integer range + int32_t x = static_cast(32767.0 * (x_ - minX) * inv_size); + int32_t y = static_cast(32767.0 * (y_ - minY) * inv_size); + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); +} + +// find the leftmost node of a polygon ring +template +typename Earcut::Node* +Earcut::getLeftmost(Node* start) { + Node* p = start; + Node* leftmost = start; + do { + if (p->x < leftmost->x || (p->x == leftmost->x && p->y < leftmost->y)) + leftmost = p; + p = p->next; + } while (p != start); + + return leftmost; +} + +// check if a point lies within a convex triangle +template +bool Earcut::pointInTriangle(double ax, double ay, double bx, double by, double cx, double cy, double px, double py) const { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; +} + +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +template +bool Earcut::isValidDiagonal(Node* a, Node* b) { + return a->next->i != b->i && a->prev->i != b->i && !intersectsPolygon(a, b) && + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); +} + +// signed area of a triangle +template +double Earcut::area(const Node* p, const Node* q, const Node* r) const { + return (q->y - p->y) * (r->x - q->x) - (q->x - p->x) * (r->y - q->y); +} + +// check if two points are equal +template +bool Earcut::equals(const Node* p1, const Node* p2) { + return p1->x == p2->x && p1->y == p2->y; +} + +// check if two segments intersect +template +bool Earcut::intersects(const Node* p1, const Node* q1, const Node* p2, const Node* q2) { + if ((equals(p1, q1) && equals(p2, q2)) || + (equals(p1, q2) && equals(p2, q1))) return true; + return (area(p1, q1, p2) > 0) != (area(p1, q1, q2) > 0) && + (area(p2, q2, p1) > 0) != (area(p2, q2, q1) > 0); +} + +// check if a polygon diagonal intersects any polygon segments +template +bool Earcut::intersectsPolygon(const Node* a, const Node* b) { + const Node* p = a; + do { + if (p->i != a->i && p->next->i != a->i && p->i != b->i && p->next->i != b->i && + intersects(p, p->next, a, b)) return true; + p = p->next; + } while (p != a); + + return false; +} + +// check if a polygon diagonal is locally inside the polygon +template +bool Earcut::locallyInside(const Node* a, const Node* b) { + return area(a->prev, a, a->next) < 0 ? + area(a, b, a->next) >= 0 && area(a, a->prev, b) >= 0 : + area(a, b, a->prev) < 0 || area(a, a->next, b) < 0; +} + +// check if the middle Vertex of a polygon diagonal is inside the polygon +template +bool Earcut::middleInside(const Node* a, const Node* b) { + const Node* p = a; + bool inside = false; + double px = (a->x + b->x) / 2; + double py = (a->y + b->y) / 2; + do { + if (((p->y > py) != (p->next->y > py)) && p->next->y != p->y && + (px < (p->next->x - p->x) * (py - p->y) / (p->next->y - p->y) + p->x)) + inside = !inside; + p = p->next; + } while (p != a); + + return inside; +} + +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits +// polygon into two; if one belongs to the outer ring and another to a hole, it merges it into a +// single ring +template +typename Earcut::Node* +Earcut::splitPolygon(Node* a, Node* b) { + Node* a2 = nodes.construct(a->i, a->x, a->y); + Node* b2 = nodes.construct(b->i, b->x, b->y); + Node* an = a->next; + Node* bp = b->prev; + + a->next = b; + b->prev = a; + + a2->next = an; + an->prev = a2; + + b2->next = a2; + a2->prev = b2; + + bp->next = b2; + b2->prev = bp; + + return b2; +} + +// create a node and util::optionally link it with previous one (in a circular doubly linked list) +template template +typename Earcut::Node* +Earcut::insertNode(std::size_t i, const Point& pt, Node* last) { + Node* p = nodes.construct(static_cast(i), util::nth<0, Point>::get(pt), util::nth<1, Point>::get(pt)); + + if (!last) { + p->prev = p; + p->next = p; + + } else { + assert(last); + p->next = last->next; + p->prev = last; + last->next->prev = p; + last->next = p; + } + return p; +} + +template +void Earcut::removeNode(Node* p) { + p->next->prev = p->prev; + p->prev->next = p->next; + + if (p->prevZ) p->prevZ->nextZ = p->nextZ; + if (p->nextZ) p->nextZ->prevZ = p->prevZ; +} +} + +template +std::vector earcut(const Polygon& poly) { + mapbox::detail::Earcut earcut; + earcut(poly); + return std::move(earcut.indices); +} +} diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/bounds.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/bounds.h new file mode 100755 index 0000000..41bca90 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/bounds.h @@ -0,0 +1,91 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2020, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_BOUNDS_H +#define ROBOT_NAV_2D_UTILS_BOUNDS_H + +#include +#include +#include + +/** + * @brief A set of utility functions for Bounds objects interacting with other messages/types + */ +namespace robot_nav_2d_utils +{ + + /** + * @brief return a floating point bounds that covers the entire NavGrid + * @param info Info for the NavGrid + * @return bounds covering the entire NavGrid + */ + robot_nav_core2::Bounds getFullBounds(const nav_grid::NavGridInfo &info); + + /** + * @brief return an integral bounds that covers the entire NavGrid + * @param info Info for the NavGrid + * @return bounds covering the entire NavGrid + */ + robot_nav_core2::UIntBounds getFullUIntBounds(const nav_grid::NavGridInfo &info); + + /** + * @brief Translate real-valued bounds to uint coordinates based on nav_grid info + * @param info Information used when converting the coordinates + * @param bounds floating point bounds object + * @returns corresponding UIntBounds for parameter + */ + robot_nav_core2::UIntBounds translateBounds(const nav_grid::NavGridInfo &info, const robot_nav_core2::Bounds &bounds); + + /** + * @brief Translate uint bounds to real-valued coordinates based on nav_grid info + * @param info Information used when converting the coordinates + * @param bounds UIntBounds object + * @returns corresponding floating point bounds for parameter + */ + robot_nav_core2::Bounds translateBounds(const nav_grid::NavGridInfo &info, const robot_nav_core2::UIntBounds &bounds); + + /** + * @brief divide the given bounds up into sub-bounds of roughly equal size + * @param original_bounds The original bounds to divide + * @param n_cols Positive number of columns to divide the bounds into + * @param n_rows Positive number of rows to divide the bounds into + * @return vector of a maximum of n_cols*n_rows nonempty bounds + * @throws std::invalid_argument when n_cols or n_rows is zero + */ + std::vector divideBounds(const robot_nav_core2::UIntBounds &original_bounds, + unsigned int n_cols, unsigned int n_rows); + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_BOUNDS_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/conversions.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/conversions.h new file mode 100755 index 0000000..f088ac0 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/conversions.h @@ -0,0 +1,106 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_CONVERSIONS_H +#define ROBOT_NAV_2D_UTILS_CONVERSIONS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#include +#include + +namespace robot_nav_2d_utils +{ + // Twist Transformations + ::robot_geometry_msgs::Twist twist2Dto3D(const ::robot_nav_2d_msgs::Twist2D &cmd_vel_2d); + ::robot_nav_2d_msgs::Twist2D twist3Dto2D(const ::robot_geometry_msgs::Twist &cmd_vel); + + // Point Transformations + ::robot_nav_2d_msgs::Point2D pointToPoint2D(const ::robot_geometry_msgs::Point &point); + ::robot_nav_2d_msgs::Point2D pointToPoint2D(const ::robot_geometry_msgs::Point32 &point); + ::robot_geometry_msgs::Point pointToPoint3D(const ::robot_nav_2d_msgs::Point2D &point); + ::robot_geometry_msgs::Point32 pointToPoint32(const ::robot_nav_2d_msgs::Point2D &point); + + // Pose Transformations + // ::robot_nav_2d_msgs::Pose2DStamped stampedPoseToPose2D(const tf::Stamped& pose); + ::robot_nav_2d_msgs::Pose2DStamped poseStampedToPose2D(const ::robot_geometry_msgs::PoseStamped &pose); + ::robot_geometry_msgs::Pose pose2DToPose(const ::robot_geometry_msgs::Pose2D &pose2d); + ::robot_geometry_msgs::PoseStamped pose2DToPoseStamped(const ::robot_nav_2d_msgs::Pose2DStamped &pose2d); + ::robot_geometry_msgs::PoseStamped pose2DToPoseStamped(const ::robot_geometry_msgs::Pose2D &pose2d, + const ::std::string &frame, const robot::Time &stamp); + + // Path Transformations + ::robot_nav_2d_msgs::Path2D pathToPath(const robot_nav_msgs::Path &path); + robot_nav_msgs::Path posesToPath(const ::std::vector<::robot_geometry_msgs::PoseStamped> &poses); + ::robot_nav_2d_msgs::Path2D posesToPath2D(const ::std::vector<::robot_geometry_msgs::PoseStamped> &poses); + robot_nav_msgs::Path poses2DToPath(const ::std::vector<::robot_geometry_msgs::Pose2D> &poses, + const ::std::string &frame, const robot::Time &stamp); + robot_nav_msgs::Path pathToPath(const ::robot_nav_2d_msgs::Path2D &path2d); + + // Polygon Transformations + ::robot_geometry_msgs::Polygon polygon2Dto3D(const ::robot_nav_2d_msgs::Polygon2D &polygon_2d); + ::robot_nav_2d_msgs::Polygon2D polygon3Dto2D(const ::robot_geometry_msgs::Polygon &polygon_3d); + ::robot_geometry_msgs::PolygonStamped polygon2Dto3D(const ::robot_nav_2d_msgs::Polygon2DStamped &polygon_2d); + ::robot_nav_2d_msgs::Polygon2DStamped polygon3Dto2D(const ::robot_geometry_msgs::PolygonStamped &polygon_3d); + + // Info Transformations + ::robot_nav_2d_msgs::NavGridInfo toMsg(const nav_grid::NavGridInfo &info); + nav_grid::NavGridInfo fromMsg(const ::robot_nav_2d_msgs::NavGridInfo &msg); + ::robot_geometry_msgs::Pose getOrigin3D(const nav_grid::NavGridInfo &info); + ::robot_geometry_msgs::Pose2D getOrigin2D(const nav_grid::NavGridInfo &info); + nav_grid::NavGridInfo infoToInfo(const robot_nav_msgs::MapMetaData &metadata, const ::std::string &frame); + robot_nav_msgs::MapMetaData infoToInfo(const nav_grid::NavGridInfo &info); + + // Bounds Transformations + robot_nav_2d_msgs::UIntBounds toMsg(const robot_nav_core2::UIntBounds &bounds); + robot_nav_core2::UIntBounds fromMsg(const robot_nav_2d_msgs::UIntBounds &msg); + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_CONVERSIONS_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/footprint.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/footprint.h new file mode 100755 index 0000000..cbed06c --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/footprint.h @@ -0,0 +1,54 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_FOOTPRINT_H +#define ROBOT_NAV_2D_UTILS_FOOTPRINT_H + +#include +#include + +namespace robot_nav_2d_utils +{ + + /** + * @brief Load the robot footprint either as a polygon from the footprint parameter or from robot_radius + * + * Analagous to robot_costmap_2d::makeFootprintFromParams in that it will return an empty polygon if neither parameter + * is present. + */ + robot_nav_2d_msgs::Polygon2D footprintFromParams(robot::NodeHandle &nh, bool write = true); + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_FOOTPRINT_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/geometry_help.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/geometry_help.h new file mode 100755 index 0000000..ca9a238 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/geometry_help.h @@ -0,0 +1,85 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_GEOMETRY_HELP_H +#define ROBOT_NAV_2D_UTILS_GEOMETRY_HELP_H + +#include + +namespace robot_nav_2d_utils +{ + /** + * @brief Distance from point (pX, pY) to closest point on line from (x0, y0) to (x1, y1) + * @param pX + * @param pY + * @param x0 + * @param y0 + * @param x1 + * @param y1 + * @return shortest distance from point to line + */ + inline double distanceToLine(double pX, double pY, double x0, double y0, double x1, double y1) + { + double A = pX - x0; + double B = pY - y0; + double C = x1 - x0; + double D = y1 - y0; + + double dot = A * C + B * D; + double len_sq = C * C + D * D; + double param = dot / len_sq; + + double xx, yy; + + if (param < 0) + { + xx = x0; + yy = y0; + } + else if (param > 1) + { + xx = x1; + yy = y1; + } + else + { + xx = x0 + param * C; + yy = y0 + param * D; + } + + return hypot(pX - xx, pY - yy); + } +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_GEOMETRY_HELP_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/odom_subscriber.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/odom_subscriber.h new file mode 100755 index 0000000..dc32376 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/odom_subscriber.h @@ -0,0 +1,87 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_ODOM_SUBSCRIBER_H +#define ROBOT_NAV_2D_UTILS_ODOM_SUBSCRIBER_H + +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + + /** + * @class OdomSubscriber + * Wrapper for some common odometry operations. Subscribes to the topic with a mutex. + */ + class OdomSubscriber + { + public: + /** + * @brief Constructor that subscribes to an Odometry topic + * + * @param nh NodeHandle for creating subscriber + * @param default_topic Name of the topic that will be loaded of the odom_topic param is not set. + */ + explicit OdomSubscriber(robot::NodeHandle &nh, std::string default_topic = "odom") + { + std::string odom_topic; + // nh.param("odom_topic", odom_topic, default_topic); + // odom_sub_ = nh.subscribe(odom_topic, 1, boost::bind(&OdomSubscriber::odomCallback, this, _1)); + } + + inline robot_nav_2d_msgs::Twist2D getTwist() { return odom_vel_.velocity; } + inline robot_nav_2d_msgs::Twist2DStamped getTwistStamped() { return odom_vel_; } + + protected: + void odomCallback(const robot_nav_msgs::Odometry::ConstPtr &msg) + { + std::cout << "odom received!" << std::endl; + boost::mutex::scoped_lock lock(odom_mutex_); + odom_vel_.header = msg->header; + odom_vel_.velocity = twist3Dto2D(msg->twist.twist); + } + + robot_nav_2d_msgs::Twist2DStamped odom_vel_; + boost::mutex odom_mutex_; + }; + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_ODOM_SUBSCRIBER_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/parameters.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/parameters.h new file mode 100755 index 0000000..70bae3a --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/parameters.h @@ -0,0 +1,153 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_PARAMETERS_H +#define ROBOT_NAV_2D_UTILS_PARAMETERS_H + +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + + /** + * @brief Search for a parameter and load it, or use the default value + * + * This templated function shortens a commonly used ROS pattern in which you + * search for a parameter and get its value if it exists, otherwise returning a default value. + * + * @param nh NodeHandle to start the parameter search from + * @param param_name Name of the parameter to search for + * @param default_value Value to return if not found + * @return Value of parameter if found, otherwise the default_value + */ + template + param_t searchAndGetParam(const robot::NodeHandle &nh, const std::string ¶m_name, const param_t &default_value) + { + std::string resolved_name; + if (nh.searchParam(param_name, resolved_name)) + { + param_t value = default_value; + robot::NodeHandle nh_private = robot::NodeHandle("~"); + nh_private.param(resolved_name, value, default_value); + return value; + } + return default_value; + } + + /** + * @brief Load a parameter from one of two namespaces. Complain if it uses the old name. + * @param nh NodeHandle to look for the parameter in + * @param current_name Parameter name that is current, i.e. not deprecated + * @param old_name Deprecated parameter name + * @param default_value If neither parameter is present, return this value + * @return The value of the parameter or the default value + */ + template + param_t loadParameterWithDeprecation(const robot::NodeHandle &nh, const std::string current_name, + const std::string old_name, const param_t &default_value) + { + param_t value; + if (nh.hasParam(current_name)) + { + nh.getParam(current_name, value, default_value); + return value; + } + if (nh.hasParam(old_name)) + { + robot::log_info_at(__FILE__, __LINE__, "Parameter %s is deprecated. Please use the name %s instead.", old_name.c_str(), current_name.c_str()); + nh.getParam(old_name, value, default_value); + return value; + } + return default_value; + } + + /** + * @brief If a deprecated parameter exists, complain and move to its new location + * @param nh NodeHandle to look for the parameter in + * @param current_name Parameter name that is current, i.e. not deprecated + * @param old_name Deprecated parameter name + */ + template + void moveDeprecatedParameter(const robot::NodeHandle &nh, const std::string current_name, const std::string old_name) + { + if (!nh.hasParam(old_name)) + return; + + param_t value; + robot::log_info_at(__FILE__, __LINE__, "Parameter %s is deprecated. Please use the name %s instead.", old_name.c_str(), current_name.c_str()); + value = nh.param(old_name); + nh.setParam(current_name, value); + } + + /** + * @brief Move a parameter from one place to another + * + * For use loading old parameter structures into new places. + * + * If the new name already has a value, don't move the old value there. + * + * @param nh NodeHandle for loading/saving params + * @param old_name Parameter name to move/remove + * @param current_name Destination parameter name + * @param default_value Value to save in the new name if old parameter is not found. + * @param should_delete If true, whether to delete the parameter from the old name + */ + template + void moveParameter(const robot::NodeHandle &nh, std::string old_name, + std::string current_name, param_t default_value, bool should_delete = true) + { + // if (nh.hasParam(current_name)) + // { + // if (should_delete) + // nh.deleteParam(old_name); + // return; + // } + // XmlRpc::XmlRpcValue value; + // if (nh.hasParam(old_name)) + // { + // nh.getParam(old_name, value); + // if (should_delete) nh.deleteParam(old_name); + // } + // else + // value = default_value; + + // nh.setParam(current_name, value); + } + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_PARAMETERS_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/path_ops.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/path_ops.h new file mode 100755 index 0000000..85e5111 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/path_ops.h @@ -0,0 +1,88 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_PATH_OPS_H +#define ROBOT_NAV_2D_UTILS_PATH_OPS_H + +#include + +namespace robot_nav_2d_utils +{ + /** + * @brief Calculate the linear distance between two poses + */ + double poseDistance(const robot_geometry_msgs::Pose2D &pose0, const robot_geometry_msgs::Pose2D &pose1); + + /** + * @brief Calculate the length of the plan, starting from the given index + */ + double getPlanLength(const robot_nav_2d_msgs::Path2D &plan, const unsigned int start_index = 0); + + /** + * @brief Calculate the length of the plan from the pose on the plan closest to the given pose + */ + double getPlanLength(const robot_nav_2d_msgs::Path2D &plan, const robot_geometry_msgs::Pose2D &query_pose); + + /** + * @brief Increase plan resolution to match that of the costmap by adding points linearly between points + * + * @param global_plan_in input plan + * @param resolution desired distance between waypoints + * @return Higher resolution plan + */ + robot_nav_2d_msgs::Path2D adjustPlanResolution(const robot_nav_2d_msgs::Path2D &global_plan_in, double resolution); + + /** + * @brief Decrease the length of the plan by eliminating colinear points + * + * Uses the Ramer Douglas Peucker algorithm. Ignores theta values + * + * @param input_path Path to compress + * @param epsilon maximum allowable error. Increase for greater compression. + * @return Path2D with possibly fewer poses + */ + robot_nav_2d_msgs::Path2D compressPlan(const robot_nav_2d_msgs::Path2D &input_path, double epsilon = 0.1); + + /** + * @brief Convenience function to add a pose to a path in one line. + * @param path Path to add to + * @param x x-coordinate + * @param y y-coordinate + * @param theta theta (if needed) + */ + void addPose(robot_nav_2d_msgs::Path2D &path, double x, double y, double theta = 0.0); + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_PATH_OPS_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/plugin_mux.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/plugin_mux.h new file mode 100755 index 0000000..c713dad --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/plugin_mux.h @@ -0,0 +1,275 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_PLUGIN_MUX_H +#define ROBOT_NAV_2D_UTILS_PLUGIN_MUX_H + +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + /** + * @class PluginMux + * @brief An organizer for switching between multiple different plugins of the same type + * + * The different plugins are specified using a list of strings on the parameter server, each of which is a namespace. + * The specific type and additional parameters for each plugin are specified on the parameter server in that namespace. + * All the plugins are loaded initially, but only one is the "current" plugin at any particular time, which is published + * on a latched topic AND stored on the ROS parameter server. You can switch which plugin is current either through a + * C++ or ROS interface. + */ + template + class PluginMux + { + public: + /** + * @brief Main Constructor - Loads plugin(s) and sets up ROS interfaces + * + * @param plugin_package The package of the plugin type + * @param plugin_class The class name for the plugin type + * @param parameter_name Name of parameter for the namespaces. + * @param default_value If class name is not specified, which plugin should be loaded + * @param ros_name ROS name for setting up topic and parameter + * @param switch_service_name ROS name for setting up the ROS service + */ + PluginMux(const std::string &plugin_package, const std::string &plugin_class, + const std::string ¶meter_name, const std::string &default_value, + const std::string &ros_name = "current_plugin", const std::string &switch_service_name = "switch_plugin"); + + /** + * @brief Create an instance of the given plugin_class_name and save it with the given plugin_name + * @param plugin_name Namespace for the new plugin + * @param plugin_class_name Class type name for the new plugin + */ + void addPlugin(const std::string &plugin_name, const std::string &plugin_class_name); + + /** + * @brief C++ Interface for switching to a given plugin + * + * @param name Namespace to set current plugin to + * @return true if that namespace exists and is loaded properly + */ + bool usePlugin(const std::string &name) + { + // If plugin with given name doesn't exist, return false + if (plugins_.count(name) == 0) + return false; + + if (switch_callback_) + { + switch_callback_(current_plugin_, name); + } + + // Switch Mux + current_plugin_ = name; + + // Update ROS info + robot_std_msgs::String str_msg; + str_msg.data = current_plugin_; + current_plugin_pub_.publish(str_msg); + private_nh_.setParam(ros_name_, current_plugin_); + + return true; + } + + /** + * @brief Get the Current Plugin Name + * @return Name of the current plugin + */ + std::string getCurrentPluginName() const + { + return current_plugin_; + } + + /** + * @brief Check to see if a plugin exists + * @param name Namespace to set current plugin to + * @return True if the plugin exists + */ + bool hasPlugin(const std::string &name) const + { + return plugins_.find(name) != plugins_.end(); + } + + /** + * @brief Get the Specified Plugin + * @param name Name of plugin to get + * @return Reference to specified plugin + */ + T &getPlugin(const std::string &name) + { + if (!hasPlugin(name)) + throw std::invalid_argument("Plugin not found"); + return *plugins_[name]; + } + + /** + * @brief Get the Current Plugin + * @return Reference to current plugin + */ + T &getCurrentPlugin() + { + return getPlugin(current_plugin_); + } + + /** + * @brief Get the current list of plugin names + */ + std::vector getPluginNames() const + { + std::vector names; + for (auto &kv : plugins_) + { + names.push_back(kv.first); + } + return names; + } + + /** + * @brief alias for the function-type of the callback fired when the plugin switches. + * + * The first parameter will be the namespace of the plugin that was previously used. + * The second parameter will be the namespace of the plugin that is being switched to. + */ + using SwitchCallback = std::function; + + /** + * @brief Set the callback fired when the plugin switches + * + * In addition to switching which plugin is being used via directly calling `usePlugin` + * a switch can also be triggered externally via ROS service. In such a case, other classes + * may want to know when this happens. This is accomplished using the SwitchCallback, which + * will be called regardless of how the plugin is switched. + */ + void setSwitchCallback(SwitchCallback switch_callback) { switch_callback_ = switch_callback; } + + protected: + /** + * @brief ROS Interface for Switching Plugins + */ + bool switchPluginService(robot_nav_2d_msgs::SwitchPlugin::Request &req, robot_nav_2d_msgs::SwitchPlugin::Response &resp) + { + std::string name = req.new_plugin; + if (usePlugin(name)) + { + resp.success = true; + resp.message = "Loaded plugin namespace " + name + "."; + } + else + { + resp.success = false; + resp.message = "Namespace " + name + " not configured!"; + } + return true; + } + + // Plugin Management + pluginlib::ClassLoader plugin_loader_; + std::map> plugins_; + std::string current_plugin_; + + // ROS Interface + robot::ServiceServer switch_plugin_srv_; + robot::Publisher current_plugin_pub_; + robot::NodeHandle private_nh_; + std::string ros_name_; + + // Switch Callback + SwitchCallback switch_callback_; + }; + + // ********************************************************************************************************************* + // ****************** Implementation of Templated Methods ************************************************************** + // ********************************************************************************************************************* + template + PluginMux::PluginMux(const std::string &plugin_package, const std::string &plugin_class, + const std::string ¶meter_name, const std::string &default_value, + const std::string &ros_name, const std::string &switch_service_name) + : plugin_loader_(plugin_package, plugin_class), private_nh_("~"), ros_name_(ros_name), switch_callback_(nullptr) + { + // Create the latched publisher + current_plugin_pub_ = private_nh_.advertise(ros_name_, 1, true); + + // Load Plugins + std::string plugin_class_name; + std::vector plugin_namespaces; + private_nh_.getParam(parameter_name, plugin_namespaces); + if (plugin_namespaces.size() == 0) + { + // If no namespaces are listed, use the name of the default class as the singular namespace. + std::string plugin_name = plugin_loader_.getName(default_value); + plugin_namespaces.push_back(plugin_name); + } + + for (const std::string &the_namespace : plugin_namespaces) + { + // Load the class name from namespace/plugin_class, or use default value + private_nh_.param(std::string(the_namespace + "/plugin_class"), plugin_class_name, default_value); + addPlugin(the_namespace, plugin_class_name); + } + + // By default, use the first one as current + usePlugin(plugin_namespaces[0]); + + // Now that the plugins are created, advertise the service if there are multiple + if (plugin_namespaces.size() > 1) + { + switch_plugin_srv_ = private_nh_.advertiseService(switch_service_name, &PluginMux::switchPluginService, this); + } + } + + template + void PluginMux::addPlugin(const std::string &plugin_name, const std::string &plugin_class_name) + { + try + { + plugins_[plugin_name] = plugin_loader_.createInstance(plugin_class_name); + } + catch (const pluginlib::PluginlibException &ex) + { + ROS_FATAL_NAMED("PluginMux", + "Failed to load the plugin: %s. Exception: %s", plugin_name.c_str(), ex.what()); + exit(EXIT_FAILURE); + } + } + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_PLUGIN_MUX_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/polygons.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/polygons.h new file mode 100755 index 0000000..ab5e6ed --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/polygons.h @@ -0,0 +1,200 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_POLYGONS_H +#define ROBOT_NAV_2D_UTILS_POLYGONS_H + +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + +/** + * @class PolygonParseException + * @brief Exception to throw when Polygon doesn't load correctly + */ +class PolygonParseException: public std::runtime_error +{ +public: + explicit PolygonParseException(const std::string& description) : std::runtime_error(description) {} +}; + +/** + * @brief Parse a vector of vectors of doubles from a string. + * Syntax is [[1.0, 2.0], [3.3, 4.4, 5.5], ...] + * + * @param input The string to parse + * @return a vector of vectors of doubles + */ +std::vector > parseVVD(const std::string& input); + +/** + * @brief Create a "circular" polygon from a given radius + * + * @param radius Radius of the polygon + * @param num_points Number of points in the resulting polygon + * @return A rotationally symmetric polygon with the specified number of vertices + */ +robot_nav_2d_msgs::Polygon2D polygonFromRadius(const double radius, const unsigned int num_points = 16); + +/** + * @brief Make a polygon from the given string. + * Format should be bracketed array of arrays of doubles, like so: [[1.0, 2.2], [3.3, 4.2], ...] + * + * @param polygon_string The string to parse + * @return Polygon2D + */ +robot_nav_2d_msgs::Polygon2D polygonFromString(const std::string& polygon_string); + +// /** +// * @brief Load a polygon from a parameter, whether it is a string or array, or two arrays +// * @param nh Node handle to load parameter from +// * @param parameter_name Name of the parameter +// * @param search Whether to search up the namespace for the parameter name +// * @return Loaded polygon +// */ +// robot_nav_2d_msgs::Polygon2D polygonFromParams(const robot::NodeHandle& nh, const std::string parameter_name, +// bool search = true); + +/** + * @brief Create a polygon from the given XmlRpcValue. + * + * @param polygon_xmlrpc should be an array of arrays, where the top-level array should have + * 3 or more elements, and the sub-arrays should all have exactly 2 elements + * (x and y coordinates). + */ +robot_nav_2d_msgs::Polygon2D polygonFromXMLRPC(robot_xmlrpcpp::XmlRpcValue& polygon_xmlrpc); + +/** + * @brief Create XMLRPC Value for writing the polygon to the parameter server + * @param polygon Polygon to convert + * @param array_of_arrays If true, write an array of arrays. Otherwise, write two parallel arrays + * @return XmlRpcValue + */ +robot_xmlrpcpp::XmlRpcValue polygonToXMLRPC(const robot_nav_2d_msgs::Polygon2D& polygon, bool array_of_arrays = true); + +// /** +// * @brief Save a polygon to a parameter +// * @param polygon The Polygon +// * @param nh Node handle to save the parameter to +// * @param parameter_name Name of the parameter +// * @param array_of_arrays If true, write an array of arrays. Otherwise, write two parallel arrays +// */ +// void polygonToParams(const robot_nav_2d_msgs::Polygon2D& polygon, const robot::NodeHandle& nh, const std::string parameter_name, +// bool array_of_arrays = true); + +/** + * @brief Create a polygon from two parallel arrays + * + * @param xs Array of doubles representing x coordinates, at least three elements long + * @param ys Array of doubles representing y coordinates, matching length of xs + */ +robot_nav_2d_msgs::Polygon2D polygonFromParallelArrays(const std::vector& xs, const std::vector& ys); + +/** + * @brief Create two parallel arrays from a polygon + * + * @param[in] polygon + * @param[out] xs Array of doubles representing x coordinates, to be populated + * @param[out] ys Array of doubles representing y coordinates, to be populated + */ +void polygonToParallelArrays(const robot_nav_2d_msgs::Polygon2D polygon, std::vector& xs, std::vector& ys); + +/** + * @brief check if two polygons are equal. Used in testing + */ +bool equals(const robot_nav_2d_msgs::Polygon2D& polygon0, const robot_nav_2d_msgs::Polygon2D& polygon1); + +/** + * @brief Translate and rotate a polygon to a new pose + * @param polygon The polygon + * @param pose The x, y and theta to use when moving the polygon + * @return A new moved polygon + */ +robot_nav_2d_msgs::Polygon2D movePolygonToPose(const robot_nav_2d_msgs::Polygon2D& polygon, + const robot_geometry_msgs::Pose2D& pose); + +/** + * @brief Check if a given point is inside of a polygon + * + * Borders are considered outside. + * + * @param polygon Polygon to check + * @param x x coordinate + * @param y y coordinate + * @return true if point is inside polygon + */ +bool isInside(const robot_nav_2d_msgs::Polygon2D& polygon, const double x, const double y); + +/** + * @brief Calculate the minimum and maximum distance from (0, 0) to any point on the polygon + * @param[in] polygon polygon to analyze + * @param[out] min_dist + * @param[out] max_dist + */ +void calculateMinAndMaxDistances(const robot_nav_2d_msgs::Polygon2D& polygon, double& min_dist, double& max_dist); + +/** + * @brief Decompose a complex polygon into a set of triangles. + * + * See https://en.wikipedia.org/wiki/Polygon_triangulation + * + * Implementation from https://github.com/mapbox/earcut.hpp + * + * @param polygon The complex polygon to deconstruct + * @return A vector of points where each set of three points represents a triangle + */ +std::vector triangulate(const robot_nav_2d_msgs::ComplexPolygon2D& polygon); + +/** + * @brief Decompose a simple polygon into a set of triangles. + * + * See https://en.wikipedia.org/wiki/Polygon_triangulation + * + * Implementation from https://github.com/mapbox/earcut.hpp + * + * @param polygon The polygon to deconstruct + * @return A vector of points where each set of three points represents a triangle + */ +std::vector triangulate(const robot_nav_2d_msgs::Polygon2D& polygon); + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_POLYGONS_H diff --git a/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/tf_help.h b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/tf_help.h new file mode 100755 index 0000000..313ab48 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/include/robot_nav_2d_utils/tf_help.h @@ -0,0 +1,103 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_2D_UTILS_TF_HELP_H +#define ROBOT_NAV_2D_UTILS_TF_HELP_H + +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + + /** + * @brief Transform a PoseStamped from one frame to another + * + * @param tf Smart pointer to TFListener + * @param in_pose Pose to transform + * @param out_pose Place to store the resulting transformed pose + * @param frame Frame to transform the pose into + * @return True if successful transform + */ + bool transform(const TFListenerPtr tf, const ::robot_geometry_msgs::PoseStamped &in_pose,::robot_geometry_msgs::PoseStamped &out_pose, const ::std::string &frame); + + /** + * @brief Transform a PoseStamped from one frame to another while catching exceptions + * + * Also returns immediately if the frames are equal. + * @param tf Smart pointer to TFListener + * @param frame Frame to transform the pose into + * @param in_pose Pose to transform + * @param out_pose Place to store the resulting transformed pose + * @param extrapolation_fallback If true, if there is an ExtrapolationException, allow looking up the latest timestamp instead. + * @return True if successful transform + */ + bool transformPose(const TFListenerPtr tf, const ::std::string frame, + const ::robot_geometry_msgs::PoseStamped &in_pose, ::robot_geometry_msgs::PoseStamped &out_pose, + const bool extrapolation_fallback = true); + + /** + * @brief Transform a Pose2DStamped from one frame to another while catching exceptions + * + * Also returns immediately if the frames are equal. + * @param tf Smart pointer to TFListener + * @param frame Frame to transform the pose into + * @param in_pose Pose to transform + * @param out_pose Place to store the resulting transformed pose + * @param extrapolation_fallback If true, if there is an ExtrapolationException, allow looking up the latest timestamp instead. + * @return True if successful transform + */ + bool transformPose(const TFListenerPtr tf, const ::std::string frame, + const ::robot_nav_2d_msgs::Pose2DStamped &in_pose, ::robot_nav_2d_msgs::Pose2DStamped &out_pose, + const bool extrapolation_fallback = true); + + /** + * @brief Transform a Pose2DStamped into another frame + * + * Note that this returns a transformed pose + * regardless of whether the transform was successfully performed. + * + * @param tf Smart pointer to TFListener + * @param pose Pose to transform + * @param frame_id Frame to transform the pose into + * @return The resulting transformed pose + */ + robot_geometry_msgs::Pose2D transformStampedPose(const TFListenerPtr tf, const ::robot_nav_2d_msgs::Pose2DStamped &pose, + const ::std::string &frame_id); + +} // namespace robot_nav_2d_utils + +#endif // ROBOT_NAV_2D_UTILS_TF_HELP_H diff --git a/src/Libraries/robot_nav_2d_utils/package.xml b/src/Libraries/robot_nav_2d_utils/package.xml new file mode 100755 index 0000000..cbdf32f --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/package.xml @@ -0,0 +1,37 @@ + + robot_nav_2d_utils + 0.7.10 + + robot_nav_2d_utils is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. robot_nav_2d_utils + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_nav_2d_utils + + catkin + + robot_nav_2d_msgs + robot_geometry_msgs + robot_nav_msgs + nav_grid + robot_nav_core2 + robot_cpp + data_convert + + robot_nav_2d_msgs + robot_geometry_msgs + robot_nav_msgs + nav_grid + robot_nav_core2 + robot_cpp + data_convert + \ No newline at end of file diff --git a/src/Libraries/robot_nav_2d_utils/setup.py b/src/Libraries/robot_nav_2d_utils/setup.py new file mode 100755 index 0000000..c9612e7 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/setup.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from distutils.core import setup +from catkin_pkg.python_setup import generate_distutils_setup + +package_info = generate_distutils_setup( + packages=['robot_nav_2d_utils'], + package_dir={'': 'src'} +) + +setup(**package_info) diff --git a/src/Libraries/robot_nav_2d_utils/src/bounds.cpp b/src/Libraries/robot_nav_2d_utils/src/bounds.cpp new file mode 100755 index 0000000..9c69dee --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/src/bounds.cpp @@ -0,0 +1,102 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2020, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + robot_nav_core2::Bounds getFullBounds(const nav_grid::NavGridInfo &info) + { + return robot_nav_core2::Bounds(info.origin_x, info.origin_y, + info.origin_x + info.resolution * info.width, info.origin_y + info.resolution * info.height); + } + + robot_nav_core2::UIntBounds getFullUIntBounds(const nav_grid::NavGridInfo &info) + { + // bounds are inclusive, so we subtract one + return robot_nav_core2::UIntBounds(0, 0, info.width - 1, info.height - 1); + } + + robot_nav_core2::UIntBounds translateBounds(const nav_grid::NavGridInfo &info, const robot_nav_core2::Bounds &bounds) + { + unsigned int g_min_x, g_min_y, g_max_x, g_max_y; + worldToGridBounded(info, bounds.getMinX(), bounds.getMinY(), g_min_x, g_min_y); + worldToGridBounded(info, bounds.getMaxX(), bounds.getMaxY(), g_max_x, g_max_y); + return robot_nav_core2::UIntBounds(g_min_x, g_min_y, g_max_x, g_max_y); + } + + robot_nav_core2::Bounds translateBounds(const nav_grid::NavGridInfo &info, const robot_nav_core2::UIntBounds &bounds) + { + double min_x, min_y, max_x, max_y; + gridToWorld(info, bounds.getMinX(), bounds.getMinY(), min_x, min_y); + gridToWorld(info, bounds.getMaxX(), bounds.getMaxY(), max_x, max_y); + return robot_nav_core2::Bounds(min_x, min_y, max_x, max_y); + } + + std::vector divideBounds(const robot_nav_core2::UIntBounds &original_bounds, + unsigned int n_cols, unsigned int n_rows) + { + if (n_cols * n_rows == 0) + { + throw std::invalid_argument("Number of rows and columns must be positive (not zero)"); + } + unsigned int full_width = original_bounds.getWidth(), + full_height = original_bounds.getHeight(); + + unsigned int small_width = static_cast(ceil(static_cast(full_width) / n_cols)), + small_height = static_cast(ceil(static_cast(full_height) / n_rows)); + + std::vector divided; + + for (unsigned int row = 0; row < n_rows; row++) + { + unsigned int min_y = original_bounds.getMinY() + small_height * row; + unsigned int max_y = std::min(min_y + small_height - 1, original_bounds.getMaxY()); + + for (unsigned int col = 0; col < n_cols; col++) + { + unsigned int min_x = original_bounds.getMinX() + small_width * col; + unsigned int max_x = std::min(min_x + small_width - 1, original_bounds.getMaxX()); + robot_nav_core2::UIntBounds sub(min_x, min_y, max_x, max_y); + if (!sub.isEmpty()) + divided.push_back(sub); + } + } + return divided; + } +} // namespace robot_nav_2d_utils diff --git a/src/Libraries/robot_nav_2d_utils/src/conversions.cpp b/src/Libraries/robot_nav_2d_utils/src/conversions.cpp new file mode 100755 index 0000000..6e8f8ed --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/src/conversions.cpp @@ -0,0 +1,338 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + + robot_geometry_msgs::Twist twist2Dto3D(const robot_nav_2d_msgs::Twist2D &cmd_vel_2d) + { + robot_geometry_msgs::Twist cmd_vel; + cmd_vel.linear.x = cmd_vel_2d.x; + cmd_vel.linear.y = cmd_vel_2d.y; + cmd_vel.angular.z = cmd_vel_2d.theta; + return cmd_vel; + } + + robot_nav_2d_msgs::Twist2D twist3Dto2D(const robot_geometry_msgs::Twist &cmd_vel) + { + robot_nav_2d_msgs::Twist2D cmd_vel_2d; + cmd_vel_2d.x = cmd_vel.linear.x; + cmd_vel_2d.y = cmd_vel.linear.y; + cmd_vel_2d.theta = cmd_vel.angular.z; + return cmd_vel_2d; + } + + robot_nav_2d_msgs::Point2D pointToPoint2D(const robot_geometry_msgs::Point &point) + { + robot_nav_2d_msgs::Point2D output; + output.x = point.x; + output.y = point.y; + return output; + } + + robot_nav_2d_msgs::Point2D pointToPoint2D(const robot_geometry_msgs::Point32 &point) + { + robot_nav_2d_msgs::Point2D output; + output.x = point.x; + output.y = point.y; + return output; + } + + robot_geometry_msgs::Point pointToPoint3D(const robot_nav_2d_msgs::Point2D &point) + { + robot_geometry_msgs::Point output; + output.x = point.x; + output.y = point.y; + return output; + } + + robot_geometry_msgs::Point32 pointToPoint32(const robot_nav_2d_msgs::Point2D &point) + { + robot_geometry_msgs::Point32 output; + output.x = point.x; + output.y = point.y; + return output; + } + + // robot_nav_2d_msgs::Pose2DStamped stampedPoseToPose2D(const tf::Stamped& pose) + // { + // robot_nav_2d_msgs::Pose2DStamped pose2d; + // pose2d.header.stamp = pose.stamp_; + // pose2d.header.frame_id = pose.frame_id_; + // pose2d.pose.x = pose.getOrigin().getX(); + // pose2d.pose.y = pose.getOrigin().getY(); + // pose2d.pose.theta = tf::getYaw(pose.getRotation()); + // return pose2d; + // } + + robot_nav_2d_msgs::Pose2DStamped poseStampedToPose2D(const robot_geometry_msgs::PoseStamped &pose) + { + robot_nav_2d_msgs::Pose2DStamped pose2d; + pose2d.header = pose.header; + pose2d.pose.x = pose.pose.position.x; + pose2d.pose.y = pose.pose.position.y; + pose2d.pose.theta = data_convert::getYaw(pose.pose.orientation); + return pose2d; + } + + robot_geometry_msgs::Pose pose2DToPose(const robot_geometry_msgs::Pose2D &pose2d) + { + robot_geometry_msgs::Pose pose; + pose.position.x = pose2d.x; + pose.position.y = pose2d.y; + pose.orientation = data_convert::createQuaternionMsgFromYaw(pose2d.theta); + return pose; + } + + robot_geometry_msgs::PoseStamped pose2DToPoseStamped(const robot_nav_2d_msgs::Pose2DStamped &pose2d) + { + robot_geometry_msgs::PoseStamped pose; + pose.header = pose2d.header; + pose.pose = pose2DToPose(pose2d.pose); + return pose; + } + + robot_geometry_msgs::PoseStamped pose2DToPoseStamped(const robot_geometry_msgs::Pose2D& pose2d, + const std::string& frame, const robot::Time& stamp) + { + robot_geometry_msgs::PoseStamped pose; + pose.header.frame_id = frame; + pose.header.stamp = stamp; + pose.pose.position.x = pose2d.x; + pose.pose.position.y = pose2d.y; + pose.pose.orientation = data_convert::createQuaternionMsgFromYaw(pose2d.theta); + return pose; + } + + robot_nav_2d_msgs::Path2D pathToPath(const robot_nav_msgs::Path &path) + { + robot_nav_2d_msgs::Path2D path2d; + path2d.header = path.header; + robot_nav_2d_msgs::Pose2DStamped stamped_2d; + path2d.poses.resize(path.poses.size()); + for (unsigned int i = 0; i < path.poses.size(); i++) + { + stamped_2d = poseStampedToPose2D(path.poses[i]); + path2d.poses[i] = stamped_2d; + } + return path2d; + } + + robot_nav_msgs::Path posesToPath(const std::vector &poses) + { + robot_nav_msgs::Path path; + if (poses.empty()) + return path; + + path.poses.resize(poses.size()); + path.header.frame_id = poses[0].header.frame_id; + path.header.stamp = poses[0].header.stamp; + for (unsigned int i = 0; i < poses.size(); i++) + { + path.poses[i] = poses[i]; + } + return path; + } + + robot_nav_2d_msgs::Path2D posesToPath2D(const std::vector &poses) + { + robot_nav_2d_msgs::Path2D path; + if (poses.empty()) + return path; + + robot_nav_2d_msgs::Pose2DStamped pose; + path.poses.resize(poses.size()); + path.header.frame_id = poses[0].header.frame_id; + path.header.stamp = poses[0].header.stamp; + for (unsigned int i = 0; i < poses.size(); i++) + { + pose = poseStampedToPose2D(poses[i]); + path.poses[i] = pose; + } + return path; + } + + robot_nav_msgs::Path poses2DToPath(const std::vector& poses, + const std::string& frame, const robot::Time& stamp) + { + robot_nav_msgs::Path path; + path.poses.resize(poses.size()); + path.header.frame_id = frame; + path.header.stamp = stamp; + for (unsigned int i = 0; i < poses.size(); i++) + { + path.poses[i] = pose2DToPoseStamped(poses[i], frame, stamp); + } + return path; + } + + robot_nav_msgs::Path pathToPath(const robot_nav_2d_msgs::Path2D &path2d) + { + robot_nav_msgs::Path path; + path.header = path2d.header; + path.poses.resize(path2d.poses.size()); + for (unsigned int i = 0; i < path.poses.size(); i++) + { + path.poses[i].header = path2d.header; + path.poses[i].pose = pose2DToPose(path2d.poses[i].pose); + } + return path; + } + + robot_geometry_msgs::Polygon polygon2Dto3D(const robot_nav_2d_msgs::Polygon2D &polygon_2d) + { + robot_geometry_msgs::Polygon polygon; + polygon.points.reserve(polygon_2d.points.size()); + for (const auto &pt : polygon_2d.points) + { + polygon.points.push_back(pointToPoint32(pt)); + } + return polygon; + } + + robot_nav_2d_msgs::Polygon2D polygon3Dto2D(const robot_geometry_msgs::Polygon &polygon_3d) + { + robot_nav_2d_msgs::Polygon2D polygon; + polygon.points.reserve(polygon_3d.points.size()); + for (const auto &pt : polygon_3d.points) + { + polygon.points.push_back(pointToPoint2D(pt)); + } + return polygon; + } + + robot_geometry_msgs::PolygonStamped polygon2Dto3D(const robot_nav_2d_msgs::Polygon2DStamped &polygon_2d) + { + robot_geometry_msgs::PolygonStamped polygon; + polygon.header = polygon_2d.header; + polygon.polygon = polygon2Dto3D(polygon_2d.polygon); + return polygon; + } + + robot_nav_2d_msgs::Polygon2DStamped polygon3Dto2D(const robot_geometry_msgs::PolygonStamped &polygon_3d) + { + robot_nav_2d_msgs::Polygon2DStamped polygon; + polygon.header = polygon_3d.header; + polygon.polygon = polygon3Dto2D(polygon_3d.polygon); + return polygon; + } + + robot_nav_2d_msgs::NavGridInfo toMsg(const nav_grid::NavGridInfo &info) + { + robot_nav_2d_msgs::NavGridInfo msg; + msg.width = info.width; + msg.height = info.height; + msg.resolution = info.resolution; + msg.frame_id = info.frame_id; + msg.origin_x = info.origin_x; + msg.origin_y = info.origin_y; + return msg; + } + + nav_grid::NavGridInfo fromMsg(const robot_nav_2d_msgs::NavGridInfo &msg) + { + nav_grid::NavGridInfo info; + info.width = msg.width; + info.height = msg.height; + info.resolution = msg.resolution; + info.frame_id = msg.frame_id; + info.origin_x = msg.origin_x; + info.origin_y = msg.origin_y; + return info; + } + + nav_grid::NavGridInfo infoToInfo(const robot_nav_msgs::MapMetaData &metadata, const std::string &frame) + { + nav_grid::NavGridInfo info; + info.frame_id = frame; + info.resolution = metadata.resolution; + info.width = metadata.width; + info.height = metadata.height; + info.origin_x = metadata.origin.position.x; + info.origin_y = metadata.origin.position.y; + if (std::abs(data_convert::getYaw(metadata.origin.orientation)) > 1e-5) + { + robot::log_warning("[conversions] conversion from MapMetaData to NavGridInfo encountered a non-zero rotation. Ignoring"); + } + return info; + } + + robot_geometry_msgs::Pose getOrigin3D(const nav_grid::NavGridInfo &info) + { + robot_geometry_msgs::Pose origin; + origin.position.x = info.origin_x; + origin.position.y = info.origin_y; + origin.orientation.w = 1.0; + return origin; + } + + robot_geometry_msgs::Pose2D getOrigin2D(const nav_grid::NavGridInfo &info) + { + robot_geometry_msgs::Pose2D origin; + origin.x = info.origin_x; + origin.y = info.origin_y; + return origin; + } + + robot_nav_msgs::MapMetaData infoToInfo(const nav_grid::NavGridInfo &info) + { + robot_nav_msgs::MapMetaData metadata; + metadata.resolution = info.resolution; + metadata.width = info.width; + metadata.height = info.height; + metadata.origin = getOrigin3D(info); + return metadata; + } + + robot_nav_2d_msgs::UIntBounds toMsg(const robot_nav_core2::UIntBounds &bounds) + { + robot_nav_2d_msgs::UIntBounds msg; + msg.min_x = bounds.getMinX(); + msg.min_y = bounds.getMinY(); + msg.max_x = bounds.getMaxX(); + msg.max_y = bounds.getMaxY(); + return msg; + } + + robot_nav_core2::UIntBounds fromMsg(const robot_nav_2d_msgs::UIntBounds &msg) + { + return robot_nav_core2::UIntBounds(msg.min_x, msg.min_y, msg.max_x, msg.max_y); + } + +} // namespace robot_nav_2d_utils diff --git a/src/Libraries/robot_nav_2d_utils/src/footprint.cpp b/src/Libraries/robot_nav_2d_utils/src/footprint.cpp new file mode 100755 index 0000000..f0ed1b8 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/src/footprint.cpp @@ -0,0 +1,67 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + robot_nav_2d_msgs::Polygon2D footprintFromParams(YAML::Node &nh, bool write) + { + std::string full_param_name; + robot_nav_2d_msgs::Polygon2D footprint; + + // if (nh.searchParam("footprint", full_param_name)) + // { + // // footprint = polygonFromParams(nh, full_param_name, false); + // if (write) + // { + // nh.setParam("footprint", polygonToXMLRPC(footprint)); + // } + // } + // else if (nh.searchParam("robot_radius", full_param_name)) + // { + // double robot_radius = 0.0; + // nh.getParam(full_param_name, robot_radius); + // footprint = polygonFromRadius(robot_radius); + // if (write) + // { + // nh.setParam("robot_radius", robot_radius); + // } + // } + return footprint; + } + +} // namespace robot_nav_2d_utils diff --git a/src/Libraries/robot_nav_2d_utils/src/path_ops.cpp b/src/Libraries/robot_nav_2d_utils/src/path_ops.cpp new file mode 100755 index 0000000..6bb7a25 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/src/path_ops.cpp @@ -0,0 +1,194 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + + double poseDistance(const robot_geometry_msgs::Pose2D &pose0, const robot_geometry_msgs::Pose2D &pose1) + { + return hypot(pose0.x - pose1.x, pose0.y - pose1.y); + } + + double getPlanLength(const robot_nav_2d_msgs::Path2D &plan, const unsigned int start_index) + { + double length = 0.0; + for (unsigned int i = start_index + 1; i < plan.poses.size(); i++) + { + length += poseDistance(plan.poses[i - 1].pose, plan.poses[i].pose); + } + return length; + } + + double getPlanLength(const robot_nav_2d_msgs::Path2D &plan, const robot_geometry_msgs::Pose2D &query_pose) + { + if (plan.poses.size() == 0) + return 0.0; + + unsigned int closest_index = 0; + double closest_distance = poseDistance(plan.poses[0].pose, query_pose); + for (unsigned int i = 1; i < plan.poses.size(); i++) + { + double distance = poseDistance(plan.poses[i].pose, query_pose); + if (closest_distance > distance) + { + closest_index = i; + closest_distance = distance; + } + } + return getPlanLength(plan, closest_index); + } + + robot_nav_2d_msgs::Path2D adjustPlanResolution(const robot_nav_2d_msgs::Path2D &global_plan_in, double resolution) + { + robot_nav_2d_msgs::Path2D global_plan_out; + global_plan_out.header = global_plan_in.header; + if (global_plan_in.poses.size() == 0) + { + return global_plan_out; + } + + robot_nav_2d_msgs::Pose2DStamped last_stp = global_plan_in.poses[0]; + global_plan_out.poses.push_back(last_stp); + + double sq_resolution = resolution * resolution; + robot_geometry_msgs::Pose2D last = last_stp.pose; + for (unsigned int i = 1; i < global_plan_in.poses.size(); ++i) + { + robot_geometry_msgs::Pose2D loop = global_plan_in.poses[i].pose; + double sq_dist = (loop.x - last.x) * (loop.x - last.x) + (loop.y - last.y) * (loop.y - last.y); + if (sq_dist > sq_resolution) + { + // add points in-between + double diff = sqrt(sq_dist) - resolution; + double steps_double = ceil(diff / resolution) + 1.0; + int steps = static_cast(steps_double); + + double delta_x = (loop.x - last.x) / steps_double; + double delta_y = (loop.y - last.y) / steps_double; + double delta_t = (loop.theta - last.theta) / steps_double; + + for (int j = 1; j < steps; ++j) + { + robot_nav_2d_msgs::Pose2DStamped pose; + pose.header = last_stp.header; + pose.pose.x = last.x + j * delta_x; + pose.pose.y = last.y + j * delta_y; + pose.pose.theta = last.theta + j * delta_t; + global_plan_out.poses.push_back(pose); + } + } + global_plan_out.poses.push_back(global_plan_in.poses[i]); + last.x = loop.x; + last.y = loop.y; + } + return global_plan_out; + } + + using PoseList = std::vector; + + /** + * @brief Helper function for other version of compressPlan. + * + * Uses the Ramer Douglas Peucker algorithm. Ignores theta values + * + * @param input Full list of poses + * @param start_index Index of first pose (inclusive) + * @param end_index Index of last pose (inclusive) + * @param epsilon maximum allowable error. Increase for greater compression. + * @param list of poses possibly compressed for the poses[start_index, end_index] + */ + PoseList compressPlan(const PoseList &input, unsigned int start_index, unsigned int end_index, double epsilon) + { + // Skip if only two points + if (end_index - start_index <= 1) + { + PoseList::const_iterator first = input.begin() + start_index; + PoseList::const_iterator last = input.begin() + end_index + 1; + return PoseList(first, last); + } + + // Find the point with the maximum distance to the line from start to end + const robot_nav_2d_msgs::Pose2DStamped &start = input[start_index], + end = input[end_index]; + double max_distance = 0.0; + unsigned int max_index = 0; + for (unsigned int i = start_index + 1; i < end_index; i++) + { + const robot_nav_2d_msgs::Pose2DStamped &pose = input[i]; + double d = distanceToLine(pose.pose.x, pose.pose.y, start.pose.x, start.pose.y, end.pose.x, end.pose.y); + if (d > max_distance) + { + max_index = i; + max_distance = d; + } + } + + // If max distance is less than epsilon, eliminate all the points between start and end + if (max_distance <= epsilon) + { + PoseList outer; + outer.push_back(start); + outer.push_back(end); + return outer; + } + + // If max distance is greater than epsilon, recursively simplify + PoseList first_part = compressPlan(input, start_index, max_index, epsilon); + PoseList second_part = compressPlan(input, max_index, end_index, epsilon); + first_part.insert(first_part.end(), second_part.begin() + 1, second_part.end()); + return first_part; + } + + robot_nav_2d_msgs::Path2D compressPlan(const robot_nav_2d_msgs::Path2D &input_path, double epsilon) + { + robot_nav_2d_msgs::Path2D results; + results.header = input_path.header; + results.poses = compressPlan(input_path.poses, 0, input_path.poses.size() - 1, epsilon); + return results; + } + + void addPose(robot_nav_2d_msgs::Path2D &path, double x, double y, double theta) + { + robot_nav_2d_msgs::Pose2DStamped pose; + pose.pose.x = x; + pose.pose.y = y; + pose.pose.theta = theta; + path.poses.push_back(pose); + } +} // namespace robot_nav_2d_utils diff --git a/src/Libraries/robot_nav_2d_utils/src/polygons.cpp b/src/Libraries/robot_nav_2d_utils/src/polygons.cpp new file mode 100755 index 0000000..b60e713 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/src/polygons.cpp @@ -0,0 +1,503 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + +using robot_nav_2d_msgs::Point2D; +using robot_nav_2d_msgs::Polygon2D; + +std::vector > parseVVD(const std::string& input) +{ + std::vector > result; + + std::stringstream input_ss(input); + int depth = 0; + std::vector current_vector; + while (input_ss.good()) + { + switch (input_ss.peek()) + { + case EOF: + break; + case '[': + depth++; + if (depth > 2) + { + throw PolygonParseException("Array depth greater than 2"); + } + input_ss.get(); + current_vector.clear(); + break; + case ']': + depth--; + if (depth < 0) + { + throw PolygonParseException("More close ] than open ["); + } + input_ss.get(); + if (depth == 1) + { + result.push_back(current_vector); + } + break; + case ',': + case ' ': + case '\t': + input_ss.get(); + break; + default: // All other characters should be part of the numbers. + if (depth != 2) + { + std::stringstream err_ss; + err_ss << "Numbers at depth other than 2. Char was '" << char(input_ss.peek()) << "'."; + throw PolygonParseException(err_ss.str()); + } + double value; + if (input_ss >> value) + { + current_vector.push_back(value); + } + break; + } + } + + if (depth != 0) + { + throw PolygonParseException("Unterminated vector string."); + } + + return result; +} + +Polygon2D polygonFromRadius(const double radius, const unsigned int num_points) +{ + Polygon2D polygon; + Point2D pt; + for (unsigned int i = 0; i < num_points; ++i) + { + double angle = i * 2 * M_PI / num_points; + pt.x = cos(angle) * radius; + pt.y = sin(angle) * radius; + polygon.points.push_back(pt); + } + + return polygon; +} + +Polygon2D polygonFromString(const std::string& polygon_string) +{ + Polygon2D polygon; + // Will throw PolygonParseException if problematic + std::vector > vvd = parseVVD(polygon_string); + + // convert vvd into points. + if (vvd.size() < 3) + { + throw PolygonParseException("You must specify at least three points for the polygon."); + } + + polygon.points.resize(vvd.size()); + for (unsigned int i = 0; i < vvd.size(); i++) + { + if (vvd[ i ].size() != 2) + { + std::stringstream err_ss; + err_ss << "Points in the polygon specification must be pairs of numbers. Point index " << i << " had "; + err_ss << int(vvd[ i ].size()) << " numbers."; + throw PolygonParseException(err_ss.str()); + } + + polygon.points[i].x = vvd[i][0]; + polygon.points[i].y = vvd[i][1]; + } + + return polygon; +} + + +/** + * @brief Helper function. Convert value to double + */ +double getNumberFromXMLRPC(robot_xmlrpcpp::XmlRpcValue& value) +{ + if (value.getType() == robot_xmlrpcpp::XmlRpcValue::TypeInt) + { + return static_cast(static_cast(value)); + } + else if (value.getType() == robot_xmlrpcpp::XmlRpcValue::TypeDouble) + { + return static_cast(value); + } + + std::stringstream err_ss; + err_ss << "Values in the polygon specification must be numbers. Found value: " << value.toXml(); + throw PolygonParseException(err_ss.str()); +} + +/** + * @brief Helper function. Convert value to double array + */ +std::vector getNumberVectorFromXMLRPC(robot_xmlrpcpp::XmlRpcValue& value) +{ + if (value.getType() != robot_xmlrpcpp::XmlRpcValue::TypeArray) + { + throw PolygonParseException("Subarray must have type list."); + } + std::vector array; + for (int i = 0; i < value.size(); i++) + { + array.push_back(getNumberFromXMLRPC(value[i])); + } + return array; +} + +Polygon2D polygonFromXMLRPC(robot_xmlrpcpp::XmlRpcValue& polygon_xmlrpc) +{ + if (polygon_xmlrpc.getType() == robot_xmlrpcpp::XmlRpcValue::TypeString && + polygon_xmlrpc != "" && polygon_xmlrpc != "[]") + { + return polygonFromString(std::string(polygon_xmlrpc)); + } + + if (polygon_xmlrpc.getType() == robot_xmlrpcpp::XmlRpcValue::TypeStruct) + { + if (!polygon_xmlrpc.hasMember("x") || !polygon_xmlrpc.hasMember("y")) + { + throw PolygonParseException("Dict-like Polygon must specify members x and y."); + } + std::vector xs = getNumberVectorFromXMLRPC(polygon_xmlrpc["x"]); + std::vector ys = getNumberVectorFromXMLRPC(polygon_xmlrpc["y"]); + return polygonFromParallelArrays(xs, ys); + } + + // Make sure we have an array of at least 3 elements. + if (polygon_xmlrpc.getType() != robot_xmlrpcpp::XmlRpcValue::TypeArray) + { + std::stringstream err_ss; + err_ss << "Polygon must be specified as a list of lists. Found object of type " << polygon_xmlrpc.getType() + << " instead."; + throw PolygonParseException(err_ss.str()); + } + else if (polygon_xmlrpc.size() < 3) + { + throw PolygonParseException("You must specify at least three points for the polygon."); + } + + Polygon2D polygon; + Point2D pt; + for (int i = 0; i < polygon_xmlrpc.size(); ++i) + { + // Make sure each element of the list is an array of size 2. (x and y coordinates) + robot_xmlrpcpp::XmlRpcValue& point_xml = polygon_xmlrpc[i]; + if (point_xml.getType() != robot_xmlrpcpp::XmlRpcValue::TypeArray) + { + std::stringstream err_ss; + err_ss << "Each point must be specified as a list. Found object of type " << point_xml.getType() << " instead."; + throw PolygonParseException(err_ss.str()); + } + else if (point_xml.size() != 2) + { + throw PolygonParseException("Each point must have two numbers (x and y)."); + } + + pt.x = getNumberFromXMLRPC(point_xml[0]); + pt.y = getNumberFromXMLRPC(point_xml[1]); + polygon.points.push_back(pt); + } + return polygon; +} + +// Polygon2D polygonFromParams(const YAML::Node& nh, const std::string parameter_name, bool search) +// { +// std::string full_param_name; +// if (search) +// { +// nh.searchParam(parameter_name, full_param_name); +// } +// else +// { +// full_param_name = parameter_name; +// } + +// if (!nh.hasParam(full_param_name)) +// { +// std::stringstream err_ss; +// err_ss << "Parameter " << parameter_name << "(" + nh.resolveName(parameter_name) << ") not found."; +// throw PolygonParseException(err_ss.str()); +// } +// XmlRpc::XmlRpcValue polygon_xmlrpc; +// nh.getParam(full_param_name, polygon_xmlrpc); +// return polygonFromXMLRPC(polygon_xmlrpc); +// } + +/** + * @brief Helper method to convert a vector of doubles + */ +robot_xmlrpcpp::XmlRpcValue vectorToXMLRPC(const std::vector& array) +{ + robot_xmlrpcpp::XmlRpcValue xml; + xml.setSize(array.size()); + for (unsigned int i = 0; i < array.size(); ++i) + { + xml[i] = array[i]; + } + return xml; +} + +robot_xmlrpcpp::XmlRpcValue polygonToXMLRPC(const robot_nav_2d_msgs::Polygon2D& polygon, bool array_of_arrays) +{ + robot_xmlrpcpp::XmlRpcValue xml; + if (array_of_arrays) + { + xml.setSize(polygon.points.size()); + for (unsigned int i = 0; i < polygon.points.size(); ++i) + { + xml[i].setSize(2); + const Point2D& p = polygon.points[i]; + xml[i][0] = p.x; + xml[i][1] = p.y; + } + } + else + { + std::vector xs, ys; + polygonToParallelArrays(polygon, xs, ys); + xml["x"] = vectorToXMLRPC(xs); + xml["y"] = vectorToXMLRPC(ys); + } + return xml; +} + +// void polygonToParams(const robot_nav_2d_msgs::Polygon2D& polygon, const YAML::Node& nh, const std::string parameter_name, +// bool array_of_arrays) +// { +// nh.setParam(parameter_name, polygonToXMLRPC(polygon, array_of_arrays)); +// } + +robot_nav_2d_msgs::Polygon2D polygonFromParallelArrays(const std::vector& xs, const std::vector& ys) +{ + if (xs.size() < 3) + { + throw PolygonParseException("You must specify at least three points for the polygon."); + } + else if (xs.size() != ys.size()) + { + throw PolygonParseException("Length of x array does not match length of y array."); + } + + Polygon2D polygon; + polygon.points.resize(xs.size()); + for (unsigned int i = 0; i < xs.size(); i++) + { + Point2D& pt = polygon.points[i]; + pt.x = xs[i]; + pt.y = ys[i]; + } + return polygon; +} + +void polygonToParallelArrays(const robot_nav_2d_msgs::Polygon2D polygon, std::vector& xs, std::vector& ys) +{ + xs.clear(); + ys.clear(); + for (const Point2D& pt : polygon.points) + { + xs.push_back(pt.x); + ys.push_back(pt.y); + } +} + +bool equals(const robot_nav_2d_msgs::Polygon2D& polygon0, const robot_nav_2d_msgs::Polygon2D& polygon1) +{ + if (polygon0.points.size() != polygon1.points.size()) + { + return false; + } + for (unsigned int i=0; i < polygon0.points.size(); i++) + { + if (polygon0.points[i].x != polygon1.points[i].x ||polygon0.points[i].y != polygon1.points[i].y) + { + return false; + } + } + return true; +} + +robot_nav_2d_msgs::Polygon2D movePolygonToPose(const robot_nav_2d_msgs::Polygon2D& polygon, + const robot_geometry_msgs::Pose2D& pose) +{ + robot_nav_2d_msgs::Polygon2D new_polygon; + new_polygon.points.resize(polygon.points.size()); + double cos_th = cos(pose.theta); + double sin_th = sin(pose.theta); + for (unsigned int i = 0; i < polygon.points.size(); ++i) + { + robot_nav_2d_msgs::Point2D& new_pt = new_polygon.points[i]; + new_pt.x = pose.x + polygon.points[i].x * cos_th - polygon.points[i].y * sin_th; + new_pt.y = pose.y + polygon.points[i].x * sin_th + polygon.points[i].y * cos_th; + } + return new_polygon; +} + +bool isInside(const robot_nav_2d_msgs::Polygon2D& polygon, const double x, const double y) +{ + // Determine if the given point is inside the polygon using the number of crossings method + // https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html + int n = polygon.points.size(); + int cross = 0; + // Loop from i = [0 ... n - 1] and j = [n - 1, 0 ... n - 2] + // Ensures first point connects to last point + for (int i = 0, j = n - 1; i < n; j = i++) + { + // Check if the line to x,y crosses this edge + if ( ((polygon.points[i].y > y) != (polygon.points[j].y > y)) + && (x < (polygon.points[j].x - polygon.points[i].x) * (y - polygon.points[i].y) / + (polygon.points[j].y - polygon.points[i].y) + polygon.points[i].x) ) + { + cross++; + } + } + // Return true if the number of crossings is odd + return cross % 2 > 0; +} + +void calculateMinAndMaxDistances(const robot_nav_2d_msgs::Polygon2D& polygon, double& min_dist, double& max_dist) +{ + min_dist = std::numeric_limits::max(); + max_dist = 0.0; + auto& points = polygon.points; + if (points.size() == 0) + { + return; + } + + for (unsigned int i = 0; i < points.size() - 1; ++i) + { + // check the distance from the robot center point to the first vertex + double vertex_dist = hypot(points[i].x, points[i].y); + double edge_dist = distanceToLine(0.0, 0.0, points[i].x, points[i].y, + points[i + 1].x, points[i + 1].y); + min_dist = std::min(min_dist, std::min(vertex_dist, edge_dist)); + max_dist = std::max(max_dist, std::max(vertex_dist, edge_dist)); + } + + // we also need to do the last vertex and the first vertex + double vertex_dist = hypot(points.back().x, points.back().y); + double edge_dist = distanceToLine(0.0, 0.0, points.back().x, points.back().y, + points.front().x, points.front().y); + min_dist = std::min(min_dist, std::min(vertex_dist, edge_dist)); + max_dist = std::max(max_dist, std::max(vertex_dist, edge_dist)); +} +} // namespace robot_nav_2d_utils + +// Adapt Point2D for use with the triangulation library +namespace mapbox +{ +namespace util +{ +template <> +struct nth<0, robot_nav_2d_msgs::Point2D> +{ + inline static double get(const robot_nav_2d_msgs::Point2D& point) + { + return point.x; + }; +}; + +template <> +struct nth<1, robot_nav_2d_msgs::Point2D> +{ + inline static double get(const robot_nav_2d_msgs::Point2D& point) + { + return point.y; + }; +}; + +} // namespace util +} // namespace mapbox + + +namespace robot_nav_2d_utils +{ +std::vector triangulate(const robot_nav_2d_msgs::ComplexPolygon2D& polygon) +{ + // Compute the triangulation + std::vector> rings; + rings.reserve(1 + polygon.inner.size()); + rings.push_back(polygon.outer.points); + for (const robot_nav_2d_msgs::Polygon2D& inner : polygon.inner) + { + rings.push_back(inner.points); + } + std::vector indices = mapbox::earcut(rings); + + // Create a sequential point index. The triangulation results are indices in this vector. + std::vector points; + for (const auto& ring : rings) + { + for (const robot_nav_2d_msgs::Point2D& point : ring) + { + points.push_back(point); + } + } + + // Construct the output triangles + std::vector result; + result.reserve(indices.size()); + for (unsigned int index : indices) + { + result.push_back(points[index]); + } + return result; +} + +std::vector triangulate(const robot_nav_2d_msgs::Polygon2D& polygon) +{ + robot_nav_2d_msgs::ComplexPolygon2D complex; + complex.outer = polygon; + return triangulate(complex); +} + + +} // namespace robot_nav_2d_utils diff --git a/src/Libraries/robot_nav_2d_utils/src/tf_help.cpp b/src/Libraries/robot_nav_2d_utils/src/tf_help.cpp new file mode 100755 index 0000000..13fc20b --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/src/tf_help.cpp @@ -0,0 +1,118 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * 2022, Metro Robots + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include +#include +#include + +namespace robot_nav_2d_utils +{ + + bool transform(const TFListenerPtr tf, + const ::robot_geometry_msgs::PoseStamped &in_pose, + ::robot_geometry_msgs::PoseStamped &out_pose, const ::std::string &frame) + { + const std::string target_frame = frame; + const std::string source_frame = in_pose.header.frame_id; + std::string *error_msg; + + if(tf->canTransform(target_frame, source_frame, tf3::Time(), error_msg)) + { + tf3::TransformStampedMsg transform =tf->lookupTransform(target_frame, source_frame, tf3::Time()); + tf3::doTransform(in_pose, out_pose, transform); + return true; + } + return false; + } + + bool transformPose(const TFListenerPtr tf, const ::std::string frame, + const ::robot_geometry_msgs::PoseStamped &in_pose, ::robot_geometry_msgs::PoseStamped &out_pose, + const bool extrapolation_fallback) + { + if (in_pose.header.frame_id == frame) + { + out_pose = in_pose; + return true; + } + + try + { + transform(tf, in_pose, out_pose, frame); + return true; + } + catch (tf3::ExtrapolationException &ex) + { + if (!extrapolation_fallback) + throw; + robot_geometry_msgs::PoseStamped latest_in_pose; + latest_in_pose.header.frame_id = in_pose.header.frame_id; + latest_in_pose.pose = in_pose.pose; + transform(tf, latest_in_pose, out_pose, frame); + return true; + } + catch (tf3::TransformException &ex) + { + robot::log_error("Exception in transformPose: %s", ex.what()); + return false; + } + return false; + } + + bool transformPose(const TFListenerPtr tf, const ::std::string frame, + const ::robot_nav_2d_msgs::Pose2DStamped &in_pose, ::robot_nav_2d_msgs::Pose2DStamped &out_pose, + const bool extrapolation_fallback) + { + robot_geometry_msgs::PoseStamped in_3d_pose = pose2DToPoseStamped(in_pose); + robot_geometry_msgs::PoseStamped out_3d_pose; + + bool ret = transformPose(tf, frame, in_3d_pose, out_3d_pose, extrapolation_fallback); + if (ret) + { + out_pose = poseStampedToPose2D(out_3d_pose); + } + return ret; + } + + ::robot_geometry_msgs::Pose2D transformStampedPose(const TFListenerPtr tf, const ::robot_nav_2d_msgs::Pose2DStamped &pose, + const ::std::string &frame_id) + { + robot_nav_2d_msgs::Pose2DStamped local_pose; + robot_nav_2d_utils::transformPose(tf, frame_id, pose, local_pose); + return local_pose.pose; + } + +} // namespace robot_nav_2d_utils diff --git a/src/Libraries/robot_nav_2d_utils/test/bounds_test.cpp b/src/Libraries/robot_nav_2d_utils/test/bounds_test.cpp new file mode 100755 index 0000000..5118951 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/test/bounds_test.cpp @@ -0,0 +1,199 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2020, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include + +using robot_nav_2d_utils::divideBounds; +using robot_nav_core2::UIntBounds; + +/** + * @brief Count the values in a grid. + * @param[in] The grid + * @param[out] match Number of values == 1 + * @param[out] missed Number of values == 0 + * @param[out] multiple Number of other values + */ +void countValues(const nav_grid::VectorNavGrid& grid, + unsigned int& match, unsigned int& missed, unsigned int& multiple) +{ + match = 0; + missed = 0; + multiple = 0; + + nav_grid::NavGridInfo info = grid.getInfo(); + + // No iterator to avoid tricky depenencies + for (unsigned int x = 0; x < info.width; x++) + { + for (unsigned int y = 0; y < info.height; y++) + { + switch (grid(x, y)) + { + case 0: + missed++; + break; + case 1: + match++; + break; + default: + multiple++; + break; + } + } + } +} + +TEST(DivideBounds, zeroes) +{ + UIntBounds bounds(2, 2, 5, 5); + // Number of rows/cols has to be positive + EXPECT_THROW(divideBounds(bounds, 0, 2), std::invalid_argument); + EXPECT_THROW(divideBounds(bounds, 2, 0), std::invalid_argument); + EXPECT_THROW(divideBounds(bounds, 0, 0), std::invalid_argument); + EXPECT_NO_THROW(divideBounds(bounds, 2, 2)); + + bounds.reset(); + // check for errors with empty bounds + EXPECT_NO_THROW(divideBounds(bounds, 2, 2)); +} + +/** + * This test is for the divideBounds method and takes grids of various sizes + * (cycled through with the outer two loops) and tries to divide them into subgrids of + * various sizes (cycled through with the next two loops). The resulting vector of + * bounds should cover every cell in the original grid, so each of the divided bounds is + * iterated over, adding one to each grid cell. If everything works perfectly, each cell + * should be touched exactly once. + */ +TEST(DivideBounds, iterative_tests) +{ + nav_grid::VectorNavGrid full_grid; + nav_grid::NavGridInfo info; + + // count variables + unsigned int match, missed, multiple; + + for (info.width = 1; info.width < 15; info.width++) + { + for (info.height = 1; info.height < 15; info.height++) + { + full_grid.setInfo(info); + UIntBounds full_bounds = robot_nav_2d_utils::getFullUIntBounds(info); + for (unsigned int rows = 1; rows < 11u; rows++) + { + for (unsigned int cols = 1; cols < 11u; cols++) + { + full_grid.reset(); + std::vector divided = divideBounds(full_bounds, cols, rows); + ASSERT_LE(divided.size(), rows * cols) << info.width << "x" << info.height << " " << rows << "x" << cols; + for (const UIntBounds& sub : divided) + { + EXPECT_FALSE(sub.isEmpty()); + // Can't use nav_grid_iterator for circular dependencies + for (unsigned int x = sub.getMinX(); x <= sub.getMaxX(); x++) + { + for (unsigned int y = sub.getMinY(); y <= sub.getMaxY(); y++) + { + full_grid.setValue(x, y, full_grid(x, y) + 1); + } + } + } + + countValues(full_grid, match, missed, multiple); + ASSERT_EQ(match, info.width * info.height) << "Full grid: " << info.width << "x" << info.height + << " Requested divisions: " << rows << "x" << cols; + EXPECT_EQ(missed, 0u); + EXPECT_EQ(multiple, 0u); + } + } + } + } +} + +/** + * This test is for the divideBounds method and calls it recursively to + * ensure that the method works when the minimum values in the original bounds + * are not zero. + */ +TEST(DivideBounds, recursive_tests) +{ + nav_grid::VectorNavGrid full_grid; + nav_grid::NavGridInfo info; + info.width = 100; + info.height = 100; + full_grid.setInfo(info); + + UIntBounds full_bounds = robot_nav_2d_utils::getFullUIntBounds(info); + + std::vector level_one = divideBounds(full_bounds, 2, 2); + ASSERT_EQ(level_one.size(), 4u); + for (const UIntBounds& sub : level_one) + { + std::vector level_two = divideBounds(sub, 2, 2); + ASSERT_EQ(level_two.size(), 4u); + for (const UIntBounds& subsub : level_two) + { + EXPECT_GE(subsub.getMinX(), sub.getMinX()); + EXPECT_LE(subsub.getMaxX(), sub.getMaxX()); + EXPECT_GE(subsub.getMinY(), sub.getMinY()); + EXPECT_LE(subsub.getMaxY(), sub.getMaxY()); + // Can't use nav_grid_iterator for circular dependencies + for (unsigned int x = subsub.getMinX(); x <= subsub.getMaxX(); x++) + { + for (unsigned int y = subsub.getMinY(); y <= subsub.getMaxY(); y++) + { + full_grid.setValue(x, y, full_grid(x, y) + 1); + } + } + } + } + + // Count values + unsigned int match = 0, + missed = 0, + multiple = 0; + countValues(full_grid, match, missed, multiple); + ASSERT_EQ(match, info.width * info.height); + EXPECT_EQ(missed, 0u); + EXPECT_EQ(multiple, 0u); +} + + +int main(int argc, char** argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Libraries/robot_nav_2d_utils/test/compress_test.cpp b/src/Libraries/robot_nav_2d_utils/test/compress_test.cpp new file mode 100755 index 0000000..3326aac --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/test/compress_test.cpp @@ -0,0 +1,97 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include + +using robot_nav_2d_utils::compressPlan; +using robot_nav_2d_utils::addPose; + +TEST(CompressTest, compress_test) +{ + robot_nav_2d_msgs::Path2D path; + // Dataset borrowed from https://karthaus.nl/rdp/ + addPose(path, 24, 173); + addPose(path, 26, 170); + addPose(path, 24, 166); + addPose(path, 27, 162); + addPose(path, 37, 161); + addPose(path, 45, 157); + addPose(path, 48, 152); + addPose(path, 46, 143); + addPose(path, 40, 140); + addPose(path, 34, 137); + addPose(path, 26, 134); + addPose(path, 24, 130); + addPose(path, 24, 125); + addPose(path, 28, 121); + addPose(path, 36, 118); + addPose(path, 46, 117); + addPose(path, 63, 121); + addPose(path, 76, 125); + addPose(path, 82, 120); + addPose(path, 86, 111); + addPose(path, 88, 103); + addPose(path, 90, 91); + addPose(path, 95, 87); + addPose(path, 107, 89); + addPose(path, 107, 104); + addPose(path, 106, 117); + addPose(path, 109, 129); + addPose(path, 119, 131); + addPose(path, 131, 131); + addPose(path, 139, 134); + addPose(path, 138, 143); + addPose(path, 131, 152); + addPose(path, 119, 154); + addPose(path, 111, 149); + addPose(path, 105, 143); + addPose(path, 91, 139); + addPose(path, 80, 142); + addPose(path, 81, 152); + addPose(path, 76, 163); + addPose(path, 67, 161); + addPose(path, 59, 149); + addPose(path, 63, 138); + + EXPECT_EQ(41U, compressPlan(path, 0.1).poses.size()); + EXPECT_EQ(34U, compressPlan(path, 1.3).poses.size()); + EXPECT_EQ(12U, compressPlan(path, 9.5).poses.size()); + EXPECT_EQ(8U, compressPlan(path, 19.9).poses.size()); +} + +int main(int argc, char** argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Libraries/robot_nav_2d_utils/test/param_tests.cpp b/src/Libraries/robot_nav_2d_utils/test/param_tests.cpp new file mode 100755 index 0000000..0e60bfb --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/test/param_tests.cpp @@ -0,0 +1,146 @@ +/********************************************************************* +* +* Software License Agreement (BSD License) +* +* Copyright (c) 2009, Willow Garage, Inc. +* 2018, Locus Robotics +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided +* with the distribution. +* * Neither the name of Willow Garage, Inc. nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Dave Hershberger +* David V. Lu!! (robot_nav_2d_utils version) +*********************************************************************/ +#include +#include +#include + +using robot_nav_2d_utils::polygonFromParams; +using robot_nav_2d_msgs::Polygon2D; + +TEST(Polygon2D, unpadded_footprint_from_string_param) +{ + YAML::Node nh("~unpadded"); + Polygon2D footprint = polygonFromParams(nh, "footprint"); + ASSERT_EQ(3U, footprint.points.size()); + + EXPECT_EQ(1.0f, footprint.points[ 0 ].x); + EXPECT_EQ(1.0f, footprint.points[ 0 ].y); + + EXPECT_EQ(-1.0f, footprint.points[ 1 ].x); + EXPECT_EQ(1.0f, footprint.points[ 1 ].y); + + EXPECT_EQ(-1.0f, footprint.points[ 2 ].x); + EXPECT_EQ(-1.0f, footprint.points[ 2 ].y); +} + +TEST(Polygon2D, check_search_capabilities) +{ + YAML::Node nh("~unpadded/unneccessarily/long_namespace"); + Polygon2D footprint = polygonFromParams(nh, "footprint"); + ASSERT_EQ(3U, footprint.points.size()); + EXPECT_THROW(polygonFromParams(nh, "footprint", false), robot_nav_2d_utils::PolygonParseException); +} + +TEST(Polygon2D, footprint_from_xmlrpc_param) +{ + YAML::Node nh("~xmlrpc"); + Polygon2D footprint = polygonFromParams(nh, "footprint"); + ASSERT_EQ(4U, footprint.points.size()); + + EXPECT_FLOAT_EQ(0.1f, footprint.points[ 0 ].x); + EXPECT_FLOAT_EQ(0.1f, footprint.points[ 0 ].y); + + EXPECT_FLOAT_EQ(-0.1f, footprint.points[ 1 ].x); + EXPECT_FLOAT_EQ(0.1f, footprint.points[ 1 ].y); + + EXPECT_FLOAT_EQ(-0.1f, footprint.points[ 2 ].x); + EXPECT_FLOAT_EQ(-0.1f, footprint.points[ 2 ].y); + + EXPECT_FLOAT_EQ(0.1f, footprint.points[ 3 ].x); + EXPECT_FLOAT_EQ(-0.1f, footprint.points[ 3 ].y); + + Polygon2D footprint2 = polygonFromParams(nh, "footprint2"); + ASSERT_TRUE(robot_nav_2d_utils::equals(footprint, footprint2)); +} + +TEST(Polygon2D, footprint_from_same_level_param) +{ + YAML::Node nh("~same_level"); + Polygon2D footprint = polygonFromParams(nh, "footprint"); + ASSERT_EQ(3U, footprint.points.size()); + + EXPECT_EQ(1.0f, footprint.points[ 0 ].x); + EXPECT_EQ(2.0f, footprint.points[ 0 ].y); + + EXPECT_EQ(3.0f, footprint.points[ 1 ].x); + EXPECT_EQ(4.0f, footprint.points[ 1 ].y); + + EXPECT_EQ(5.0f, footprint.points[ 2 ].x); + EXPECT_EQ(6.0f, footprint.points[ 2 ].y); +} + +TEST(Polygon2D, footprint_from_xmlrpc_param_failure) +{ + YAML::Node nh("~xmlrpc_fail"); + EXPECT_THROW(polygonFromParams(nh, "footprint"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint2"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint3"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint4"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint5"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint6"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint7"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint8"), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParams(nh, "footprint9"), robot_nav_2d_utils::PolygonParseException); +} + +TEST(Polygon2D, footprint_empty) +{ + YAML::Node nh("~empty"); + EXPECT_THROW(polygonFromParams(nh, "footprint"), robot_nav_2d_utils::PolygonParseException); +} + +TEST(Polygon2D, test_write) +{ + YAML::Node nh("~unpadded"); + Polygon2D footprint = polygonFromParams(nh, "footprint"); + nh.setParam("another_footprint", robot_nav_2d_utils::polygonToXMLRPC(footprint)); + Polygon2D another_footprint = polygonFromParams(nh, "another_footprint"); + EXPECT_TRUE(robot_nav_2d_utils::equals(footprint, another_footprint)); + + nh.setParam("third_footprint", robot_nav_2d_utils::polygonToXMLRPC(footprint, false)); + another_footprint = polygonFromParams(nh, "third_footprint"); + EXPECT_TRUE(robot_nav_2d_utils::equals(footprint, another_footprint)); +} + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "param_tests"); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Libraries/robot_nav_2d_utils/test/param_tests.launch b/src/Libraries/robot_nav_2d_utils/test/param_tests.launch new file mode 100755 index 0000000..d4e0730 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/test/param_tests.launch @@ -0,0 +1,34 @@ + + + + + + footprint: [[0.1, 0.1], [-0.1, 0.1], [-0.1, -0.1], [0.1, -0.1]] + footprint2: + x: [0.1, -0.1, -0.1, 0.1] + y: [0.1, 0.1, -0.1, -0.1] + + + + footprint: [[0.1, 0.1], [-0.1, 0.1, 77.0], [-0.1, -0.1], [0.1, -0.1]] + footprint2: 1.0 + footprint3: false + footprint4: [[0.1, 0.1], [0.1, 0.1]] + footprint5: ['x', 'y', 'z'] + footprint6: [['x', 'y'], ['a', 'b'], ['c'], ['d']] + footprint7: + x: [0.1, -0.1, -0.1, 0.1] + footprint8: + x: 0 + y: 0 + footprint9: + x: ['a', 'b', 'c'] + y: [d, e, f] + + + + + + + + diff --git a/src/Libraries/robot_nav_2d_utils/test/polygon_tests.cpp b/src/Libraries/robot_nav_2d_utils/test/polygon_tests.cpp new file mode 100755 index 0000000..bdd6b93 --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/test/polygon_tests.cpp @@ -0,0 +1,185 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include + +using robot_nav_2d_utils::parseVVD; +using robot_nav_2d_msgs::Polygon2D; +using robot_nav_2d_utils::polygonFromString; +using robot_nav_2d_utils::polygonFromParallelArrays; + +TEST(array_parser, basic_operation) +{ + std::vector > vvd; + vvd = parseVVD("[[1, 2.2], [.3, -4e4]]"); + EXPECT_DOUBLE_EQ(2U, vvd.size()); + EXPECT_DOUBLE_EQ(2U, vvd[0].size()); + EXPECT_DOUBLE_EQ(2U, vvd[1].size()); + EXPECT_DOUBLE_EQ(1.0, vvd[0][0]); + EXPECT_DOUBLE_EQ(2.2, vvd[0][1]); + EXPECT_DOUBLE_EQ(0.3, vvd[1][0]); + EXPECT_DOUBLE_EQ(-40000.0, vvd[1][1]); +} + +TEST(array_parser, missing_open) +{ + EXPECT_THROW(parseVVD("[1, 2.2], [.3, -4e4]]"), robot_nav_2d_utils::PolygonParseException); +} + +TEST(array_parser, missing_close) +{ + EXPECT_THROW(parseVVD("[[1, 2.2], [.3, -4e4]"), robot_nav_2d_utils::PolygonParseException); +} + +TEST(array_parser, wrong_depth) +{ + EXPECT_THROW(parseVVD("[1, 2.2], [.3, -4e4]"), robot_nav_2d_utils::PolygonParseException); +} + +TEST(Polygon2D, radius_param) +{ + Polygon2D footprint = robot_nav_2d_utils::polygonFromRadius(10.0); + // Circular robot has 16-point footprint auto-generated. + ASSERT_EQ(16U, footprint.points.size()); + + // Check the first point + EXPECT_EQ(10.0, footprint.points[0].x); + EXPECT_EQ(0.0, footprint.points[0].y); + + // Check the 4th point, which should be 90 degrees around the circle from the first. + EXPECT_NEAR(0.0, footprint.points[4].x, 0.0001); + EXPECT_NEAR(10.0, footprint.points[4].y, 0.0001); +} + +TEST(Polygon2D, string_param) +{ + Polygon2D footprint = polygonFromString("[[1, 1], [-1, 1], [-1, -1]]"); + ASSERT_EQ(3U, footprint.points.size()); + + EXPECT_EQ(1.0, footprint.points[ 0 ].x); + EXPECT_EQ(1.0, footprint.points[ 0 ].y); + + EXPECT_EQ(-1.0, footprint.points[ 1 ].x); + EXPECT_EQ(1.0, footprint.points[ 1 ].y); + + EXPECT_EQ(-1.0, footprint.points[ 2 ].x); + EXPECT_EQ(-1.0, footprint.points[ 2 ].y); +} + +TEST(Polygon2D, broken_string_param) +{ + // Not enough points + EXPECT_THROW(polygonFromString("[[1, 1], [-1, 1]]"), robot_nav_2d_utils::PolygonParseException); + + // Too many numbers in point + EXPECT_THROW(polygonFromString("[[1, 1, 1], [-1, 1], [-1, -1]]"), robot_nav_2d_utils::PolygonParseException); + + // Unexpected character + EXPECT_THROW(polygonFromString("[[x, 1], [-1, 1], [-1, -1]]"), robot_nav_2d_utils::PolygonParseException); + + // Empty String + EXPECT_THROW(polygonFromString(""), robot_nav_2d_utils::PolygonParseException); + + // Empty List + EXPECT_THROW(polygonFromString("[]"), robot_nav_2d_utils::PolygonParseException); + + // Empty Point + EXPECT_THROW(polygonFromString("[[]]"), robot_nav_2d_utils::PolygonParseException); +} + +TEST(Polygon2D, arrays) +{ + std::vector xs = {1, -1, -1}; + std::vector ys = {1, 1, -1}; + Polygon2D footprint = polygonFromParallelArrays(xs, ys); + ASSERT_EQ(3U, footprint.points.size()); + + EXPECT_EQ(1.0, footprint.points[ 0 ].x); + EXPECT_EQ(1.0, footprint.points[ 0 ].y); + + EXPECT_EQ(-1.0, footprint.points[ 1 ].x); + EXPECT_EQ(1.0, footprint.points[ 1 ].y); + + EXPECT_EQ(-1.0, footprint.points[ 2 ].x); + EXPECT_EQ(-1.0, footprint.points[ 2 ].y); +} + +TEST(Polygon2D, broken_arrays) +{ + std::vector shorty = {1, -1}; + std::vector three = {1, 1, -1}; + std::vector four = {1, 1, -1, -1}; + EXPECT_THROW(polygonFromParallelArrays(shorty, shorty), robot_nav_2d_utils::PolygonParseException); + EXPECT_THROW(polygonFromParallelArrays(three, four), robot_nav_2d_utils::PolygonParseException); +} + +TEST(Polygon2D, test_move) +{ + Polygon2D square = polygonFromString("[[0.5, 0.5], [0.5, -0.5], [-0.5, -0.5], [-0.5, 0.5]]"); + robot_geometry_msgs::Pose2D pose; + Polygon2D square2 = robot_nav_2d_utils::movePolygonToPose(square, pose); + EXPECT_TRUE(robot_nav_2d_utils::equals(square, square2)); + pose.x = 15; + pose.y = -10; + pose.theta = M_PI / 4; + Polygon2D diamond = robot_nav_2d_utils::movePolygonToPose(square, pose); + ASSERT_EQ(4U, diamond.points.size()); + double side = 1.0 / sqrt(2); + + EXPECT_DOUBLE_EQ(pose.x, diamond.points[ 0 ].x); + EXPECT_DOUBLE_EQ(pose.y + side, diamond.points[ 0 ].y); + EXPECT_DOUBLE_EQ(pose.x + side, diamond.points[ 1 ].x); + EXPECT_DOUBLE_EQ(pose.y, diamond.points[ 1 ].y); + EXPECT_DOUBLE_EQ(pose.x, diamond.points[ 2 ].x); + EXPECT_DOUBLE_EQ(pose.y - side, diamond.points[ 2 ].y); + EXPECT_DOUBLE_EQ(pose.x - side, diamond.points[ 3 ].x); + EXPECT_DOUBLE_EQ(pose.y, diamond.points[ 3 ].y); +} + +TEST(Polygon2D, inside) +{ + Polygon2D square = polygonFromString("[[0.5, 0.5], [0.5, -0.5], [-0.5, -0.5], [-0.5, 0.5]]"); + EXPECT_TRUE(robot_nav_2d_utils::isInside(square, 0.00, 0.00)); + EXPECT_TRUE(robot_nav_2d_utils::isInside(square, 0.45, 0.45)); + EXPECT_FALSE(robot_nav_2d_utils::isInside(square, 0.50, 0.50)); + EXPECT_FALSE(robot_nav_2d_utils::isInside(square, 0.00, 0.50)); + EXPECT_FALSE(robot_nav_2d_utils::isInside(square, 0.55, 0.55)); +} + +int main(int argc, char** argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Libraries/robot_nav_2d_utils/test/resolution_test.cpp b/src/Libraries/robot_nav_2d_utils/test/resolution_test.cpp new file mode 100755 index 0000000..7e03a9a --- /dev/null +++ b/src/Libraries/robot_nav_2d_utils/test/resolution_test.cpp @@ -0,0 +1,78 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include + +using robot_nav_2d_utils::adjustPlanResolution; +using robot_nav_2d_utils::addPose; + +TEST(ResolutionTest, simple_example) +{ + robot_nav_2d_msgs::Path2D path; + // Space between points is one meter + addPose(path, 0.0, 0.0); + addPose(path, 0.0, 1.0); + + // resolution>=1, path won't change + EXPECT_EQ(2U, adjustPlanResolution(path, 2.0).poses.size()); + EXPECT_EQ(2U, adjustPlanResolution(path, 1.0).poses.size()); + + // 0.5 <= resolution < 1.0, one point should be added in the middle + EXPECT_EQ(3U, adjustPlanResolution(path, 0.8).poses.size()); + EXPECT_EQ(3U, adjustPlanResolution(path, 0.5).poses.size()); + + // 0.333 <= resolution < 0.5, two points need to be added + EXPECT_EQ(4U, adjustPlanResolution(path, 0.34).poses.size()); + + // 0.25 <= resolution < 0.333, three points need to be added + EXPECT_EQ(5U, adjustPlanResolution(path, 0.32).poses.size()); +} + +TEST(ResolutionTest, real_example) +{ + // This test is based on a real-world example + robot_nav_2d_msgs::Path2D path; + addPose(path, 17.779193, -0.972024); + addPose(path, 17.799171, -0.950775); + addPose(path, 17.851942, -0.903709); + EXPECT_EQ(3U, adjustPlanResolution(path, 0.2).poses.size()); + EXPECT_EQ(4U, adjustPlanResolution(path, 0.05).poses.size()); +} + + +int main(int argc, char** argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Libraries/robot_sensor_ports b/src/Libraries/robot_sensor_ports new file mode 160000 index 0000000..c60173d --- /dev/null +++ b/src/Libraries/robot_sensor_ports @@ -0,0 +1 @@ +Subproject commit c60173d320c81a6e9a5f7ffd3b89002e0be7ec73 diff --git a/src/Libraries/robot_time b/src/Libraries/robot_time new file mode 160000 index 0000000..8c1abce --- /dev/null +++ b/src/Libraries/robot_time @@ -0,0 +1 @@ +Subproject commit 8c1abcec640c24a2629567ba57e0de5afca586fe diff --git a/src/Libraries/sbpl b/src/Libraries/sbpl new file mode 160000 index 0000000..ca1ba36 --- /dev/null +++ b/src/Libraries/sbpl @@ -0,0 +1 @@ +Subproject commit ca1ba369817d63b0c82e6d3331670584c6f0a422 diff --git a/src/Libraries/voxel_grid b/src/Libraries/voxel_grid new file mode 160000 index 0000000..081c520 --- /dev/null +++ b/src/Libraries/voxel_grid @@ -0,0 +1 @@ +Subproject commit 081c520b8a1a9d73e11c305d29b558ad1346d5ac diff --git a/src/Libraries/xmlrpcpp b/src/Libraries/xmlrpcpp new file mode 160000 index 0000000..1f8d5cc --- /dev/null +++ b/src/Libraries/xmlrpcpp @@ -0,0 +1 @@ +Subproject commit 1f8d5cc30098001ea7587b86348677d86bc4d831 diff --git a/src/Navigations/Cores/move_base_core/.gitignore b/src/Navigations/Cores/move_base_core/.gitignore new file mode 100755 index 0000000..d5dca0c --- /dev/null +++ b/src/Navigations/Cores/move_base_core/.gitignore @@ -0,0 +1,414 @@ +# ---> VisualStudio +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +# ---> VisualStudioCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + diff --git a/src/Navigations/Cores/move_base_core/CMakeLists.txt b/src/Navigations/Cores/move_base_core/CMakeLists.txt new file mode 100644 index 0000000..043b7d2 --- /dev/null +++ b/src/Navigations/Cores/move_base_core/CMakeLists.txt @@ -0,0 +1,155 @@ +cmake_minimum_required(VERSION 3.0.2) +project(move_base_core VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building move_base_core with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building move_base_core with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + tf3 + robot_time + robot_geometry_msgs + robot_protocol_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_msgs + robot_sensor_msgs + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_time + robot_geometry_msgs + robot_protocol_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + ) + find_package(tf3) + + catkin_package( + INCLUDE_DIRS include + # LIBRARIES không cần vì đây là header-only library + CATKIN_DEPENDS robot_time robot_geometry_msgs robot_protocol_msgs robot_nav_2d_msgs + DEPENDS tf3 + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/move_base_core/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PACKAGES_DIR} + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: tf3, robot_time, robot_geometry_msgs, robot_protocol_msgs, robot_nav_2d_msgs") + message(STATUS "=================================") +endif() diff --git a/src/Navigations/Cores/move_base_core/README.md b/src/Navigations/Cores/move_base_core/README.md new file mode 100755 index 0000000..13779c7 --- /dev/null +++ b/src/Navigations/Cores/move_base_core/README.md @@ -0,0 +1,257 @@ +# move_base_core + +## Tổng quan + +`move_base_core` là một thư viện header-only C++ cung cấp các interface và cấu trúc dữ liệu cốt lõi cho hệ thống navigation của robot, tương tự như `move_base_msgs` trong ROS nhưng độc lập, không phụ thuộc vào ROS. Thư viện này định nghĩa: + +- **Interface chính**: `BaseNavigation` - giao diện trừu tượng cho các module navigation +- **Trạng thái navigation**: Enum `State` mô tả các trạng thái của quá trình navigation +- **Feedback structure**: `NavFeedback` để theo dõi trạng thái navigation +- **Planner data**: `PlannerDataOutput` cho dữ liệu đầu ra từ planner +- **Utility functions**: Các hàm hỗ trợ chuyển đổi và tính toán + +## Mục đích + +Thư viện này được thiết kế để: + +- Cung cấp API chuẩn hóa cho navigation system không sử dụng ROS +- Định nghĩa interface chung cho các implementation navigation khác nhau +- Hỗ trợ các chức năng navigation cơ bản: di chuyển đến điểm, docking, quay, tạm dừng +- Cung cấp cơ chế feedback và trạng thái để theo dõi quá trình navigation +- Đảm bảo tính nhất quán và khả năng mở rộng cho các module navigation + +## Các thành phần chính + +### 1. `BaseNavigation` - Interface chính cho Navigation + +`BaseNavigation` là abstract class định nghĩa tất cả các phương thức cần thiết cho một hệ thống navigation hoàn chỉnh. + +**Chức năng chính:** + +- **Khởi tạo**: `initialize()` - khởi tạo hệ thống navigation với TF listener +- **Quản lý footprint**: `setRobotFootprint()`, `getRobotFootprint()` - thiết lập và lấy hình dạng robot +- **Quản lý dữ liệu cảm biến**: + - Thêm/xóa static maps, laser scans, point clouds + - Quản lý nhiều nguồn dữ liệu với tên riêng biệt +- **Quản lý odometry**: `addOdometry()` - cập nhật thông tin vị trí robot +- **Navigation commands**: + - `moveTo(goal, …)` - di chuyển đến một điểm đích + - `moveTo(order, goal, …)` - một order VDA5050, được cắt thành từng chặng + - `executeInstantActions(actions)` - một message `instantActions` của VDA5050 (0..n action) +- **Điều khiển motion**: + - `pause()` - tạm dừng di chuyển + - `resume()` - tiếp tục di chuyển + - `cancel()` - hủy mục tiêu hiện tại + - `setTwistLinear()`, `setTwistAngular()` - điều khiển vận tốc +- **Lấy thông tin**: + - `getRobotPose()` - lấy vị trí hiện tại của robot + - `getTwist()` - lấy vận tốc hiện tại + - `getFeedback()` - lấy feedback về trạng thái navigation + - `getGlobalData()`, `getLocalData()` - lấy dữ liệu từ planner + +**Bốn entry point đã bị gỡ khỏi interface** + +`dockTo()` (hai overload), `moveStraightTo()` và `rotateTo()` không còn tồn tại. Chúng đẩy goal +thẳng vào lõi navigation, bỏ qua mission layer, nên một goal đến giữa chừng lặng lẽ thay thế chặng +mà hàng đợi mission đang chạy — rồi hàng đợi vẫn giao chặng kế tiếp của một tuyến robot đã rời khỏi. + +Bốn kiểu chuyển động đó **không mất**: chúng là thuộc tính của từng chặng trong order +(`profile: position | docking | go_straight | rotate`, cộng `marker` cho docking), nên đi cùng đường +với mọi chặng khác — cùng mission id, cùng vòng đời, cùng đường cancel. + +Ai còn gọi bốn hàm này: `nav_c_api` đã gỡ năm export tương ứng, `nav_c_api_2` gỡ +`navigation_dock_to_order_v2`, OPC-UA gỡ ba method node `DockToNode` / `RotateTo` / `MoveStraight`. +Binding .NET nào còn khai chúng sẽ hỏng lúc **chạy** (`EntryPointNotFoundException`), không phải lúc +biên dịch. + +**Đặc điểm:** + +- Tất cả các phương thức đều là pure virtual, đảm bảo implementation đầy đủ +- Hỗ trợ nhiều nguồn dữ liệu cảm biến với tên riêng biệt +- Cung cấp cả PoseStamped và Pose2D cho linh hoạt +- Thread-safe design với shared pointers + +### 2. `State` - Trạng thái Navigation + +Enum `State` mô tả các trạng thái khác nhau trong quá trình navigation. + +**Các trạng thái chính:** + +- **PENDING**: Chờ xử lý, mục tiêu đã được gửi nhưng chưa bắt đầu +- **ACTIVE**: Đang hoạt động, navigation đang được thực thi +- **PLANNING**: Đang lập kế hoạch đường đi +- **CONTROLLING**: Đang điều khiển robot di chuyển theo plan +- **CLEARING**: Đang dọn dẹp costmap, thực hiện recovery behaviors +- **PAUSED**: Tạm dừng navigation +- **SUCCEEDED**: Hoàn thành thành công +- **ABORTED**: Bị lỗi, không thể hoàn thành +- **PREEMPTED**: Bị hủy bởi mục tiêu mới +- **REJECTED**: Bị từ chối bởi planner hoặc controller +- **LOST**: Mất trạng thái, không xác định được vị trí + +**Ứng dụng:** + +- Theo dõi tiến trình navigation +- Debugging và logging +- Hiển thị trạng thái trong UI +- Điều khiển state machine của navigation system + +### 3. `NavFeedback` - Feedback Navigation + +Cấu trúc `NavFeedback` cung cấp thông tin chi tiết về trạng thái navigation hiện tại. + +**Các thành phần:** + +- **navigation_state**: Trạng thái hiện tại của navigation (State enum) +- **feed_back_str**: Chuỗi mô tả hoặc thông điệp debug +- **current_pose**: Vị trí hiện tại của robot (Pose2D) +- **goal_checked**: Cờ xác nhận mục tiêu đã được kiểm tra +- **is_ready**: Cờ cho biết robot đã sẵn sàng nhận lệnh + +**Ứng dụng:** + +- Cập nhật trạng thái real-time cho người dùng +- Debugging và monitoring +- Ghi log quá trình navigation +- Tích hợp với hệ thống giám sát + +### 4. `PlannerDataOutput` - Dữ liệu Planner + +Cấu trúc `PlannerDataOutput` chứa dữ liệu đầu ra từ planner. + +**Các thành phần:** + +- **plan**: Đường đi đã được lập kế hoạch (Path2D) +- **costmap**: Bản đồ chi phí (OccupancyGrid) +- **costmap_update**: Cập nhật bản đồ chi phí (OccupancyGridUpdate) + +**Ứng dụng:** + +- Lấy kế hoạch đường đi từ global/local planner +- Xem costmap để debugging +- Cập nhật costmap động +- Visualization và monitoring + +### 5. Utility Functions - Hàm hỗ trợ + +Các hàm tiện ích hỗ trợ các thao tác phổ biến. + +**`toString(State state)`**: + +- Chuyển đổi enum State sang chuỗi mô tả +- Hữu ích cho logging, debugging, hiển thị UI +- Trả về tên trạng thái dễ đọc (ví dụ: "PLANNING", "CONTROLLING") + +**`offset_goal()`**: + +- Tạo mục tiêu mới bằng cách offset từ vị trí hiện tại +- Hỗ trợ offset dọc theo hướng heading của robot +- Có hai overload: từ Pose2D và từ PoseStamped +- Hữu ích cho các tác vụ như di chuyển tiến/lùi một khoảng cách cố định + +## Ứng dụng + +### Trong Navigation System + +`move_base_core` là nền tảng cho các implementation navigation như `move_base`: + +- Định nghĩa contract mà tất cả navigation modules phải tuân theo +- Cho phép thay thế implementation mà không thay đổi code sử dụng +- Hỗ trợ plugin system cho các navigation strategies khác nhau + +### Trong User Applications + +Các ứng dụng sử dụng navigation system: + +- Gọi `moveTo()` hoặc `executeInstantActions()` để điều khiển robot +- Theo dõi `NavFeedback` để biết trạng thái navigation +- Sử dụng `getRobotPose()` để lấy vị trí hiện tại +- Quản lý dữ liệu cảm biến thông qua các phương thức add/remove + +### Trong Monitoring Systems + +Hệ thống giám sát và logging: + +- Sử dụng `State` để hiển thị trạng thái navigation +- Đọc `NavFeedback` để cập nhật UI real-time +- Sử dụng `toString()` để format log messages +- Lấy `PlannerDataOutput` để visualize costmap và plan + +## Best Practices + +### Implementation BaseNavigation + +- Implement đầy đủ tất cả pure virtual methods +- Đảm bảo thread-safety cho các phương thức public +- Cập nhật `nav_feedback_` một cách nhất quán +- Xử lý lỗi một cách graceful và cập nhật state phù hợp + +### Sử dụng State + +- Luôn kiểm tra state trước khi thực hiện các thao tác +- Sử dụng `toString()` cho logging thay vì hardcode strings +- Xử lý các trạng thái lỗi (ABORTED, REJECTED) một cách phù hợp + +### Quản lý Feedback + +- Cập nhật `navigation_state` ngay khi state thay đổi +- Cung cấp `feed_back_str` mô tả rõ ràng cho debugging +- Đảm bảo `current_pose` được cập nhật thường xuyên +- Sử dụng `is_ready` để kiểm tra robot sẵn sàng nhận lệnh + +### Quản lý Dữ liệu Cảm biến + +- Sử dụng tên rõ ràng, duy nhất cho mỗi nguồn dữ liệu +- Xóa dữ liệu không còn sử dụng để tiết kiệm bộ nhớ +- Kiểm tra dữ liệu tồn tại trước khi sử dụng +- Cập nhật dữ liệu thường xuyên để đảm bảo tính chính xác + +## Tính năng nổi bật + +### Header-Only Library + +- Không cần compile, chỉ cần include header files +- Dễ dàng tích hợp vào các project khác +- Không có runtime dependencies + +### ROS-Independent + +- Hoàn toàn độc lập với ROS +- Có thể sử dụng trong các ứng dụng C++ thuần +- Tương thích với các framework khác + +### Extensible Design + +- Dễ dàng mở rộng với các phương thức mới +- Hỗ trợ nhiều implementation khác nhau +- Plugin-friendly architecture + +### Type-Safe + +- Sử dụng strong typing với enums và structures +- Compile-time type checking +- Giảm thiểu lỗi runtime + +## Dependencies + +`move_base_core` phụ thuộc vào: + +- **tf3**: Transform library cho coordinate frames +- **robot_time**: Time utilities +- **robot_geometry_msgs**: Geometry message types +- **robot_nav_2d_msgs**: 2D navigation message types +- **robot_nav_msgs**: Navigation message types +- **robot_sensor_msgs**: Sensor message types +- **robot_map_msgs**: Map message types +- **robot_protocol_msgs**: Protocol message types + +## Tóm tắt + +`move_base_core` là nền tảng quan trọng cho navigation system, cung cấp: + +- Interface chuẩn hóa cho navigation modules +- Cấu trúc dữ liệu cho state và feedback +- Utility functions hỗ trợ các thao tác phổ biến +- Design linh hoạt, dễ mở rộng và không phụ thuộc ROS + +Thư viện này đảm bảo tính nhất quán và khả năng tương thích giữa các component navigation khác nhau, tạo nền tảng vững chắc cho việc phát triển các ứng dụng navigation phức tạp. diff --git a/src/Navigations/Cores/move_base_core/include/move_base_core/common.h b/src/Navigations/Cores/move_base_core/include/move_base_core/common.h new file mode 100644 index 0000000..985320b --- /dev/null +++ b/src/Navigations/Cores/move_base_core/include/move_base_core/common.h @@ -0,0 +1,18 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2025, Locus Robotics + * All rights reserved. + * + */ +#ifndef _MOVE_BASE_CORE_COMMON_H_INCLUDED_ +#define _MOVE_BASE_CORE_COMMON_H_INCLUDED_ + +#include +#include + +namespace robot +{ + using TFListenerPtr = std::shared_ptr; +} // namespace robot +#endif // NAV_CORE2_COMMON_H diff --git a/src/Navigations/Cores/move_base_core/include/move_base_core/navigation.h b/src/Navigations/Cores/move_base_core/include/move_base_core/navigation.h new file mode 100755 index 0000000..525bdb3 --- /dev/null +++ b/src/Navigations/Cores/move_base_core/include/move_base_core/navigation.h @@ -0,0 +1,548 @@ +#ifndef _MOVE_BASE_CORE_NAVIGATION_H_INCLUDED_ +#define _MOVE_BASE_CORE_NAVIGATION_H_INCLUDED_ + +#include + +// msgs +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// tf +#include +#include +#include +#include +#include +#include + +namespace robot +{ + namespace move_base_core + { + // Navigation states, including planning and controller status + enum class State + { + PENDING, + ACTIVE, + PREEMPTED, + SUCCEEDED, + ABORTED, + REJECTED, + PREEMPTING, + RECALLING, + RECALLED, + LOST, + PLANNING, + CONTROLLING, + CLEARING, + PAUSED + }; + + /** + * @brief Feedback structure to describe current navigation status + */ + struct NavFeedback + { + State navigation_state; // Current navigation state + std::string feed_back_str; // Description or debug message + robot_geometry_msgs::Pose2D current_pose; // Robot’s current pose in 2D + bool goal_checked; // Whether the current goal is verified + bool is_ready; // Robot is ready for commands + }; + + /** + * @brief Planner data output structure. + */ + struct PlannerDataOutput + { + robot_nav_2d_msgs::Path2D plan; + robot_nav_msgs::OccupancyGrid costmap; + robot_map_msgs::OccupancyGridUpdate costmap_update; + bool is_costmap_updated; + robot_geometry_msgs::PolygonStamped footprint; + }; + + /** + * @brief Convert a State enum to its string representation. + * Useful for debugging/logging or displaying in UI. + * + * @param state Enum value of move_base_core::State + * @return std::string The corresponding string, e.g. "PENDING" + */ + inline std::string toString(move_base_core::State state) + { + using move_base_core::State; + switch (state) + { + case State::PENDING: + return "PENDING"; // Chờ xử lý + case State::ACTIVE: + return "ACTIVE"; // Đang hoạt động + case State::PREEMPTED: + return "PREEMPTED"; // Đã bị huỷ bởi yêu cầu mới + case State::SUCCEEDED: + return "SUCCEEDED"; // Thành công + case State::ABORTED: + return "ABORTED"; // Bị lỗi + case State::REJECTED: + return "REJECTED"; // Từ chối bởi planner hoặc controller + case State::PREEMPTING: + return "PREEMPTING"; // Đang huỷ bỏ theo yêu cầu + case State::RECALLING: + return "RECALLING"; // Đang huỷ bỏ nội bộ + case State::RECALLED: + return "RECALLED"; // Đã được thu hồi + case State::LOST: + return "LOST"; // Mất trạng thái + case State::PLANNING: + return "PLANNING"; // Đang lập kế hoạch đường đi + case State::CONTROLLING: + return "CONTROLLING"; // Đang điều khiển robot di chuyển theo plan + case State::CLEARING: + return "CLEARING"; // Đang dọn dẹp bản đồ / costmap + case State::PAUSED: + return "PAUSED"; // Tạm dừng + default: + return "UNKNOWN_STATE"; // Không xác định + } + } + + /** + * @brief Creates a target pose (PoseStamped) by offsetting a given 2D pose along its heading direction. + * + * This function calculates a new position by moving forward (or backward if negative) + * a certain `offset_distance` from the current position, following the given heading angle (theta). + * + * @param pose The original 2D pose (x, y, theta) in the local plane. + * @param frame_id The coordinate frame in which the output PoseStamped will be expressed. + * @param offset_distance The distance to offset along the heading direction, in meters. + * Positive moves forward, negative moves backward. + * @return A new PoseStamped offset from the input pose, in the given frame. + */ + inline robot_geometry_msgs::PoseStamped offset_goal(const robot_geometry_msgs::Pose2D &pose, const std::string &frame_id, double offset_distance) + { + robot_geometry_msgs::PoseStamped goal; + goal.header.frame_id = frame_id; + goal.header.stamp = robot::Time::now(); + goal.pose.position.x = pose.x + offset_distance * cos(pose.theta); + goal.pose.position.y = pose.y + offset_distance * sin(pose.theta); + goal.pose.orientation = robot_nav_2d_utils::pose2DToPose(pose).orientation; + return goal; + } + + /** + * @brief Overloaded version: creates an offset target pose from a given PoseStamped. + * + * This function extracts the 2D position and orientation (yaw) from the given PoseStamped, + * offsets it forward (or backward) along the current heading direction, + * and returns a new PoseStamped in the same frame. + * + * @param pose The original pose with full position and orientation. + * @param offset_distance Distance to offset along the current heading direction (in meters). + * @return A new PoseStamped offset from the original pose. + */ + inline robot_geometry_msgs::PoseStamped offset_goal(const robot_geometry_msgs::PoseStamped &pose, double offset_distance) + { + robot_geometry_msgs::Pose2D pose2d; + pose2d.x = pose.pose.position.x; + pose2d.y = pose.pose.position.y; + pose2d.theta = robot_nav_2d_utils::poseStampedToPose2D(pose).pose.theta; + return offset_goal(pose2d, pose.header.frame_id, offset_distance); + } + + /** + * @class BaseNavigation + * @brief Abstract interface for robot navigation modules. + * + * Provides core methods for setting goals, moving, rotating, and handling motion control. + * All navigation logic must implement this interface. + */ + class BaseNavigation + { + public: + using Ptr = std::shared_ptr; + robot_nav_msgs::OccupancyGrid map_save_; + std::string map_name_save_; + virtual ~BaseNavigation() {} + + /** + * @brief Initialize the navigation system. + * @param tf Shared pointer to the TF listener or buffer. + */ + virtual void initialize(TFListenerPtr tf) = 0; + + /** + * @brief Stop internal activity (control loop, planner...) before destruction. + * + * The host MUST be able to quiesce the navigation core at a chosen point in its + * own shutdown sequence, while the process is still fully alive — destroying the + * object from a static-destruction context after main() has returned is exactly + * the race that produced boost::lock_error crashes. Default is a no-op so legacy + * implementations remain source-compatible; after this call the object must stop + * producing velocity commands, and queries (getFeedback, getTwist...) must remain + * safe to call. Safe to call multiple times. + */ + virtual void shutdown() {} + + /** + * @brief Set the robot's footprint (outline shape) in the global frame. + * This can be used for planning or collision checking. + * + * @param fprt A vector of points representing the robot's footprint polygon. + * The points should be ordered counter-clockwise. + * Example: + * + ^ Y + | + | P3(-0.3, 0.2) P2(0.3, 0.2) + | ●---------------● + | | | + | | Robot | (view Top ) + | | | + | ●---------------● + | P4(-0.3, -0.2) P1(0.3, -0.2) + +-------------------------------> X + + std::vector footprint; + 1. footprint.push_back(make_point(0.3, -0.2)); + 2. footprint.push_back(make_point(0.3, 0.2)); + 3. footprint.push_back(make_point(-0.3, 0.2)); + 4. footprint.push_back(make_point(-0.3, -0.2)); + */ + virtual void setRobotFootprint(const std::vector &fprt) = 0; + + /** + * @brief Get the robot's footprint (outline shape) in the global frame. + * @return A vector of points representing the robot's footprint polygon. + */ + virtual std::vector getRobotFootprint() = 0; + + /** + * @brief Add a static map to the navigation system. + * @param map_name The name of the map. + * @param map The map to add. + */ + virtual void addStaticMap(const std::string &map_name, robot_nav_msgs::OccupancyGrid map) = 0; + + /** + * @brief Add a laser scan to the navigation system. + * @param laser_scan_name The name of the laser scan. + * @param laser_scan The laser scan to add. + */ + virtual void addLaserScan(const std::string &laser_scan_name, robot_sensor_msgs::LaserScan laser_scan) = 0; + + /** + * @brief Add a point cloud to the navigation system. + * @param point_cloud_name The name of the point cloud. + * @param point_cloud The point cloud to add. + */ + virtual void addPointCloud(const std::string &point_cloud_name, robot_sensor_msgs::PointCloud point_cloud) = 0; + + /** + * @brief Add a point cloud2 to the navigation system. + * @param point_cloud2_name The name of the point cloud2. + * @param point_cloud2 The point cloud2 to add. + */ + virtual void addPointCloud2(const std::string &point_cloud2_name, robot_sensor_msgs::PointCloud2 point_cloud2) = 0; + + /** + * @brief Add one coherent depth-camera sample to the navigation system. + * @param topic The logical topic of the combined depth-camera stream. + * @param data Depth image and matching camera intrinsics. + */ + virtual void addDepthCameraData(const std::string &topic, + robot_sensor_msgs::DepthCameraData::ConstPtr data) = 0; + + /** + * @brief Get a static map from the navigation system. + * @param map_name The name of the map. + * @return The map. + */ + virtual robot_nav_msgs::OccupancyGrid getStaticMap(const std::string &map_name) = 0; + + /** + * @brief Get a laser scan from the navigation system. + * @param laser_scan_name The name of the laser scan. + * @return The laser scan. + */ + virtual robot_sensor_msgs::LaserScan getLaserScan(const std::string &laser_scan_name) = 0; + + /** + * @brief Get a point cloud from the navigation system. + * @param point_cloud_name The name of the point cloud. + * @return The point cloud. + */ + virtual robot_sensor_msgs::PointCloud getPointCloud(const std::string &point_cloud_name) = 0; + + /** + * @brief Get a point cloud2 from the navigation system. + * @param point_cloud2_name The name of the point cloud2. + * @return The point cloud2. + */ + virtual robot_sensor_msgs::PointCloud2 getPointCloud2(const std::string &point_cloud2_name) = 0; + + /** + * @brief Get all static maps from the navigation system. + * @return The static maps. + */ + virtual std::map getAllStaticMaps() = 0; + + /** + * @brief Get all laser scans from the navigation system. + * @return The laser scans. + */ + virtual std::map getAllLaserScans() = 0; + + /** + * @brief Get all point clouds from the navigation system. + * @return The point clouds. + */ + virtual std::map getAllPointClouds() = 0; + + /** + * @brief Get all point cloud2s from the navigation system. + * @return The point cloud2s. + */ + virtual std::map getAllPointCloud2s() = 0; + + /** + * @brief Remove a static map from the navigation system. + * @param map_name The name of the map. + * @return True if the map was removed successfully. + */ + virtual bool removeStaticMap(const std::string &map_name) = 0; + + /** + * @brief Remove a laser scan from the navigation system. + * @param laser_scan_name The name of the laser scan. + * @return True if the laser scan was removed successfully. + */ + virtual bool removeLaserScan(const std::string &laser_scan_name) = 0; + + /** + * @brief Remove a point cloud from the navigation system. + * @param point_cloud_name The name of the point cloud. + * @return True if the point cloud was removed successfully. + */ + virtual bool removePointCloud(const std::string &point_cloud_name) = 0; + + /** + * @brief Remove a point cloud2 from the navigation system. + * @param point_cloud2_name The name of the point cloud2. + * @return True if the point cloud2 was removed successfully. + */ + virtual bool removePointCloud2(const std::string &point_cloud2_name) = 0; + + /** + * @brief Remove all static maps from the navigation system. + * @return True if the static maps were removed successfully. + */ + virtual bool removeAllStaticMaps() = 0; + + /** + * @brief Remove all laser scans from the navigation system. + * @return True if the laser scans were removed successfully. + */ + virtual bool removeAllLaserScans() = 0; + + /** + * @brief Remove all point clouds from the navigation system. + * @return True if the point clouds were removed successfully. + */ + virtual bool removeAllPointClouds() = 0; + + /** + * @brief Remove all point cloud2s from the navigation system. + * @return True if the point cloud2s were removed successfully. + */ + virtual bool removeAllPointCloud2s() = 0; + + /** + * @brief Remove all data from the navigation system. + * @return True if the data was removed successfully. + */ + virtual bool removeAllData() = 0; + + /** + * @brief Add an odometry to the navigation system. + * @param odometry_name The name of the odometry. + * @param odometry The odometry to add. + */ + virtual void addOdometry(const std::string &odometry_name, robot_nav_msgs::Odometry odometry) = 0; + + /** + * @brief Send a goal for the robot to navigate to. + * @param goal Target pose in the global frame. + * @param xy_goal_tolerance Acceptable error in X/Y (meters). + * @param yaw_goal_tolerance Acceptable angular error (radians). + * @return True if goal was accepted and sent successfully. + */ + virtual bool moveTo(const robot_geometry_msgs::PoseStamped &goal, + double xy_goal_tolerance = 0.0, + double yaw_goal_tolerance = 0.0) = 0; + + /** + * @brief Send a goal for the robot to navigate to. + * @param msg Order message. + * @param goal Target pose in the global frame. + * @param xy_goal_tolerance Acceptable error in X/Y (meters). + * @param yaw_goal_tolerance Acceptable angular error (radians). + * @return True if goal was accepted and sent successfully. + */ + virtual bool moveTo(const robot_protocol_msgs::Order &msg, + const robot_geometry_msgs::PoseStamped &goal, + double xy_goal_tolerance = 0.0, + double yaw_goal_tolerance = 0.0) = 0; + + /** + * Docking, go-straight and rotate are no longer entry points of this contract. + * + * They used to exist as `dockTo` (two overloads), `moveStraightTo` and `rotateTo`, each + * pushing a goal straight into the navigation core and bypassing the mission layer. That + * bypass had no defined preemption semantics: a goal arriving through one of them silently + * replaced whatever leg the mission queue was running, and the queue kept handing out the + * next leg of a route the robot had already left. + * + * The motion profiles themselves are unchanged and still reachable — an order carries them + * per leg (`profile: docking | go_straight | rotate`, plus `marker` for docking), so they + * now travel the same path as every other leg: one mission id, one lifecycle, one cancel. + */ + + /** + * @brief Execute one VDA5050 `instantActions` message — a list of actions sent outside any order. + * + * This is the one entry point that takes bare actions. It exists because the four + * removed above did not: it does not push anything into the core directly. The actions + * are handed to the mission layer, which expands each against the same compound-action + * table that node actions use and queues the resulting legs, so an instantAction gets + * the same mission id, lifecycle and cancel path as any other work. + * + * The whole message goes down as ONE batch, in the order given. Submitting the actions + * one at a time would break as soon as a message carried two of them: the second `HARD` + * action preempts and wipes the legs of the first, so two commands sent together would + * eat each other. + * + * Execution stops at the first leg that fails, and the rest of the message is dropped + * with it (`clear_queue_on_failure`). The caller therefore reports one outcome for the + * message, not one per action. + * + * `blockingType` decides how the batch meets a running order: any `HARD` action makes + * the whole message preempt it; otherwise it queues behind it. `NONE` asks for + * execution in parallel with driving, which this runtime cannot do — it is queued + * instead, and the narrowing is logged. + * + * Lifecycle instantActions — `cancelOrder`, `startPause`, `stopPause` — must NOT come + * through here. They steer the queue rather than being work in it; the host calls + * @ref cancel, @ref pause and @ref resume for those. + * + * @param actions The actions of one `instantActions` message, in the order received. + * Must not be empty; every action needs `actionType` and `actionId`. + * @return True if the message was accepted. False means it was rejected outright — empty + * list, missing identity, or the mission layer is not running — and the caller + * must report failure rather than wait for a result that will not come. + */ + virtual bool executeInstantActions( + const std::vector &actions) = 0; + + /** + * @brief Pause the robot's movement (e.g. during obstacle avoidance). + */ + virtual void pause() = 0; + + /** + * @brief Resume motion after a pause. + */ + virtual void resume() = 0; + + /** + * @brief Cancel the current goal and stop the robot. + */ + virtual void cancel() = 0; + + /** + * @brief Send limited linear velocity command. + * @param linear Linear velocity vector (x, y, z). + * @return True if the command was accepted. + */ + virtual bool setTwistLinear(const robot_geometry_msgs::Vector3 &linear) = 0; + + /** + * @brief Send limited angular velocity command. + * @param angular Angular velocity vector (x, y, z). + * @return True if the command was accepted. + */ + virtual bool setTwistAngular(const robot_geometry_msgs::Vector3 &angular) = 0; + + /** + * @brief Get the robot’s pose as a PoseStamped. + * @param pose Output parameter with the robot’s current pose. + * @return True if pose was successfully retrieved. + */ + virtual bool getRobotPose(robot_geometry_msgs::PoseStamped &pose) = 0; + + /** + * @brief Get the robot’s pose as a 2D pose. + * @param pose Output parameter with the robot’s current 2D pose. + * @return True if pose was successfully retrieved. + */ + virtual bool getRobotPose(robot_geometry_msgs::Pose2D &pose) = 0; + + /** + * @brief Get the robot’s twist. + * @return The robot’s current twist. + */ + virtual robot_nav_2d_msgs::Twist2DStamped getTwist() = 0; + + /** + * @brief Get the navigation feedback. + * @return Pointer to the navigation feedback. + */ + virtual NavFeedback *getFeedback() = 0; + + /** + * @brief Get the global data. + * @return The global data. + */ + virtual PlannerDataOutput getGlobalData() = 0; + + /** + * @brief Get the local data. + * @return The local data. + */ + virtual PlannerDataOutput getLocalData() = 0; + + protected: + // Shared feedback data for navigation status tracking + std::shared_ptr nav_feedback_; + robot_nav_2d_msgs::Twist2DStamped twist_; + robot_nav_msgs::Odometry odometry_; + PlannerDataOutput global_data_; + PlannerDataOutput local_data_; + + std::map static_maps_; + std::map laser_scans_; + std::map point_clouds_; + std::map point_cloud2s_; + + BaseNavigation() = default; + }; + + } // namespace move_base_core +}; + +#endif // _MOVE_BASE_CORE_NAVIGATION_H_INCLUDED_ diff --git a/src/Navigations/Cores/move_base_core/package.xml b/src/Navigations/Cores/move_base_core/package.xml new file mode 100644 index 0000000..cc70819 --- /dev/null +++ b/src/Navigations/Cores/move_base_core/package.xml @@ -0,0 +1,45 @@ + + move_base_core + 0.7.10 + + move_base_core provides the core interfaces and data structures for robot navigation + systems, independent of ROS. It includes: + - BaseNavigation: Abstract interface defining navigation operations (moveTo, dockTo, rotateTo, etc.) + - State: Navigation state enumeration (PLANNING, CONTROLLING, CLEARING, SUCCEEDED, etc.) + - NavFeedback: Structure for navigation status feedback + - PlannerDataOutput: Structure for planner output data + - Helper functions: State conversion, goal offsetting utilities + + This package serves as the foundation for implementing navigation modules, providing + a standardized API for goal-based navigation, motion control, and status reporting + in standalone C++ applications. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/move_base_core + + catkin + + robot_time + robot_geometry_msgs + robot_protocol_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_msgs + robot_sensor_msgs + robot_map_msgs + + + robot_time + robot_geometry_msgs + robot_protocol_msgs + robot_nav_2d_msgs + robot_nav_2d_utils + robot_nav_msgs + robot_sensor_msgs + robot_map_msgs + \ No newline at end of file diff --git a/src/Navigations/Cores/robot_nav_core/CHANGELOG.rst b/src/Navigations/Cores/robot_nav_core/CHANGELOG.rst new file mode 100755 index 0000000..06388d8 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core/CHANGELOG.rst @@ -0,0 +1,112 @@ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Changelog for package robot_nav_core +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +1.17.3 (2023-01-10) +------------------- + +1.17.2 (2022-06-20) +------------------- + +1.17.1 (2020-08-27) +------------------- + +1.17.0 (2020-04-02) +------------------- +* Merge pull request `#982 `_ from ros-planning/noetic_prep + Noetic Migration +* increase required cmake version +* Contributors: Michael Ferguson + +1.16.6 (2020-03-18) +------------------- + +1.16.5 (2020-03-15) +------------------- + +1.16.4 (2020-03-04) +------------------- + +1.16.3 (2019-11-15) +------------------- + +1.16.2 (2018-07-31) +------------------- + +1.16.1 (2018-07-28) +------------------- + +1.16.0 (2018-07-25) +------------------- +* Switch to TF2 `#755 `_ +* unify parameter names between base_local_planner and dwa_local_planner + addresses parts of `#90 `_ +* fix param names of RotateRecovery, closes `#706 `_ +* Contributors: David V. Lu, Michael Ferguson, Vincent Rabaud + +1.15.2 (2018-03-22) +------------------- +* Merge pull request `#673 `_ from ros-planning/email_update_lunar + update maintainer email (lunar) +* Merge pull request `#649 `_ from aaronhoy/lunar_add_ahoy + Add myself as a maintainer. +* Contributors: Aaron Hoy, Michael Ferguson + +1.15.1 (2017-08-14) +------------------- + +1.15.0 (2017-08-07) +------------------- +* convert packages to format2 +* makePlan overload must return. +* Contributors: Eric Tappan, Mikael Arguedas + +1.14.0 (2016-05-20) +------------------- + +1.13.1 (2015-10-29) +------------------- +* Merge pull request `#338 `_ from mikeferguson/planner_review +* fix doxygen, couple style fixes +* Contributors: Michael Ferguson + +1.13.0 (2015-03-17) +------------------- +* adding makePlan function with returned cost to base_global_planner +* Contributors: phil0stine + +1.12.0 (2015-02-04) +------------------- +* update maintainer email +* Contributors: Michael Ferguson + +1.11.15 (2015-02-03) +-------------------- + +1.11.14 (2014-12-05) +-------------------- + +1.11.13 (2014-10-02) +-------------------- + +1.11.12 (2014-10-01) +-------------------- + +1.11.11 (2014-07-23) +-------------------- + +1.11.10 (2014-06-25) +-------------------- + +1.11.9 (2014-06-10) +------------------- + +1.11.8 (2014-05-21) +------------------- + +1.11.7 (2014-05-21) +------------------- + +1.11.4 (2013-09-27) +------------------- +* Package URL Updates diff --git a/src/Navigations/Cores/robot_nav_core/CMakeLists.txt b/src/Navigations/Cores/robot_nav_core/CMakeLists.txt new file mode 100644 index 0000000..ee72fc3 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core/CMakeLists.txt @@ -0,0 +1,147 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_nav_core VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_nav_core with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_nav_core with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_costmap_2d + tf3 + robot_protocol_msgs + ) + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_costmap_2d + robot_protocol_msgs + ) + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + catkin_package( + INCLUDE_DIRS include + # LIBRARIES không cần vì đây là header-only library + CATKIN_DEPENDS robot_costmap_2d robot_protocol_msgs + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${TF3_INCLUDE_DIR} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/robot_nav_core/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PACKAGES_DIR} + ${TF3_LIBRARY} + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: robot_costmap_2d, tf3, robot_protocol_msgs") + message(STATUS "=================================") +endif() diff --git a/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_global_planner.h b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_global_planner.h new file mode 100755 index 0000000..d66d168 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_global_planner.h @@ -0,0 +1,112 @@ +/********************************************************************* +* +* Software License Agreement (BSD License) +* +* Copyright (c) 2008, Willow Garage, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided +* with the distribution. +* * Neither the name of Willow Garage, Inc. nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Eitan Marder-Eppstein +*********************************************************************/ +#ifndef ROBOT_NAV_CORE_BASE_GLOBAL_PLANNER_H +#define ROBOT_NAV_CORE_BASE_GLOBAL_PLANNER_H + +#include +#include +#include +#include + +namespace robot_nav_core { + /** + * @class BaseGlobalPlanner + * @brief Provides an interface for global planners used in navigation. All global planners written as plugins for the navigation stack must adhere to this interface. + */ + class BaseGlobalPlanner{ + public: + using Ptr = std::shared_ptr; + + /** + * @brief Given a goal pose in the world, compute a plan + * @param start The start pose + * @param goal The goal pose + * @param plan The plan... filled by the planner + * @return True if a valid plan was found, false otherwise + */ + virtual bool makePlan(const robot_geometry_msgs::PoseStamped& start, + const robot_geometry_msgs::PoseStamped& goal, std::vector& plan) = 0; + + /** + * @brief Given a goal pose in the world, compute a plan + * @param start The start pose + * @param goal The goal pose + * @param plan The plan... filled by the planner + * @param cost The plans calculated cost + * @return True if a valid plan was found, false otherwise + */ + virtual bool makePlan(const robot_geometry_msgs::PoseStamped& start, + const robot_geometry_msgs::PoseStamped& goal, std::vector& plan, + double& cost) + { + cost = 0; + return false; + } + + /** + * @brief Given a goal pose in the world, compute a plan + * @param start The start pose + * @param goal The goal pose + * @param plan The plan... filled by the planner + * @return True if a valid plan was found, false otherwise + */ + virtual bool makePlan(const robot_protocol_msgs::Order& msg, + const robot_geometry_msgs::PoseStamped& start, + const robot_geometry_msgs::PoseStamped& goal, + std::vector& plan) + { + return false; + } + + /** + * @brief Initialization function for the BaseGlobalPlanner + * @param name The name of this planner + * @param costmap_robot A pointer to the wrapper of the costmap to use for planning + */ + virtual bool initialize(std::string name, robot_costmap_2d::Costmap2DROBOT* costmap_robot) = 0; + + /** + * @brief Virtual destructor for the interface + */ + virtual ~BaseGlobalPlanner(){} + + protected: + BaseGlobalPlanner(){} + }; +} // namespace robot_nav_core + +#endif // ROBOT_NAV_CORE_BASE_GLOBAL_PLANNER_H \ No newline at end of file diff --git a/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_local_planner.h b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_local_planner.h new file mode 100755 index 0000000..6225cdb --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/base_local_planner.h @@ -0,0 +1,180 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + *********************************************************************/ +#ifndef ROBOT_NAV_CORE_BASE_LOCAL_PLANNER_H +#define ROBOT_NAV_CORE_BASE_LOCAL_PLANNER_H + +#include +#include +#include +#include +#include +#include + +namespace robot_nav_core +{ + /** + * @class BaseLocalPlanner + * @brief Provides an interface for local planners used in navigation. All local planners written as plugins for the navigation stack must adhere to this interface. + */ + class BaseLocalPlanner + { + public: + using Ptr = std::shared_ptr; + /** + * @brief Given the current position, orientation, and velocity of the robot, compute velocity commands to send to the base + * @param velocity The velocity of the robot + * @param cmd_vel Will be filled with the velocity command to be passed to the robot base + * @return True if a valid velocity command was found, false otherwise + */ + virtual bool computeVelocityCommands(const robot_geometry_msgs::Twist &velocity, robot_geometry_msgs::Twist &cmd_vel) = 0; + + /** + * @brief Swap object will be injected interjace robot_nav_core::BaseLocalPlanner + * @param planner_name The object name + * @return True if instance object is successed, False otherwise + */ + virtual bool swapPlanner(std::string planner_name) { return false; } + + /** + * @brief Set velocity for x, y asix of the robot + * @param linear the command velocity + * @return True if set is done, false otherwise + */ + virtual bool setTwistLinear(robot_geometry_msgs::Vector3 linear) { return false; } + + /** + * @brief Get velocity for x, y asix of the robot + * @param linear The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistLinear(bool direct) { throw std::runtime_error("Function getTwistLinear is not Support."); } + + /** + * @brief Set velocity theta for z asix of the robot + * @param angular the command velocity + * @return True if set is done, false otherwise + */ + virtual bool setTwistAngular(robot_geometry_msgs::Vector3 angular) { return false; } + + /** + * @brief Get velocity theta for z asix of the robot + * @param direct The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistAngular(bool direct) { throw std::runtime_error("Function getTwistLinear is not Support."); } + + /** + * @brief Get velocity for x, y asix of the robot + * @return The current velocity + */ + virtual robot_geometry_msgs::Twist getActualTwist() { throw std::runtime_error("Function getActualTwist is not Support."); } + + /** + * @brief Check if the kinematic parameters are currently locked + * @return True if the kinematic parameters are locked, false otherwise + * + * This function indicates whether the kinematic parameters (e.g., velocities, accelerations, or direction settings) are in a locked state, preventing modifications. If the parameters are locked during in-place rotation, it could prevent updates to the direction or velocity, potentially causing inconsistencies in motion commands that lead to odometry errors and localization jumps in AMCL. + */ + virtual bool islock() {throw std::runtime_error("Function islock is not Support.");} + + /** + * @brief Lock the kinematic parameters to prevent modifications + */ + virtual void lock() {throw std::runtime_error("Function lock is not Support.");} + + /** + * @brief Unlock the kinematic parameters to allow modifications + */ + virtual void unlock() {throw std::runtime_error("Function unlock is not Support.");} + + /** + * @brief Check if the goal pose has been achieved by the local planner + * @return True if achieved, false otherwise + */ + virtual bool isGoalReached() = 0; + + /** + * @brief Set the plan that the local planner is following + * @param plan The plan to pass to the local planner + * @return True if the plan was updated successfully, false otherwise + */ + virtual bool setPlan(const std::vector &plan) = 0; + + /** + * @brief Gets the global plan for this local planner. + * + * @param path The global plan + */ + virtual void getPlan(std::vector &path) = 0; + + + /** + * @brief Gets the current global plan + * @param path The global plan + */ + virtual void getGlobalPlan(std::vector &path) = 0; + + /** + * @brief Constructs the local planner + * @param name The name to give this instance of the local planner + * @param tf A pointer to a transform listener + * @param costmap_robot The cost map to use for assigning costs to local plans + */ + virtual void initialize(std::string name, tf3::BufferCore *tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) = 0; + + /** + * @brief Set the odometry of the robot + * @param odom The odometry of the robot + */ + virtual void setOdom(robot_nav_msgs::Odometry *odom) { odom_ = odom; } + + /** + * @brief Virtual destructor for the interface + */ + virtual ~BaseLocalPlanner() {} + + protected: + BaseLocalPlanner() {} + + /** + * @brief The odometry of the robot + */ + robot_nav_msgs::Odometry *odom_; + }; +} // namespace robot_nav_core + +#endif // ROBOT_NAV_CORE_BASE_LOCAL_PLANNER_H diff --git a/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/parameter_magic.h b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/parameter_magic.h new file mode 100755 index 0000000..a5794d1 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/parameter_magic.h @@ -0,0 +1,86 @@ +/********************************************************************* +* +* Software License Agreement (BSD License) +* +* Copyright (c) 2018, Open Source Robotics Foundation +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided +* with the distribution. +* * Neither the name of OSRF nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: David Lu +*********************************************************************/ + +#ifndef ROBOT_NAV_CORE_PARAMETER_MAGIC_H +#define ROBOT_NAV_CORE_PARAMETER_MAGIC_H + +namespace robot_nav_core +{ + +/** + * @brief Load a parameter from one of two namespaces. Complain if it uses the old name. + * @param nh NodeHandle to look for the parameter in + * @param current_name Parameter name that is current, i.e. not deprecated + * @param old_name Deprecated parameter name + * @param default_value If neither parameter is present, return this value + * @return The value of the parameter or the default value + */ +template +param_t loadParameterWithDeprecation(const std::string current_name, + const std::string old_name, const param_t& default_value) +{ + param_t value; + if (nh.hasParam(current_name)) + { + nh.getParam(current_name, value); + return value; + } + if (nh.hasParam(old_name)) + { + ROS_WARN("Parameter %s is deprecated. Please use the name %s instead.", old_name.c_str(), current_name.c_str()); + nh.getParam(old_name, value); + return value; + } + return default_value; +} + +/** + * @brief Warn if a parameter exists under a deprecated (and unsupported) name. + * + * Parameters loaded exclusively through dynamic reconfigure can't really use loadParamWithDeprecation. + */ +void warnRenamedParameter(const std::string current_name, const std::string old_name) +{ + if (nh.hasParam(old_name)) + { + ROS_WARN("Parameter %s is deprecated (and will not load properly). Use %s instead.", old_name.c_str(), current_name.c_str()); + } +} + +} // namespace robot_nav_core + +#endif // ROBOT_NAV_CORE_PARAMETER_MAGIC_H diff --git a/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/recovery_behavior.h b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/recovery_behavior.h new file mode 100755 index 0000000..1e56687 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core/include/robot_nav_core/recovery_behavior.h @@ -0,0 +1,77 @@ +/********************************************************************* +* +* Software License Agreement (BSD License) +* +* Copyright (c) 2009, Willow Garage, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided +* with the distribution. +* * Neither the name of Willow Garage, Inc. nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Eitan Marder-Eppstein +*********************************************************************/ +#ifndef ROBOT_NAV_CORE_RECOVERY_BEHAVIOR_H +#define ROBOT_NAV_CORE_RECOVERY_BEHAVIOR_H + +#include +#include +#include + +namespace robot_nav_core { + /** + * @class RecoveryBehavior + * @brief Provides an interface for recovery behaviors used in navigation. All recovery behaviors written as plugins for the navigation stack must adhere to this interface. + */ + class RecoveryBehavior{ + public: + + using Ptr = std::shared_ptr; + + /** + * @brief Initialization function for the RecoveryBehavior + * @param tf A pointer to a transform listener + * @param global_costmap A pointer to the global_costmap used by the navigation stack + * @param local_costmap A pointer to the local_costmap used by the navigation stack + */ + virtual void initialize(std::string name, tf3::BufferCore* tf, robot_costmap_2d::Costmap2DROBOT* global_costmap, robot_costmap_2d::Costmap2DROBOT* local_costmap) = 0; + + /** + * @brief Runs the RecoveryBehavior + */ + virtual void runBehavior() = 0; + + /** + * @brief Virtual destructor for the interface + */ + virtual ~RecoveryBehavior(){} + + protected: + RecoveryBehavior(){} + }; +} // namespace robot_nav_core + +#endif // ROBOT_NAV_CORE_RECOVERY_BEHAVIOR_H diff --git a/src/Navigations/Cores/robot_nav_core/package.xml b/src/Navigations/Cores/robot_nav_core/package.xml new file mode 100644 index 0000000..bce7b7f --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core/package.xml @@ -0,0 +1,31 @@ + + robot_nav_core + 0.7.10 + + robot_nav_core is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. robot_nav_core + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_nav_core + + catkin + + robot_costmap_2d + robot_costmap_2d + + + + + robot_protocol_msgs + robot_protocol_msgs + + \ No newline at end of file diff --git a/src/Navigations/Cores/robot_nav_core2/CMakeLists.txt b/src/Navigations/Cores/robot_nav_core2/CMakeLists.txt new file mode 100755 index 0000000..9e613df --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/CMakeLists.txt @@ -0,0 +1,154 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_nav_core2 VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_nav_core2 with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_nav_core2 with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_costmap_2d + tf3 + nav_grid + robot_nav_2d_msgs + robot_cpp + robot_geometry_msgs + ) + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_costmap_2d + nav_grid + robot_nav_2d_msgs + robot_cpp + robot_geometry_msgs + ) + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + catkin_package( + INCLUDE_DIRS include + # LIBRARIES không cần vì đây là header-only library + CATKIN_DEPENDS robot_costmap_2d nav_grid robot_nav_2d_msgs robot_cpp robot_geometry_msgs + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${TF3_INCLUDE_DIR} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/robot_nav_core2/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + ${TF3_LIBRARY} + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PACKAGES_DIR} + ${TF3_LIBRARY} + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: robot_costmap_2d, nav_grid, robot_nav_2d_msgs, robot_cpp, robot_geometry_msgs") + message(STATUS "=================================") +endif() diff --git a/src/Navigations/Cores/robot_nav_core2/README.md b/src/Navigations/Cores/robot_nav_core2/README.md new file mode 100755 index 0000000..99a4b9e --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/README.md @@ -0,0 +1,52 @@ +# robot_nav_core2 +A replacement interface for [robot_nav_core2](https://github.com/ros-planning/navigation/tree/a2837b5a9dc6dd4b4da176fca7d899d6a3722bf8/robot_nav_core2/include/robot_nav_core2) that defines basic two dimensional planner interfaces. + +There were a few key reasons for creating new interfaces rather than extending the old ones. + * Use `robot_nav_2d_msgs` to eliminate unused data fields + * Use a new `Costmap` interface as a plugin rather that forcing all implementations of the interfaces to use `robot_costmap_2d::Costmap2DROBOT`. + * Provide more data in the interfaces for easier testing. + * Use Exceptions rather than booleans to provide more information about the types of errors encountered. + +## `Costmap` +`robot_costmap_2d::Costmap2DROBOT` has been a vital part of the navigation stack for years, but it was not without its flaws. + * Initialization required a transform be available from the global frame to the base frame, which was later used to move rolling costmaps around (and a few other things). This made doing simple testing of any planner or other `Costmap2DROBOT`-based behavior annoying, because transforms had to be set up, often outside of the immediate code that was being tested. + * Initialization also started an update thread, which is also not always needed in testing. + * Using `Costmap2DROBOT` locked users into a layered costmap based approach, which made some tasks much easier, but didn't give users the freedom to change the implementation. + +The [`robot_nav_core2::Costmap`](include/robot_nav_core2/costmap.h) interface extends the `nav_grid::NavGrid` for abstracting away the data storage and coordinate manipulation, and provides a few other key methods for costmap functioning such as + * a mutex + * a way to potentially track changes to the costmap + * a public `update` method that can be called in whatever thread you please + +The `Costmap` can be loaded using `pluginlib`, allowing for arbitrary implementations of underlying update algorithms, include the layered costmap approach. + +One basic implementation is provided in [`BasicCostmap`](include/robot_nav_core2/basic_costmap.h). You can also use the `robot_nav_core2_adapter::CostmapAdapter` class which implements the `Costmap` interface while allowing you to still use `Costmap2DROBOT`. + +Note: One could also imagine the `Costmap` interface being templatized itself like `NavGrid` instead of forcing use of `unsigned char`. While this may be possible, it was decided that it was a bit ambitious and the use of templates would force all of the implementation into headers, and would ultimately obfuscate the operation of algorithms. + +## Global Planner +Let us compare the old [robot_nav_core2::BaseGlobalPlanner](https://github.com/ros-planning/navigation/blob/a2837b5a9dc6dd4b4da176fca7d899d6a3722bf8/robot_nav_core2/include/robot_nav_core2/base_global_planner.h) to the new [robot_nav_core2/GlobalPlanner](include/robot_nav_core2/global_planner.h). + +| `robot_nav_core2` | `robot_nav_core2` | comments | +|---|--|---| +|`void initialize(std::string, robot_costmap_2d::Costmap2DROBOT*)`|`void initialize(const YAML::Node& parent, const std::string&, TFListenerPtr, Costmap::Ptr)`|Uses modern pointers instead of raw pointers, and provides a TFListener| +|`bool makePlan(const robot_geometry_msgs::PoseStamped&, const robot_geometry_msgs::PoseStamped&, std::vector&)`|`robot_nav_2d_msgs::Path2D makePlan(const robot_nav_2d_msgs::Pose2DStamped&, const robot_nav_2d_msgs::Pose2DStamped&)`|Uses exceptions for errors instead of returning a bool, which frees up the return for the actual path.| + +## Local Planner +Now let's compare the old [robot_nav_core2::BaseLocalPlanner](https://github.com/ros-planning/navigation/blob/a2837b5a9dc6dd4b4da176fca7d899d6a3722bf8/robot_nav_core2/include/robot_nav_core2/base_local_planner.h) to the new [robot_nav_core2/LocalPlanner](include/robot_nav_core2/local_planner.h). + +| `robot_nav_core2` | `robot_nav_core2` | comments | +|---|--|---| +|`void initialize(std::string, tf::TransformListener*, robot_costmap_2d::Costmap2DROBOT*)`|`void initialize(const YAML::Node& parent, const std::string&, TFListenerPtr, Costmap::Ptr)`|Uses modern pointers instead of raw pointers| +|(no equivalent)|`void setGoalPose(const robot_nav_2d_msgs::Pose2DStamped&)`|Explicitly set the new goal location, rather than using the last pose of the global plan` +|`bool setPlan(const std::vector&)`|`setPlan(const robot_nav_2d_msgs::Path2D&)`|| +|`bool computeVelocityCommands(robot_geometry_msgs::Twist&)`|`robot_nav_2d_msgs::Twist2DStamped computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped&, const robot_nav_2d_msgs::Twist2D&)`|Explicitly provides the current pose and velocity for more explicit data control and easier testing. Uses exceptions for errors instead of returning a bool, which frees up the return for the actual command.| +|`bool isGoalReached()` | `bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped&, const robot_nav_2d_msgs::Twist2D&)` | Explicitly provide the current pose and velocity for more explicit data control and easier testing. | + +## Exceptions +A hierarchical collection of [exceptions](include/robot_nav_core2/exceptions.h) is provided to allow for reacting to navigation failures in a more robust and contextual way. +![exception hierarchy tree](doc/exceptions.png) +Each exception has a corresponding integer "result code" that can be used in ROS interfaces where passing the C++ object is infeasible. Note that due to the hierarchy, the result_code will be for the child-most exception. For example, if you throw a `StartBoundsException` which has a corresponding result code of `6`, it could also be seen as a `InvalidStartPoseException`, `GlobalPlannerException`, `PlannerException` or `NavCore2Exception`, all of which would also have the result code of `6`. + +## Bounds +For use in tracking `Costmap` changes and more, this package also provides an implementation of [bounding boxes](include/robot_nav_core2/bounds.h). These are represented with the ranges `[min_x, max_x]` and `[min_y, max_y]` (inclusive). diff --git a/src/Navigations/Cores/robot_nav_core2/doc/exceptions.png b/src/Navigations/Cores/robot_nav_core2/doc/exceptions.png new file mode 100755 index 0000000000000000000000000000000000000000..83f31e4513777f93c382308e949bb5c57d29b006 GIT binary patch literal 38943 zcmb5WWk6J27dAYkND8Plh_sZ_A)$0CEiKXw(v3<>NJ}Fr-9v*&$Iv|j(lK;5??#{d zxu5TQf4zT1&g?m7pS{;!>sr^k7QwF-rEoAwF(D8Lj*PUpG6aJ10|G%N$3O;GpdznX zAP`@OjQ9&x*Xhkh97pxBgcF58RnB{Kxc9%KhP|XFY|0S7Bp!N0oYa|-6@jf48A2z< z`dGpL+bKTPz0x0k=8`lS9q*oDnhAU(QC%ZU+*k7JQPo}hY`O0^oVXW;CCMqLM^q7F zd2|(vI7+-qy=c9+@3wlQKT$VPdopFZ<8|zHJlotj;M6~}8WBY+Ls6)0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z-wDbKTPN{%qC>ks*6R q_C4<}ySuZv9WqvkylKMWz<>7ULg~U4C*OlS&*16m=d#Wzp$P!tx#(*E literal 0 HcmV?d00001 diff --git a/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/basic_costmap.h b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/basic_costmap.h new file mode 100755 index 0000000..ec1208a --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/basic_costmap.h @@ -0,0 +1,68 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_CORE2_BASIC_COSTMAP_H +#define ROBOT_NAV_CORE2_BASIC_COSTMAP_H + +#include +#include +#include + +namespace robot_nav_core2 +{ +class BasicCostmap : public robot_nav_core2::Costmap +{ +public: + // Standard Costmap Interface + mutex_t* getMutex() override { return &my_mutex_; } + + // NavGrid Interface + void reset() override; + void setValue(const unsigned int x, const unsigned int y, const unsigned char& value) override; + unsigned char getValue(const unsigned int x, const unsigned int y) const override; + void setInfo(const nav_grid::NavGridInfo& new_info) override + { + info_ = new_info; + reset(); + } + + // Index Conversion + unsigned int getIndex(const unsigned int x, const unsigned int y) const; +protected: + mutex_t my_mutex_; + std::vector data_; +}; +} // namespace robot_nav_core2 + +#endif // ROBOT_NAV_CORE2_BASIC_COSTMAP_H diff --git a/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/bounds.h b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/bounds.h new file mode 100755 index 0000000..dafeffd --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/bounds.h @@ -0,0 +1,209 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_CORE2_BOUNDS_H +#define ROBOT_NAV_CORE2_BOUNDS_H + +#include +#include +#include + +namespace robot_nav_core2 +{ +/** + * @brief Templatized method for checking if a value falls inside a one-dimensional range + * @param value The value to check + * @param min_value The minimum value of the range + * @param max_value The maximum value of the range + * @return True if the value is within the range + */ +template +inline bool inRange(const NumericType value, const NumericType min_value, const NumericType max_value) +{ + return min_value <= value && value <= max_value; +} + +/** + * @class GenericBounds + * @brief Templatized class that represents a two dimensional bounds with ranges [min_x, max_x] [min_y, max_y] inclusive + */ +template +struct GenericBounds +{ +public: + /** + * @brief Constructor for an empty bounds + */ + GenericBounds() + { + reset(); + } + + /** + * @brief Constructor for a non-empty initial bounds + * @param x0 Initial min x + * @param y0 Initial min y + * @param x1 Initial max x + * @param y1 Initial max y + */ + GenericBounds(NumericType x0, NumericType y0, NumericType x1, NumericType y1) + : min_x_(x0), min_y_(y0), max_x_(x1), max_y_(y1) {} + + /** + * @brief Reset the bounds to be empty + */ + void reset() + { + min_x_ = min_y_ = std::numeric_limits::max(); + max_x_ = max_y_ = std::numeric_limits::lowest(); // -max + } + + /** + * @brief Update the bounds to include the point (x, y) + */ + void touch(NumericType x, NumericType y) + { + min_x_ = std::min(x, min_x_); + min_y_ = std::min(y, min_y_); + max_x_ = std::max(x, max_x_); + max_y_ = std::max(y, max_y_); + } + + /** + * @brief Update the bounds to include points (x0, y0) and (x1, y1) + * @param x0 smaller of two x values + * @param y0 smaller of two y values + * @param x1 larger of two x values + * @param y1 larger of two y values + */ + void update(NumericType x0, NumericType y0, NumericType x1, NumericType y1) + { + min_x_ = std::min(x0, min_x_); + min_y_ = std::min(y0, min_y_); + max_x_ = std::max(x1, max_x_); + max_y_ = std::max(y1, max_y_); + } + + /** + * @brief Update the bounds to include the entirety of another bounds object + * @param other Another bounds object + */ + void merge(const GenericBounds& other) + { + update(other.min_x_, other.min_y_, other.max_x_, other.max_y_); + } + + /** + * @brief Returns true if the range is empty + */ + bool isEmpty() const + { + return min_x_ > max_x_ && min_y_ > max_y_; + } + + /** + * @brief Returns true if the point is inside this range + */ + bool contains(NumericType x, NumericType y) const + { + return inRange(x, min_x_, max_x_) && inRange(y, min_y_, max_y_); + } + + /** + * @brief returns true if the two bounds overlap each other + */ + bool overlaps(const GenericBounds& other) const + { + return !isEmpty() && !other.isEmpty() + && max_y_ >= other.min_y_ && min_y_ <= other.max_y_ + && max_x_ >= other.min_x_ && min_x_ <= other.max_x_; + } + + /** + * @brief comparison operator that requires all fields are equal + */ + bool operator==(const GenericBounds& other) const + { + return min_x_ == other.min_x_ && min_y_ == other.min_y_ && + max_x_ == other.max_x_ && max_y_ == other.max_y_; + } + + bool operator!=(const GenericBounds& other) const + { + return !operator==(other); + } + + /** + * @brief Returns a string representation of the bounds + */ + std::string toString() const + { + if (!isEmpty()) + { + return "(" + std::to_string(min_x_) + "," + std::to_string(min_y_) + "):(" + + std::to_string(max_x_) + "," + std::to_string(max_y_) + ")"; + } + else + { + return "(empty bounds)"; + } + } + + NumericType getMinX() const { return min_x_; } + NumericType getMinY() const { return min_y_; } + NumericType getMaxX() const { return max_x_; } + NumericType getMaxY() const { return max_y_; } + +protected: + NumericType min_x_, min_y_, max_x_, max_y_; +}; + +using Bounds = GenericBounds; + +inline unsigned int getDimension(unsigned int min_v, unsigned int max_v) +{ + return (min_v > max_v) ? 0 : max_v - min_v + 1; +} + +class UIntBounds : public GenericBounds +{ +public: + using GenericBounds::GenericBounds; + unsigned int getWidth() const { return getDimension(min_x_, max_x_); } + unsigned int getHeight() const { return getDimension(min_y_, max_y_); } +}; + +} // namespace robot_nav_core2 + +#endif // ROBOT_NAV_CORE2_BOUNDS_H diff --git a/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/common.h b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/common.h new file mode 100755 index 0000000..baeaadc --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/common.h @@ -0,0 +1,42 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ROBOT_NAV_CORE2_COMMON_H +#define ROBOT_NAV_CORE2_COMMON_H + +#include +#include + +using TFListenerPtr = std::shared_ptr; + +#endif // ROBOT_NAV_CORE2_COMMON_H diff --git a/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/costmap.h b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/costmap.h new file mode 100755 index 0000000..0a68fba --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/costmap.h @@ -0,0 +1,157 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_CORE2_COSTMAP_H +#define ROBOT_NAV_CORE2_COSTMAP_H + +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_core2 +{ + +class Costmap : public nav_grid::NavGrid +{ +public: + static const unsigned char NO_INFORMATION = 255; + static const unsigned char LETHAL_OBSTACLE = 254; + static const unsigned char INSCRIBED_INFLATED_OBSTACLE = 253; + static const unsigned char FREE_SPACE = 0; + + using Ptr = std::shared_ptr; + + /** + * @brief Virtual Destructor + */ + virtual ~Costmap() {} + + /** + * @brief Initialization function for the Costmap + * + * ROS parameters/topics are expected to be in the parent/name namespace. + * It is suggested that all NodeHandles in the costmap use the parent NodeHandle's callback queue. + * + * @param parent NodeHandle to derive other NodeHandles from + * @param name The namespace for the costmap + * @param tf A pointer to a transform listener + */ + virtual void initialize(const robot::NodeHandle& parent, const std::string& name, TFListenerPtr tf) {} + + inline unsigned char getCost(const unsigned int x, const unsigned int y) + { + return getValue(x, y); + } + + inline unsigned char getCost(const nav_grid::Index& index) + { + return getValue(index.x, index.y); + } + + inline void setCost(const unsigned int x, const unsigned int y, const unsigned char cost) + { + setValue(x, y, cost); + } + + inline void setCost(const nav_grid::Index& index, const unsigned char cost) + { + setValue(index, cost); + } + + /** + * @brief Update the values in the costmap + * + * Note that this method can throw CostmapExceptions to indicate problems, like when it would be unsafe to navigate. + * e.g. If the costmap expects laser data at a given rate, but laser data hasn't shown up in a while, this method + * might throw a CostmapDataLagException. + */ + virtual void update() {} + + using mutex_t = boost::recursive_mutex; + /** + * @brief Accessor for boost mutex + */ + virtual mutex_t* getMutex() = 0; + + /** + * @brief Flag to indicate whether this costmap is able to track how much has changed + */ + virtual bool canTrackChanges() { return false; } + + /** + * @brief If canTrackChanges, get the bounding box for how much of the costmap has changed + * + * Rather than querying based on time stamps (which can require an arbitrary amount of storage) + * we instead query based on a namespace. The return bounding box reports how much of the costmap + * has changed since the last time this method was called with a particular namespace. If a namespace + * is new, then it returns a bounding box for the whole costmap. The max values are inclusive. + * + * Example Sequence with a 5x5 costmap: (results listed (min_x,min_y):(max_x, max_y)) + * 0) getChangeBounds("A") --> (0,0):(4,4) + * 1) getChangeBounds("B") --> (0,0):(4,4) + * 2) update cell 1, 1 + * 3) getChangeBounds("C") --> (0,0):(4,4) + * 4) getChangeBounds("A") --> (1,1):(1,1) + * 5) getChangeBounds("A") --> (empty bounds) (i.e. nothing was updated since last call) + * 6) updateCell 2, 4 + * 7) getChangeBounds("A") --> (2,4):(2,4) + * 8) getChangeBounds("B") --> (1,1):(2,4) + * + * @param ns The namespace + * @return Updated bounds + * @throws std::runtime_error If canTrackChanges is false, the returned bounds would be meaningless + */ + virtual UIntBounds getChangeBounds(const std::string& ns) + { + if (!canTrackChanges()) + { + throw std::runtime_error("You called 'getChangeBounds()' on a derived Costmap type that is not capable of " + "tracking changes (i.e. canTrackChanges() returns false). You shouldn't do that."); + } + else + { + throw std::runtime_error("You called 'getChangeBounds()' on a derived Costmap type that is capable of tracking " + "changes but has not properly implemented this function. You should yell at the author " + "of the derived Costmap."); + } + return UIntBounds(); + } +}; +} // namespace robot_nav_core2 + +#endif // ROBOT_NAV_CORE2_COSTMAP_H diff --git a/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/exceptions.h b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/exceptions.h new file mode 100755 index 0000000..c707d08 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/exceptions.h @@ -0,0 +1,321 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ROBOT_NAV_CORE2_EXCEPTIONS_H +#define ROBOT_NAV_CORE2_EXCEPTIONS_H + +#include +#include +#include +#include +#include + +/************************************************** + * The robot_nav_core2 Planning Exception Hierarchy!! + * (with arbitrary integer result codes) + ************************************************** + * NavCore2Exception + * 0 CostmapException + * 1 CostmapSafetyException + * 2 CostmapDataLagException + * 3 PlannerException + * 4 GlobalPlannerException + * 5 InvalidStartPoseException + * 6 StartBoundsException + * 7 OccupiedStartException + * 8 InvalidGoalPoseException + * 9 GoalBoundsException + * 10 OccupiedGoalException + * 11 NoGlobalPathException + * 12 GlobalPlannerTimeoutException + * 13 LocalPlannerException + * 14 IllegalTrajectoryException + * 15 NoLegalTrajectoriesException + * 16 PlannerTFException + * + * -1 Unknown + **************************************************/ + +namespace robot_nav_core2 +{ + +inline std::string poseToString(const robot_nav_2d_msgs::Pose2DStamped& pose) +{ + return "(" + std::to_string(pose.pose.x) + ", " + std::to_string(pose.pose.y) + ", " + std::to_string(pose.pose.theta) + + " : " + pose.header.frame_id + ")"; +} + +class NavCore2Exception: public std::runtime_error +{ +public: + explicit NavCore2Exception(const std::string& description, int result_code) + : std::runtime_error(description), result_code_(result_code) {} + int getResultCode() const { return result_code_; } +protected: + int result_code_; +}; + +using NavCore2ExceptionPtr = std::exception_ptr; + +/** + * @brief Handy function for getting the result code + */ +inline int getResultCode(const NavCore2ExceptionPtr& e_ptr) +{ + if (e_ptr == nullptr) + { + return -1; + } + try + { + std::rethrow_exception(e_ptr); + } + catch (const NavCore2Exception& e) + { + return e.getResultCode(); + } + catch (...) + { + // Will end up here if current_exception returned a non-NavCore2Exception + return -1; + } +} + +/** + * @class CostmapException + * @brief Extensible exception class for all costmap-related problems + */ +class CostmapException: public NavCore2Exception +{ +public: + explicit CostmapException(const std::string& description, int result_code = 0) + : NavCore2Exception(description, result_code) {} +}; + +/** + * @class CostmapSafetyException + * @brief General container for exceptions thrown when the costmap thinks any movement would be unsafe + */ +class CostmapSafetyException: public CostmapException +{ +public: + explicit CostmapSafetyException(const std::string& description, int result_code = 1) + : CostmapException(description, result_code) {} +}; + +/** + * @class CostmapDataLagException + * @brief Indicates costmap is out of date because data in not up to date. + * + * Functions similarly to `!Costmap2Drobot::isCurrent()` + */ +class CostmapDataLagException: public CostmapSafetyException +{ +public: + explicit CostmapDataLagException(const std::string& description, int result_code = 2) + : CostmapSafetyException(description, result_code) {} +}; + +/** + * @class PlannerException + * @brief Parent type of all exceptions defined within + */ +class PlannerException: public NavCore2Exception +{ +public: + explicit PlannerException(const std::string& description, int result_code = 3) + : NavCore2Exception(description, result_code) {} +}; + +/** + * @class GlobalPlannerException + * @brief General container for exceptions thrown from the Global Planner + */ +class GlobalPlannerException: public PlannerException +{ +public: + explicit GlobalPlannerException(const std::string& description, int result_code = 4) + : PlannerException(description, result_code) {} +}; + +/** + * @class LocalPlannerException + * @brief General container for exceptions thrown from the Local Planner + */ +class LocalPlannerException: public PlannerException +{ +public: + explicit LocalPlannerException(const std::string& description, int result_code = 13) + : PlannerException(description, result_code) {} +}; + +/** + * @class PlannerTFException + * @brief Thrown when either the global or local planner cannot complete its operation due to TF errors + */ +class PlannerTFException: public PlannerException +{ +public: + explicit PlannerTFException(const std::string& description, int result_code = 16) + : PlannerException(description, result_code) {} +}; + +/** + * @class InvalidStartPoseException + * @brief Exception thrown when there is a problem at the start location for the global planner + */ +class InvalidStartPoseException: public GlobalPlannerException +{ +public: + explicit InvalidStartPoseException(const std::string& description, int result_code = 5) + : GlobalPlannerException(description, result_code) {} + InvalidStartPoseException(const robot_nav_2d_msgs::Pose2DStamped& pose, const std::string& problem, int result_code = 5) : + InvalidStartPoseException("The starting pose " + poseToString(pose) + " is " + problem, result_code) {} +}; + +/** + * @class StartBoundsException + * @brief Exception thrown when the start location of the global planner is out of the expected bounds + */ +class StartBoundsException: public InvalidStartPoseException +{ +public: + explicit StartBoundsException(const std::string& description, int result_code = 6) + : InvalidStartPoseException(description, result_code) {} + explicit StartBoundsException(const robot_nav_2d_msgs::Pose2DStamped& pose) : + InvalidStartPoseException(pose, "out of bounds", 6) {} +}; + +/** + * @class OccupiedStartException + * @brief Exception thrown when the start location of the global planner is occupied in the costmap + */ +class OccupiedStartException: public InvalidStartPoseException +{ +public: + explicit OccupiedStartException(const std::string& description, int result_code = 7) + : InvalidStartPoseException(description, result_code) {} + explicit OccupiedStartException(const robot_nav_2d_msgs::Pose2DStamped& pose) : + InvalidStartPoseException(pose, "occupied", 7) {} +}; + +/** + * @class InvalidGoalPoseException + * @brief Exception thrown when there is a problem at the goal location for the global planner + */ +class InvalidGoalPoseException: public GlobalPlannerException +{ +public: + explicit InvalidGoalPoseException(const std::string& description, int result_code = 8) + : GlobalPlannerException(description, result_code) {} + InvalidGoalPoseException(const robot_nav_2d_msgs::Pose2DStamped& pose, const std::string& problem, int result_code = 8) : + GlobalPlannerException("The goal pose " + poseToString(pose) + " is " + problem, result_code) {} +}; + +/** + * @class GoalBoundsException + * @brief Exception thrown when the goal location of the global planner is out of the expected bounds + */ +class GoalBoundsException: public InvalidGoalPoseException +{ +public: + explicit GoalBoundsException(const std::string& description, int result_code = 9) + : InvalidGoalPoseException(description, result_code) {} + explicit GoalBoundsException(const robot_nav_2d_msgs::Pose2DStamped& pose) : + InvalidGoalPoseException(pose, "out of bounds", 9) {} +}; + +/** + * @class OccupiedGoalException + * @brief Exception thrown when the goal location of the global planner is occupied in the costmap + */ +class OccupiedGoalException: public InvalidGoalPoseException +{ +public: + explicit OccupiedGoalException(const std::string& description, int result_code = 10) + : InvalidGoalPoseException(description, result_code) {} + explicit OccupiedGoalException(const robot_nav_2d_msgs::Pose2DStamped& pose) : + InvalidGoalPoseException(pose, "occupied", 10) {} +}; + +/** + * @class NoGlobalPathException + * @brief Exception thrown when the global planner cannot find a path from the start to the goal + */ +class NoGlobalPathException: public GlobalPlannerException +{ +public: + explicit NoGlobalPathException(const std::string& description, int result_code = 11) + : GlobalPlannerException(description, result_code) {} + NoGlobalPathException() : GlobalPlannerException("No global path found.") {} +}; + +/** + * @class GlobalPlannerTimeoutException + * @brief Exception thrown when the global planner has spent too long looking for a path + */ +class GlobalPlannerTimeoutException: public GlobalPlannerException +{ +public: + explicit GlobalPlannerTimeoutException(const std::string& description, int result_code = 12) + : GlobalPlannerException(description, result_code) {} +}; + +/** + * @class IllegalTrajectoryException + * @brief Thrown when one of the critics encountered a fatal error + */ +class IllegalTrajectoryException: public LocalPlannerException +{ +public: + IllegalTrajectoryException(const std::string& critic_name, const std::string& description, int result_code = 14) + : LocalPlannerException(description, result_code), critic_name_(critic_name) {} + std::string getCriticName() const { return critic_name_; } +protected: + std::string critic_name_; +}; + +/** + * @class NoLegalTrajectoriesException + * @brief Thrown when all the trajectories explored are illegal + */ +class NoLegalTrajectoriesException: public LocalPlannerException +{ +public: + explicit NoLegalTrajectoriesException(const std::string& description, int result_code = 15) + : LocalPlannerException(description, result_code) {} +}; + +} // namespace robot_nav_core2 + +#endif // ROBOT_NAV_CORE2_EXCEPTIONS_H diff --git a/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/global_planner.h b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/global_planner.h new file mode 100755 index 0000000..90465f6 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/global_planner.h @@ -0,0 +1,86 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ROBOT_NAV_CORE2_GLOBAL_PLANNER_H +#define ROBOT_NAV_CORE2_GLOBAL_PLANNER_H + +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_core2 +{ + +/** + * @class GlobalPlanner + * @brief Provides an interface for global planners used in navigation. + */ +class GlobalPlanner +{ +public: + using Ptr = std::shared_ptr; + /** + * @brief Virtual Destructor + */ + virtual ~GlobalPlanner() {} + + /** + * @brief Initialization function for the GlobalPlanner + * + * ROS parameters/topics are expected to be in the parent/name namespace. + * It is suggested that all NodeHandles in the planner use the parent NodeHandle's callback queue. + * + * @param parent NodeHandle to derive other NodeHandles from + * @param name The name of this planner + * @param tf A pointer to a transform listener + * @param costmap A pointer to the costmap + */ + virtual void initialize(const robot::NodeHandle& parent, const std::string& name, + TFListenerPtr tf, Costmap::Ptr costmap) = 0; + + /** + * @brief Run the global planner to make a plan starting at the start and ending at the goal. + * @param start The starting pose of the robot + * @param goal The goal pose of the robot + * @return The sequence of poses to get from start to goal, if any + */ + virtual robot_nav_2d_msgs::Path2D makePlan(const robot_nav_2d_msgs::Pose2DStamped& start, + const robot_nav_2d_msgs::Pose2DStamped& goal) = 0; +}; +} // namespace robot_nav_core2 + +#endif // ROBOT_NAV_CORE2_GLOBAL_PLANNER_H diff --git a/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/local_planner.h b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/local_planner.h new file mode 100755 index 0000000..24f8120 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/include/robot_nav_core2/local_planner.h @@ -0,0 +1,187 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef ROBOT_NAV_CORE2_LOCAL_PLANNER_H +#define ROBOT_NAV_CORE2_LOCAL_PLANNER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_core2 +{ + + /** + * @class LocalPlanner + * @brief Provides an interface for local planners used in navigation. + */ + class LocalPlanner + { + public: + + using Ptr = std::shared_ptr; + /** + * @brief Virtual Destructor + */ + virtual ~LocalPlanner() {} + + /** + * @brief Constructs the local planner + * + * ROS parameters/topics are expected to be in the parent/name namespace. + * It is suggested that all NodeHandles in the planner use the parent NodeHandle's callback queue. + * + * @param parent NodeHandle to derive other NodeHandles from + * @param name The name to give this instance of the local planner + * @param tf A pointer to a transform listener + * @param costmap A pointer to the costmap + */ + // virtual void initialize(YAML::Node &parent, const std::string &name, + // TFListenerPtr tf, Costmap::Ptr costmap) = 0; + + virtual void initialize(robot::NodeHandle &parent, const std::string &name, + TFListenerPtr tf, robot_costmap_2d::Costmap2DROBOT *costmap) = 0; + + /** + * @brief Sets the global goal for this local planner. + * @param goal_pose The Goal Pose + */ + virtual void setGoalPose(const robot_nav_2d_msgs::Pose2DStamped &goal_pose) = 0; + + /** + * @brief Sets the global plan for this local planner. + * + * @param path The global plan + */ + virtual void setPlan(const robot_nav_2d_msgs::Path2D &path) = 0; + + /** + * @brief Gets the global plan for this local planner. + * + * @param path The global plan + */ + virtual void getPlan(robot_nav_2d_msgs::Path2D &path) = 0; + + /** + * @brief Gets the current global plan + * @param path The global plan + */ + virtual void getGlobalPlan(robot_nav_2d_msgs::Path2D &path) = 0; + + /** + * @brief Compute the best command given the current pose, velocity and goal + * + * Get the local plan, given an initial pose, velocity and goal pose. + * It is presumed that the global plan is already set. + * + * @param pose Current robot pose + * @param velocity Current robot velocity + * @return The best computed velocity + */ + virtual robot_nav_2d_msgs::Twist2DStamped computeVelocityCommands(const robot_nav_2d_msgs::Pose2DStamped &pose, + const robot_nav_2d_msgs::Twist2D &velocity) = 0; + + /** + * @brief set velocity for x, y asix of the robot + * @param linear the velocity command + * @return True if set is done, false otherwise + */ + virtual bool setTwistLinear(robot_geometry_msgs::Vector3 linear) { return true; } + + /** + * @brief get velocity for x, y asix of the robot + * @param linear The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistLinear(bool direct) { throw std::runtime_error("Function getTwistLinear is not Support."); } + + /** + * @brief Set velocity theta for z asix of the robot + * @param angular the command velocity + * @return True if set is done, false otherwise + */ + virtual bool setTwistAngular(robot_geometry_msgs::Vector3 angular) { return false; } + + /** + * @brief Get velocity theta for z asix of the robot + * @param direct The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistAngular(bool direct) { throw std::runtime_error("Function getTwistLinear is not Support."); } + + /** + * @brief Get velocity for x, y asix of the robot + * @return The current velocity + */ + virtual robot_geometry_msgs::Twist getActualTwist() { throw std::runtime_error("Function getActualTwist is not Support."); } + + /** + * @brief Check if the kinematic parameters are currently locked + * @return True if the kinematic parameters are locked, false otherwise + * + * This function indicates whether the kinematic parameters (e.g., velocities, accelerations, or direction settings) are in a locked state, preventing modifications. If the parameters are locked during in-place rotation, it could prevent updates to the direction or velocity, potentially causing inconsistencies in motion commands that lead to odometry errors and localization jumps in AMCL. + */ + virtual bool islock() {throw std::runtime_error("Function islock is not Support.");} + + /** + * @brief Lock the kinematic parameters to prevent modifications + */ + virtual void lock() {throw std::runtime_error("Function lock is not Support.");} + + /** + * @brief Unlock the kinematic parameters to allow modifications + */ + virtual void unlock() {throw std::runtime_error("Function unlock is not Support.");} + + /** + * @brief Check to see whether the robot has reached its goal + * + * This tests whether the robot has fully reached the goal, given the current pose and velocity. + * + * @param query_pose The pose to check, in local costmap coordinates. + * @param velocity Velocity to check + * @return True if the goal conditions have been met + */ + virtual bool isGoalReached(const robot_nav_2d_msgs::Pose2DStamped &pose, const robot_nav_2d_msgs::Twist2D &velocity) = 0; + }; +} // namespace robot_nav_core2 + +#endif // ROBOT_NAV_CORE2_LOCAL_PLANNER_H diff --git a/src/Navigations/Cores/robot_nav_core2/package.xml b/src/Navigations/Cores/robot_nav_core2/package.xml new file mode 100644 index 0000000..fd29a4e --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/package.xml @@ -0,0 +1,40 @@ + + robot_nav_core2 + 0.7.10 + + robot_nav_core2 is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. robot_nav_core2 + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_nav_core2 + + catkin + + robot_costmap_2d + robot_costmap_2d + + + + + nav_grid + nav_grid + + robot_nav_2d_msgs + robot_nav_2d_msgs + + robot_cpp + robot_cpp + + robot_geometry_msgs + robot_geometry_msgs + + \ No newline at end of file diff --git a/src/Navigations/Cores/robot_nav_core2/src/basic_costmap.cpp b/src/Navigations/Cores/robot_nav_core2/src/basic_costmap.cpp new file mode 100755 index 0000000..a9b9675 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/src/basic_costmap.cpp @@ -0,0 +1,60 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +namespace robot_nav_core2 +{ + +void BasicCostmap::reset() +{ + data_.assign(info_.width * info_.height, this->default_value_); +} + +unsigned int BasicCostmap::getIndex(const unsigned int x, const unsigned int y) const +{ + return y * info_.width + x; +} + +unsigned char BasicCostmap::getValue(const unsigned int x, const unsigned int y) const +{ + return data_[getIndex(x, y)]; +} + +void BasicCostmap::setValue(const unsigned int x, const unsigned int y, const unsigned char& value) +{ + data_[getIndex(x, y)] = value; +} + +} // namespace robot_nav_core2 diff --git a/src/Navigations/Cores/robot_nav_core2/test/bounds_test.cpp b/src/Navigations/Cores/robot_nav_core2/test/bounds_test.cpp new file mode 100755 index 0000000..0ee095c --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/test/bounds_test.cpp @@ -0,0 +1,124 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include + +using robot_nav_core2::Bounds; +using robot_nav_core2::UIntBounds; + +TEST(Bounds, test_bounds_simple) +{ + Bounds b; + EXPECT_TRUE(b.isEmpty()); + + b.touch(5.0, 6.0); + EXPECT_EQ(5.0, b.getMinX()); + EXPECT_EQ(5.0, b.getMinX()); + EXPECT_EQ(5.0, b.getMaxX()); + EXPECT_EQ(6.0, b.getMinY()); + EXPECT_EQ(6.0, b.getMaxY()); + EXPECT_TRUE(b.contains(5.0, 6.0)); + EXPECT_FALSE(b.contains(5.5, 6.0)); + EXPECT_FALSE(b.contains(5.5, 4.0)); + EXPECT_FALSE(b.isEmpty()); + + Bounds b2 = b; + EXPECT_EQ(5.0, b2.getMinX()); + EXPECT_EQ(5.0, b2.getMaxX()); + EXPECT_EQ(6.0, b2.getMinY()); + EXPECT_EQ(6.0, b2.getMaxY()); + + b.reset(); + EXPECT_EQ(5.0, b2.getMinX()); + EXPECT_EQ(5.0, b2.getMaxX()); + EXPECT_EQ(6.0, b2.getMinY()); + EXPECT_EQ(6.0, b2.getMaxY()); + EXPECT_FALSE(b.contains(5.0, 6.0)); + EXPECT_FALSE(b.contains(5.5, 6.0)); + EXPECT_TRUE(b2.contains(5.0, 6.0)); + EXPECT_FALSE(b.contains(5.5, 6.0)); + EXPECT_TRUE(b.isEmpty()); + + Bounds b3; + b3.touch(1.0, 5.0); + b3.touch(4.0, 2.0); + EXPECT_TRUE(b3.contains(3.0, 3.0)); + EXPECT_FALSE(b3.contains(0.0, 3.0)); + EXPECT_FALSE(b3.contains(5.0, 3.0)); + EXPECT_FALSE(b3.contains(3.0, 6.0)); + EXPECT_FALSE(b3.contains(3.0, 1.0)); +} + +TEST(Bounds, test_dimensions) +{ + UIntBounds empty; + UIntBounds square(0, 0, 5, 5); + UIntBounds rectangle(1, 4, 3, 15); + EXPECT_EQ(empty.getWidth(), 0u); + EXPECT_EQ(empty.getHeight(), 0u); + + EXPECT_EQ(square.getWidth(), 6u); + EXPECT_EQ(square.getHeight(), 6u); + + EXPECT_EQ(rectangle.getWidth(), 3u); + EXPECT_EQ(rectangle.getHeight(), 12u); +} + +TEST(Bounds, test_bounds_overlap) +{ + UIntBounds b0(0, 0, 5, 5); + UIntBounds b1(0, 0, 5, 5); + UIntBounds b2(0, 0, 3, 3); + UIntBounds b3(3, 0, 4, 4); + UIntBounds b4(4, 0, 4, 4); + UIntBounds b5(1, 4, 3, 15); + UIntBounds b6(10, 10, 10, 10); + EXPECT_TRUE(b0.overlaps(b0)); + EXPECT_TRUE(b0.overlaps(b1)); + EXPECT_TRUE(b0.overlaps(b2)); + EXPECT_TRUE(b2.overlaps(b0)); + EXPECT_TRUE(b0.overlaps(b3)); + EXPECT_TRUE(b2.overlaps(b3)); + EXPECT_FALSE(b2.overlaps(b4)); + EXPECT_TRUE(b0.overlaps(b5)); + EXPECT_TRUE(b5.overlaps(b0)); + EXPECT_FALSE(b0.overlaps(b6)); + EXPECT_FALSE(b6.overlaps(b0)); +} + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Navigations/Cores/robot_nav_core2/test/exception_test.cpp b/src/Navigations/Cores/robot_nav_core2/test/exception_test.cpp new file mode 100755 index 0000000..995829e --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core2/test/exception_test.cpp @@ -0,0 +1,133 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2019, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include + +TEST(Exceptions, direct_code_access) +{ + // Make sure the caught exceptions have the same types as the thrown exception + // (This version does not create any copies of the exception) + try + { + throw robot_nav_core2::GlobalPlannerTimeoutException("test case"); + } + catch (robot_nav_core2::GlobalPlannerTimeoutException& x) + { + EXPECT_EQ(x.getResultCode(), 12); + } + + try + { + throw robot_nav_core2::GlobalPlannerTimeoutException("test case"); + } + catch (robot_nav_core2::PlannerException& x) + { + EXPECT_EQ(x.getResultCode(), 12); + } +} + +TEST(Exceptions, indirect_code_access) +{ + // Make sure the caught exceptions have the same types as the thrown exception + // (This version copies the exception to a new object with the parent type) + robot_nav_core2::PlannerException e(""); + try + { + throw robot_nav_core2::GlobalPlannerTimeoutException("test case"); + } + catch (robot_nav_core2::GlobalPlannerTimeoutException& x) + { + e = x; + } + EXPECT_EQ(e.getResultCode(), 12); +} + +TEST(Exceptions, rethrow) +{ + // This version tests the ability to catch specific exceptions when rethrown + // A copy of the exception is made and rethrown, with the goal being able to catch the specific type + // and not the parent type. + robot_nav_core2::NavCore2ExceptionPtr e; + try + { + throw robot_nav_core2::GlobalPlannerTimeoutException("test case"); + } + catch (robot_nav_core2::GlobalPlannerTimeoutException& x) + { + e = std::current_exception(); + } + + EXPECT_EQ(robot_nav_core2::getResultCode(e), 12); + + try + { + std::rethrow_exception(e); + } + catch (robot_nav_core2::GlobalPlannerTimeoutException& x) + { + EXPECT_EQ(x.getResultCode(), 12); + SUCCEED(); + } + catch (robot_nav_core2::PlannerException& x) + { + FAIL() << "PlannerException caught instead of specific exception"; + } +} + +TEST(Exceptions, weird_exception) +{ + robot_nav_core2::NavCore2ExceptionPtr e; + + // Check what happens with no exception + EXPECT_EQ(robot_nav_core2::getResultCode(e), -1); + + // Check what happens with a non NavCore2Exception + try + { + std::string().at(1); // this generates an std::out_of_range + } + catch (...) + { + e = std::current_exception(); + } + + EXPECT_EQ(robot_nav_core2::getResultCode(e), -1); +} + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Navigations/Cores/robot_nav_core_adapter/CMakeLists.txt b/src/Navigations/Cores/robot_nav_core_adapter/CMakeLists.txt new file mode 100755 index 0000000..9f6f595 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/CMakeLists.txt @@ -0,0 +1,244 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_nav_core_adapter VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_nav_core_adapter with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_nav_core_adapter with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS filesystem system) +find_package(Threads REQUIRED) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + geometry_msgs + robot_std_msgs + robot_nav_core + robot_nav_core2 + robot_nav_2d_utils + robot_cpp + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + geometry_msgs + robot_std_msgs + robot_nav_core + robot_nav_core2 + robot_nav_2d_utils + robot_cpp + ) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES costmap_adapter local_planner_adapter global_planner_adapter + CATKIN_DEPENDS geometry_msgs robot_std_msgs robot_nav_core robot_nav_core2 robot_nav_2d_utils robot_cpp + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ) +endif() + +# ======================================================== +# Libraries +# ======================================================== +add_library(costmap_adapter SHARED + src/costmap_adapter.cpp +) + +add_library(local_planner_adapter SHARED + src/local_planner_adapter.cpp +) + +add_library(global_planner_adapter SHARED + src/global_planner_adapter.cpp +) + +if(BUILDING_WITH_CATKIN) + add_dependencies(costmap_adapter ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(local_planner_adapter ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + add_dependencies(global_planner_adapter ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # costmap_adapter + target_include_directories(costmap_adapter + PUBLIC + $ + $ + ) + + target_link_libraries(costmap_adapter + PUBLIC ${catkin_LIBRARIES} + ) + + # local_planner_adapter + target_include_directories(local_planner_adapter + PUBLIC + $ + $ + ) + + target_link_libraries(local_planner_adapter + PUBLIC costmap_adapter + PRIVATE ${catkin_LIBRARIES} + PRIVATE Boost::filesystem Boost::system + PRIVATE dl + PRIVATE robot_cpp + ) + + # global_planner_adapter + target_include_directories(global_planner_adapter + PUBLIC + $ + $ + ) + + target_link_libraries(global_planner_adapter + PUBLIC costmap_adapter + PRIVATE ${catkin_LIBRARIES} + PRIVATE Boost::filesystem Boost::system + PRIVATE dl + ) + +else() + + # costmap_adapter + target_include_directories(costmap_adapter + PUBLIC + $ + $ + ) + + target_link_libraries(costmap_adapter + PUBLIC + ${PACKAGES_DIR} + ) + + set_target_properties(costmap_adapter PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + + # local_planner_adapter + target_include_directories(local_planner_adapter + PUBLIC + $ + $ + ) + + target_link_libraries(local_planner_adapter + PUBLIC costmap_adapter + PRIVATE + ${PACKAGES_DIR} + Boost::filesystem Boost::system + dl + robot_cpp + ) + + set_target_properties(local_planner_adapter PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + + # global_planner_adapter + target_include_directories(global_planner_adapter + PUBLIC + $ + $ + ) + + target_link_libraries(global_planner_adapter + PUBLIC costmap_adapter + PRIVATE + ${PACKAGES_DIR} + Boost::filesystem Boost::system + dl + ) + + set_target_properties(global_planner_adapter PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + +endif() + +# ======================================================== +# Install +# ======================================================== +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS costmap_adapter local_planner_adapter global_planner_adapter + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS costmap_adapter local_planner_adapter global_planner_adapter + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Libraries: costmap_adapter, local_planner_adapter, global_planner_adapter") + message(STATUS "Dependencies: geometry_msgs, robot_std_msgs, robot_nav_core, robot_nav_core2, robot_nav_2d_utils, robot_cpp, Boost") + message(STATUS "=================================") +endif() diff --git a/src/Navigations/Cores/robot_nav_core_adapter/README.md b/src/Navigations/Cores/robot_nav_core_adapter/README.md new file mode 100755 index 0000000..44f663b --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/README.md @@ -0,0 +1,48 @@ +# robot_nav_core_adapter +This package contains adapters for using `robot_nav_core2` plugins as `robot_nav_core2` plugins and vice versa (more or less). In general, the adaptation process involves + * Converting between 2d and 3d datatypes. + * Converting between returning false and throwing exceptions on failure. + +We also provide an adapter for using a `robot_costmap_2d::Costmap2DROBOT` as a plugin for the `robot_nav_core2::Costmap` interface. + +## Adapter Classes + * Global Planner Adapters + * `GlobalPlannerAdapter` is used for employing a `robot_nav_core2` global planner interface (such as `dlux_global_planner`) as a `robot_nav_core2` plugin, like in `move_base`. + * `GlobalPlannerAdapter2` is used for employing a `robot_nav_core2` global planner interface (such as `navfn`) +as a `robot_nav_core2` plugin, like in `locomotor`. + * Local Planner Adapter + * `LocalPlannerAdapter` is used for employing a `robot_nav_core2` local planner interface (such as `dwb_local_planner`) as a `robot_nav_core2` plugin, like in `move_base`. In addition to the standard adaptation steps listed above, the local planner adapter also uses the costmap to grab the global pose and subscribes to the odometry in order to get the current velocity. + * There is no `LocalPlannerAdapter2`. The `robot_nav_core2` interfaces use additional information (like velocity) in the `local_planner` interface than its `robot_nav_core2` counterpart. This information would be ignored by a `robot_nav_core2` planner, so no adapter is provided. + * `CostmapAdapter` provides most of the functionality from `robot_nav_core2::Costmap` and also provides a raw pointer to the `Costmap2DROBOT` object. It is not a perfect adaptation, because + * `Costmap2DROBOT` starts its own update thread and updates on its own schedule, so calling `update()` does not actually cause the costmap to update. It does update some of the metadata though. + * `setInfo` is not implemented. + +## Parameter Setup +Let's look at a practical example of how to use `dwb_local_planner` in `move_base`. + +If you were using `DWA` you would probably have parameters set up like this: +``` +base_local_planner: dwa_local_planner/DWALocalPlanner +DWALocalPlanner: + acc_lim_x: 0.42 + ... +``` +i.e. you specify + * The name of the planner + * A bunch of additional parameters within the planner's namespace + +To use the adapter, you have to provide additional information. +``` +base_local_planner: robot_nav_core_adapter::LocalPlannerAdapter +LocalPlannerAdapter: + planner_name: dwb_local_planner::DWBLocalPlanner +DWBLocalPlanner: + acc_lim_x: 0.42 + ... +``` +i.e. + * The name of the planner now points at the adapter + * The name of the actual planner loaded into the adapter's namespace + * The planner's parameters still in the planner's namespace. + +The process for the global planners is similar. diff --git a/src/Navigations/Cores/robot_nav_core_adapter/cfg/NavCoreAdapter.cfg b/src/Navigations/Cores/robot_nav_core_adapter/cfg/NavCoreAdapter.cfg new file mode 100755 index 0000000..9ba9ea2 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/cfg/NavCoreAdapter.cfg @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +PACKAGE = 'robot_nav_core_adapter' + +from dynamic_reconfigure.parameter_generator_catkin import ParameterGenerator, str_t, double_t, bool_t, int_t + +gen = ParameterGenerator() +gen.add("planner_name", str_t, 0, "The name of the plugin for the local planner to use with move_base.", "base_local_planner/TrajectoryPlannerROS") +exit(gen.generate(PACKAGE, "robot_nav_core_adapter", "NavCoreAdapter")) diff --git a/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/costmap_adapter.h b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/costmap_adapter.h new file mode 100755 index 0000000..53bfc64 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/costmap_adapter.h @@ -0,0 +1,85 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_CORE_ADAPTER_COSTMAP_ADAPTER_H +#define ROBOT_NAV_CORE_ADAPTER_COSTMAP_ADAPTER_H + +#include +#include +#include +#include + +namespace robot_nav_core_adapter +{ +nav_grid::NavGridInfo infoFromCostmap(robot_costmap_2d::Costmap2DROBOT* costmap_robot); + +class CostmapAdapter : public robot_nav_core2::Costmap +{ +public: + /** + * @brief Deconstructor for possibly freeing the costmap_robot_ object + */ + virtual ~CostmapAdapter(); + + /** + * @brief Initialize from an existing Costmap2DROBOT object + * @param costmap_robot A Costmap2DROBOT object + * @param needs_destruction Whether to free the costmap_robot object when this class is destroyed + */ + void initialize(robot_costmap_2d::Costmap2DROBOT* costmap_robot, bool needs_destruction = false); + + // Standard Costmap Interface + void initialize(const robot::NodeHandle& parent, const std::string& name, TFListenerPtr tf) override; + robot_nav_core2::Costmap::mutex_t* getMutex() override; + + // NavGrid Interface + void reset() override; + void update() override; + void setValue(const unsigned int x, const unsigned int y, const unsigned char& value) override; + unsigned char getValue(const unsigned int x, const unsigned int y) const override; + void setInfo(const nav_grid::NavGridInfo& new_info) override; + void updateInfo(const nav_grid::NavGridInfo& new_info) override; + + // Get Costmap Pointer for Backwards Compatibility + robot_costmap_2d::Costmap2DROBOT* getCostmap2DROBOT() const { return costmap_robot_; } + +protected: + robot_costmap_2d::Costmap2DROBOT* costmap_robot_; + robot_costmap_2d::Costmap2D* costmap_; + bool needs_destruction_; +}; + +} // namespace robot_nav_core_adapter + +#endif // ROBOT_NAV_CORE_ADAPTER_COSTMAP_ADAPTER_H diff --git a/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/global_planner_adapter.h b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/global_planner_adapter.h new file mode 100755 index 0000000..3a975c1 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/global_planner_adapter.h @@ -0,0 +1,75 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_CORE_ADAPTER_GLOBAL_PLANNER_ADAPTER2_H +#define ROBOT_NAV_CORE_ADAPTER_GLOBAL_PLANNER_ADAPTER2_H + +#include +#include +#include +#include +#include + +namespace robot_nav_core_adapter +{ + +/** + * @class GlobalPlannerAdapter + * @brief used for employing a `robot_nav_core2` global planner (such as `navfn`) as a `robot_nav_core2` plugin, like in `locomotor`. + */ +class GlobalPlannerAdapter: public robot_nav_core2::GlobalPlanner +{ +public: + GlobalPlannerAdapter(); + + // Nav Core 2 Global Planner Interface + void initialize(const robot::NodeHandle& parent, const std::string& name, + TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) override; + robot_nav_2d_msgs::Path2D makePlan(const robot_nav_2d_msgs::Pose2DStamped& start, + const robot_nav_2d_msgs::Pose2DStamped& goal) override; + + static robot_nav_core2::GlobalPlanner::Ptr create(); + +protected: + // Plugin handling + boost::function planner_loader_; + robot_nav_core::BaseGlobalPlanner::Ptr planner_; + + robot_costmap_2d::Costmap2DROBOT* costmap_robot_; + robot_nav_core2::Costmap::Ptr costmap_; +}; + +} // namespace robot_nav_core_adapter + +#endif // ROBOT_NAV_CORE_ADAPTER_GLOBAL_PLANNER_ADAPTER2_H diff --git a/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/local_planner_adapter.h b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/local_planner_adapter.h new file mode 100755 index 0000000..80bc1f8 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/local_planner_adapter.h @@ -0,0 +1,220 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_CORE_ADAPTER_LOCAL_PLANNER_ADAPTER_H +#define ROBOT_NAV_CORE_ADAPTER_LOCAL_PLANNER_ADAPTER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_core_adapter +{ + struct NavCoreAdapterConfig + { + std::string planner_name; + bool use_odom; + bool use_costmap; + bool use_tf; + bool use_dynamic_reconfigure; + }; + + /** + * @class LocalPlannerAdapter + * @brief used for employing a robot_nav_core2 local planner (such as dwb) as a robot_nav_core2 plugin, like in move_base. + */ + class LocalPlannerAdapter : public robot_nav_core::BaseLocalPlanner + { + public: + + using Ptr = boost::shared_ptr; + + /** + * @brief Constructor + */ + LocalPlannerAdapter(); + + /** + * @brief Destructor + */ + virtual ~LocalPlannerAdapter(); + + // Standard ROS Local Planner Interface + void initialize(std::string name, tf3::BufferCore *tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) override; + + /** + * @brief Given the current position, orientation, and velocity of the robot, compute velocity commands to send to the base + * @param velocity The velocity of the robot + * @param cmd_vel Will be filled with the velocity command to be passed to the robot base + * @return True if a valid velocity command was found, false otherwise + */ + bool computeVelocityCommands(const robot_geometry_msgs::Twist &velocity, robot_geometry_msgs::Twist &cmd_vel) override; + + /** + * @brief Swap object will be injected interjace robot_nav_core2::BaseLocalPlanner + * @param planner_name The object name + * @return True if instance object is successed, False otherwise + */ + virtual bool swapPlanner(std::string planner_name) override; + + /** + * @brief set velocity for x, y asix of the robot + * @param linear The velocity command + * @return True if set is done, false otherwise + */ + virtual bool setTwistLinear(robot_geometry_msgs::Vector3 linear) override; + + /** + * @brief get velocity for x, y asix of the robot + * @param linear The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistLinear(bool direct) override; + + /** + * @brief Set velocity theta for z asix of the robot + * @param angular the command velocity + * @return True if set is done, false otherwise + */ + virtual bool setTwistAngular(robot_geometry_msgs::Vector3 angular) override; + + /** + * @brief Get velocity theta for z asix of the robot + * @param direct The velocity command + * @return True if set is done, false otherwise + */ + virtual robot_geometry_msgs::Vector3 getTwistAngular(bool direct) override; + + /** + * @brief Get actual velocity for x, y asix of the robot + * @return The current velocity + */ + virtual robot_geometry_msgs::Twist getActualTwist() override; + + /** + * @brief Check if the kinematic parameters are currently locked + * @return True if the kinematic parameters are locked, false otherwise + * + * This function indicates whether the kinematic parameters (e.g., velocities, accelerations, or direction settings) are in a locked state, preventing modifications. If the parameters are locked during in-place rotation, it could prevent updates to the direction or velocity, potentially causing inconsistencies in motion commands that lead to odometry errors and localization jumps in AMCL. + */ + virtual bool islock() override; + + /** + * @brief Lock the kinematic parameters to prevent modifications + */ + virtual void lock() override; + + /** + * @brief Unlock the kinematic parameters to allow modifications + */ + virtual void unlock() override; + + /** + * @brief Check if the goal pose has been achieved by the local planner + * @return True if achieved, false otherwise + */ + bool isGoalReached() override; + + /** + * @brief Set the plan that the local planner is following + * @param plan The plan to pass to the local planner + * @return True if the plan was updated successfully, false otherwise + */ + bool setPlan(const std::vector &plan) override; + + + /** + * @brief Gets the global plan for this local planner. + * + * @param path The global plan + */ + virtual void getPlan(std::vector &path) override; + + /** + * @brief Gets the current global plan + * @param path The global plan + */ + virtual void getGlobalPlan(std::vector &path) override; + + /** + * @brief Create a new LocalPlannerAdapter + * @return A shared pointer to the new LocalPlannerAdapter + */ + static robot_nav_core::BaseLocalPlanner::Ptr create(); + + protected: + /** + * @brief Get the robot pose from the costmap and store as Pose2DStamped + */ + bool getRobotPose(robot_nav_2d_msgs::Pose2DStamped &pose2d); + + /** + * @brief See if the back of the global plan matches the most recent goal pose + * @return True if the plan has changed + */ + bool hasGoalChanged(const robot_nav_2d_msgs::Pose2DStamped &new_goal); + + // The most recent goal pose + robot_nav_2d_msgs::Pose2DStamped last_goal_; + bool has_active_goal_; + + // Plugin handling + boost::function planner_loader_; + robot_nav_core2::LocalPlanner::Ptr planner_; + + bool initialized_; + // Pointer Copies + TFListenerPtr tf_; + + std::shared_ptr costmap_adapter_; + robot_costmap_2d::Costmap2DROBOT *costmap_robot_; + + boost::recursive_mutex configuration_mutex_; + + robot::NodeHandle private_nh_; + robot::NodeHandle adapter_nh_; + + robot_nav_core_adapter::NavCoreAdapterConfig last_config_; + robot_nav_core_adapter::NavCoreAdapterConfig default_config_; + }; + +} // namespace robot_nav_core_adapter + +#endif // ROBOT_NAV_CORE_ADAPTER_LOCAL_PLANNER_ADAPTER_H diff --git a/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/shared_pointers.h b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/shared_pointers.h new file mode 100755 index 0000000..cc186e4 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/include/robot_nav_core_adapter/shared_pointers.h @@ -0,0 +1,67 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ROBOT_NAV_CORE_ADAPTER_SHARED_POINTERS_H +#define ROBOT_NAV_CORE_ADAPTER_SHARED_POINTERS_H + +#include +#include + +namespace robot_nav_core_adapter +{ + +template +void null_deleter(T* raw_ptr) {} + +/** + * @brief Custom Constructor for creating a shared pointer to an existing object that doesn't delete the ptr when done + * + * @note This is considered bad form, and is only done here for backwards compatibility purposes. The robot_nav_core2 + * interfaces require shared pointers, but the creation of the shared pointer from a raw pointer takes ownership + * of the object such that when the object containing the shared pointer is freed, the object pointed at by the + * shared pointer is also freed. This presents a problem, for instance, when switching from one planner to another + * if the costmap is freed by one planner. + * + * @param raw_ptr The raw pointer to an object + * @return A Shared pointer pointing at the raw_ptr, but when it is freed, the raw_ptr remains valid + */ +template +std::shared_ptr createSharedPointerWithNoDelete(T* raw_ptr) +{ + return std::shared_ptr(raw_ptr, null_deleter); +} + +} // namespace robot_nav_core_adapter + +#endif // ROBOT_NAV_CORE_ADAPTER_SHARED_POINTERS_H diff --git a/src/Navigations/Cores/robot_nav_core_adapter/package.xml b/src/Navigations/Cores/robot_nav_core_adapter/package.xml new file mode 100644 index 0000000..5ba8da8 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/package.xml @@ -0,0 +1,40 @@ + + robot_nav_core_adapter + 0.7.10 + + robot_nav_core_adapter is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. robot_nav_core_adapter + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_nav_core_adapter + + catkin + + geometry_msgs + geometry_msgs + + robot_std_msgs + robot_std_msgs + + robot_nav_core + robot_nav_core + + robot_nav_core2 + robot_nav_core2 + + robot_nav_2d_utils + robot_nav_2d_utils + + robot_cpp + robot_cpp + + \ No newline at end of file diff --git a/src/Navigations/Cores/robot_nav_core_adapter/src/costmap_adapter.cpp b/src/Navigations/Cores/robot_nav_core_adapter/src/costmap_adapter.cpp new file mode 100755 index 0000000..ab9b57e --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/src/costmap_adapter.cpp @@ -0,0 +1,119 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +// #include +#include + +// PLUGINLIB_EXPORT_CLASS(robot_nav_core_adapter::CostmapAdapter, robot_nav_core2::Costmap) + +namespace robot_nav_core_adapter +{ + +nav_grid::NavGridInfo infoFromCostmap(robot_costmap_2d::Costmap2DROBOT* costmap_robot) +{ + nav_grid::NavGridInfo info; + robot_costmap_2d::Costmap2D* costmap = costmap_robot->getCostmap(); + info.width = costmap->getSizeInCellsX(); + info.height = costmap->getSizeInCellsY(); + info.resolution = costmap->getResolution(); + info.frame_id = costmap_robot->getGlobalFrameID(); + info.origin_x = costmap->getOriginX(); + info.origin_y = costmap->getOriginY(); + return info; +} + +CostmapAdapter::~CostmapAdapter() +{ + if (needs_destruction_) + { + delete costmap_robot_; + } +} + +void CostmapAdapter::initialize(robot_costmap_2d::Costmap2DROBOT* costmap_robot, bool needs_destruction) +{ + costmap_robot_ = costmap_robot; + needs_destruction_ = needs_destruction; + info_ = infoFromCostmap(costmap_robot_); + costmap_ = costmap_robot_->getCostmap(); +} + +void CostmapAdapter::initialize(const robot::NodeHandle& parent, const std::string& name, TFListenerPtr tf) +{ + // TODO: Implement this if needed + throw robot_nav_core2::CostmapException("initialize with robot::NodeHandle not implemented"); +} + +robot_nav_core2::Costmap::mutex_t* CostmapAdapter::getMutex() +{ + return costmap_->getMutex(); +} + +void CostmapAdapter::reset() +{ + costmap_robot_->resetLayers(); +} + +void CostmapAdapter::update() +{ + info_ = infoFromCostmap(costmap_robot_); + if (!costmap_robot_->isCurrent()) + throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow."); +} + +void CostmapAdapter::setValue(const unsigned int x, const unsigned int y, const unsigned char& value) +{ + costmap_->setCost(x, y, value); +} + +unsigned char CostmapAdapter::getValue(const unsigned int x, const unsigned int y) const +{ + unsigned int index = costmap_->getIndex(x, y); + return costmap_->getCharMap()[index]; +} + +void CostmapAdapter::setInfo(const nav_grid::NavGridInfo& new_info) +{ + throw robot_nav_core2::CostmapException("setInfo not implemented on CostmapAdapter"); +} + +void CostmapAdapter::updateInfo(const nav_grid::NavGridInfo& new_info) +{ + costmap_->updateOrigin(new_info.origin_x, new_info.origin_y); +} + +} // namespace robot_nav_core_adapter diff --git a/src/Navigations/Cores/robot_nav_core_adapter/src/global_planner_adapter.cpp b/src/Navigations/Cores/robot_nav_core_adapter/src/global_planner_adapter.cpp new file mode 100755 index 0000000..1219eab --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/src/global_planner_adapter.cpp @@ -0,0 +1,102 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_core_adapter +{ + + GlobalPlannerAdapter::GlobalPlannerAdapter() + // : planner_loader_("robot_nav_core2", "robot_nav_core2::BaseGlobalPlanner") + { + } + + /** + * @brief Load the robot_nav_core2 global planner and initialize it + */ + void GlobalPlannerAdapter::initialize(const robot::NodeHandle& parent, const std::string& name, + TFListenerPtr tf, robot_nav_core2::Costmap::Ptr costmap) + { + costmap_ = costmap; + std::shared_ptr ptr = std::static_pointer_cast(costmap); + + if (!ptr) + { + + std::cerr << "GlobalPlannerAdapter can only be used with the CostmapAdapter, not other Costmaps!" << std::endl; + exit(EXIT_FAILURE); + } + costmap_robot_ = ptr->getCostmap2DROBOT(); + + // YAML::Node planner_nh(parent, name); + std::string planner_name; + // planner_nh.param("planner_name", planner_name, std::string("global_planner/GlobalPlanner")); + // ROS_INFO_NAMED("GlobalPlannerAdapter", "Loading plugin %s", planner_name.c_str()); + std::string path_file_so; + planner_loader_ = boost::dll::import_alias( + path_file_so, planner_name, boost::dll::load_mode::append_decorations); + planner_ = planner_loader_(); + planner_->initialize(planner_name, costmap_robot_); + } + + robot_nav_2d_msgs::Path2D GlobalPlannerAdapter::makePlan(const robot_nav_2d_msgs::Pose2DStamped& start, + const robot_nav_2d_msgs::Pose2DStamped& goal) + { + robot_geometry_msgs::PoseStamped start3d = robot_nav_2d_utils::pose2DToPoseStamped(start), + goal3d = robot_nav_2d_utils::pose2DToPoseStamped(goal); + std::vector plan; + bool ret = planner_->makePlan(start3d, goal3d, plan); + if (!ret) + { + throw robot_nav_core2::PlannerException("Generic Global Planner Error"); + } + return robot_nav_2d_utils::posesToPath2D(plan); + } + + robot_nav_core2::GlobalPlanner::Ptr GlobalPlannerAdapter::create() + { + return std::make_shared(); + } +} // namespace robot_nav_core_adapter + +// register this planner as a GlobalPlanner plugin +BOOST_DLL_ALIAS(robot_nav_core_adapter::GlobalPlannerAdapter::create, create_plugin) diff --git a/src/Navigations/Cores/robot_nav_core_adapter/src/local_planner_adapter.cpp b/src/Navigations/Cores/robot_nav_core_adapter/src/local_planner_adapter.cpp new file mode 100755 index 0000000..7bbc5de --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/src/local_planner_adapter.cpp @@ -0,0 +1,452 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2017, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace robot_nav_core_adapter +{ + + LocalPlannerAdapter::LocalPlannerAdapter() + : initialized_(false), + tf_(nullptr), + costmap_robot_(nullptr), + has_active_goal_(false) + { + } + + LocalPlannerAdapter::~LocalPlannerAdapter() + { + robot::log_info("=== LocalPlannerAdapter destructor called ==="); + + if (planner_) + { + planner_.reset(); + robot::log_info("Planner reset complete"); + } + else + { + robot::log_warning("Planner already null"); + } + + robot::log_info("=== LocalPlannerAdapter destructor finished ==="); + } + + /** + * @brief Load the robot_nav_core2 local planner and initialize it + */ + void LocalPlannerAdapter::initialize(std::string name, tf3::BufferCore *tf, robot_costmap_2d::Costmap2DROBOT *costmap_robot) + { + if (!initialized_) + { + tf_ = createSharedPointerWithNoDelete(tf); + costmap_robot_ = costmap_robot; + costmap_adapter_ = std::make_shared(); + costmap_adapter_->initialize(costmap_robot); + + private_nh_ = robot::NodeHandle("~"); + adapter_nh_ = robot::NodeHandle(private_nh_, name); + + std::string planner_name; + if (adapter_nh_.hasParam("planner_name")) + { + adapter_nh_.getParam("planner_name", planner_name, std::string("dwb_local_planner::DWBLocalPlanner")); + } + else + { + planner_name = robot_nav_2d_utils::searchAndGetParam(adapter_nh_, "position_planner_name", std::string("dwb_local_planner::DWBLocalPlanner")); + adapter_nh_.setParam("planner_name", planner_name); + } + try + { + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(planner_name); + planner_loader_ = boost::dll::import_alias( + path_file_so, planner_name, boost::dll::load_mode::append_decorations); + planner_ = planner_loader_(); + if (!planner_) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to load planner %s: returned null pointer", planner_name.c_str()); + exit(EXIT_FAILURE); + } + last_config_.planner_name = planner_name; + robot::log_info("\nLocalPlannerAdapter initialize: %s", planner_name.c_str()); + planner_->initialize(private_nh_, planner_name, tf_, costmap_robot_); + robot::log_info("[%s:%d]\n Successfully initialized planner \"%s\"", __FILE__, __LINE__, planner_name.c_str()); + } + catch (const boost::system::system_error &ex) + { + robot::log_error_at(__FILE__, __LINE__, "System error while loading planner \"%s\": %s", planner_name.c_str(), ex.what()); + exit(EXIT_FAILURE); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to load planner \"%s\", are you sure it is properly registered and that the containing library is built? Exception: %s", planner_name.c_str(), ex.what()); + exit(EXIT_FAILURE); + } + + initialized_ = true; + robot::log_info("LocalPlannerAdapter initialized successfully"); + } + else + { + robot::log_info("LocalPlannerAdapter already initialized"); + } + } + + bool LocalPlannerAdapter::swapPlanner(std::string planner_name) + { + boost::recursive_mutex::scoped_lock l(configuration_mutex_); + if (!initialized_) + { + return false; + } + if(tf_ == nullptr) + { + robot::log_error("[%s:%d]\n ERROR: tf is nullptr", __FILE__, __LINE__); + throw std::runtime_error("Failed to create the tf"); + } + else + { + robot::log_info("[%s:%d]\n INFO: tf is not nullptr", __FILE__, __LINE__); + } + if (planner_name != last_config_.planner_name) + { + robot_nav_core2::LocalPlanner::Ptr old_planner = planner_; + auto old_loader = planner_loader_; + try + { + boost::unique_lock lock(configuration_mutex_); + robot::PluginLoaderHelper loader; + std::string path_file_so = loader.findLibraryPath(planner_name); + auto new_loader = boost::dll::import_alias( + path_file_so, planner_name, boost::dll::load_mode::append_decorations); + + auto new_planner = new_loader(); + if (!new_planner) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to load planner %s", planner_name.c_str()); + throw std::runtime_error("Failed to load planner " + planner_name); + } + new_planner->initialize(private_nh_, planner_name, tf_, costmap_robot_); + planner_ = new_planner; + planner_loader_ = new_loader; + last_config_.planner_name = planner_name; + robot::log_info("Loaded new planner: %s", planner_name.c_str()); + + // Release old planner while old loader is still alive. + old_planner.reset(); + old_loader = boost::function(); + lock.unlock(); + } + catch (const std::exception &ex) + { + robot::log_error_at(__FILE__, __LINE__, "Failed to load planner %s: %s", planner_name.c_str(), ex.what()); + planner_ = old_planner; + planner_loader_ = old_loader; + return false; + } + } + return true; + } + + /** + * @brief Collect the additional information needed by robot_nav_core2 and call the child computeVelocityCommands + */ + bool LocalPlannerAdapter::computeVelocityCommands(const robot_geometry_msgs::Twist &velocity, robot_geometry_msgs::Twist &cmd_vel) + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + if (!has_active_goal_) + { + return false; + } + + // Get the Pose + robot_nav_2d_msgs::Pose2DStamped pose2d; + if (!getRobotPose(pose2d)) + { + return false; + } + + // Get the Velocity + robot_nav_2d_msgs::Twist2DStamped cmd_vel_2d; + try + { + cmd_vel_2d = planner_->computeVelocityCommands(pose2d, robot_nav_2d_utils::twist3Dto2D(velocity)); + } + catch (const robot_nav_core2::PlannerException &e) + { + robot::log_error_at(__FILE__, __LINE__, "LocalPlannerAdapter computeVelocityCommands exception: %s", e.what()); + return false; + } + cmd_vel = robot_nav_2d_utils::twist2Dto3D(cmd_vel_2d.velocity); + return true; + } + + bool LocalPlannerAdapter::setTwistLinear(robot_geometry_msgs::Vector3 linear) + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + try + { + if (planner_) + return planner_->setTwistLinear(linear); + else + throw std::runtime_error("Failed to set linear"); + } + catch (const std::exception &e) + { + throw std::exception(e); + } + } + + robot_geometry_msgs::Vector3 LocalPlannerAdapter::getTwistLinear(bool direct) + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + try + { + if (planner_) + return planner_->getTwistLinear(direct); + else + throw std::runtime_error("Failed to get linear"); + } + catch (const std::exception &e) + { + throw std::exception(e); + } + } + + bool LocalPlannerAdapter::setTwistAngular(robot_geometry_msgs::Vector3 angular) + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + try + { + if (planner_) + return planner_->setTwistAngular(angular); + else + throw std::runtime_error("Failed to set angular"); + } + catch (const std::exception &e) + { + throw std::exception(e); + } + } + + robot_geometry_msgs::Vector3 LocalPlannerAdapter::getTwistAngular(bool direct) + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + try + { + if (planner_) + return planner_->getTwistAngular(direct); + else + throw std::runtime_error("Failed to get angular"); + } + catch (const std::exception &e) + { + throw std::exception(e); + } + } + + robot_geometry_msgs::Twist LocalPlannerAdapter::getActualTwist() + { + return odom_->twist.twist; + } + + bool LocalPlannerAdapter::islock() + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + try + { + if (planner_) + return planner_->islock(); + else + throw std::runtime_error("Failed to call funcion islock"); + } + catch (const std::exception &e) + { + std::cerr << e.what() << std::endl; + throw std::exception(e); + } + } + + void LocalPlannerAdapter::lock() + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + try + { + if (planner_) + planner_->lock(); + else + throw std::runtime_error("Failed to call funcion lock"); + } + catch (const std::exception &e) + { + std::cerr << e.what() << std::endl; + throw std::exception(e); + } + } + + void LocalPlannerAdapter::unlock() + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + try + { + if (planner_) + planner_->unlock(); + else + throw std::runtime_error("Failed to call funcion unlock"); + } + catch (const std::exception &e) + { + std::cerr << e.what() << std::endl; + throw std::exception(e); + } + } + + /** + * @brief Collect the additional information needed by robot_nav_core2 and call the child isGoalReached + */ + bool LocalPlannerAdapter::isGoalReached() + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + // Get the Pose + robot_nav_2d_msgs::Pose2DStamped pose2d; + if (!getRobotPose(pose2d)) + return false; + + robot_nav_2d_msgs::Twist2D velocity = robot_nav_2d_utils::twist3Dto2D(odom_->twist.twist); + bool ret = planner_->isGoalReached(pose2d, velocity); + if (ret) + { + has_active_goal_ = false; + } + return ret; + } + + /** + * @brief Convert from 2d to 3d and call child setPlan + */ + bool LocalPlannerAdapter::setPlan(const std::vector &orig_global_plan) + { + boost::recursive_mutex::scoped_lock ecl(configuration_mutex_); + robot_nav_2d_msgs::Path2D path = robot_nav_2d_utils::posesToPath2D(orig_global_plan); + try + { + if (path.poses.size() > 0) + { + robot_nav_2d_msgs::Pose2DStamped goal_pose; + goal_pose = path.poses.back(); + + if (!has_active_goal_ || hasGoalChanged(goal_pose)) + { + last_goal_ = goal_pose; + has_active_goal_ = true; + planner_->setGoalPose(goal_pose); + planner_->setPlan(path); + } + } + return true; + } + catch (const robot_nav_core2::PlannerException &e) + { + std::cerr << "setPlan Exception: " << e.what() << std::endl; + return false; + } + } + + void LocalPlannerAdapter::getPlan(std::vector &path) + { + if (!planner_) + { + return; + } + robot_nav_2d_msgs::Path2D path2d; + planner_->getPlan(path2d); + path = robot_nav_2d_utils::pathToPath(path2d).poses; + } + + void LocalPlannerAdapter::getGlobalPlan(std::vector &path) + { + if (!planner_) + { + return; + } + robot_nav_2d_msgs::Path2D path2d; + planner_->getGlobalPlan(path2d); + path = robot_nav_2d_utils::pathToPath(path2d).poses; + } + + bool LocalPlannerAdapter::hasGoalChanged(const robot_nav_2d_msgs::Pose2DStamped &new_goal) + { + if (last_goal_.header.frame_id != new_goal.header.frame_id || + last_goal_.header.stamp.toSec() != new_goal.header.stamp.toSec()) + { + return true; + } + + return last_goal_.pose.x != new_goal.pose.x || last_goal_.pose.y != new_goal.pose.y || + last_goal_.pose.theta != new_goal.pose.theta; + } + + bool LocalPlannerAdapter::getRobotPose(robot_nav_2d_msgs::Pose2DStamped &pose2d) + { + robot_geometry_msgs::PoseStamped current_pose; + if (!costmap_robot_->getRobotPose(current_pose)) + { + std::cout << "Could not get robot pose" << std::endl; + return false; + } + pose2d = robot_nav_2d_utils::poseStampedToPose2D(current_pose); + return true; + } + + robot_nav_core::BaseLocalPlanner::Ptr LocalPlannerAdapter::create() + { + return std::make_shared(); + } +} // namespace robot_nav_core_adapter + +// register this planner as a BaseLocalPlanner plugin +BOOST_DLL_ALIAS(robot_nav_core_adapter::LocalPlannerAdapter::create, LocalPlannerAdapter) \ No newline at end of file diff --git a/src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.cpp b/src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.cpp new file mode 100755 index 0000000..e87fac5 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.cpp @@ -0,0 +1,69 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include + + +TEST(LocalPlannerAdapter, unload_local_planner) +{ + tf2_robot::Buffer tf; + tf.setUsingDedicatedThread(true); + + // This empty transform is added to satisfy the constructor of + // Costmap2DROBOT, which waits for the transform from map to base_link + // to become available. + robot_geometry_msgs::TransformStamped base_rel_map; + base_rel_map.child_frame_id = "base_link"; + base_rel_map.header.frame_id = "map"; + base_rel_map.transform.rotation.w = 1.0; + tf.setTransform(base_rel_map, "unload", true); + + robot_nav_core_adapter::LocalPlannerAdapter* lpa = new robot_nav_core_adapter::LocalPlannerAdapter(); + + robot_costmap_2d::Costmap2DROBOT costmap_robot("local_costmap", tf); + lpa->initialize("lpa", &tf, &costmap_robot); + + delete lpa; + + // Simple test to make sure costmap hasn't been deleted + EXPECT_EQ("map", costmap_robot.getGlobalFrameID()); +} + + +int main(int argc, char** argv) +{ + robot::init(argc, argv, "unload_test"); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.launch b/src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.launch new file mode 100755 index 0000000..1c64734 --- /dev/null +++ b/src/Navigations/Cores/robot_nav_core_adapter/test/unload_test.launch @@ -0,0 +1,3 @@ + + + diff --git a/src/Navigations/Libraries/nav_grid/CMakeLists.txt b/src/Navigations/Libraries/nav_grid/CMakeLists.txt new file mode 100755 index 0000000..6c75965 --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/CMakeLists.txt @@ -0,0 +1,159 @@ +cmake_minimum_required(VERSION 3.0.2) +project(nav_grid VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building nav_grid with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building nav_grid with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(GTest QUIET) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED) + + catkin_package( + INCLUDE_DIRS include + # LIBRARIES không cần vì đây là header-only library + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/nav_grid/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: None") + message(STATUS "=================================") +endif() + +# ======================================================== +# Test executables +# ======================================================== +# Tests are a development-machine concern: a catkin workspace is where they run, +# while the standalone CMake build is the robot deployment path and must not +# produce test executables. Force with -DBUILD_NAV_GRID_TESTS=ON to build them +# from a standalone build. +option(BUILD_NAV_GRID_TESTS "Build the nav_grid unit tests" ${BUILDING_WITH_CATKIN}) + +if(BUILD_NAV_GRID_TESTS AND (GTest_FOUND OR GTEST_FOUND)) + enable_testing() + find_package(Threads REQUIRED) + + if(BUILD_NAV_GRID_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/utest.cpp) + add_executable(${PROJECT_NAME}_test test/utest.cpp) + target_link_libraries(${PROJECT_NAME}_test PRIVATE + ${PROJECT_NAME} + GTest::GTest + GTest::Main + Threads::Threads + ) + add_test(NAME ${PROJECT_NAME}_test COMMAND ${PROJECT_NAME}_test) + endif() +else() + message(STATUS "Google Test not found. Tests will not be built.") +endif() diff --git a/src/Navigations/Libraries/nav_grid/README.md b/src/Navigations/Libraries/nav_grid/README.md new file mode 100755 index 0000000..74c8054 --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/README.md @@ -0,0 +1,39 @@ +# nav_grid + +Many navigation algorithms rely on the concept of a two dimensional grid being overlaid on the world, with a value being assigned to each grid cell. In the original navigation stack, `Costmap2DROBOT` associated an `unsigned char` with grid cells, global planners cache distance to the goal as `float`s and local planners would cache various metrics in a grid to quickly calculate the strength of different trajectories. + +![nav_grid diagram](doc/nav_grid.png) + +## `NavGridInfo` + +Where the grid exists in the world is defined by six parameters. + * `width` and `height` (which together define the number of cells in the grid) + * `resolution` which is the dimension of each cell in meters (square cells only) + * `frame_id` which is the TF frame the grid is defined relative to. + * `origin_x` and `origin_y` which define the offset in meters from the root of the TF frame to the minimum corner of the (0, 0) cell. + +Together, these components make a [`nav_grid::NavGridInfo`](include/nav_grid/nav_grid_info.h) struct. It evolved from the [`robot_nav_msgs::MapMetaData` message](http://docs.ros.org/melodic/api/robot_nav_msgs/html/msg/MapMetaData.html) but without `map_load_time`, simplified origin geometry and the `frame_id` added. Note: for general efficiency of computation (particularly moving the grid while retaining some of the values) there is no rotation component to the origin. Each grid is locked to the orientation of its TF frame. + +The default values are `width=0, height=0, resolution=1.0, frame_id="map", origin_x=0.0, origin_y=0.0`. + +## Coordinate Conversion +One of the most common operations is to want to convert between the real world coordinates and the grid coordinates. These operations can be done with a `NavGridInfo` object and the methods in [`coordinate_conversion.h`](include/nav_grid/coordinate_conversion.h). They are derived from methods in [`robot_costmap_2d.h`](https://github.com/ros-planning/navigation/blob/a2837b5a9dc6dd4b4da176fca7d899d6a3722bf8/robot_costmap_2d/include/robot_costmap_2d/robot_costmap_2d.h#L126), but with some key differences (beyond replacing `map` with `grid`). + * `gridToWorld` is the same as `mapToWorld`, as both return the world coordinates of the center of the specified cell. + * `worldToGrid` works like `worldToMapNoBounds`, but it results in either `int` or `double` coordinates depending on the output parameter types. As the result are not bounded by the grid, the results are signed. + * `worldToGridBounded` is a combination of `worldToMap` and `worldToMapEnforceBounds`. It returns a bool for whether the input coordinates are within the grid AND the output coordinates are forced to be within the grid. The output coordinates are therefore `unsigned int`. + * There's also `isWithinGrid` that returns whether a given point is within the grid (i.e. will match the return value of `worldToGridBounded` but saves some of the computation associated with calculating the actual values of the coordinates. + +![example coordinate conversion](doc/coords.png) + +## `NavGrid` +Of course, we also want to associate a value with each cell in the grid. For that, we define the templatized [`nav_grid::NavGrid`](include/nav_grid/nav_grid.h) abstract class. The template allows for storing arbitrary data types associated with each grid cell. The actual storage mechanism for the data is not part of the base class to allow for possibly more efficient methods. A default implementation where the data is simply stored in row-major order in a one-dimensional vector is provided in [`nav_grid::VectorNavGrid`](include/nav_grid/vector_nav_grid.h>) + +The constructor for `NavGrid` takes a default value for each cell which is 0 by default. The grid's initial info matches the default info above, so the grid is initially `0x0`. + +The `NavGrid` class provides handy methods for accessing values via their grid indexes. You can use `grid(x, y)` or `grid.getValue(x, y)` to access each value, and use `grid.setValue(x, y, value)` to write each value. There is also the helper class [`nav_grid::Index`](include/nav_grid/index.h) that can be used to store the two coordinates and used in accessing the data as well a la `grid(index)` and `grid.setValue(index, value)`. + +There are two methods for changing the `info` associated with the grid: `setInfo` and `updateInfo`. `setInfo` changes the `info` while maintaining the data associated with each grid coordinate. `updateInfo` will change the info but instead maintain the data associated with the world coordinates. + +For instance, imagine a 5x5 grid with 0.5 meter resolution with the cell (2, 0) set to red which represents a cell at (1.25, 0.25) in the world. If we change the origin to be 0.5 meters to the right, the grids will have different values according to the method we use. With `setInfo`, cell (2, 0) is still red, but it is associated with a cell at (1.75, 0.25) in the world. With `updateInfo`, the cell at (1.25, 0.25) is still red, but it is now associated with cell (1, 0). The exact mechanism for how this data is preserved is left to the implementing class. + +![illustration of grid update](doc/change_info.png) diff --git a/src/Navigations/Libraries/nav_grid/doc/change_info.png b/src/Navigations/Libraries/nav_grid/doc/change_info.png new file mode 100755 index 0000000000000000000000000000000000000000..1e0e9c5776a67a90376a05fec2a2c7f3b86316b6 GIT binary patch literal 9816 zcmb7~2{@E{*#D=KtyGi~N|vKVC#0m5ZH_}!M3Q7D$~t7@J!k85z2}_&`#vsQ*R%efd;8tr&+oZ?#z1%D`t9ox2*k#dC$!HZ z5I?+t-*tRHz@G7h3%|fWo{M_A+6Xr1C#@#)0qj|K<%F3x0>LlD`CWrZND_seygnyS zALsqDjz>UVNN~pU76KuKIH|39E}(yI2;*kri&bVBSG-s88C0>bkMynfZML`aM3rh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vXOMp9@(?eROs710{4Wd;^9!dE7ud|5sb={{xZTXleie literal 0 HcmV?d00001 diff --git a/src/Navigations/Libraries/nav_grid/doc/coords.png b/src/Navigations/Libraries/nav_grid/doc/coords.png new file mode 100755 index 0000000000000000000000000000000000000000..dfa40bf1cfad32d142567f41ae8e90018718c1f7 GIT binary patch literal 56655 zcmaHT2Rzn$8@D7$LUt0evp1QMo$QtDWM^lOB7~4+uWUEjd#5`gdnJ4Cy*KaWbe`v( zpV#ww&T($H+kgCi*Y#c3KTt_Q`W7ZBCJGA5Em;`}6%>@K0VpV_WEiOM%CBegd+;xG zqbJf5C>NLi`%;$`0k7P!m3iiXf^rl8^8Z&*;u1*U#p{l;PbIHU-$2J{d?IjSUJ@`-u^EKjy8zz~nB950wG}3!@I5!Uqq#TswDa3kwV1T!90HuW!}c zRNVi5kD~J6?~5pJ)Gn_BeEs(u6ei|Kufxe3+zfwzP?)5$q>t3sqqyaHM9cl}?-hEf zEO{%69$Bro)p(=6{$F0b-sg>EUv0>`K!5e`Cw~o7JKii|6FGMzN3v%fv`)-7vWWis z+2krqKQtM8kJyMZMczL3`1`7XaC)y`QiHNcK+3bf2mGciN>20!E{^Dl&*=g6#i^-- zEdj;fH)}md^lxoVB-$QtKjGg&`}^Y8JhkJw=s(`x^3h`V4jwUH`}^{5CB{7uQp1L% z@+_Rcub|{IMUEdaY!78#tX=u ztC8y7$6SU5bopg4kkQ-V-*AddPW7`pHaKpLo~$7F`y(xN#BM_}o#Q#r>D-v8*sk*5 zmkoF_dU1^Yd7Jg|Mwe|^nVW?CB0Yu z=gJ-_7P=2*D*a6~ROvAC*8+*R8-(5WzqT6tyuI8T@TIbZH`L(WAeUibZXTG_Zp>L$ zUQUYT|6YHfzu$~IE-R?~@B2_>GQw{MN-z^Wp~Pi=7%)F?f`vTw^48a<_(1sg9UtYQ zzvn%#FflRVoLPPzLQ@S-y_s`522)2(rgvi78BOX!OE_B}Wq4YZ6N!~d+ZTj`f(h|x3 zwYGNDj2r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cNd!>C;iA+8A2p2-fTlMm0)yu}a57QUNj_^e(F~)*QE~(}$yyRI5 zc^8WT7cewmZ(ck-L1}+5b*Y_U;FpK|8{&Nq%vqQ^Dxarq*6y6J7po)o+YT*VfL zi>JA!NF$!T16OiK3`@r5XT+D`ass#dvf?#|z>ojCR&RP@TN z&$%XV^q+2ypSQ~Y(LFM&{KVHvIbNGwx0#U-IjBg)lcj9*#|?qM5z3Eh$fPb_+&2R< zQB+7M-(!q-aA^ffcH04a9um;IAQoZV@d}m0QwY|-a%dt@jHEF ze(du8^fR2U!Sm>?BEG0Y6M#04w^c8-DNc&`La@5@o8e(h7J#&17(!}(Dahc!bHu7( zBv@nkViS@cKuw~xASr2O4)JAz2*smwdH$c|a2(o*C}nmO?eHx2(rL)<$0K>NAG1Er z$I3)(GE)&>KG9V3FF8T~_&Gm++&@JK{oi>i>MXHxnq425ThAC>UvJAkus_*JB%^p5 z-LB#1kcyqapw}^Od*WsN$V|HWz6<089zQwvpMU%p23g`8|Ffs)NsMJ$eqjoVl2LDn O?@?3HQcgc);rnkEk|;O; literal 0 HcmV?d00001 diff --git a/src/Navigations/Libraries/nav_grid/doc/nav_grid.png b/src/Navigations/Libraries/nav_grid/doc/nav_grid.png new file mode 100755 index 0000000000000000000000000000000000000000..c43cda0d8e710e978f0a208357858de350245b9d GIT binary patch literal 15299 zcmcJ01yq#XyYCPJN-8NxSV)&jGl(c%g3=|aba$&D0-|(}lF|awCDI@uC5|+RbV)PB zea7$n|Lfd)&${d0wa%UI8^Fo^?sxC!`PCb$rXovvj{Y11fgqKayQhvo;JPCaI4B}q zc%)RzR2F^_m?+BLL!4s&dsm+m4Ue34kkfHSAc!fkcN|1g3LQL1=pwItpK#_Z0XYv& zhrb3M0>OfizbEz3AI^p&IC)bP`v4E7>}znELP85Db8-6-8}G_F^!P98r>NLAE8b|L`_S(*DJOzeCc($ z^+?y8)3YWRQNLx6i1Y7zGBU3s%gV|gaXd0G7@uwqS(HZ1Ubxv7iB6O7whQ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5XYAhwA~x_T}ZJ{Bc|;|%*A{@5lD2z|!MWs><%pq!e9hDZA& z3lixEZa$orOg-pxpB)GaS%~12=vCOfmqsYvx^(>fJO~SrxENji{^Zs+LBQFU$E9@a zNR&O~?7*nUhK3-~tDdVQC-+Vdp~Uu;&J_PDNG{o*K0TxWcdf+d;1A>?qdV`-BNBuY z_}ezZAjtCiwVk~^;2e`qxGaK;=nGVBaO(5(@)oWjDDiK$(fQGY-S>H?#@0dz& +#include + +namespace nav_grid +{ +/** + * @brief Convert from grid coordinates to world coordinates of the center of the cell + * + * The resulting coordinates are for the center of the grid cell. + * + * @param[in] mx The x grid coordinate + * @param[in] my The y grid coordinate + * @param[out] wx Set to the associated x world coordinate + * @param[out] wy Set to the associated y world coordinate + */ +inline void gridToWorld(const NavGridInfo& info, int mx, int my, double& wx, double& wy) +{ + wx = info.origin_x + (mx + 0.5) * info.resolution; + wy = info.origin_y + (my + 0.5) * info.resolution; +} + +/** + * @brief Convert from world coordinates to the precise (double) grid coordinates + * + * The results are not rounded, so that the values can be used for locating a position within a cell + * + * @param[in] wx The x world coordinate + * @param[in] wy The y world coordinate + * @param[out] mx Set to the associated x grid coordinate + * @param[out] my Set to the associated y grid coordinate + */ +inline void worldToGrid(const NavGridInfo& info, double wx, double wy, double& mx, double& my) +{ + mx = (wx - info.origin_x) / info.resolution; + my = (wy - info.origin_y) / info.resolution; +} + +/** + * @brief Convert from world coordinates to grid coordinates without checking for legal bounds + * @param[in] wx The x world coordinate + * @param[in] wy The y world coordinate + * @param[out] mx Set to the associated x grid coordinate + * @param[out] my Set to the associated y grid coordinate + * @note The returned grid coordinates are not guaranteed to lie within the grid. + */ +inline void worldToGrid(const NavGridInfo& info, double wx, double wy, int& mx, int& my) +{ + double dmx, dmy; + worldToGrid(info, wx, wy, dmx, dmy); + mx = static_cast(floor(dmx)); + my = static_cast(floor(dmy)); +} + +/** + * @brief Convert from world coordinates to grid coordinates + * + * Combined functionality from robot_costmap_2d::worldToMap and robot_costmap_2d::worldToMapEnforceBounds. + * The output parameters are set to grid indexes within the grid, even if the function returns false, + * meaning the coordinates are outside the grid. + * + * @param[in] wx The x world coordinate + * @param[in] wy The y world coordinate + * @param[out] mx Set to the associated (bounds-enforced) x grid coordinate + * @param[out] my Set to the associated (bounds-enforced) y grid coordinate + * @return True if the input coordinates were within the grid + */ +inline bool worldToGridBounded(const NavGridInfo& info, double wx, double wy, unsigned int& mx, unsigned int& my) +{ + double dmx, dmy; + worldToGrid(info, wx, wy, dmx, dmy); + + bool valid = true; + + if (dmx < 0.0) + { + mx = 0; + valid = false; + } + else if (dmx >= info.width) + { + mx = info.width - 1; + valid = false; + } + else + { + mx = static_cast(dmx); + } + + if (dmy < 0.0) + { + my = 0; + valid = false; + } + else if (dmy >= info.height) + { + my = info.height - 1; + valid = false; + } + else + { + my = static_cast(dmy); + } + + return valid; +} + +/** + * @brief Check to see if the world coordinates are within the grid. + * + * This should only be used if the caller does not need the associated grid coordinates. Otherwise it would + * be more efficient to call worldToGridBounded. + * + * @param[in] wx The x world coordinate + * @param[in] wy The y world coordinate + * @return True if the input coordinates were within the grid + */ +inline bool isWithinGrid(const NavGridInfo& info, double wx, double wy) +{ + wx -= info.origin_x; + wy -= info.origin_y; + return wx >= 0.0 && + wy >= 0.0 && + wx < info.width * info.resolution && + wy < info.height * info.resolution; +} + + + +} // namespace nav_grid + +#endif // NAV_GRID_COORDINATE_CONVERSION_H diff --git a/src/Navigations/Libraries/nav_grid/include/nav_grid/index.h b/src/Navigations/Libraries/nav_grid/include/nav_grid/index.h new file mode 100755 index 0000000..e6be03d --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/include/nav_grid/index.h @@ -0,0 +1,99 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NAV_GRID_INDEX_H +#define NAV_GRID_INDEX_H + +#include + +namespace nav_grid +{ +/** + * @class GenericIndex + * @brief A simple pair of x/y coordinates + */ +template +struct GenericIndex +{ + NumericType x, y; + explicit GenericIndex(const NumericType& x = 0, const NumericType& y = 0) : x(x), y(y) {} + + /** + * @brief comparison operator that requires equal x and y + */ + bool operator == (const GenericIndex& other) const + { + return x == other.x && y == other.y; + } + + bool operator != (const GenericIndex& other) const + { + return !operator==(other); + } + + /** + * @brief less than operator so object can be used in sets + */ + bool operator < (const GenericIndex& other) const + { + return x < other.x || (x == other.x && y < other.y); + } + + // Derived Comparators + bool operator > (const GenericIndex& other) const { return other < *this; } + bool operator <= (const GenericIndex& other) const { return !(*this > other); } + bool operator >= (const GenericIndex& other) const { return !(*this < other); } + + /** + * @brief String representation of this object + */ + std::string toString() const + { + return "(" + std::to_string(x) + ", " + std::to_string(y) + ")"; + } +}; + +template +inline std::ostream& operator<<(std::ostream& stream, const GenericIndex& index) +{ + stream << index.toString(); + return stream; +} + +using SignedIndex = GenericIndex; +using Index = GenericIndex; + +} // namespace nav_grid + +#endif // NAV_GRID_INDEX_H diff --git a/src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid.h b/src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid.h new file mode 100755 index 0000000..768a422 --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid.h @@ -0,0 +1,157 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NAV_GRID_NAV_GRID_H +#define NAV_GRID_NAV_GRID_H + +#include +#include +#include + +namespace nav_grid +{ +/** + * @class NavGrid + * This class is a spiritual successor to the robot_costmap_2d::Costmap2D class, with the key differences being that + * the datatype and data storage methods are not specified, and the frame_id is specified. + * + * The templatized nature of the class allows you to store whatever you like at each grid location, including + * unsigned chars if emulating Costmap2D or floating point numbers if emulating the grid_map package, or whatever + * else. + * + * The VectorNavGrid class in this package implements this class with a straight-forward single-dimensional vector + * representing the two dimensional grid. Other classes could implement the data storage differently. + * + * Getting data from the grid can be done either through the getValue methods or the parenthetical operators (which call + * getValue internally). Implementing classes must implement getValue. + * x = grid(0, 0) + grid.getValue(0, 1); + * + * Writing data to the grid must be done through the setValue method (which implementing classes must implement) + * grid.setValue(0, 0, x); + * + * You can also use nav_grid::Index objects + * nav_grid::Index index(0, 0); + * x = grid(index) + grid.getValue(index); + * index.y = 3; + * grid.setCost(index, x); + * The Index methods also internally call setValue/getValue + * + * The geometry of the grid is specified by the NavGridInfo. Borrowing an idea from the grid_map package, two + * separate methods are defined for changing the info. setInfo will change the info without changing the grid values. + * updateInfo will change the info while trying to preserve the contents of the grid. + * + * The final component is a collection of methods inspired by Costmap2D for converting coordinates of different types. + */ +template class NavGrid +{ +public: + explicit NavGrid(const T default_value = T{}) : default_value_(default_value) {} + + /** + * @brief Reset the contents of the grid + */ + virtual void reset() = 0; + + /** + * @brief get the value of the grid at (x,y) + * @param x[in] Valid x coordinate + * @param y[in] Valid y coordinate + * @return value at (x,y) + */ + virtual T getValue(const unsigned int x, const unsigned int y) const = 0; + + /** + * @brief set the value of the grid at (x,y) + * @param x[in] Valid x coordinate + * @param y[in] Valid y coordinate + * @param value[in] New Value + */ + virtual void setValue(const unsigned int x, const unsigned int y, const T& value) = 0; + + /**@name Convenience Aliases */ + // Note: You may not be able to use these unless your deriving class declares using NavGrid::operator() or + // using NavGrid::getValue + /**@{*/ + T getValue(const Index& index) { return getValue(index.x, index.y); } + T operator() (const unsigned int x, const unsigned int y) const { return getValue(x, y); } + T operator() (const Index& index) const { return getValue(index.x, index.y); } + void setValue(const Index& index, const T& value) { setValue(index.x, index.y, value); } + + /**@}*/ + + /** + * @brief Change the info while attempting to keep the values associated with the grid coordinates + * @param[in] new_info New grid info + */ + virtual void setInfo(const NavGridInfo& new_info) = 0; + + /** + * @brief Change the info while attempting to keep the values associated with the world coordinates + * + * For example, if the only change to the info is to the origin's x coordinate (increasing by an amount equal to the + * resolution), then all the values should be shifted one grid cell to the left. + * + * @param[in] new_info New grid info + */ + virtual void updateInfo(const NavGridInfo& new_info) { setInfo(new_info); } + + inline NavGridInfo getInfo() const { return info_; } + + /** + * @brief Set the default value + * @param[in] new_value New Default Value + */ + void setDefaultValue(const T new_value) + { + default_value_ = new_value; + } + + /***************************************************************************************************** + * NavGridInfo accessor methods + *****************************************************************************************************/ + inline unsigned int getWidth() const { return info_.width; } + inline unsigned int getHeight() const { return info_.height; } + inline double getResolution() const { return info_.resolution; } + inline std::string getFrameId() const { return info_.frame_id; } + inline double getOriginX() const { return info_.origin_x; } + inline double getOriginY() const { return info_.origin_y; } + +protected: + NavGridInfo info_; + T default_value_; +}; + +} // namespace nav_grid + +#endif // NAV_GRID_NAV_GRID_H diff --git a/src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid_info.h b/src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid_info.h new file mode 100755 index 0000000..b8c3e99 --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/include/nav_grid/nav_grid_info.h @@ -0,0 +1,92 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NAV_GRID_NAV_GRID_INFO_H +#define NAV_GRID_NAV_GRID_INFO_H + +#include + +namespace nav_grid +{ +/** + * @struct NavGridInfo + * This class defines a way to discretize a finite section of the world into a grid. + * It contains similar information to the ROS msg robot_nav_msgs/MapMetaData (aka the info field of robot_nav_msgs/OccupancyGrid) + * except the map_load_time is removed, the geometry is simplified from a Pose to xy coordinates, and the frame_id + * is added. + */ +struct NavGridInfo +{ +public: + /* All data is publically accessible */ + unsigned int width = 0; + unsigned int height = 0; + double resolution = 1.0; + std::string frame_id = "map"; + double origin_x = 0.0; ///< The origin defines the coordinates of minimum corner of cell (0,0) in the grid + double origin_y = 0.0; + + /** + * @brief comparison operator that requires all fields are equal + */ + bool operator == (const NavGridInfo& info) const + { + return width == info.width && height == info.height && resolution == info.resolution && + origin_x == info.origin_x && origin_y == info.origin_y && frame_id == info.frame_id; + } + + bool operator != (const NavGridInfo& info) const + { + return !operator==(info); + } + + /** + * @brief String representation of this object + */ + std::string toString() const + { + return std::to_string(width) + "x" + std::to_string(height) + " (" + std::to_string(resolution) + "res) " + + frame_id + " " + std::to_string(origin_x) + " " + std::to_string(origin_y); + } +}; + +inline std::ostream& operator<<(std::ostream& stream, const NavGridInfo& info) +{ + stream << info.toString(); + return stream; +} + +} // namespace nav_grid + +#endif // NAV_GRID_NAV_GRID_INFO_H diff --git a/src/Navigations/Libraries/nav_grid/include/nav_grid/vector_nav_grid.h b/src/Navigations/Libraries/nav_grid/include/nav_grid/vector_nav_grid.h new file mode 100755 index 0000000..ea7c4a9 --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/include/nav_grid/vector_nav_grid.h @@ -0,0 +1,239 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NAV_GRID_VECTOR_NAV_GRID_H +#define NAV_GRID_VECTOR_NAV_GRID_H + +#include +#include +#include +#include + +namespace nav_grid +{ +/** + * @class VectorNavGrid + * A straight-forward implementation of the NavGrid class where the data for cell (x, y) is stored in a std::vector + * with index (y * info.width + x). + */ +template class VectorNavGrid : public NavGrid +{ +public: + using NavGrid::NavGrid; + + /** + * @brief Reset the contents of the grid to the default value + */ + void reset() override + { + data_.assign(this->info_.width * this->info_.height, this->default_value_); + } + + /** + * @brief Change the info while attempting to keep the values associated with the grid coordinates + * + * If the width changes, we need to move each row to its new location + * + * If just the height changes, then we can resize the vector without having to move elements + * + * We just overwrite the rest of the grid info + */ + void setInfo(const NavGridInfo& new_info) override + { + if (this->info_.width != new_info.width) + { + std::vector new_vector(new_info.width * new_info.height, this->default_value_); + unsigned int cols_to_move = std::min(this->info_.width, new_info.width); + auto old_it = data_.begin(); + auto new_it = new_vector.begin(); + unsigned int max_row = std::min(this->info_.height, new_info.height); + for (unsigned int row = 0; row < max_row; row++) + { + std::copy(old_it, old_it + cols_to_move, new_it); + old_it += this->info_.width; + new_it += new_info.width; + } + data_.swap(new_vector); + } + else if (this->info_.height != new_info.height) + { + data_.resize(new_info.width * new_info.height, this->default_value_); + } + + this->info_ = new_info; + } + + /** + * @brief Update the info while keeping the data geometrically in tact + * + * If the resolution or frame_id changes, reset all the data. + * + * Otherwise, adjust the new_info so the grid stays aligned (The grid's new info will be within a + * resolution-length of the original new_info). Then copy the common values into the new grid. + * + * @param[in] new_info New information to update the grid with + */ + void updateInfo(const NavGridInfo& new_info) override + { + // If the info is the same, make no changes + if (this->info_ == new_info) + { + return; + } + + // If the resolution or frame changes, reset the whole grid + if (this->info_.resolution != new_info.resolution || this->info_.frame_id != new_info.frame_id) + { + setInfo(new_info); + return; + } + + // project the new origin into the grid + int cell_ox, cell_oy; + worldToGrid(this->info_, new_info.origin_x, new_info.origin_y, cell_ox, cell_oy); + + // To save casting from unsigned int to int a bunch of times + int old_size_x = static_cast(this->info_.width); + int old_size_y = static_cast(this->info_.height); + + // we need to compute the overlap of the new and existing windows + int lower_left_x = std::min(std::max(cell_ox, 0), old_size_x); + int lower_left_y = std::min(std::max(cell_oy, 0), old_size_y); + int upper_right_x = std::min(std::max(cell_ox + static_cast(new_info.width), 0), old_size_x); + int upper_right_y = std::min(std::max(cell_oy + static_cast(new_info.height), 0), old_size_y); + + unsigned int cell_size_x = upper_right_x - lower_left_x; + unsigned int cell_size_y = upper_right_y - lower_left_y; + + // we need a vector to store the new contents in the window temporarily + std::vector new_data(new_info.width * new_info.height, this->default_value_); + + // compute the starting cell location for copying data back in + int start_x = lower_left_x - cell_ox; + int start_y = lower_left_y - cell_oy; + + // now we want to copy the overlapping information into the new vector, but in its new location + // we'll first need to compute the starting points for each vector + auto src_index = data_.begin() + (lower_left_y * old_size_x + lower_left_x); + auto dest_index = new_data.begin() + (start_y * new_info.width + start_x); + + // now, we'll copy the source vector into the destination vector + for (unsigned int i = 0; i < cell_size_y; ++i) + { + std::copy(src_index, src_index + cell_size_x, dest_index); + src_index += this->info_.width; + dest_index += new_info.width; + } + + data_.swap(new_data); + + // update the dimensions + this->info_.width = new_info.width; + this->info_.height = new_info.height; + + // update the origin. Recomputed instead of using new_info.origin + // because we want to keep things grid-aligned + this->info_.origin_x += cell_ox * this->info_.resolution; + this->info_.origin_y += cell_oy * this->info_.resolution; + } + + void setValue(const unsigned int x, const unsigned int y, const T& value) override + { + data_[getIndex(x, y)] = value; + } + + T getValue(const unsigned int x, const unsigned int y) const override + { + return data_[getIndex(x, y)]; + } + + using NavGrid::operator(); + using NavGrid::getValue; + using NavGrid::setValue; + + /** + * Overloading the [] operator so that the data can be accessed directly with vector_nav_grid[i] + */ + T operator[] (unsigned int i) const {return data_[i];} + T& operator[] (unsigned int i) {return data_[i];} + + /** + * @brief Return the size of the vector. Equivalent to width * height. + * @return size of the vector + */ + unsigned int size() const { return data_.size(); } + + /** + * @brief Given two grid coordinates... compute the associated index + * @param[in] mx The x coordinate + * @param[in] my The y coordinate + * @return The associated index + */ + inline unsigned int getIndex(unsigned int mx, unsigned int my) const + { + return my * this->info_.width + mx; + } + + /** + * @brief Given two world coordinates... compute the associated index + * @param[in] mx The x coordinate + * @param[in] my The y coordinate + * @return The associated index + */ + inline unsigned int getIndex(double x, double y) const + { + unsigned int mx, my; + worldToGridBounded(this->info_, x, y, mx, my); + return getIndex(mx, my); + } + + /** + * @brief Given an index... compute the associated grid coordinates + * @param[in] index The index + * @param[out] mx Set to the associated x grid coordinate + * @param[out] my Set to the associated y grid coordinate + */ + inline void indexToCells(unsigned int index, unsigned int& mx, unsigned int& my) const + { + unsigned int w = this->info_.width; + my = index / w; + mx = index - my * w; + } + +protected: + std::vector data_; +}; +} // namespace nav_grid + +#endif // NAV_GRID_VECTOR_NAV_GRID_H diff --git a/src/Navigations/Libraries/nav_grid/package.xml b/src/Navigations/Libraries/nav_grid/package.xml new file mode 100644 index 0000000..59216ed --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/package.xml @@ -0,0 +1,22 @@ + + nav_grid + 0.7.10 + + nav_grid is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. nav_grid + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/nav_grid + + catkin + + \ No newline at end of file diff --git a/src/Navigations/Libraries/nav_grid/test/utest.cpp b/src/Navigations/Libraries/nav_grid/test/utest.cpp new file mode 100755 index 0000000..c9463cf --- /dev/null +++ b/src/Navigations/Libraries/nav_grid/test/utest.cpp @@ -0,0 +1,522 @@ +/* + * Software License Agreement (BSD License) + * + * Copyright (c) 2018, Locus Robotics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include + +TEST(VectorNavGrid, info_equality) +{ + nav_grid::NavGridInfo info0; + nav_grid::NavGridInfo info1; + nav_grid::NavGridInfo width_info; + width_info.width = 3; + + nav_grid::NavGridInfo height_info; + height_info.height = 3; + + nav_grid::NavGridInfo res_info; + res_info.resolution = 3.0; + + nav_grid::NavGridInfo frame_info; + frame_info.frame_id = "foobar"; + + nav_grid::NavGridInfo originx_info; + originx_info.origin_x = 3.0; + + nav_grid::NavGridInfo originy_info; + originy_info.origin_y = 3.0; + + + EXPECT_EQ(info0, info0); + EXPECT_EQ(info0, info1); + EXPECT_NE(info0, width_info); + EXPECT_NE(info0, height_info); + EXPECT_NE(info0, res_info); + EXPECT_NE(info0, frame_info); + EXPECT_NE(info0, originx_info); + EXPECT_NE(info0, originy_info); +} + +TEST(VectorNavGrid, basic_test) +{ + nav_grid::VectorNavGrid grid(-3); + nav_grid::NavGridInfo info; + info.width = 2; + info.height = 3; + grid.setInfo(info); + EXPECT_EQ(grid(0, 0), -3); + grid.setValue(1, 1, 10); + EXPECT_EQ(grid(0, 0), -3); + EXPECT_EQ(grid(1, 1), 10); +} + +TEST(VectorNavGrid, basic_index_test) +{ + nav_grid::VectorNavGrid grid(-3); + nav_grid::NavGridInfo info; + info.width = 2; + info.height = 3; + grid.setInfo(info); + + nav_grid::Index index0(0, 0), index1(1, 1); + EXPECT_EQ(grid(index0), -3); + grid.setValue(index1, 10); + EXPECT_EQ(grid(index0), -3); + EXPECT_EQ(grid(index1), 10); + EXPECT_EQ(grid(0, 0), -3); + EXPECT_EQ(grid(1, 1), 10); +} + +TEST(VectorNavGrid, easy_coordinates_test) +{ + nav_grid::NavGridInfo info; + info.width = 2; + info.height = 3; + + double wx, wy; + gridToWorld(info, 0, 0, wx, wy); + EXPECT_DOUBLE_EQ(wx, 0.5); + EXPECT_DOUBLE_EQ(wy, 0.5); + gridToWorld(info, 1, 2, wx, wy); + EXPECT_DOUBLE_EQ(wx, 1.5); + EXPECT_DOUBLE_EQ(wy, 2.5); + + unsigned int umx, umy; + int mx, my; + double dmx, dmy; + ASSERT_TRUE(worldToGridBounded(info, wx, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_EQ(umy, 2); + worldToGrid(info, wx, wy, mx, my); + EXPECT_EQ(mx, 1); + EXPECT_EQ(my, 2); + worldToGrid(info, wx, wy, dmx, dmy); + EXPECT_DOUBLE_EQ(dmx, wx); + EXPECT_DOUBLE_EQ(dmy, wy); + + // Invalid Coordinate + wx = 2.5; + EXPECT_FALSE(worldToGridBounded(info, wx, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_EQ(umy, 2); + worldToGrid(info, wx, wy, mx, my); + EXPECT_EQ(mx, 2); + EXPECT_EQ(my, 2); + + // Border Cases + EXPECT_TRUE(worldToGridBounded(info, 0.0, wy, umx, umy)); + EXPECT_EQ(umx, 0); + EXPECT_TRUE(worldToGridBounded(info, 0.25, wy, umx, umy)); + EXPECT_EQ(umx, 0); + EXPECT_TRUE(worldToGridBounded(info, 0.75, wy, umx, umy)); + EXPECT_EQ(umx, 0); + EXPECT_TRUE(worldToGridBounded(info, 0.9999, wy, umx, umy)); + EXPECT_EQ(umx, 0); + EXPECT_TRUE(worldToGridBounded(info, 1.0, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_TRUE(worldToGridBounded(info, 1.25, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_TRUE(worldToGridBounded(info, 1.75, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_TRUE(worldToGridBounded(info, 1.9999, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_FALSE(worldToGridBounded(info, 2.0, wy, umx, umy)); + EXPECT_EQ(umx, 1); +} + +TEST(VectorNavGrid, hard_coordinates_test) +{ + nav_grid::NavGridInfo info; + info.width = 2; + info.height = 3; + info.resolution = 0.1; + info.origin_x = -0.2; + info.origin_y = 0.2; + + double wx, wy; + gridToWorld(info, 0, 0, wx, wy); + EXPECT_DOUBLE_EQ(wx, -0.15); + EXPECT_DOUBLE_EQ(wy, 0.25); + gridToWorld(info, 1, 2, wx, wy); + EXPECT_DOUBLE_EQ(wx, -0.05); + EXPECT_DOUBLE_EQ(wy, 0.45); + + unsigned int umx, umy; + int mx, my; + double dmx, dmy; + EXPECT_TRUE(worldToGridBounded(info, wx, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_EQ(umy, 2); + worldToGrid(info, wx, wy, mx, my); + EXPECT_EQ(mx, 1); + EXPECT_EQ(my, 2); + worldToGrid(info, wx, wy, dmx, dmy); + EXPECT_DOUBLE_EQ(dmx, 1.5); + EXPECT_DOUBLE_EQ(dmy, 2.5); + + // Invalid Coordinate + wx = 2.5; + EXPECT_FALSE(worldToGridBounded(info, wx, wy, umx, umy)); + EXPECT_EQ(umx, 1); + EXPECT_EQ(umy, 2); + worldToGrid(info, wx, wy, mx, my); + EXPECT_EQ(mx, 27); + EXPECT_EQ(my, 2); +} + + +TEST(VectorNavGrid, speed_test) +{ + nav_grid::NavGridInfo info; + + const int N = 1000; + const int EXTRA = 300; + + info.width = N; + info.height = N; + + double wx, wy; + unsigned int umx, umy; + int mx, my; + double dmx, dmy; + + for (int x = -EXTRA; x < N + EXTRA; x++) + { + for (int y = -EXTRA; y < N + EXTRA; y++) + { + gridToWorld(info, x, y, wx, wy); + if (x < 0 || y < 0 || x >= N || y >= N) + { + EXPECT_FALSE(isWithinGrid(info, wx, wy)); + EXPECT_FALSE(worldToGridBounded(info, wx, wy, umx, umy)); + EXPECT_EQ(umx, std::min(std::max(0, x), N - 1)); + EXPECT_EQ(umy, std::min(std::max(0, y), N - 1)); + } + else + { + EXPECT_TRUE(isWithinGrid(info, wx, wy)); + EXPECT_TRUE(worldToGridBounded(info, wx, wy, umx, umy)); + EXPECT_EQ(umx, x); + EXPECT_EQ(umy, y); + } + worldToGrid(info, wx, wy, mx, my); + EXPECT_EQ(mx, x); + EXPECT_EQ(my, y); + worldToGrid(info, wx, wy, dmx, dmy); + EXPECT_DOUBLE_EQ(dmx, x + 0.5); + EXPECT_DOUBLE_EQ(dmy, y + 0.5); + } + } +} + +int testGridValue(double x, double y) +{ + return static_cast(100 * floor(x) + floor(y)); +} + +/** + * Initialize Grid Values with values based on the grid/world coordinates + * which are initially the same + * + * x --> + * 000 100 200 300 400 500 600 700 800 900 y + * 001 101 201 301 401 501 601 701 801 901 | + * 002 102 202 302 402 502 602 702 802 902 | + * 003 103 203 303 403 503 603 703 803 903 V + * 004 104 204 304 404 504 604 704 804 904 + + */ +void initializeTestGrid(nav_grid::VectorNavGrid& grid) +{ + grid.setDefaultValue(-10); + nav_grid::NavGridInfo info; + info.width = 10; + info.height = 5; + grid.setInfo(info); + double mx, my; + for (unsigned int j = 0; j < info.height; j++) + { + for (unsigned int i = 0; i < info.width; i++) + { + gridToWorld(info, i, j, mx, my); + grid.setValue(i, j, testGridValue(mx, my)); + } + } +} + +/** + * Check to make sure all the grid values are now the same based on their grid coordinates + */ +void checkSetGridValues(const nav_grid::VectorNavGrid& grid, + unsigned int x0, unsigned int x1, unsigned int y0, unsigned int y1) +{ + for (unsigned int x = 0; x < grid.getWidth(); x++) + { + for (unsigned int y = 0; y < grid.getHeight(); y++) + { + if (x >= x0 && x < x1 && y >= y0 && y < y1) + { + EXPECT_EQ(grid(x, y), testGridValue(x, y)); // testGridValue based on Grid Coordinates + } + else + { + EXPECT_EQ(grid(x, y), -10); + } + } + } +} + +/** + * Check to make sure all the grid values are now the same based on their world coordinates + */ +void checkUpdateGridValues(const nav_grid::VectorNavGrid& grid, + unsigned int x0, unsigned int x1, unsigned int y0, unsigned int y1) +{ + double mx, my; + for (unsigned int x = 0; x < grid.getWidth(); x++) + { + for (unsigned int y = 0; y < grid.getHeight(); y++) + { + if (x >= x0 && x < x1 && y >= y0 && y < y1) + { + gridToWorld(grid.getInfo(), x, y, mx, my); + EXPECT_EQ(grid(x, y), testGridValue(mx, my)); // testGridValue based on World Coordinates + } + else + { + EXPECT_EQ(grid(x, y), -10); + } + } + } +} + +void debugGridValues(const nav_grid::VectorNavGrid& grid) +{ + for (unsigned int j = 0; j < grid.getHeight(); j++) + { + for (unsigned int i = 0; i < grid.getWidth(); i++) + { + printf("%d ", grid(i, j)); + } + printf("\n"); + } + printf("\n"); +} + +TEST(VectorNavGrid, resizing_grid_with_set) +{ + nav_grid::VectorNavGrid grid; + initializeTestGrid(grid); + checkSetGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + nav_grid::NavGridInfo decreased_width_info = grid.getInfo(); + decreased_width_info.width = 5; + grid.setInfo(decreased_width_info); + checkSetGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + nav_grid::NavGridInfo increased_width_info = grid.getInfo(); + increased_width_info.width = 9; + grid.setInfo(increased_width_info); + checkSetGridValues(grid, 0, 5, 0, grid.getHeight()); + + initializeTestGrid(grid); + checkSetGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + nav_grid::NavGridInfo increased_height_info = grid.getInfo(); + increased_height_info.height = 9; + grid.setInfo(increased_height_info); + checkSetGridValues(grid, 0, grid.getWidth(), 0, 5); + + nav_grid::NavGridInfo decreased_height_info = grid.getInfo(); + decreased_height_info.height = 4; + grid.setInfo(decreased_height_info); + checkSetGridValues(grid, 0, grid.getWidth(), 0, 4); +} + +TEST(VectorNavGrid, resizing_grid_with_update) +{ + nav_grid::VectorNavGrid grid; + initializeTestGrid(grid); + checkUpdateGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + nav_grid::NavGridInfo decreased_width_info = grid.getInfo(); + decreased_width_info.width = 5; + grid.updateInfo(decreased_width_info); + checkUpdateGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + nav_grid::NavGridInfo increased_width_info = grid.getInfo(); + increased_width_info.width = 9; + grid.updateInfo(increased_width_info); + checkUpdateGridValues(grid, 0, 5, 0, grid.getHeight()); + + initializeTestGrid(grid); + checkUpdateGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + nav_grid::NavGridInfo increased_height_info = grid.getInfo(); + increased_height_info.height = 9; + grid.updateInfo(increased_height_info); + checkUpdateGridValues(grid, 0, grid.getWidth(), 0, 5); + + nav_grid::NavGridInfo decreased_height_info = grid.getInfo(); + decreased_height_info.height = 4; + grid.updateInfo(decreased_height_info); + checkUpdateGridValues(grid, 0, grid.getWidth(), 0, 4); +} + +TEST(VectorNavGrid, change_origin) +{ + nav_grid::VectorNavGrid grid; + initializeTestGrid(grid); + + nav_grid::NavGridInfo bump_right_info = grid.getInfo(); + bump_right_info.origin_x = 3; + grid.updateInfo(bump_right_info); + checkUpdateGridValues(grid, 0, 7, 0, grid.getHeight()); + + nav_grid::NavGridInfo bump_up_info = grid.getInfo(); + bump_up_info.origin_y = 2; + grid.updateInfo(bump_up_info); + checkUpdateGridValues(grid, 0, 7, 0, 3); + + nav_grid::NavGridInfo bump_left_info = grid.getInfo(); + bump_left_info.origin_x = -1; + grid.updateInfo(bump_left_info); + checkUpdateGridValues(grid, 4, grid.getWidth(), 0, 3); + + nav_grid::NavGridInfo bump_down_info = grid.getInfo(); + bump_down_info.origin_y = 0; + grid.updateInfo(bump_down_info); + checkUpdateGridValues(grid, 4, grid.getWidth(), 2, grid.getHeight()); + + + initializeTestGrid(grid); + nav_grid::NavGridInfo bump_far_right_info = grid.getInfo(); + bump_far_right_info.origin_x = 30; + grid.updateInfo(bump_far_right_info); + checkUpdateGridValues(grid, 0, 0, 0, 0); +} + +TEST(VectorNavGrid, combined_changes) +{ + // This is not a complete set of possible combined changes, just enough to satisfy my curiousity + nav_grid::VectorNavGrid grid; + initializeTestGrid(grid); + checkUpdateGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + nav_grid::NavGridInfo info1 = grid.getInfo(); + info1.width = 15; + info1.origin_x = -5.0; + grid.updateInfo(info1); + checkUpdateGridValues(grid, 5, grid.getWidth(), 0, grid.getHeight()); + + initializeTestGrid(grid); + nav_grid::NavGridInfo info2 = grid.getInfo(); + info2.width = 17; + info2.origin_x = -5.0; + grid.updateInfo(info2); + checkUpdateGridValues(grid, 5, grid.getWidth() - 2, 0, grid.getHeight()); + + initializeTestGrid(grid); + nav_grid::NavGridInfo info3 = grid.getInfo(); + info3.width = 2; + info3.origin_x = 2.0; + grid.updateInfo(info3); + checkUpdateGridValues(grid, 0, grid.getWidth(), 0, grid.getHeight()); + + initializeTestGrid(grid); + nav_grid::NavGridInfo info4 = grid.getInfo(); + info4.width = 20; + info4.height = 20; + info4.origin_x = -2.0; + info4.origin_y = -5.0; + grid.updateInfo(info4); + checkUpdateGridValues(grid, 2, 12, 5, 10); +} + +TEST(Index, comparison_tests) +{ + unsigned int N = 5; + for (unsigned int x0 = 0; x0 < N; ++x0) + { + for (unsigned int y0 = 0; y0 < N; ++y0) + { + nav_grid::Index index0(x0, y0); + + for (unsigned int x1 = 0; x1 < N; ++x1) + { + for (unsigned int y1 = 0; y1 < N; ++y1) + { + nav_grid::Index index1(x1, y1); + // Check equality and the test for equality that sets use + // See https://stackoverflow.com/a/1114862 + if (x0 == x1 && y0 == y1) + { + EXPECT_EQ(index0, index1); + EXPECT_TRUE(!(index0 < index1) && !(index1 < index0)); + EXPECT_GE(index0, index1); + EXPECT_LE(index0, index1); + EXPECT_GE(index1, index0); + EXPECT_LE(index1, index0); + } + else + { + EXPECT_NE(index0, index1); + EXPECT_FALSE(!(index0 < index1) && !(index1 < index0)); + if (x0 < x1 || (x0 == x1 && y0 < y1)) + { + EXPECT_LT(index0, index1); + EXPECT_GT(index1, index0); + EXPECT_LE(index0, index1); + EXPECT_GE(index1, index0); + } + else + { + EXPECT_GT(index0, index1); + EXPECT_LT(index1, index0); + EXPECT_GE(index0, index1); + EXPECT_LE(index1, index0); + } + } + } + } + } + } +} + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/Navigations/Libraries/robot_actionlib_msgs/CMakeLists.txt b/src/Navigations/Libraries/robot_actionlib_msgs/CMakeLists.txt new file mode 100644 index 0000000..0cc579e --- /dev/null +++ b/src/Navigations/Libraries/robot_actionlib_msgs/CMakeLists.txt @@ -0,0 +1,154 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_actionlib_msgs VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_actionlib_msgs with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_actionlib_msgs with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_std_msgs + robot_time + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_std_msgs + robot_time + ) + + find_package(Boost REQUIRED) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS robot_std_msgs robot_time + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/robot_actionlib_msgs/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + Boost::headers + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PACKAGES_DIR} + Boost::headers + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: robot_std_msgs, utils, robot_time, Boost") + message(STATUS "=================================") +endif() + diff --git a/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalID.h b/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalID.h new file mode 100644 index 0000000..1bb37e3 --- /dev/null +++ b/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalID.h @@ -0,0 +1,65 @@ +// Generated by gencpp from file actionlib_msgs/GoalID.msg +// DO NOT EDIT! + +#ifndef ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALID_H +#define ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALID_H + +#include +#include +#include + +#include + +namespace robot_actionlib_msgs +{ + template + struct GoalID_ + { + typedef GoalID_ Type; + + GoalID_() + : stamp(), id() + { + } + GoalID_(const ContainerAllocator &_alloc) + : stamp(), id(_alloc) + { + (void)_alloc; + } + + typedef robot::Time _stamp_type; + _stamp_type stamp; + + typedef std::basic_string, typename std::allocator_traits::template rebind_alloc> _id_type; + _id_type id; + + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalID_> Ptr; + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalID_ const> ConstPtr; + + }; // struct GoalID_ + + typedef ::robot_actionlib_msgs::GoalID_> GoalID; + + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalID> GoalIDPtr; + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalID const> GoalIDConstPtr; + + // constants requiring out of line definition + + + + template + bool operator==(const ::robot_actionlib_msgs::GoalID_ &lhs, const ::robot_actionlib_msgs::GoalID_ &rhs) + { + return lhs.stamp == rhs.stamp && + lhs.id == rhs.id; + } + + template + bool operator!=(const ::robot_actionlib_msgs::GoalID_ &lhs, const ::robot_actionlib_msgs::GoalID_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_actionlib_msgs + +#endif // ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALID_H diff --git a/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatus.h b/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatus.h new file mode 100644 index 0000000..239bad2 --- /dev/null +++ b/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatus.h @@ -0,0 +1,112 @@ +// Generated by gencpp from file actionlib_msgs/GoalStatus.msg +// DO NOT EDIT! + +#ifndef ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALSTATUS_H +#define ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALSTATUS_H + +#include +#include +#include +#include + +namespace robot_actionlib_msgs +{ + template + struct GoalStatus_ + { + typedef GoalStatus_ Type; + + GoalStatus_() + : goal_id(), status(0), text() + { + } + GoalStatus_(const ContainerAllocator &_alloc) + : goal_id(_alloc), status(0), text(_alloc) + { + (void)_alloc; + } + + typedef ::robot_actionlib_msgs::GoalID_ _goal_id_type; + _goal_id_type goal_id; + + typedef uint8_t _status_type; + _status_type status; + + typedef std::basic_string, typename std::allocator_traits::template rebind_alloc> _text_type; + _text_type text; + +// reducing the odds to have name collisions with Windows.h +#if defined(_WIN32) && defined(PENDING) +#undef PENDING +#endif +#if defined(_WIN32) && defined(ACTIVE) +#undef ACTIVE +#endif +#if defined(_WIN32) && defined(PREEMPTED) +#undef PREEMPTED +#endif +#if defined(_WIN32) && defined(SUCCEEDED) +#undef SUCCEEDED +#endif +#if defined(_WIN32) && defined(ABORTED) +#undef ABORTED +#endif +#if defined(_WIN32) && defined(REJECTED) +#undef REJECTED +#endif +#if defined(_WIN32) && defined(PREEMPTING) +#undef PREEMPTING +#endif +#if defined(_WIN32) && defined(RECALLING) +#undef RECALLING +#endif +#if defined(_WIN32) && defined(RECALLED) +#undef RECALLED +#endif +#if defined(_WIN32) && defined(LOST) +#undef LOST +#endif + + enum + { + PENDING = 0u, + ACTIVE = 1u, + PREEMPTED = 2u, + SUCCEEDED = 3u, + ABORTED = 4u, + REJECTED = 5u, + PREEMPTING = 6u, + RECALLING = 7u, + RECALLED = 8u, + LOST = 9u, + }; + + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatus_> Ptr; + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatus_ const> ConstPtr; + + }; // struct GoalStatus_ + + typedef ::robot_actionlib_msgs::GoalStatus_> GoalStatus; + + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatus> GoalStatusPtr; + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatus const> GoalStatusConstPtr; + + // constants requiring out of line definition + + template + bool operator==(const ::robot_actionlib_msgs::GoalStatus_ &lhs, const ::robot_actionlib_msgs::GoalStatus_ &rhs) + { + return lhs.goal_id == rhs.goal_id && + lhs.status == rhs.status && + lhs.text == rhs.text; + } + + template + bool operator!=(const ::robot_actionlib_msgs::GoalStatus_ &lhs, const ::robot_actionlib_msgs::GoalStatus_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_actionlib_msgs + +#endif // ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALSTATUS_H diff --git a/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatusArray.h b/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatusArray.h new file mode 100644 index 0000000..e5591c8 --- /dev/null +++ b/src/Navigations/Libraries/robot_actionlib_msgs/include/robot_actionlib_msgs/GoalStatusArray.h @@ -0,0 +1,64 @@ +// Generated by gencpp from file actionlib_msgs/GoalStatusArray.msg +// DO NOT EDIT! + +#ifndef ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALSTATUSARRAY_H +#define ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALSTATUSARRAY_H + +#include +#include +#include + +#include +#include + +namespace robot_actionlib_msgs +{ + template + struct GoalStatusArray_ + { + typedef GoalStatusArray_ Type; + + GoalStatusArray_() + : header(), status_list() + { + } + GoalStatusArray_(const ContainerAllocator &_alloc) + : header(_alloc), status_list(_alloc) + { + (void)_alloc; + } + + typedef ::robot_std_msgs::Header_ _header_type; + _header_type header; + + typedef std::vector<::robot_actionlib_msgs::GoalStatus_, typename std::allocator_traits::template rebind_alloc<::robot_actionlib_msgs::GoalStatus_>> _status_list_type; + _status_list_type status_list; + + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatusArray_> Ptr; + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatusArray_ const> ConstPtr; + + }; // struct GoalStatusArray_ + + typedef ::robot_actionlib_msgs::GoalStatusArray_> GoalStatusArray; + + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatusArray> GoalStatusArrayPtr; + typedef boost::shared_ptr<::robot_actionlib_msgs::GoalStatusArray const> GoalStatusArrayConstPtr; + + // constants requiring out of line definition + + template + bool operator==(const ::robot_actionlib_msgs::GoalStatusArray_ &lhs, const ::robot_actionlib_msgs::GoalStatusArray_ &rhs) + { + return lhs.header == rhs.header && + lhs.status_list == rhs.status_list; + } + + template + bool operator!=(const ::robot_actionlib_msgs::GoalStatusArray_ &lhs, const ::robot_actionlib_msgs::GoalStatusArray_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_actionlib_msgs + +#endif // ROBOT_ACTIONLIB_MSGS_MESSAGE_GOALSTATUSARRAY_H diff --git a/src/Navigations/Libraries/robot_actionlib_msgs/package.xml b/src/Navigations/Libraries/robot_actionlib_msgs/package.xml new file mode 100644 index 0000000..f39a664 --- /dev/null +++ b/src/Navigations/Libraries/robot_actionlib_msgs/package.xml @@ -0,0 +1,27 @@ + + robot_actionlib_msgs + 0.7.10 + + robot_actionlib_msgs is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. robot_actionlib_msgs + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_actionlib_msgs + + catkin + + robot_std_msgs + robot_std_msgs + + robot_time + robot_time + \ No newline at end of file diff --git a/src/Navigations/Libraries/robot_clear_costmap_recovery/CMakeLists.txt b/src/Navigations/Libraries/robot_clear_costmap_recovery/CMakeLists.txt new file mode 100644 index 0000000..c672ac7 --- /dev/null +++ b/src/Navigations/Libraries/robot_clear_costmap_recovery/CMakeLists.txt @@ -0,0 +1,144 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_clear_costmap_recovery VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_clear_costmap_recovery with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_clear_costmap_recovery with Standalone CMake") +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED COMPONENTS system thread) + +if (NOT BUILDING_WITH_CATKIN) + +# Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_nav_core + robot_costmap_2d + robot_cpp + tf3 + ) + + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_nav_core + robot_costmap_2d + robot_cpp + ) + + find_package(Boost REQUIRED COMPONENTS system thread) + find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS robot_cpp robot_nav_core robot_costmap_2d + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${TF3_INCLUDE_DIR} + ) +endif() + +# Libraries +add_library(${PROJECT_NAME} src/clear_costmap_recovery.cpp) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES}) + +else() + + target_link_libraries(${PROJECT_NAME} + PUBLIC + ${PACKAGES_DIR} + ${Boost_LIBRARIES} + ${TF3_LIBRARY} + ) + + set_target_properties(${PROJECT_NAME} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + BUILD_RPATH "${CMAKE_BINARY_DIR}" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + ) + + target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ${TF3_INCLUDE_DIR} + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" + PATTERN ".svn" EXCLUDE + ) +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME}") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Libraries: ${PROJECT_NAME}") + message(STATUS "Dependencies: robot_nav_core, robot_costmap_2d, robot_cpp, Boost") + message(STATUS "=================================") +endif() diff --git a/src/Navigations/Libraries/robot_clear_costmap_recovery/include/robot_clear_costmap_recovery/clear_costmap_recovery.h b/src/Navigations/Libraries/robot_clear_costmap_recovery/include/robot_clear_costmap_recovery/clear_costmap_recovery.h new file mode 100755 index 0000000..85f834f --- /dev/null +++ b/src/Navigations/Libraries/robot_clear_costmap_recovery/include/robot_clear_costmap_recovery/clear_costmap_recovery.h @@ -0,0 +1,68 @@ +/********************************************************************* +* +* Software License Agreement (BSD License) +* +* +* Author: Kevin Lee +*********************************************************************/ +#ifndef _ROBOT_CLEAR_COSTMAP_RECOVERY_H_ +#define _ROBOT_CLEAR_COSTMAP_RECOVERY_H_ +#include +#include +#include + +#include + +namespace robot_clear_costmap_recovery +{ + /** + * @class ClearCostmapRecovery + * @brief A recovery behavior that reverts the navigation stack's costmaps to the static map outside of a user-specified region. + */ + class ClearCostmapRecovery : public robot_nav_core::RecoveryBehavior { + public: + /** + * @brief Constructor, make sure to call initialize in addition to actually initialize the object + * @param + * @return + */ + ClearCostmapRecovery(); + + /** + * @brief Initialization function for the ClearCostmapRecovery recovery behavior + * @param tf A pointer to a transform listener + * @param global_costmap A pointer to the global_costmap used by the navigation stack + * @param local_costmap A pointer to the local_costmap used by the navigation stack + */ + void initialize(std::string name, tf3::BufferCore* tf, + robot_costmap_2d::Costmap2DROBOT* global_costmap, robot_costmap_2d::Costmap2DROBOT* local_costmap); + + /** + * @brief Run the ClearCostmapRecovery recovery behavior. Reverts the + * costmap to the static map outside of a user-specified window and + * clears unknown space around the robot. + */ + void runBehavior(); + + /** + * @brief Export factory function for the ClearCostmapRecovery recovery behavior + * @return A pointer to the ClearCostmapRecovery recovery behavior + */ + static std::shared_ptr create(); + + private: + void clear(robot_costmap_2d::Costmap2DROBOT* costmap); + void clearMap(boost::shared_ptr costmap, double pose_x, double pose_y); + robot_costmap_2d::Costmap2DROBOT* global_costmap_, *local_costmap_; + std::string name_; + tf3::BufferCore* tf_; + bool initialized_; + bool force_updating_; ///< force costmap update after clearing, so we don't need to wait for update thread + double reset_distance_; + bool invert_area_to_clear_; + std::string affected_maps_; ///< clear only local, global or both costmaps + std::set clearable_layers_; ///< Layer names which will be cleared. + }; +} // namespace robot_clear_costmap_recovery + +#endif // _ROBOT_CLEAR_COSTMAP_RECOVERY_H_ diff --git a/src/Navigations/Libraries/robot_clear_costmap_recovery/package.xml b/src/Navigations/Libraries/robot_clear_costmap_recovery/package.xml new file mode 100644 index 0000000..ec95bc1 --- /dev/null +++ b/src/Navigations/Libraries/robot_clear_costmap_recovery/package.xml @@ -0,0 +1,27 @@ + + robot_clear_costmap_recovery + 0.7.10 + + robot_clear_costmap_recovery is a recovery behavior that reverts the navigation stack's + costmaps to the static map outside of a user-specified region. + + Eitan Marder-Eppstein + Tully Foote + BSD + + http://www.ros.org/wiki/robot_clear_costmap_recovery + + catkin + + robot_nav_core + robot_nav_core + + robot_costmap_2d + robot_costmap_2d + + robot_cpp + robot_cpp + + + + \ No newline at end of file diff --git a/src/Navigations/Libraries/robot_clear_costmap_recovery/src/clear_costmap_recovery.cpp b/src/Navigations/Libraries/robot_clear_costmap_recovery/src/clear_costmap_recovery.cpp new file mode 100755 index 0000000..2ce3ab7 --- /dev/null +++ b/src/Navigations/Libraries/robot_clear_costmap_recovery/src/clear_costmap_recovery.cpp @@ -0,0 +1,337 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2009, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + *********************************************************************/ +#include +#include +#include +#include + +using robot_costmap_2d::NO_INFORMATION; + +namespace robot_clear_costmap_recovery +{ + ClearCostmapRecovery::ClearCostmapRecovery() : global_costmap_(NULL), local_costmap_(NULL), + tf_(NULL), initialized_(false) {} + + void ClearCostmapRecovery::initialize(std::string name, tf3::BufferCore *tf, + robot_costmap_2d::Costmap2DROBOT *global_costmap, robot_costmap_2d::Costmap2DROBOT *local_costmap) + { + if (!initialized_) + { + name_ = name; + tf_ = tf; + global_costmap_ = global_costmap; + local_costmap_ = local_costmap; + + // get some parameters from the parameter server + robot::NodeHandle private_nh("~/" + name_); + + private_nh.param("reset_distance", reset_distance_, 3.0); + private_nh.param("invert_area_to_clear", invert_area_to_clear_, false); + private_nh.param("force_updating", force_updating_, false); + private_nh.param("affected_maps", affected_maps_, std::string("both")); + if (affected_maps_ != "local" && affected_maps_ != "global" && affected_maps_ != "both") + { + robot::log_warning("Wrong value for affected_maps parameter: '%s'; valid values are 'local', 'global' or 'both'; " + "defaulting to 'both'", + affected_maps_.c_str()); + affected_maps_ = "both"; + } + + std::vector clearable_layers_default, clearable_layers; + clearable_layers_default.push_back(std::string("obstacles")); + private_nh.param("layer_names", clearable_layers, clearable_layers_default); + + for (unsigned i = 0; i < clearable_layers.size(); i++) + { + robot::log_info("Recovery behavior will clear layer '%s'", clearable_layers[i].c_str()); + clearable_layers_.insert(clearable_layers[i]); + } + initialized_ = true; + } + else + { + robot::log_error("You should not call initialize twice on this object, doing nothing "); + } + } + + void ClearCostmapRecovery::runBehavior() + { + robot::log_info("[ClearCostmapRecovery::runBehavior] ===== ENTRY ====="); + robot::log_info("[ClearCostmapRecovery::runBehavior] Name: %s", name_.c_str()); + + // Check initialization + if (!initialized_) + { + robot::log_error("[ClearCostmapRecovery::runBehavior] ERROR: Not initialized!"); + robot::log_info("[ClearCostmapRecovery::runBehavior] ===== EXIT (not initialized) ====="); + return; + } + robot::log_debug("[ClearCostmapRecovery::runBehavior] Initialization check: OK"); + + // Check costmaps + if (global_costmap_ == NULL || local_costmap_ == NULL) + { + robot::log_error("[ClearCostmapRecovery::runBehavior] ERROR: Costmaps are NULL!"); + robot::log_error("[ClearCostmapRecovery::runBehavior] global_costmap_: %s", global_costmap_ ? "valid" : "NULL"); + robot::log_error("[ClearCostmapRecovery::runBehavior] local_costmap_: %s", local_costmap_ ? "valid" : "NULL"); + robot::log_info("[ClearCostmapRecovery::runBehavior] ===== EXIT (NULL costmaps) ====="); + return; + } + robot::log_debug("[ClearCostmapRecovery::runBehavior] Costmaps check: OK"); + + // Log parameters + robot::log_info("[ClearCostmapRecovery::runBehavior] Parameters:"); + robot::log_info("[ClearCostmapRecovery::runBehavior] - reset_distance: %.2f m", reset_distance_); + robot::log_info("[ClearCostmapRecovery::runBehavior] - invert_area_to_clear: %s", invert_area_to_clear_ ? "true" : "false"); + robot::log_info("[ClearCostmapRecovery::runBehavior] - force_updating: %s", force_updating_ ? "true" : "false"); + robot::log_info("[ClearCostmapRecovery::runBehavior] - affected_maps: %s", affected_maps_.c_str()); + robot::log_info("[ClearCostmapRecovery::runBehavior] - clearable_layers count: %zu", clearable_layers_.size()); + for (const auto& layer : clearable_layers_) + { + robot::log_info("[ClearCostmapRecovery::runBehavior] - layer: '%s'", layer.c_str()); + } + + // Log clearing mode + if (!invert_area_to_clear_) + { + robot::log_warning("[ClearCostmapRecovery::runBehavior] %s is Clearing %s costmap%s outside a square (%.2fm) large centered on the robot.", + name_.c_str(), affected_maps_.c_str(), + affected_maps_ == "both" ? "s" : "", reset_distance_); + } + else + { + robot::log_warning("[ClearCostmapRecovery::runBehavior] %s is Clearing %s costmap%s inside a square (%.2fm) large centered on the robot.", + name_.c_str(), affected_maps_.c_str(), + affected_maps_ == "both" ? "s" : "", reset_distance_); + } + + // Process global costmap + robot::WallTime t0 = robot::WallTime::now(); + if (affected_maps_ == "global" || affected_maps_ == "both") + { + robot::log_info("[ClearCostmapRecovery::runBehavior] Processing GLOBAL costmap..."); + robot::WallTime clear_start = robot::WallTime::now(); + + clear(global_costmap_); + + robot::WallDuration clear_duration = robot::WallTime::now() - clear_start; + robot::log_info("[ClearCostmapRecovery::runBehavior] Global costmap clear() completed in %.6f s", clear_duration.toSec()); + + if (force_updating_) + { + robot::log_info("[ClearCostmapRecovery::runBehavior] Force updating global costmap..."); + robot::WallTime update_start = robot::WallTime::now(); + global_costmap_->updateMap(); + robot::WallDuration update_duration = robot::WallTime::now() - update_start; + robot::log_info("[ClearCostmapRecovery::runBehavior] Global costmap updateMap() completed in %.6f s", update_duration.toSec()); + } + + robot::WallDuration total_duration = robot::WallTime::now() - t0; + robot::log_info("[ClearCostmapRecovery::runBehavior] Global costmap total processing time: %.6f s", total_duration.toSec()); + robot::log_debug("[ClearCostmapRecovery::runBehavior] Global costmap cleared in %fs", total_duration.toSec()); + } + else + { + robot::log_debug("[ClearCostmapRecovery::runBehavior] Skipping global costmap (affected_maps='%s')", affected_maps_.c_str()); + } + + // Process local costmap + t0 = robot::WallTime::now(); + if (affected_maps_ == "local" || affected_maps_ == "both") + { + robot::log_info("[ClearCostmapRecovery::runBehavior] Processing LOCAL costmap..."); + robot::WallTime clear_start = robot::WallTime::now(); + + clear(local_costmap_); + + robot::WallDuration clear_duration = robot::WallTime::now() - clear_start; + robot::log_info("[ClearCostmapRecovery::runBehavior] Local costmap clear() completed in %.6f s", clear_duration.toSec()); + + if (force_updating_) + { + robot::log_info("[ClearCostmapRecovery::runBehavior] Force updating local costmap..."); + robot::WallTime update_start = robot::WallTime::now(); + local_costmap_->updateMap(); + robot::WallDuration update_duration = robot::WallTime::now() - update_start; + robot::log_info("[ClearCostmapRecovery::runBehavior] Local costmap updateMap() completed in %.6f s", update_duration.toSec()); + } + + robot::WallDuration total_duration = robot::WallTime::now() - t0; + robot::log_info("[ClearCostmapRecovery::runBehavior] Local costmap total processing time: %.6f s", total_duration.toSec()); + robot::log_debug("[ClearCostmapRecovery::runBehavior] Local costmap cleared in %fs", total_duration.toSec()); + } + else + { + robot::log_debug("[ClearCostmapRecovery::runBehavior] Skipping local costmap (affected_maps='%s')", affected_maps_.c_str()); + } + + robot::log_info("[ClearCostmapRecovery::runBehavior] ===== EXIT (success) ====="); + } + + void ClearCostmapRecovery::clear(robot_costmap_2d::Costmap2DROBOT *costmap) + { + robot::log_debug("[ClearCostmapRecovery::clear] ===== ENTRY ====="); + + std::vector> *plugins = costmap->getLayeredCostmap()->getPlugins(); + robot::log_debug("[ClearCostmapRecovery::clear] Found %zu plugins", plugins ? plugins->size() : 0); + + robot_geometry_msgs::PoseStamped pose; + + if (!costmap->getRobotPose(pose)) + { + robot::log_error("[ClearCostmapRecovery::clear] ERROR: Cannot clear map because pose cannot be retrieved"); + robot::log_debug("[ClearCostmapRecovery::clear] ===== EXIT (no pose) ====="); + return; + } + + double x = pose.pose.position.x; + double y = pose.pose.position.y; + robot::log_debug("[ClearCostmapRecovery::clear] Robot pose: x=%.3f, y=%.3f", x, y); + + if (!plugins) + { + robot::log_error("[ClearCostmapRecovery::clear] ERROR: plugins pointer is NULL"); + robot::log_debug("[ClearCostmapRecovery::clear] ===== EXIT (NULL plugins) ====="); + return; + } + + int processed_layers = 0; + int skipped_layers = 0; + + for (std::vector>::iterator pluginp = plugins->begin(); pluginp != plugins->end(); ++pluginp) + { + boost::shared_ptr plugin = *pluginp; + if (!plugin) + { + robot::log_warning("[ClearCostmapRecovery::clear] WARNING: Found NULL plugin, skipping"); + skipped_layers++; + continue; + } + + std::string name = plugin->getName(); + std::string original_name = name; + int slash = name.rfind('/'); + if (slash != std::string::npos) + { + name = name.substr(slash + 1); + } + + robot::log_debug("[ClearCostmapRecovery::clear] Processing layer: '%s' (original: '%s')", name.c_str(), original_name.c_str()); + + if (clearable_layers_.count(name) != 0) + { + robot::log_info("[ClearCostmapRecovery::clear] Layer '%s' is in clearable_layers, processing...", name.c_str()); + + // check if the value is convertable + if (!dynamic_cast(plugin.get())) + { + robot::log_error("[ClearCostmapRecovery::clear] ERROR: Layer '%s' is not derived from costmap_2d::CostmapLayer", name.c_str()); + skipped_layers++; + continue; + } + + boost::shared_ptr costmap_layer; + costmap_layer = boost::static_pointer_cast(plugin); + + robot::log_debug("[ClearCostmapRecovery::clear] Calling clearMap for layer '%s' at (%.3f, %.3f)", name.c_str(), x, y); + clearMap(costmap_layer, x, y); + processed_layers++; + robot::log_info("[ClearCostmapRecovery::clear] Successfully cleared layer '%s'", name.c_str()); + } + else + { + robot::log_debug("[ClearCostmapRecovery::clear] Layer '%s' is NOT in clearable_layers, skipping", name.c_str()); + skipped_layers++; + } + } + + robot::log_info("[ClearCostmapRecovery::clear] Summary: processed=%d, skipped=%d, total=%zu", + processed_layers, skipped_layers, plugins->size()); + robot::log_debug("[ClearCostmapRecovery::clear] ===== EXIT ====="); + } + + void ClearCostmapRecovery::clearMap(boost::shared_ptr costmap, + double pose_x, double pose_y) + { + robot::log_debug("[ClearCostmapRecovery::clearMap] ===== ENTRY ====="); + robot::log_debug("[ClearCostmapRecovery::clearMap] Robot pose: (%.3f, %.3f)", pose_x, pose_y); + robot::log_debug("[ClearCostmapRecovery::clearMap] Reset distance: %.3f m", reset_distance_); + robot::log_debug("[ClearCostmapRecovery::clearMap] Invert area: %s", invert_area_to_clear_ ? "true" : "false"); + + boost::unique_lock lock(*(costmap->getMutex())); + robot::log_debug("[ClearCostmapRecovery::clearMap] Mutex acquired"); + + double start_point_x = pose_x - reset_distance_ / 2; + double start_point_y = pose_y - reset_distance_ / 2; + double end_point_x = start_point_x + reset_distance_; + double end_point_y = start_point_y + reset_distance_; + + robot::log_debug("[ClearCostmapRecovery::clearMap] Clear area (world coords):"); + robot::log_debug("[ClearCostmapRecovery::clearMap] start: (%.3f, %.3f)", start_point_x, start_point_y); + robot::log_debug("[ClearCostmapRecovery::clearMap] end: (%.3f, %.3f)", end_point_x, end_point_y); + + int start_x, start_y, end_x, end_y; + costmap->worldToMapNoBounds(start_point_x, start_point_y, start_x, start_y); + costmap->worldToMapNoBounds(end_point_x, end_point_y, end_x, end_y); + + robot::log_debug("[ClearCostmapRecovery::clearMap] Clear area (map coords):"); + robot::log_debug("[ClearCostmapRecovery::clearMap] start: (%d, %d)", start_x, start_y); + robot::log_debug("[ClearCostmapRecovery::clearMap] end: (%d, %d)", end_x, end_y); + + costmap->clearArea(start_x, start_y, end_x, end_y, invert_area_to_clear_); + robot::log_debug("[ClearCostmapRecovery::clearMap] clearArea() called"); + + double ox = costmap->getOriginX(), oy = costmap->getOriginY(); + double width = costmap->getSizeInMetersX(), height = costmap->getSizeInMetersY(); + robot::log_debug("[ClearCostmapRecovery::clearMap] Costmap bounds:"); + robot::log_debug("[ClearCostmapRecovery::clearMap] origin: (%.3f, %.3f)", ox, oy); + robot::log_debug("[ClearCostmapRecovery::clearMap] size: %.3f x %.3f m", width, height); + + costmap->addExtraBounds(ox, oy, ox + width, oy + height); + robot::log_debug("[ClearCostmapRecovery::clearMap] addExtraBounds() called"); + robot::log_debug("[ClearCostmapRecovery::clearMap] ===== EXIT ====="); + return; + } + + std::shared_ptr ClearCostmapRecovery::create() + { + return std::make_shared(); + } + +}; + +BOOST_DLL_ALIAS(robot_clear_costmap_recovery::ClearCostmapRecovery::create, ClearCostmapRecovery) \ No newline at end of file diff --git a/src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tester.cpp b/src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tester.cpp new file mode 100755 index 0000000..fa0e46a --- /dev/null +++ b/src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tester.cpp @@ -0,0 +1,95 @@ +#include +#include +#include + +#include +#include + +tf2_ros::Buffer* transformer; +tf2_ros::TransformListener* tfl; + +using costmap_2d::LETHAL_OBSTACLE; + +void testClearBehavior(std::string name, + double distance, + bool obstacles, + bool static_map, + costmap_2d::Costmap2DROS* global_costmap, + costmap_2d::Costmap2DROS* local_costmap){ + robot_clear_costmap_recovery::ClearCostmapRecovery clear = robot_clear_costmap_recovery::ClearCostmapRecovery(); + + ros::NodeHandle clr("~/" + name); + clr.setParam("reset_distance", distance); + + std::vector clearable_layers; + if(obstacles) + clearable_layers.push_back( std::string("obstacles") ); + if(static_map) + clearable_layers.push_back( std::string("static_map") ); + + clr.setParam("layer_names", clearable_layers); + + clear.initialize(name, transformer, global_costmap, local_costmap); + + clear.runBehavior(); +} + +void testCountLethal(std::string name, double distance, bool obstacles, bool static_map, int global_lethal, int local_lethal=0) +{ + costmap_2d::Costmap2DROS global(name + "/global", *transformer); + costmap_2d::Costmap2DROS local(name + "/local" , *transformer); + boost::shared_ptr olayer; + + std::vector >* plugins = global.getLayeredCostmap()->getPlugins(); + for (std::vector >::iterator pluginp = plugins->begin(); pluginp != plugins->end(); ++pluginp) { + boost::shared_ptr plugin = *pluginp; + if(plugin->getName().find("obstacles")!=std::string::npos){ + olayer = boost::static_pointer_cast(plugin); + addObservation(&(*olayer), 5.0, 0.0, MAX_Z/2, 0, 0, MAX_Z/2); + addObservation(&(*olayer), 0.0, 5.0, MAX_Z/2, 0, 0, MAX_Z/2); + } + } + + global.updateMap(); + local.updateMap(); + olayer->clearStaticObservations(true, true); + + testClearBehavior("clear", distance, obstacles, static_map, &global, &local); + + global.updateMap(); + local.updateMap(); + + printMap(*global.getCostmap()); + ASSERT_EQ(countValues(*global.getCostmap(), LETHAL_OBSTACLE), global_lethal); + ASSERT_EQ(countValues( *local.getCostmap(), LETHAL_OBSTACLE), local_lethal); + +} + +TEST(ClearTester, basicTest){ + testCountLethal("base", 3.0, true, false, 20); +} + +TEST(ClearTester, bigRadiusTest){ + testCountLethal("base", 20.0, true, false, 22); +} + +TEST(ClearTester, clearNoLayersTest){ + testCountLethal("base", 20.0, false, false, 22); +} + +TEST(ClearTester, clearBothTest){ + testCountLethal("base", 3.0, true, true, 0); +} + +TEST(ClearTester, clearBothTest2){ + testCountLethal("base", 12.0, true, true, 6); +} + + +int main(int argc, char** argv){ + ros::init(argc, argv, "clear_tests"); + testing::InitGoogleTest(&argc, argv); + transformer = new tf2_ros::Buffer(ros::Duration(10)); + tfl = new tf2_ros::TransformListener(*transformer); + return RUN_ALL_TESTS(); +} diff --git a/src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tests.launch b/src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tests.launch new file mode 100755 index 0000000..637c207 --- /dev/null +++ b/src/Navigations/Libraries/robot_clear_costmap_recovery/test/clear_tests.launch @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Navigations/Libraries/robot_clear_costmap_recovery/test/params.yaml b/src/Navigations/Libraries/robot_clear_costmap_recovery/test/params.yaml new file mode 100755 index 0000000..7ebca4e --- /dev/null +++ b/src/Navigations/Libraries/robot_clear_costmap_recovery/test/params.yaml @@ -0,0 +1,13 @@ +base: + global: + plugins: + - {name: static_map, type: "costmap_2d::StaticLayer"} + - {name: obstacles, type: "costmap_2d::ObstacleLayer"} + - {name: inflation, type: "costmap_2d::InflationLayer"} + obstacles: + track_unknown_space: true + local: + plugins: [] + robot_radius: .5 +clear: + clearing_distance: 7.0 diff --git a/src/Navigations/Libraries/robot_move_base_msgs/CMakeLists.txt b/src/Navigations/Libraries/robot_move_base_msgs/CMakeLists.txt new file mode 100644 index 0000000..521ee5a --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/CMakeLists.txt @@ -0,0 +1,156 @@ +cmake_minimum_required(VERSION 3.0.2) +project(robot_move_base_msgs VERSION 1.0.0 LANGUAGES CXX) + +if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) + set(BUILDING_WITH_CATKIN TRUE) + message(STATUS "Building robot_move_base_msgs with Catkin") + +else() + set(BUILDING_WITH_CATKIN FALSE) + message(STATUS "Building robot_move_base_msgs with Standalone CMake") +endif() + +# C++ Standard - must be set before find_package +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Find dependencies +find_package(Boost REQUIRED) + +if (NOT BUILDING_WITH_CATKIN) + + # Enable Position Independent Code + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Cấu hình RPATH để tránh cycle trong runtime search path + set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}") + + set(PACKAGES_DIR + robot_std_msgs + robot_actionlib_msgs + robot_geometry_msgs + ) + +else() + +# ======================================================== +# Catkin specific configuration +# ======================================================== + find_package(catkin REQUIRED COMPONENTS + robot_std_msgs + robot_actionlib_msgs + robot_geometry_msgs + ) + + find_package(Boost REQUIRED) + + catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS robot_std_msgs robot_actionlib_msgs robot_geometry_msgs + DEPENDS Boost + ) + + include_directories( + include + ${catkin_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ) +endif() + +# Tìm tất cả header files +file(GLOB_RECURSE HEADERS "include/robot_move_base_msgs/*.h") + +# Tạo INTERFACE library (header-only) +add_library(${PROJECT_NAME} INTERFACE) + +if(BUILDING_WITH_CATKIN) + add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${catkin_LIBRARIES} + Boost::headers + ) + +else() + + # Set include directories + target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ + ) + + # Link dependencies (header-only, chỉ cần include paths) + target_link_libraries(${PROJECT_NAME} + INTERFACE + ${PACKAGES_DIR} + Boost::headers + ) + +endif() + +if(BUILDING_WITH_CATKIN) + ## Mark libraries for installation + ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html + install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +else() + + install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) + + # Export targets + install(EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} + ) + + ## Mark cpp header files for installation + install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + + # Print configuration info + message(STATUS "=================================") + message(STATUS "Project: ${PROJECT_NAME} (Header-Only)") + message(STATUS "Version: ${PROJECT_VERSION}") + message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") + message(STATUS "Headers found:") + foreach(hdr ${HEADERS}) + message(STATUS " - ${hdr}") + endforeach() + message(STATUS "Dependencies: robot_std_msgs, robot_actionlib_msgs, robot_geometry_msgs, Boost") + message(STATUS "=================================") +endif() + diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseAction.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseAction.h new file mode 100644 index 0000000..9dcdfee --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseAction.h @@ -0,0 +1,69 @@ +// Generated by gencpp from file robot_move_base_msgs/MoveBaseAction.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTION_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTION_H + +#include +#include +#include + +#include +#include +#include + +namespace robot_move_base_msgs +{ + template + struct MoveBaseAction_ + { + typedef MoveBaseAction_ Type; + + MoveBaseAction_() + : action_goal(), action_result(), action_feedback() + { + } + MoveBaseAction_(const ContainerAllocator &_alloc) + : action_goal(_alloc), action_result(_alloc), action_feedback(_alloc) + { + (void)_alloc; + } + + typedef ::robot_move_base_msgs::MoveBaseActionGoal_ _action_goal_type; + _action_goal_type action_goal; + + typedef ::robot_move_base_msgs::MoveBaseActionResult_ _action_result_type; + _action_result_type action_result; + + typedef ::robot_move_base_msgs::MoveBaseActionFeedback_ _action_feedback_type; + _action_feedback_type action_feedback; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseAction_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseAction_ const> ConstPtr; + + }; // struct MoveBaseAction_ + + typedef ::robot_move_base_msgs::MoveBaseAction_> MoveBaseAction; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseAction> MoveBaseActionPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseAction const> MoveBaseActionConstPtr; + + // constants requiring out of line definition + + template + bool operator==(const ::robot_move_base_msgs::MoveBaseAction_ &lhs, const ::robot_move_base_msgs::MoveBaseAction_ &rhs) + { + return lhs.action_goal == rhs.action_goal && + lhs.action_result == rhs.action_result && + lhs.action_feedback == rhs.action_feedback; + } + + template + bool operator!=(const ::robot_move_base_msgs::MoveBaseAction_ &lhs, const ::robot_move_base_msgs::MoveBaseAction_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTION_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionFeedback.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionFeedback.h new file mode 100644 index 0000000..b066f75 --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionFeedback.h @@ -0,0 +1,68 @@ +// Generated by gencpp from file robot_move_base_msgs/MoveBaseActionFeedback.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONFEEDBACK_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONFEEDBACK_H + +#include +#include +#include + +#include +#include +#include + +namespace robot_move_base_msgs +{ + template + struct MoveBaseActionFeedback_ + { + typedef MoveBaseActionFeedback_ Type; + + MoveBaseActionFeedback_() + : header(), status(), feedback() + { + } + MoveBaseActionFeedback_(const ContainerAllocator &_alloc) + : header(_alloc), status(_alloc), feedback(_alloc) + { + (void)_alloc; + } + + typedef ::robot_std_msgs::Header_ _header_type; + _header_type header; + + typedef ::robot_actionlib_msgs::GoalStatus_ _status_type; + _status_type status; + + typedef ::robot_move_base_msgs::MoveBaseFeedback_ _feedback_type; + _feedback_type feedback; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionFeedback_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionFeedback_ const> ConstPtr; + + }; // struct MoveBaseActionFeedback_ + + typedef ::robot_move_base_msgs::MoveBaseActionFeedback_> MoveBaseActionFeedback; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionFeedback> MoveBaseActionFeedbackPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionFeedback const> MoveBaseActionFeedbackConstPtr; + + // constants requiring out of line definition + template + bool operator==(const ::robot_move_base_msgs::MoveBaseActionFeedback_ &lhs, const ::robot_move_base_msgs::MoveBaseActionFeedback_ &rhs) + { + return lhs.header == rhs.header && + lhs.status == rhs.status && + lhs.feedback == rhs.feedback; + } + + template + bool operator!=(const ::robot_move_base_msgs::MoveBaseActionFeedback_ &lhs, const ::robot_move_base_msgs::MoveBaseActionFeedback_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONFEEDBACK_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionGoal.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionGoal.h new file mode 100644 index 0000000..2d6608e --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionGoal.h @@ -0,0 +1,69 @@ +// Generated by gencpp from file robot_move_base_msgs/MoveBaseActionGoal.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONGOAL_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONGOAL_H + +#include +#include +#include + +#include +#include +#include + +namespace robot_move_base_msgs +{ + template + struct MoveBaseActionGoal_ + { + typedef MoveBaseActionGoal_ Type; + + MoveBaseActionGoal_() + : header(), goal_id(), goal() + { + } + MoveBaseActionGoal_(const ContainerAllocator &_alloc) + : header(_alloc), goal_id(_alloc), goal(_alloc) + { + (void)_alloc; + } + + typedef ::robot_std_msgs::Header_ _header_type; + _header_type header; + + typedef ::robot_actionlib_msgs::GoalID_ _goal_id_type; + _goal_id_type goal_id; + + typedef ::robot_move_base_msgs::MoveBaseGoal_ _goal_type; + _goal_type goal; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionGoal_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionGoal_ const> ConstPtr; + + }; // struct MoveBaseActionGoal_ + + typedef ::robot_move_base_msgs::MoveBaseActionGoal_> MoveBaseActionGoal; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionGoal> MoveBaseActionGoalPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionGoal const> MoveBaseActionGoalConstPtr; + + // constants requiring out of line definition + + template + bool operator==(const ::robot_move_base_msgs::MoveBaseActionGoal_ &lhs, const ::robot_move_base_msgs::MoveBaseActionGoal_ &rhs) + { + return lhs.header == rhs.header && + lhs.goal_id == rhs.goal_id && + lhs.goal == rhs.goal; + } + + template + bool operator!=(const ::robot_move_base_msgs::MoveBaseActionGoal_ &lhs, const ::robot_move_base_msgs::MoveBaseActionGoal_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONGOAL_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionResult.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionResult.h new file mode 100644 index 0000000..322f62c --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseActionResult.h @@ -0,0 +1,68 @@ +// Generated by gencpp from file robot_move_base_msgs/MoveBaseActionResult.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONRESULT_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONRESULT_H + +#include +#include +#include + +#include +#include +#include + +namespace robot_move_base_msgs +{ + template + struct MoveBaseActionResult_ + { + typedef MoveBaseActionResult_ Type; + + MoveBaseActionResult_() + : header(), status(), result() + { + } + MoveBaseActionResult_(const ContainerAllocator &_alloc) + : header(_alloc), status(_alloc), result(_alloc) + { + (void)_alloc; + } + + typedef ::robot_std_msgs::Header_ _header_type; + _header_type header; + + typedef ::robot_actionlib_msgs::GoalStatus_ _status_type; + _status_type status; + + typedef ::robot_move_base_msgs::MoveBaseResult_ _result_type; + _result_type result; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionResult_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionResult_ const> ConstPtr; + + }; // struct MoveBaseActionResult_ + + typedef ::robot_move_base_msgs::MoveBaseActionResult_> MoveBaseActionResult; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionResult> MoveBaseActionResultPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseActionResult const> MoveBaseActionResultConstPtr; + + // constants requiring out of line definition + template + bool operator==(const ::robot_move_base_msgs::MoveBaseActionResult_ &lhs, const ::robot_move_base_msgs::MoveBaseActionResult_ &rhs) + { + return lhs.header == rhs.header && + lhs.status == rhs.status && + lhs.result == rhs.result; + } + + template + bool operator!=(const ::robot_move_base_msgs::MoveBaseActionResult_ &lhs, const ::robot_move_base_msgs::MoveBaseActionResult_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONRESULT_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseFeedback.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseFeedback.h new file mode 100644 index 0000000..bd64e29 --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseFeedback.h @@ -0,0 +1,58 @@ +// Generated by gencpp from file robot_move_base_msgs/MoveBaseFeedback.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEFEEDBACK_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEFEEDBACK_H + +#include +#include +#include + +#include + +namespace robot_move_base_msgs +{ + template + struct MoveBaseFeedback_ + { + typedef MoveBaseFeedback_ Type; + + MoveBaseFeedback_() + : base_position() + { + } + MoveBaseFeedback_(const ContainerAllocator &_alloc) + : base_position(_alloc) + { + (void)_alloc; + } + + typedef ::robot_geometry_msgs::PoseStamped_ _base_position_type; + _base_position_type base_position; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseFeedback_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseFeedback_ const> ConstPtr; + + }; // struct MoveBaseFeedback_ + + typedef ::robot_move_base_msgs::MoveBaseFeedback_> MoveBaseFeedback; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseFeedback> MoveBaseFeedbackPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseFeedback const> MoveBaseFeedbackConstPtr; + + // constants requiring out of line definition + template + bool operator==(const ::robot_move_base_msgs::MoveBaseFeedback_ &lhs, const ::robot_move_base_msgs::MoveBaseFeedback_ &rhs) + { + return lhs.base_position == rhs.base_position; + } + + template + bool operator!=(const ::robot_move_base_msgs::MoveBaseFeedback_ &lhs, const ::robot_move_base_msgs::MoveBaseFeedback_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEFEEDBACK_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseGoal.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseGoal.h new file mode 100644 index 0000000..bcdd110 --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseGoal.h @@ -0,0 +1,57 @@ +// Generated by gencpp from file robot_move_base_msgs/MoveBaseGoal.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEGOAL_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEGOAL_H + +#include +#include +#include +#include + +namespace robot_move_base_msgs +{ + template + struct MoveBaseGoal_ + { + typedef MoveBaseGoal_ Type; + + MoveBaseGoal_() + : target_pose() + { + } + MoveBaseGoal_(const ContainerAllocator &_alloc) + : target_pose(_alloc) + { + (void)_alloc; + } + + typedef ::robot_geometry_msgs::PoseStamped_ _target_pose_type; + _target_pose_type target_pose; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseGoal_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseGoal_ const> ConstPtr; + + }; // struct MoveBaseGoal_ + + typedef ::robot_move_base_msgs::MoveBaseGoal_> MoveBaseGoal; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseGoal> MoveBaseGoalPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseGoal const> MoveBaseGoalConstPtr; + + // constants requiring out of line definition + template + bool operator==(const ::robot_move_base_msgs::MoveBaseGoal_ &lhs, const ::robot_move_base_msgs::MoveBaseGoal_ &rhs) + { + return lhs.target_pose == rhs.target_pose; + } + + template + bool operator!=(const ::robot_move_base_msgs::MoveBaseGoal_ &lhs, const ::robot_move_base_msgs::MoveBaseGoal_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASEGOAL_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseResult.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseResult.h new file mode 100644 index 0000000..728a499 --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/MoveBaseResult.h @@ -0,0 +1,39 @@ +// Generated by gencpp from file robot_move_base_msgs/MoveBaseResult.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASERESULT_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASERESULT_H + +#include +#include +#include + +namespace robot_move_base_msgs +{ + template + struct MoveBaseResult_ + { + typedef MoveBaseResult_ Type; + + MoveBaseResult_() + { + } + MoveBaseResult_(const ContainerAllocator &_alloc) + { + (void)_alloc; + } + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseResult_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseResult_ const> ConstPtr; + + }; // struct MoveBaseResult_ + + typedef ::robot_move_base_msgs::MoveBaseResult_> MoveBaseResult; + + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseResult> MoveBaseResultPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::MoveBaseResult const> MoveBaseResultConstPtr; + + // constants requiring out of line definition +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_MOVEBASERESULT_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/RecoveryStatus.h b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/RecoveryStatus.h new file mode 100644 index 0000000..a9c775f --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/include/robot_move_base_msgs/RecoveryStatus.h @@ -0,0 +1,71 @@ +// Generated by gencpp from file robot_move_base_msgs/RecoveryStatus.msg +// DO NOT EDIT! + +#ifndef ROBOT_MOVE_BASE_MSGS_MESSAGE_RECOVERYSTATUS_H +#define ROBOT_MOVE_BASE_MSGS_MESSAGE_RECOVERYSTATUS_H + +#include +#include +#include + +#include + +namespace robot_move_base_msgs +{ + template + struct RecoveryStatus_ + { + typedef RecoveryStatus_ Type; + + RecoveryStatus_() + : pose_stamped(), current_recovery_number(0), total_number_of_recoveries(0), recovery_behavior_name() + { + } + RecoveryStatus_(const ContainerAllocator &_alloc) + : pose_stamped(_alloc), current_recovery_number(0), total_number_of_recoveries(0), recovery_behavior_name(_alloc) + { + (void)_alloc; + } + + typedef ::robot_geometry_msgs::PoseStamped_ _pose_stamped_type; + _pose_stamped_type pose_stamped; + + typedef uint16_t _current_recovery_number_type; + _current_recovery_number_type current_recovery_number; + + typedef uint16_t _total_number_of_recoveries_type; + _total_number_of_recoveries_type total_number_of_recoveries; + + typedef std::basic_string, typename std::allocator_traits::template rebind_alloc> _recovery_behavior_name_type; + _recovery_behavior_name_type recovery_behavior_name; + + typedef boost::shared_ptr<::robot_move_base_msgs::RecoveryStatus_> Ptr; + typedef boost::shared_ptr<::robot_move_base_msgs::RecoveryStatus_ const> ConstPtr; + + }; // struct RecoveryStatus_ + + typedef ::robot_move_base_msgs::RecoveryStatus_> RecoveryStatus; + + typedef boost::shared_ptr<::robot_move_base_msgs::RecoveryStatus> RecoveryStatusPtr; + typedef boost::shared_ptr<::robot_move_base_msgs::RecoveryStatus const> RecoveryStatusConstPtr; + + // constants requiring out of line definition + + template + bool operator==(const ::robot_move_base_msgs::RecoveryStatus_ &lhs, const ::robot_move_base_msgs::RecoveryStatus_ &rhs) + { + return lhs.pose_stamped == rhs.pose_stamped && + lhs.current_recovery_number == rhs.current_recovery_number && + lhs.total_number_of_recoveries == rhs.total_number_of_recoveries && + lhs.recovery_behavior_name == rhs.recovery_behavior_name; + } + + template + bool operator!=(const ::robot_move_base_msgs::RecoveryStatus_ &lhs, const ::robot_move_base_msgs::RecoveryStatus_ &rhs) + { + return !(lhs == rhs); + } + +} // namespace robot_move_base_msgs + +#endif // ROBOT_MOVE_BASE_MSGS_MESSAGE_RECOVERYSTATUS_H diff --git a/src/Navigations/Libraries/robot_move_base_msgs/package.xml b/src/Navigations/Libraries/robot_move_base_msgs/package.xml new file mode 100644 index 0000000..df9878e --- /dev/null +++ b/src/Navigations/Libraries/robot_move_base_msgs/package.xml @@ -0,0 +1,30 @@ + + robot_move_base_msgs + 0.7.10 + + robot_move_base_msgs is the second generation of the transform library, which lets + the user keep track of multiple coordinate frames over time. robot_move_base_msgs + maintains the relationship between coordinate frames in a tree + structure buffered in time, and lets the user transform points, + vectors, etc between any two coordinate frames at any desired + point in time. + + Tully Foote + Eitan Marder-Eppstein + Wim Meeussen + Tully Foote + BSD + + http://www.ros.org/wiki/robot_move_base_msgs + + catkin + + robot_std_msgs + robot_std_msgs + + robot_actionlib_msgs + robot_actionlib_msgs + + robot_geometry_msgs + robot_geometry_msgs + \ No newline at end of file diff --git a/src/Navigations/Packages/move_base2 b/src/Navigations/Packages/move_base2 new file mode 160000 index 0000000..8571943 --- /dev/null +++ b/src/Navigations/Packages/move_base2 @@ -0,0 +1 @@ +Subproject commit 857194367f05ecacfa17f428dee2aa31b0e693f0