Corentin Chauvin-Hameau – 2019-2020
Coverage Path Planning for an underwater robot surveying a marine farm
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
mfcpp::FarmNodelet Class Reference

Nodelet class for farm simulation. More...

#include <farm_nodelet.hpp>

Inheritance diagram for mfcpp::FarmNodelet:
Inheritance graph
[legend]
Collaboration diagram for mfcpp::FarmNodelet:
Collaboration graph
[legend]

Public Member Functions

 FarmNodelet ()
 
 ~FarmNodelet ()
 
virtual void onInit ()
 Function called at beginning of nodelet execution. More...
 

Private Member Functions

void main_cb (const ros::TimerEvent &timer_event)
 Main callback which is called by a timer. More...
 
void reconfigure_cb (mf_farm_simulator::FarmSimulatorConfig &config, uint32_t level)
 Callback for dynamic reconfigure. More...
 
void pub_algae ()
 Publishes the position and heatmap of the algae. More...
 
Initialisation functions
void init_cb (const ros::TimerEvent &timer_event)
 Callback for the oneshot initialisation timer. More...
 
void init_algae_lines ()
 Initialise the algae lines. More...
 
template<class T >
rand_gaussian (T mu, T sigma)
 Draw a random number from a Gaussian distribution. More...
 
template<class T >
rand_uniform (T a, T b)
 Draw a random number from a uniform distribution. More...
 
bool rand_bernoulli (double p)
 Draw a random number from a bernoulli distribution. More...
 
void init_anchors (AlgaeLine &line, unsigned int i)
 Init anchors of a specific algae line. More...
 
void init_ropes (AlgaeLine &line)
 Init ropes of an algae line. More...
 
void init_algae (AlgaeLine &line)
 Init algae of an algae line. More...
 
Visualisation functions
void pub_rviz_markers (float duration) const
 Displays objects by publishing Rviz markers. More...
 
void pop_buoys_marker (visualization_msgs::Marker &marker, MarkerArgs args) const
 Populates a marker for displaying the buoys. More...
 
void pop_ropes_marker (visualization_msgs::Marker &marker, MarkerArgs args) const
 Populates a marker for displaying the ropes. More...
 
void pop_algae_marker (visualization_msgs::Marker &marker, MarkerArgs args) const
 Populates a marker for displaying the algae. More...
 
void pop_algae_heatmaps (visualization_msgs::Marker &marker, MarkerArgs args) const
 Populates a marker for displaying the disease heatmaps. More...
 
void pop_img_marker (visualization_msgs::Marker &marker, std::vector< std::vector< float >> img, const std::vector< tf2::Vector3 > &coord) const
 Populates a triangle marker for displaying images. More...
 

Static Private Member Functions

static void sigint_handler (int s)
 SINGINT (Ctrl+C) callback to stop the nodelet properly. More...
 

Private Attributes

ros::NodeHandle nh_
 Node handler (for topics and services) More...
 
ros::NodeHandle private_nh_
 Private node handler (for parameters) More...
 
dynamic_reconfigure::Server< mf_farm_simulator::FarmSimulatorConfig > reconf_srv_
 Dynamic reconfigure server. More...
 
ros::Publisher rviz_pub_
 ROS publisher for Rviz. More...
 
ros::Publisher algae_pub_
 ROS publisher for the algae. More...
 
std::vector< AlgaeLinealgae_lines_
 Vector of all the algae in the farm. More...
 
bool reconfigure_initialised_
 Whether the dynamic reconfigure callback has been called once. More...
 
bool init_done_
 Whether the farm initialisation has been done. More...
 
std::random_device random_device_
 Seed initialiser for random number generation. More...
 
std::mt19937 random_generator_
 Random number initialiser. More...
 
PerlinNoiseGenerator perlin_
 For randomising the heatmaps. More...
 
ROS parameters
float main_loop_freq_
 Frequency of the main loop. More...
 
int random_seed_
 Seed for random numbers (0 for random seed) More...
 
int nbr_lines_
 Number of algae lines. More...
 
float offset_lines_
 Lateral distance (m) between each line. More...
 
float length_lines_
 Length (m) of each line. More...
 
float thickness_ropes_
 Diameter (m) of each line. More...
 
float depth_lines_
 Distance (m) between water surface and line. More...
 
float depth_water_
 Distance (m) between water surface and seafloor. More...
 
float anchors_diameter_
 Diameter (m) of the cylindrical anchors. More...
 
float anchors_height_
 Height (m) of the cylindrical anchors. More...
 
int nbr_buoys_
 Number of buoys on each floating rope. More...
 
