@@ -21,6 +21,10 @@ WaypointMode string_to_waypoint_mode(const std::string& str) {
2121 return WaypointMode::XY_AND_YAW ;
2222 if (str == " XY_FORWARD_DIR" || str == " xy_forward_dir" )
2323 return WaypointMode::XY_FORWARD_DIR ;
24+ if (str == " LEVEL_ORIENTATION" || str == " level_orientation" )
25+ return WaypointMode::LEVEL_ORIENTATION ;
26+ if (str == " ONLY_Z" || str == " only_z" )
27+ return WaypointMode::ONLY_Z ;
2428 throw std::runtime_error (" Unknown WaypointMode string: '" + str + " '" );
2529}
2630
@@ -42,6 +46,10 @@ WaypointMode int_to_waypoint_mode(int value) {
4246 return WaypointMode::XY_AND_YAW ;
4347 case static_cast <int >(WaypointMode::XY_FORWARD_DIR ):
4448 return WaypointMode::XY_FORWARD_DIR ;
49+ case static_cast <int >(WaypointMode::LEVEL_ORIENTATION ):
50+ return WaypointMode::LEVEL_ORIENTATION ;
51+ case static_cast <int >(WaypointMode::ONLY_Z ):
52+ return WaypointMode::ONLY_Z ;
4553 default :
4654 throw std::runtime_error (" Unknown WaypointMode numeric value: " +
4755 std::to_string (value));
@@ -167,6 +175,21 @@ Pose compute_waypoint_goal(const Pose& incoming_waypoint,
167175 Eigen::AngleAxisd (forward_heading, Eigen::Vector3d::UnitZ ())));
168176 break ;
169177 }
178+
179+ case WaypointMode::LEVEL_ORIENTATION : {
180+ waypoint_out.set_pos (current_state.pos_vector ());
181+ const double current_yaw = vortex::utils::math::quat_to_euler (
182+ current_state.ori_quaternion ())(2 );
183+ waypoint_out.set_ori (Eigen::Quaterniond (
184+ Eigen::AngleAxisd (current_yaw, Eigen::Vector3d::UnitZ ())));
185+ break ;
186+ }
187+
188+ case WaypointMode::ONLY_Z :
189+ waypoint_out.x = current_state.x ;
190+ waypoint_out.y = current_state.y ;
191+ waypoint_out.set_ori (current_state.ori_quaternion ());
192+ break ;
170193 }
171194
172195 return waypoint_out;
@@ -195,6 +218,10 @@ bool has_converged(const Pose& state,
195218 return std::sqrt (ep.head <2 >().squaredNorm () + ea (2 ) * ea (2 ));
196219 case WaypointMode::XY_FORWARD_DIR :
197220 return ep.head <2 >().norm ();
221+ case WaypointMode::LEVEL_ORIENTATION :
222+ return ea.head <2 >().norm ();
223+ case WaypointMode::ONLY_Z :
224+ return std::abs (ep (2 ));
198225 case WaypointMode::FULL_POSE :
199226 default :
200227 return std::sqrt (ep.squaredNorm () + ea.squaredNorm ());
@@ -271,6 +298,7 @@ WaypointGoal load_waypoint_goal_from_yaml(const std::string& file_path,
271298
272299 bool keep_altitude = false ;
273300 double desired_altitude = 0.0 ;
301+ bool require_altitude_convergence = false ;
274302 if (wp[" keep_altitude" ]) {
275303 keep_altitude = wp[" keep_altitude" ].as <bool >();
276304 }
@@ -281,13 +309,19 @@ WaypointGoal load_waypoint_goal_from_yaml(const std::string& file_path,
281309 " required field 'desired_altitude'" );
282310 }
283311 desired_altitude = wp[" desired_altitude" ].as <double >();
312+ if (wp[" require_altitude_convergence" ]) {
313+ require_altitude_convergence =
314+ wp[" require_altitude_convergence" ].as <bool >();
315+ }
284316 }
285317
286318 return WaypointGoal{.pose = pose,
287319 .mode = mode,
288320 .convergence_threshold = convergence_threshold,
289321 .keep_altitude = keep_altitude,
290- .desired_altitude = desired_altitude};
322+ .desired_altitude = desired_altitude,
323+ .require_altitude_convergence =
324+ require_altitude_convergence};
291325}
292326
293327LandmarkConvergenceGoal load_landmark_goal_from_yaml (
0 commit comments