9 #ifndef EXPERIMENT_STATS_HPP 10 #define EXPERIMENT_STATS_HPP 12 #include "mf_common/EulerPose.h" 13 #include "mf_common/Array2D.h" 14 #include "mf_common/Float32Array.h" 15 #include "mf_farm_simulator/Algae.h" 16 #include <nav_msgs/Odometry.h> 17 #include <nav_msgs/Path.h> 18 #include <geometry_msgs/Pose.h> 19 #include <tf2_ros/transform_listener.h> 105 const std::vector<geometry_msgs::PoseStamped> &path,
106 const geometry_msgs::Pose &pose
123 const std::vector<std::vector<float>> &array1,
124 const std::vector<std::vector<float>> &array2
138 const geometry_msgs::Pose &pose,
139 const geometry_msgs::Pose &reference,
140 const mf_common::EulerPose &error,
154 std::string file_name,
155 std::vector<float> &gp_mean
void save_gp()
Saves the mean of the Gaussian Process in a file.
void algae_cb(const mf_farm_simulator::Algae msg)
Callback for farm algae.
float moved_distance_
Distance moved by the robot since the start.
ros::Subscriber path_sub_
Subscriber for the reference path.
bool gp_cov_received_
Whether the covariance of the GP has been received.
std::vector< float > init_gp_cov_
Diagonal of the initial covariance of the GP.
float gp_threshold_
Threshold to consider a GP component in information gain computation.
ros::Subscriber odom_sub_
Subscriber for robot odometry.
float main_freq_
Frequency of the main loop.
void gp_mean_cb(const mf_common::Float32Array msg)
Callback for the mean of the Gaussian Process.
void gp_eval_cb(const mf_common::Array2D msg)
Callback for the evaluated GP.
std::vector< float > gp_cov_
Diagonal of the covariance of the Gaussian Proces.
std::string gp_file_name_
double start_time_
Start time of the test.
ros::Publisher ref_pub_
Publisher for the reference pose.
ros::Publisher diff_img_pub_
Publisher for the image of the difference between the mapped GP and the algae heatmap.
nav_msgs::Path path_
Reference path to follow.
bool odom_received_
Whether odometry has been received.
ros::Subscriber gp_cov_sub_
Subscriber for covariance of the GP.
std::vector< std::vector< std::vector< float > > > algae_heatmaps_
Disease heatmaps of the algae.
std::vector< float > gp_mean_
Mean of the Gaussian Process.
void gp_cov_cb(const mf_common::Array2D msg)
Callback for the covariance of the Gaussian Process.
bool load_gp(std::string file_name, std::vector< float > &gp_mean)
Loads the GP mean from a file.
bool path_received_
Whether the reference path has been received.
Class to measure statistics about experiments.
tf2_ros::TransformListener tf_listener_
Transform listener for tf2.
ros::Subscriber algae_sub_
Subscriber for the farm algae.
void odom_cb(const nav_msgs::Odometry msg)
Callback for odometry.
void path_cb(const nav_msgs::Path msg)
Callback for the reference path.
bool gp_mean_received_
Whether the mean of the GP has been received.
float compute_diff(const std::vector< std::vector< float >> &array1, const std::vector< std::vector< float >> &array2)
Computes the difference between two arrays.
bool save_gp_
Whether to save the Gaussian Process at the end.
ros::NodeHandle nh_
Node handler.
std::vector< std::vector< float > > gp_eval_
Evaluated GP.
std::ofstream out_file_
Output CSV file containg data of the experiment.
bool load_gp_
Whether to load the Gaussian Process at the beginning.
geometry_msgs::Pose find_closest(const std::vector< geometry_msgs::PoseStamped > &path, const geometry_msgs::Pose &pose)
Finds the closest pose in a path.
ros::Subscriber gp_mean_sub_
Subscriber for mean of the GP.
ros::Subscriber gp_eval_sub_
Subscriber for the evaluated GP.
ros::Publisher error_pub_
Publisher for the tracking error.
bool gp_eval_received_
Whether the evaluated GP has been received.
nav_msgs::Odometry odom_
Last odometry message received.
void init_node()
Initialises the node and its parameters.
bool algae_received_
Whether the farm algae have been received.
void write_output(const geometry_msgs::Pose &pose, const geometry_msgs::Pose &reference, const mf_common::EulerPose &error, float gp_cov_trace, float information, float gp_diff_norm)
Writes the output statistics in the out file.
void run_node()
Runs the node.
ros::ServiceClient load_gp_client_
Service client for loading the GP.
tf2_ros::Buffer tf_buffer_
Buffer for tf2.