float buoys_diameter_
 Diameter (m) of each buoy. More...
 
bool randomise_lines_
 Whether to randomise the position of each line. More...
 
float alga_miss_rate_
 Probability to have a missing alga. More...
 
float phi_lines_
 Mean of phi angle for algae line generation. More...
 
float theta_lines_
 Mean of theta angle for algae line generation. More...
 
float bnd_phi_lines_
 Bound such that phi is sampled in [mean-bnd, mean+bnd]. More...
 
float bnd_theta_lines_
 Bound such that theta is sampled in [mean-bnd, mean+bnd]. More...
 
float bnd_gamma_lines_
 Bound such that gamma is sampled in [mean-bnd, mean+bnd]. More...
 
bool randomise_algae_
 Whether to randomise size and orientation of algae. More...
 
int nbr_algae_
 Number of algae per line. More...
 
float width_algae_
 Mean of the width of an alga. More...
 
float length_algae_
 Mean of the length of an alga. More...
 
float thickness_algae_
 Thickness of an alga (for collision detection) More...
 
float psi_algae_
 Mean of the algae orientation. More...
 
float std_width_algae_
 Standard deviation on algae width. More...
 
float std_length_algae_
 Standard deviation on algae length. More...
 
float std_psi_algae_
 Standard deviation on algae orientation. More...
 
bool disp_disease_
 Whether to display the disease heatmaps. More...
 
float disease_ratio_
 Ratio of alga disease (0->fully sane, 1->fully sick) More...
 
int height_disease_heatmap_
 Height of the algae disease heatmap. More...
 
int width_disease_heatmap_
 Width of the algae disease heatmap. More...
 
int height_grid_heatmap_
 Height of the grid for perlin noise generation. More...
 
int width_grid_heatmap_
 

Static Private Attributes

static sig_atomic_t volatile b_sigint_ = 0
 Whether SIGINT signal has been received. More...
 
static ros::Timer init_timer_ = ros::Timer()
 Timer callback for the init function. More...
 
static ros::Timer main_timer_ = ros::Timer()
 Timer callback for the main function. More...
 

Detailed Description

Nodelet class for farm simulation.

Definition at line 31 of file farm_nodelet.hpp.

Constructor & Destructor Documentation

mfcpp::FarmNodelet::FarmNodelet ( )

Definition at line 45 of file farm_nodelet.cpp.

mfcpp::FarmNodelet::~FarmNodelet ( )

Definition at line 46 of file farm_nodelet.cpp.

Member Function Documentation

void mfcpp::FarmNodelet::init_algae ( AlgaeLine line)
private

Init algae of an algae line.

Parameters
lineConcerned algae line

Definition at line 91 of file farm_initialisation.cpp.

void mfcpp::FarmNodelet::init_algae_lines ( )
private

Initialise the algae lines.

Definition at line 178 of file farm_nodelet.cpp.

void mfcpp::FarmNodelet::init_anchors ( AlgaeLine line,
unsigned int  i 
)
private

Init anchors of a specific algae line.

Parameters
lineConcerned algae line
iIndex of the algae line

Definition at line 19 of file farm_initialisation.cpp.

void mfcpp::FarmNodelet::init_cb ( const ros::TimerEvent &  timer_event)
private

Callback for the oneshot initialisation timer.

Parameters
timer_eventTimer event information

Definition at line 171 of file farm_nodelet.cpp.

void mfcpp::FarmNodelet::init_ropes ( AlgaeLine line)
private

Init ropes of an algae line.

Parameters
lineConcerned algae line

Definition at line 34 of file farm_initialisation.cpp.

void mfcpp::FarmNodelet::main_cb ( const ros::TimerEvent &  timer_event)
private

Main callback which is called by a timer.

Parameters
timer_eventTimer event information

Definition at line 132 of file farm_nodelet.cpp.

void mfcpp::FarmNodelet::onInit ( )
virtual

Function called at beginning of nodelet execution.

Definition at line 48 of file farm_nodelet.cpp.

void mfcpp::FarmNodelet::pop_algae_heatmaps ( visualization_msgs::Marker &  marker,
MarkerArgs  args 
) const
private

Populates a marker for displaying the disease heatmaps.

Parameters
markerMarker to populate
argsCommon arguments to fill ROS message

Definition at line 193 of file farm_output.cpp.

void mfcpp::FarmNodelet::pop_algae_marker ( visualization_msgs::Marker &  marker,
MarkerArgs  args 
) const
private

Populates a marker for displaying the algae.

Parameters
markerMarker to populate
argsCommon arguments to fill ROS message

