Skip to content

Commit

Permalink
[src/nav_node.cpp] Standardization of topic name
Browse files Browse the repository at this point in the history
The previous code syntax forced the launch file programmer to write
explicitly the name of each topic, even if those names will be fixed (eg
"action_topic", "nav_stop"...).
Moreover when you write "/" before the
name of the topic, the name is "absolute" and can't be affected by
namespaces.

I removed the parameters to choose the name of topics, if we want to do
that, we can use a "remap" as it is usually done.
I also changed the name of topics to allow the use of namespace

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@outlook.com>
  • Loading branch information
Taumille committed Oct 28, 2023
1 parent 6200e57 commit 4de98a3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/nav_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,16 @@ Nav_node::Nav_node() : Node("nav_node"){
// Get parameters

this->declare_parameter("robot_id", 0);
this->declare_parameter("pic_action_topic", "/pic_action");
this->declare_parameter("result_topic", "/result");
this->declare_parameter("robot_data_topic", "/robot_data");
this->declare_parameter("position_goal_topic", "/position_goal");
this->declare_parameter("stop_topic", "/stop");
this->declare_parameter("normal_radius", 0.15);
this->declare_parameter("variation_obs", 0.10);
this->declare_parameter("map_file", "blank.txt");

this->robot_number = this->get_parameter("robot_id").as_int();
std::string pic_action_topic = this->get_parameter("pic_action_topic").as_string();
std::string result_topic = this->get_parameter("result_topic").as_string();
std::string robot_data_topic = this->get_parameter("robot_data_topic").as_string();
std::string position_goal_topic = this->get_parameter("position_goal_topic").as_string();
std::string stop_topic = this->get_parameter("stop_topic").as_string();
std::string pic_action_topic = "pic_action";
std::string result_topic = "nav_result";
std::string robot_data_topic = "robot_data";
std::string position_goal_topic = "nav_goal";
std::string stop_topic = "nav_stop";
this->normal_radius = this->get_parameter("normal_radius").as_double();
this->variation_obs = this->get_parameter("variation_obs").as_double();
this->map_file = this->get_parameter("map_file").as_string();
Expand Down

0 comments on commit 4de98a3

Please sign in to comment.