-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created a new parameter manager object to standardize across estimato…
…r, path planner, etc.
- Loading branch information
1 parent
1f4b10e
commit eafe369
Showing
9 changed files
with
274 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ log/ | |
|
||
# IDE files | ||
.vscode/ | ||
.idea/ | ||
.idea/ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* @file param_manager.hpp | ||
* | ||
* Manager for the parameters in ROSplane. Includes helper functions to call parameters | ||
* | ||
* @author Jacob Moore <[email protected]> | ||
*/ | ||
|
||
#ifndef PARAM_MANAGER_H | ||
#define PARAM_MANAGER_H | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
#include <variant> | ||
|
||
namespace rosplane | ||
{ | ||
|
||
class param_manager | ||
{ | ||
public: | ||
/** | ||
* Public constructor | ||
* | ||
* @param node: the ROS2 node that has this parameter object. Used to poll the ROS2 parameters | ||
*/ | ||
param_manager(rclcpp::Node * node); | ||
|
||
/** | ||
* Helper functions to access parameter values stored in param_manager object | ||
* Returns a std::variant that holds the value of the given parameter | ||
*/ | ||
double get_double(std::string param_name); | ||
bool get_bool(std::string param_name); | ||
int64_t get_int(std::string param_name); | ||
std::string get_string(std::string param_name); | ||
|
||
/** | ||
* Helper functions to declare parameters in the param_manager object | ||
* Inserts a parameter into the parameter object and declares it with the ROS system | ||
*/ | ||
void declare_param(std::string param_name, double value); | ||
void declare_param(std::string param_name, bool value); | ||
void declare_int(std::string param_name, int64_t value); | ||
void declare_param(std::string param_name, std::string value); | ||
|
||
/** | ||
* This sets the parameters with the values in the params_ object from the supplied parameter file, or sets them to | ||
* the default if no value is given for a parameter. | ||
*/ | ||
// TODO: Check to make sure that setting a parameter before declaring it won't give an error. | ||
// Hypothesis is that it will break, but is that not desired behavior? | ||
void set_parameters(); | ||
|
||
private: | ||
/** | ||
* Data structure to hold all of the parameters | ||
*/ | ||
std::map<std::string, std::variant<double, bool, int64_t, std::string>> params_; // Can I cast ROS int to int? | ||
rclcpp::Node * container_node_; | ||
}; | ||
|
||
|
||
} // namespace rosplane | ||
#endif // PARAM_MANAGER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.