Definition at line 141 of file farm_output.cpp.

void mfcpp::FarmNodelet::pop_buoys_marker ( visualization_msgs::Marker &  marker,
MarkerArgs  args 
) const
private

Populates a marker for displaying the buoys.

Parameters
markerMarker to populate
argsCommon arguments to fill ROS message

Definition at line 84 of file farm_output.cpp.

void mfcpp::FarmNodelet::pop_img_marker ( visualization_msgs::Marker &  marker,
std::vector< std::vector< float >>  img,
const std::vector< tf2::Vector3 > &  coord 
) const
private

Populates a triangle marker for displaying images.

coord[0] | coord[1]

coord[3] | coord[2]

Note
For speed issues, space for the concerned vectors should already be reserved.
Parameters
markerMarker to populate
imgBlack and white image to add to the marker
coordFour 3D coordinates of the corners of the image

Definition at line 232 of file farm_output.cpp.

void mfcpp::FarmNodelet::pop_ropes_marker ( visualization_msgs::Marker &  marker,
MarkerArgs  args 
) const
private

Populates a marker for displaying the ropes.

Parameters
markerMarker to populate
argsCommon arguments to fill ROS message

Definition at line 105 of file farm_output.cpp.

void mfcpp::FarmNodelet::pub_algae ( )
private

Publishes the position and heatmap of the algae.

Definition at line 281 of file farm_output.cpp.

void mfcpp::FarmNodelet::pub_rviz_markers ( float  duration) const
private

Displays objects by publishing Rviz markers.

Parameters
durationDuration of the marker (in sec)

Definition at line 23 of file farm_output.cpp.

bool mfcpp::FarmNodelet::rand_bernoulli ( double  p)
inlineprivate

Draw a random number from a bernoulli distribution.

Parameters
pProbability to get true
Returns
Random number following a uniform law in [a, b]

Definition at line 284 of file farm_nodelet.hpp.

template<class T >
T mfcpp::FarmNodelet::rand_gaussian ( mu,
sigma 
)
inlineprivate

Draw a random number from a Gaussian distribution.

Parameters
muMean of the distribution
sigmaStandard deviation of the distribution
Returns
Random number following a normal law (mu, sigma)

Definition at line 269 of file farm_nodelet.hpp.

template<class T >
T mfcpp::FarmNodelet::rand_uniform ( a,
b 
)
inlineprivate

Draw a random number from a uniform distribution.

Parameters
aLower bound
bUpper bound
Returns
Random number following a uniform law in [a, b]

Definition at line 277 of file farm_nodelet.hpp.

void mfcpp::FarmNodelet::reconfigure_cb ( mf_farm_simulator::FarmSimulatorConfig &  config,
uint32_t  level 
)
private

Callback for dynamic reconfigure.

Parameters
Newconfiguration
Changelevel

Definition at line 153 of file farm_nodelet.cpp.

void mfcpp::FarmNodelet::sigint_handler ( int  s)
staticprivate

SINGINT (Ctrl+C) callback to stop the nodelet properly.

Definition at line 144 of file farm_nodelet.cpp.

Member Data Documentation

float mfcpp::FarmNodelet::alga_miss_rate_
private

Probability to have a missing alga.

Definition at line 78 of file farm_nodelet.hpp.

std::vector<AlgaeLine> mfcpp::FarmNodelet::algae_lines_
private

Vector of all the algae in the farm.

Definition at line 54 of file farm_nodelet.hpp.

ros::Publisher mfcpp::FarmNodelet::algae_pub_
private

ROS publisher for the algae.

Definition at line 53 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::anchors_diameter_
private

Diameter (m) of the cylindrical anchors.

Definition at line 72 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::anchors_height_
private

Height (m) of the cylindrical anchors.

Definition at line 73 of file farm_nodelet.hpp.

sig_atomic_t volatile mfcpp::FarmNodelet::b_sigint_ = 0
staticprivate

Whether SIGINT signal has been received.

Definition at line 44 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::bnd_gamma_lines_
private

Bound such that gamma is sampled in [mean-bnd, mean+bnd].

Definition at line 83 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::bnd_phi_lines_
private

Bound such that phi is sampled in [mean-bnd, mean+bnd].

Definition at line 81 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::bnd_theta_lines_
private

Bound such that theta is sampled in [mean-bnd, mean+bnd].

Definition at line 82 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::buoys_diameter_
private

Diameter (m) of each buoy.

Definition at line 75 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::depth_lines_
private

Distance (m) between water surface and line.

Definition at line 70 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::depth_water_
private

