Corentin Chauvin-Hameau – 2019-2020
Coverage Path Planning for an underwater robot surveying a marine farm
planning_nodelet.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  *
4  * \brief Declaration of a nodelet for path plannning of an underwater robot
5  * surveying a marine farm
6  * \author Corentin Chauvin-Hameau
7  * \date 2019
8  */
9 
10 #ifndef PLANNING_NODELET_HPP
11 #define PLANNING_NODELET_HPP
12 
13 #include "lattice.hpp"
15 #include "mf_common/Float32Array.h"
16 #include "mf_common/Float32Array.h"
17 #include "mf_common/Array2D.h"
18 #include <nav_msgs/Path.h>
19 #include <geometry_msgs/Pose.h>
20 #include <geometry_msgs/TransformStamped.h>
21 #include <std_srvs/Empty.h>
22 #include <tf2_ros/transform_listener.h>
23 #include <nodelet/nodelet.h>
24 #include <ros/ros.h>
25 #include <string>
26 #include <csignal>
27 
28 namespace mfcpp {
29 
30 /**
31  * \brief Nodelet for path planning of an underwater robot surveying a marine
32  * farm
33  */
34 class PlanningNodelet: public nodelet::Nodelet {
35  public:
38 
39  /**
40  * \brief Function called at beginning of nodelet execution
41  */
42  virtual void onInit();
43 
44  private:
45  // Static members
46  // Note: the timers need to be static since stopped by the SIGINT callback
47  static sig_atomic_t volatile b_sigint_; ///< Whether SIGINT signal has been received
48  static ros::Timer main_timer_; ///< Timer callback for the main function
49 
50  // Private members
51  ros::NodeHandle nh_; ///< Node handler (for topics and services)
52  ros::NodeHandle private_nh_; ///< Private node handler (for parameters)
53  ros::ServiceClient ray_multi_client_; ///< Service client for raycasting at several camera poses
54  ros::ServiceClient update_gp_client_; ///< Service client for updating the Gaussian Process
55  ros::ServiceServer disable_serv_; ///< Service server to disable planning
56  ros::ServiceServer enable_serv_; ///< Service server to enable planning
57  ros::Publisher lattice_pub_; ///< Publisher for the waypoints lattice
58  ros::Publisher lattice_pose_pub_; ///< Publisher for the waypoints lattice poses
59  ros::Publisher path_pub_; ///< Publisher for the path
60  ros::Subscriber gp_mean_sub_; ///< Subscriber for the mean of the Gaussian Process
61  ros::Subscriber gp_cov_sub_; ///< Subscriber for the covariance of the Gaussian Process
62  ros::Subscriber state_sub_; ///< Subscriber for the state of the robot
63  tf2_ros::Buffer tf_buffer_; ///< Buffer for tf2
64  tf2_ros::TransformListener tf_listener_; ///< Transform listener for tf2
65 
66  bool planner_enabled_; ///< Whether the planner should run
67  RobotModel robot_model_; ///< Robot model
68  RobotModel::state_type state_; ///< State of the robot (in ocean frame)
69  bool state_received_; ///< Whether the state of the robot has been received
70  geometry_msgs::TransformStamped wall_robot_tf_; ///< Transform from wall to robot frames
71  geometry_msgs::TransformStamped robot_wall_tf_; ///< Transform from robot to wall frames
72  geometry_msgs::TransformStamped ocean_robot_tf_; ///< Transform from ocean to robot frames
73  geometry_msgs::TransformStamped robot_ocean_tf_; ///< Transform from robot to ocean frames
74  geometry_msgs::TransformStamped ocean_wall_tf_; ///< Transform from ocean to wall frames
75  geometry_msgs::TransformStamped wall_ocean_tf_; ///< Transform from wall to ocean frames
76  geometry_msgs::TransformStamped ocean_camera_tf_; ///< Transform from ocean to camera frames
77  std::vector<geometry_msgs::Pose> lattice_; ///< Lattice of possible waypoints in ocean frame
78  std::vector<geometry_msgs::Pose> selected_vp_; ///< Selected view points in the lattice (in ocean frame)
79  std::vector<float> x_hit_pt_sel_; ///< X coordinates of the hit points for the selected viewpoint (in ocean frame)
80  std::vector<float> y_hit_pt_sel_; ///< Y coordinates of the hit points for the selected viewpoint (in ocean frame)
81  std::vector<float> z_hit_pt_sel_; ///< Z coordinates of the hit points for the selected viewpoint (in ocean frame)
82  std::vector<float> last_gp_mean_; ///< Last mean of the Gaussian Process
83  std::vector<std::vector<float>> last_gp_cov_; ///< Last covariance of the Gaussian Process
84  std::vector<geometry_msgs::Pose> waypoints_; ///< Waypoints to follow (in ocean frame)
85  nav_msgs::Path path_; ///< Interpolated path between the waypoints (in ocean frame)
86 
87  /// \name General ROS parameters
88  ///@{
89  float main_freq_; ///< Frequency of the main loop
90  std::string ocean_frame_; ///< Ocean frame
91  std::string wall_frame_; ///< Wall frame
92  std::string robot_frame_; ///< Robot frame
93  std::string camera_frame_; ///< Camera frame
94  float length_wall_; ///< Length of the algae wall
95  ///@}
96 
97  /// \name ROS parameters for lattice of viewpoint generation
98  ///@{
99  float max_lat_rudder_; ///< Maximum angle of the lateral rudder
100  float max_elev_rudder_; ///< Maximum angle of the elevation rudder
101 
102  bool horiz_motion_; ///< Whether to allow motion in the horizontal plane
103  bool vert_motion_; ///< Whether to allow motion in the vertical plane
104  bool mult_lattices_; ///< Whether to use multi-lattices planning
105  bool replan_; ///< Whether to replan from the current robot pose, or to plan from the last planned pose
106  int nbr_lattices_; ///< Number of lattices for multi-lattices planning
107  bool cart_lattice_; ///< Whether to create a cartesian lattice, or use motion model instead
108  float plan_speed_; ///< Planned speed (m/s) of the robot
109  float plan_horizon_; ///< Horizon (m) of the planning (for each lattice)
110  int lattice_size_horiz_; ///< Size of the lattice in the horizontal direction (half size when single-lattice planning)
111  int lattice_size_vert_; ///< Size of the lattice in the vertical direction (half size when single-lattice planning)
112  float wall_orientation_; ///< Orientation of the wall (absolute value)
113  float lattice_res_; ///< Resolution (m) of the waypoints lattice
114  std::vector<float> bnd_wall_dist_; ///< Bounds on the distance to the wall for waypoint selection
115  std::vector<float> bnd_depth_; ///< Bounds on the depth (in wall frame) for waypoint selection
116  float bnd_pitch_; ///< Bound on the pith (in radian) (provided in degree as ROS param)
117  ///@}
118 
119  /// \name ROS parameters for viewpoint selection
120  ///@{
121  int camera_height_; ///< Number of pixels of the camera along height (-1 for actual camera size)
122  int camera_width_; ///< Number of pixels of the camera along width (-1 for actual camera size)
123  float gp_threshold_; ///< Threshold to consider a GP component in information gain computation
124  ///@}
125 
126  /// \name ROS parameters for path generation
127  ///@{
128  bool linear_path_; ///< Whether to create a linear path, or a spline one
129  float path_res_; ///< Spatial resolution (m) of the planned trajectory
130  float min_wall_dist_; ///< Minimum distance to the wall that can be planned
131  ///@}
132 
133  /**
134  * \brief Main callback which is called by a timer
135  *
136  * \param timer_event Timer event information
137  */
138  void main_cb(const ros::TimerEvent &timer_event);
139 
140  /**
141  * \brief SINGINT (Ctrl+C) callback to stop the nodelet properly
142  */
143  static void sigint_handler(int s);
144 
145  /**
146  * \brief Checks whether planning is needed or not
147  *
148  * If the last planned waypoint is at the end of the wall, it is not
149  * required to plan more.
150  *
151  * \return Whether to plan more
152  */
153  bool check_planning_needed();
154 
155  /**
156  * \brief Converts a 2D std vector to a custom ROS array
157  *
158  * \param 2D vector to convert
159  * \return Converted array
160  */
161  std::vector<mf_common::Float32Array> vector2D_to_array(
162  const std::vector<std::vector<float>> &vector2D);
163 
164  /**
165  * \brief Converts a custom ROS array to a 2D std vector
166  *
167  * \param The array to convert
168  * \return Converted 2D vector
169  */
170  std::vector<std::vector<float>> array_to_vector2D(
171  const std::vector<mf_common::Float32Array> &array);
172 
173  /**
174  * \brief Converts a custom ROS array to a 2D std vector
175  *
176  * \param The array to convert
177  * \return Converted 2D vector
178  */
179  std::vector<std::vector<float>> array_to_vector2D(
180  const mf_common::Array2D &array);
181 
182  /**
183  * \brief Gets horizontal unit vector along the wall with same orientation as the robot
184  *
185  * \param[out] Yaw of the wall
186  * \return Wall orientation vector in ocean frame
187  */
188  Eigen::Vector3f get_wall_orientation(float &yaw_wall);
189 
190 
191  /**
192  * \brief Gets horizontal unit vector along the wall with same orientation as the robot
193  *
194  * \return Wall orientation in ocean frame
195  */
196  Eigen::Vector3f get_wall_orientation();
197 
198  /**
199  * \brief Fills a cartesian lattice of possible waypoints
200  *
201  * Generates a lattice of possible waypoints in robot frame. These waypoints
202  * will be aligned on a cartesian grid, within specified limit angles and
203  * horizon distance.
204  *
205  * \param [in] max_lat_angle Maximum lateral angle
206  * \param [in] max_elev_angle Maximum elevation angle
207  * \param [in] horizon Maximum distance
208  * \param [in] resolution Spatial resolution of the lattice
209  * \param [out] lattice Lattice to fill
210  */
212  float max_lat_angle,
213  float max_elev_angle,
214  float horizon,
215  float resolution,
216  Lattice &lattice
217  );
218 
219  /**
220  * \brief Fills a lattice of possible waypoints based on motion model
221  *
222  * Generate the lattice by picking different control inputs and applying it
223  * during a fixed time. The speed and horizontal angle commands will be
224  * constant. The horizontal command will be interpolated to guaranty that
225  * the final pose is parallel to the algae wall.
226  *
227  * \param[out] lattice Lattice to fill
228  */
229  void generate_lattice(Lattice &lattice);
230 
231  /**
232  * \brief Generates several lattices along the wall
233  *
234  * The lattices are simple cartesian grids along the wall. The viewpoints are
235  * expressed in robot frame.
236  *
237  * \param[in] init_state State at beginning of planning
238  * \param[out] lattices Lattices of viewpoints (assumed to be already sized)
239  */
240  void generate_lattices(
241  const RobotModel::state_type &init_state,
242  std::vector<Lattice> &lattices
243  );
244 
245  /**
246  * \brief Filters out waypoints that are not in given bounds
247  *
248  * Bounds are on the position with respect to the wall and the pitch angle.
249  * Waypoints going backwards are also discarded.
250  *
251  * \warning The input lattice won't be usable anymore (pointers losing
252  * ownership)
253  *
254  * \param[int] lattice_in Lattice to filter
255  * \param[out] lattice_out Filtered lattice
256  */
257  void filter_lattice(Lattice &lattice_in, Lattice &lattice_out);
258 
259  /**
260  * \brief Apply a TF transform to all nodes of a set of lattices
261  */
262  void transform_lattices(
263  std::vector<Lattice> &lattices,
264  const geometry_msgs::TransformStamped &transform
265  );
266 
267  /**
268  * \brief Adds a node given by its state to a lattice
269  *
270  * \param[in] state State of the node (in ocean frame)
271  * \param[in] frame_ocean_tf Transform between "frame" and "ocean" frames
272  * \param[in,out] lattice Lattice with an added node transformed in "frame" frame
273  */
274  void add_node(
275  const RobotModel::state_type &state,
276  const geometry_msgs::TransformStamped &frame_ocean_tf,
277  Lattice &lattice
278  );
279 
280  /**
281  * \brief Connects lattices and removes viewpoints not dynamically reachable
282  *
283  * Propagates the motion model from all the viewpoints to determine which
284  * viewpoints are reachable in the next lattice. Viewpoints not reachable
285  * from any viewpoint of the previous lattice (or from the initial state)
286  * are removed.
287  *
288  * \warning The input lattice won't be usable anymore (pointers losing
289  * ownership)
290  *
291  * \todo Remove nodes of the first lattice that doesn't lead to the right
292  * tree depth.
293  *
294  * \param[in] init_state Initial state of the robot
295  * \param[in] lattices_in Input lattices
296  * \param[out] lattices_out Output lattices
297  */
298  void connect_lattices(
299  const RobotModel::state_type &init_state,
300  std::vector<Lattice> &lattices_in,
301  std::vector<Lattice> &lattices_out
302  );
303 
304  /**
305  * \brief Computes the diagonal of the covariance for each viewpoint of the lattice
306  *
307  * Will also store the camera hit points for each viewpoint
308  *
309  * \param[in,out] lattice Lattice of viewpoints
310  * \param[in] stamp Time at which to fetch the ROS transforms
311  */
312  bool compute_lattice_gp(Lattice &lattice, ros::Time stamp);
313 
314  /**
315  * \brief Computes information gain over a lattice of viewpoint
316  *
317  * \param[in,out] lattice Lattice of viewpoint
318  */
319  void compute_info_gain(Lattice &lattice);
320 
321  /**
322  * \brief Selects a sequence of viewpoints maximising information gain over a list of lattices
323  *
324  * \param[in] lattices List of lattices of viewpoints
325  * \return Sequence of viewpoints
326  */
327  std::vector<LatticeNode*> select_viewpoints(
328  const std::vector<Lattice> &lattices
329  );
330 
331  /**
332  * \brief Selects recursively a list of nodes viewpoints maximising information gain
333  *
334  * \param[in] node Current viewpoint node
335  * \param[out] info_gain Cumulated information gain of this node and the best next ones
336  * \param[out] selected_vp List of this viewpoint, and the next best ones
337  */
338  void select_viewpoints(
339  LatticeNode *node,
340  float &info_gain,
341  std::vector<LatticeNode*> &selected_vp
342  );
343 
344  /**
345  * \brief Fills display objects
346  *
347  * \param[in] lattices Lattices of viewpoints
348  * \param[in] selected_vp Selected viewpoints
349  */
350  void fill_display_obj(
351  const std::vector<Lattice> &lattices,
352  const std::vector<LatticeNode*> &selected_vp
353  );
354 
355  /**
356  * \brief Generates a spline trajectory between the selected points
357  *
358  * Everything is in ocean frame.
359  *
360  * \param[in] selected_vp Selected viewpoints
361  * \param[out] new_path New path to append to the previous one
362  * \param[out] waypoints New waypoints to append to the previous ones
363  */
364  void generate_path(
365  const std::vector<geometry_msgs::Pose> &selected_vp,
366  nav_msgs::Path &path,
367  std::vector<geometry_msgs::Pose> &waypoints
368  );
369 
370 
371  /**
372  * \brief Interpolates a straight line path between two poses
373  *
374  * \param p1 Start of the path
375  * \param p2 End of the path
376  * \param resolution Spatial resolution of the path
377  * \return Generated path
378  */
379  nav_msgs::Path straight_line_path(const geometry_msgs::Pose &start,
380  const geometry_msgs::Pose &end, float resolution);
381 
382  /**
383  * \brief Interpolates a spline path between a list of poses
384  *
385  * \param waypoints List of pose
386  * \param resolution Spatial resolution of the path
387  * \param speed Desired speed along the path
388  * \return Generated path
389  */
390  nav_msgs::Path spline_path(
391  const std::vector<geometry_msgs::Pose> &waypoints,
392  float resolution,
393  float speed
394  );
395 
396  /**
397  * \brief Main function to compute a trajectory plan
398  */
399  bool plan_trajectory();
400 
401  /**
402  * \brief Publishes the waypoints lattice markers
403  */
404  void pub_lattice_markers();
405 
406  /**
407  * \brief Gets tf transforms
408  *
409  * \return Whether it could retrieve a transform
410  */
411  bool get_tf();
412 
413  /**
414  * \brief Callback for Gaussian Process mean
415  */
416  void gp_mean_cb(const mf_common::Float32ArrayConstPtr msg);
417 
418  /**
419  * \brief Callback for Gaussian Process covariance
420  */
421  void gp_cov_cb(const mf_common::Array2DConstPtr msg);
422 
423  /**
424  * \brief Callback for the state of the robot
425  */
426  void state_cb(const mf_common::Float32Array msg);
427 
428  /**
429  * \brief Service server callback to disable planning
430  */
431  bool disable_cb(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res);
432 
433  /**
434  * \brief Service server callback to enable planning
435  */
436  bool enable_cb(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res);
437 
438  /**
439  * \brief Converts a tf transform to a pose, assuming the frames correspond
440  *
441  * \param transf Transform to convert
442  * \retturn Converted pose
443  */
444  inline geometry_msgs::Pose tf_to_pose(const geometry_msgs::TransformStamped &transf);
445 
446 
447 };
448 
449 
450 inline geometry_msgs::Pose PlanningNodelet::tf_to_pose(
451  const geometry_msgs::TransformStamped &transf
452 )
453 {
454  geometry_msgs::Pose pose;
455  pose.position.x = transf.transform.translation.x;
456  pose.position.y = transf.transform.translation.y;
457  pose.position.z = transf.transform.translation.z;
458  pose.orientation.x = transf.transform.rotation.x;
459  pose.orientation.y = transf.transform.rotation.y;
460  pose.orientation.z = transf.transform.rotation.z;
461  pose.orientation.w = transf.transform.rotation.w;
462 
463  return pose;
464 }
465 
466 
467 
468 } // namespace mfcpp
469 
470 
471 #endif
int nbr_lattices_
Number of lattices for multi-lattices planning.
float plan_horizon_
Horizon (m) of the planning (for each lattice)
static void sigint_handler(int s)
SINGINT (Ctrl+C) callback to stop the nodelet properly.
void compute_info_gain(Lattice &lattice)
Computes information gain over a lattice of viewpoint.
Definition: planning.cpp:575
std::vector< float > x_hit_pt_sel_
X coordinates of the hit points for the selected viewpoint (in ocean frame)
bool vert_motion_
Whether to allow motion in the vertical plane.
geometry_msgs::TransformStamped robot_ocean_tf_
Transform from robot to ocean frames.
ros::Subscriber state_sub_
Subscriber for the state of the robot.
Definition: common.hpp:23
Declaration of physical underwater robot model.
float path_res_
Spatial resolution (m) of the planned trajectory.
geometry_msgs::TransformStamped wall_ocean_tf_
Transform from wall to ocean frames.
ros::Subscriber gp_mean_sub_
Subscriber for the mean of the Gaussian Process.
float wall_orientation_
Orientation of the wall (absolute value)
void generate_lattice(Lattice &lattice)
Fills a lattice of possible waypoints based on motion model.
Definition: planning.cpp:152
float lattice_res_
Resolution (m) of the waypoints lattice.
bool compute_lattice_gp(Lattice &lattice, ros::Time stamp)
Computes the diagonal of the covariance for each viewpoint of the lattice.
Definition: planning.cpp:487
bool enable_cb(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Service server callback to enable planning.
tf2_ros::Buffer tf_buffer_
Buffer for tf2.
std::string camera_frame_
Camera frame.
int camera_width_
Number of pixels of the camera along width (-1 for actual camera size)
ros::NodeHandle nh_
Node handler (for topics and services)
geometry_msgs::TransformStamped ocean_camera_tf_
Transform from ocean to camera frames.
Class to represent a lattice.
Definition: lattice.hpp:54
bool disable_cb(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Service server callback to disable planning.
nav_msgs::Path straight_line_path(const geometry_msgs::Pose &start, const geometry_msgs::Pose &end, float resolution)
Interpolates a straight line path between two poses.
Definition: planning.cpp:732
void fill_display_obj(const std::vector< Lattice > &lattices, const std::vector< LatticeNode * > &selected_vp)
Fills display objects.
Definition: planning.cpp:651
std::vector< std::vector< float > > array_to_vector2D(const std::vector< mf_common::Float32Array > &array)
Converts a custom ROS array to a 2D std vector.
tf2_ros::TransformListener tf_listener_
Transform listener for tf2.
std::vector< float > last_gp_mean_
Last mean of the Gaussian Process.
nav_msgs::Path path_
Interpolated path between the waypoints (in ocean frame)
Eigen::Vector3f get_wall_orientation()
Gets horizontal unit vector along the wall with same orientation as the robot.
Definition: planning.cpp:93
void state_cb(const mf_common::Float32Array msg)
Callback for the state of the robot.
float main_freq_
Frequency of the main loop.
ros::Publisher path_pub_
Publisher for the path.
geometry_msgs::TransformStamped robot_wall_tf_
Transform from robot to wall frames.
void transform_lattices(std::vector< Lattice > &lattices, const geometry_msgs::TransformStamped &transform)
Apply a TF transform to all nodes of a set of lattices.
Definition: planning.cpp:329
ros::NodeHandle private_nh_
Private node handler (for parameters)
std::vector< geometry_msgs::Pose > lattice_
Lattice of possible waypoints in ocean frame.
geometry_msgs::TransformStamped ocean_wall_tf_
Transform from ocean to wall frames.
bool plan_trajectory()
Main function to compute a trajectory plan.
Definition: planning.cpp:812
std::vector< double > state_type
Data type of the state.
Definition: robot_model.hpp:51
void gp_mean_cb(const mf_common::Float32ArrayConstPtr msg)
Callback for Gaussian Process mean.
void pub_lattice_markers()
Publishes the waypoints lattice markers.
ros::ServiceClient update_gp_client_
Service client for updating the Gaussian Process.
std::vector< geometry_msgs::Pose > waypoints_
Waypoints to follow (in ocean frame)
ros::Subscriber gp_cov_sub_
Subscriber for the covariance of the Gaussian Process.
std::vector< std::vector< float > > last_gp_cov_
Last covariance of the Gaussian Process.
void generate_cart_lattice(float max_lat_angle, float max_elev_angle, float horizon, float resolution, Lattice &lattice)
Fills a cartesian lattice of possible waypoints.
Definition: planning.cpp:100
RobotModel::state_type state_
State of the robot (in ocean frame)
nav_msgs::Path spline_path(const std::vector< geometry_msgs::Pose > &waypoints, float resolution, float speed)
Interpolates a spline path between a list of poses.
Definition: planning.cpp:766
geometry_msgs::Pose tf_to_pose(const geometry_msgs::TransformStamped &transf)
Converts a tf transform to a pose, assuming the frames correspond.
bool cart_lattice_
Whether to create a cartesian lattice, or use motion model instead.
std::vector< geometry_msgs::Pose > selected_vp_
Selected view points in the lattice (in ocean frame)
bool check_planning_needed()
Checks whether planning is needed or not.
bool horiz_motion_
Whether to allow motion in the horizontal plane.
std::vector< float > bnd_depth_
Bounds on the depth (in wall frame) for waypoint selection.
std::vector< float > z_hit_pt_sel_
Z coordinates of the hit points for the selected viewpoint (in ocean frame)
std::vector< float > y_hit_pt_sel_
Y coordinates of the hit points for the selected viewpoint (in ocean frame)
std::string ocean_frame_
Ocean frame.
std::vector< LatticeNode * > select_viewpoints(const std::vector< Lattice > &lattices)
Selects a sequence of viewpoints maximising information gain over a list of lattices.
Definition: planning.cpp:595
Class defining the robot model.
Definition: robot_model.hpp:47
float max_elev_rudder_
Maximum angle of the elevation rudder.
ros::ServiceClient ray_multi_client_
Service client for raycasting at several camera poses.
static sig_atomic_t volatile b_sigint_
Whether SIGINT signal has been received.
virtual void onInit()
Function called at beginning of nodelet execution.
geometry_msgs::TransformStamped wall_robot_tf_
Transform from wall to robot frames.
static ros::Timer main_timer_
Timer callback for the main function.
RobotModel robot_model_
Robot model.
void add_node(const RobotModel::state_type &state, const geometry_msgs::TransformStamped &frame_ocean_tf, Lattice &lattice)
Adds a node given by its state to a lattice.
Definition: planning.cpp:343
void connect_lattices(const RobotModel::state_type &init_state, std::vector< Lattice > &lattices_in, std::vector< Lattice > &lattices_out)
Connects lattices and removes viewpoints not dynamically reachable.
Definition: planning.cpp:362
int lattice_size_vert_
Size of the lattice in the vertical direction (half size when single-lattice planning) ...
int lattice_size_horiz_
Size of the lattice in the horizontal direction (half size when single-lattice planning) ...
std::string wall_frame_
Wall frame.
bool linear_path_
Whether to create a linear path, or a spline one.
int camera_height_
Number of pixels of the camera along height (-1 for actual camera size)
float plan_speed_
Planned speed (m/s) of the robot.
void generate_lattices(const RobotModel::state_type &init_state, std::vector< Lattice > &lattices)
Generates several lattices along the wall.
Definition: planning.cpp:205
std::string robot_frame_
Robot frame.
float max_lat_rudder_
Maximum angle of the lateral rudder.
bool get_tf()
Gets tf transforms.
bool planner_enabled_
Whether the planner should run.
bool replan_
Whether to replan from the current robot pose, or to plan from the last planned pose.
std::vector< mf_common::Float32Array > vector2D_to_array(const std::vector< std::vector< float >> &vector2D)
Converts a 2D std vector to a custom ROS array.
Definition: planning.cpp:33
ros::ServiceServer disable_serv_
Service server to disable planning.
bool state_received_
Whether the state of the robot has been received.
ros::Publisher lattice_pub_
Publisher for the waypoints lattice.
bool mult_lattices_
Whether to use multi-lattices planning.
Declaration of useful classes for planning with lattices.
geometry_msgs::TransformStamped ocean_robot_tf_
Transform from ocean to robot frames.
Nodelet for path planning of an underwater robot surveying a marine farm.
void main_cb(const ros::TimerEvent &timer_event)
Main callback which is called by a timer.
ros::ServiceServer enable_serv_
Service server to enable planning.
Class to represent a node (viewpoint) of a lattice.
Definition: lattice.hpp:24
void gp_cov_cb(const mf_common::Array2DConstPtr msg)
Callback for Gaussian Process covariance.
ros::Publisher lattice_pose_pub_
Publisher for the waypoints lattice poses.
void filter_lattice(Lattice &lattice_in, Lattice &lattice_out)
Filters out waypoints that are not in given bounds.
Definition: planning.cpp:282
std::vector< float > bnd_wall_dist_
Bounds on the distance to the wall for waypoint selection.
void generate_path(const std::vector< geometry_msgs::Pose > &selected_vp, nav_msgs::Path &path, std::vector< geometry_msgs::Pose > &waypoints)
Generates a spline trajectory between the selected points.
Definition: planning.cpp:702