Distance (m) between water surface and seafloor.

Definition at line 71 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::disease_ratio_
private

Ratio of alga disease (0->fully sane, 1->fully sick)

Definition at line 96 of file farm_nodelet.hpp.

bool mfcpp::FarmNodelet::disp_disease_
private

Whether to display the disease heatmaps.

Definition at line 95 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::height_disease_heatmap_
private

Height of the algae disease heatmap.

Definition at line 97 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::height_grid_heatmap_
private

Height of the grid for perlin noise generation.

Definition at line 99 of file farm_nodelet.hpp.

bool mfcpp::FarmNodelet::init_done_
private

Whether the farm initialisation has been done.

Definition at line 56 of file farm_nodelet.hpp.

ros::Timer mfcpp::FarmNodelet::init_timer_ = ros::Timer()
staticprivate

Timer callback for the init function.

Definition at line 45 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::length_algae_
private

Mean of the length of an alga.

Definition at line 88 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::length_lines_
private

Length (m) of each line.

Definition at line 68 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::main_loop_freq_
private

Frequency of the main loop.

Definition at line 64 of file farm_nodelet.hpp.

ros::Timer mfcpp::FarmNodelet::main_timer_ = ros::Timer()
staticprivate

Timer callback for the main function.

Definition at line 46 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::nbr_algae_
private

Number of algae per line.

Definition at line 86 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::nbr_buoys_
private

Number of buoys on each floating rope.

Definition at line 74 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::nbr_lines_
private

Number of algae lines.

Definition at line 66 of file farm_nodelet.hpp.

ros::NodeHandle mfcpp::FarmNodelet::nh_
private

Node handler (for topics and services)

Definition at line 49 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::offset_lines_
private

Lateral distance (m) between each line.

Definition at line 67 of file farm_nodelet.hpp.

PerlinNoiseGenerator mfcpp::FarmNodelet::perlin_
private

For randomising the heatmaps.

Definition at line 59 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::phi_lines_
private

Mean of phi angle for algae line generation.

Definition at line 79 of file farm_nodelet.hpp.

ros::NodeHandle mfcpp::FarmNodelet::private_nh_
private

Private node handler (for parameters)

Definition at line 50 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::psi_algae_
private

Mean of the algae orientation.

Definition at line 90 of file farm_nodelet.hpp.

std::random_device mfcpp::FarmNodelet::random_device_
private

Seed initialiser for random number generation.

Definition at line 57 of file farm_nodelet.hpp.

std::mt19937 mfcpp::FarmNodelet::random_generator_
private

Random number initialiser.

Definition at line 58 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::random_seed_
private

Seed for random numbers (0 for random seed)

Definition at line 65 of file farm_nodelet.hpp.

bool mfcpp::FarmNodelet::randomise_algae_
private

Whether to randomise size and orientation of algae.

Definition at line 85 of file farm_nodelet.hpp.

bool mfcpp::FarmNodelet::randomise_lines_
private

Whether to randomise the position of each line.

Definition at line 77 of file farm_nodelet.hpp.

dynamic_reconfigure::Server<mf_farm_simulator::FarmSimulatorConfig> mfcpp::FarmNodelet::reconf_srv_
private

Dynamic reconfigure server.

Definition at line 51 of file farm_nodelet.hpp.

bool mfcpp::FarmNodelet::reconfigure_initialised_
private

Whether the dynamic reconfigure callback has been called once.

Definition at line 55 of file farm_nodelet.hpp.

ros::Publisher mfcpp::FarmNodelet::rviz_pub_
private

ROS publisher for Rviz.

Definition at line 52 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::std_length_algae_
private

Standard deviation on algae length.

Definition at line 92 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::std_psi_algae_
private

Standard deviation on algae orientation.

Definition at line 93 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::std_width_algae_
private

Standard deviation on algae width.

Definition at line 91 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::theta_lines_
private

Mean of theta angle for algae line generation.

Definition at line 80 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::thickness_algae_
private

Thickness of an alga (for collision detection)

Definition at line 89 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::thickness_ropes_
private

Diameter (m) of each line.

Definition at line 69 of file farm_nodelet.hpp.

float mfcpp::FarmNodelet::width_algae_
private

Mean of the width of an alga.

Definition at line 87 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::width_disease_heatmap_
private

Width of the algae disease heatmap.

Definition at line 98 of file farm_nodelet.hpp.

int mfcpp::FarmNodelet::width_grid_heatmap_
private

Width of the grid for perlin noise generation

Definition at line 100 of file farm_nodelet.hpp.


The documentation for this class was generated from the following files: