Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added scan_topic parameter #117

Open
wants to merge 1 commit into
base: ros2-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/urg_node/urg_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ class UrgNode : public rclcpp::Node
/** The laser tf frame id. */
std::string laser_frame_id_;

std::string scan_topic_;

volatile bool service_yield_;

rclcpp::Publisher<sensor_msgs::msg::LaserScan>::SharedPtr laser_pub_;
Expand Down
1 change: 1 addition & 0 deletions launch/urg_node_ethernet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ urg_node:
ip_port: 10940
serial_baud: 115200
laser_frame_id: "laser"
scan_topic: "scan"
calibrate_time: false
default_user_latency: 0.0
diagnostics_tolerance: 0.05
Expand Down
1 change: 1 addition & 0 deletions launch/urg_node_serial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ urg_node:
serial_port: "/dev/ttyACM0"
serial_baud: 115200
laser_frame_id: "laser"
scan_topic: "scan"
calibrate_time: false
default_user_latency: 0.0
diagnostics_tolerance: 0.05
Expand Down
4 changes: 3 additions & 1 deletion src/urg_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ UrgNode::UrgNode(const rclcpp::NodeOptions & node_options)
skip_(0),
default_user_latency_(0.0),
laser_frame_id_("laser"),
scan_topic_("scan"),
service_yield_(true)
{
(void) synchronize_time_;
Expand All @@ -83,6 +84,7 @@ void UrgNode::initSetup()
ip_address_ = this->declare_parameter<std::string>("ip_address", ip_address_);
ip_port_ = this->declare_parameter<int>("ip_port", ip_port_);
laser_frame_id_ = this->declare_parameter<std::string>("laser_frame_id", laser_frame_id_);
scan_topic_ = this->declare_parameter<std::string>("scan_topic", scan_topic_);
serial_port_ = this->declare_parameter<std::string>("serial_port", serial_port_);
serial_baud_ = this->declare_parameter<int>("serial_baud", serial_baud_);
calibrate_time_ = this->declare_parameter<bool>("calibrate_time", calibrate_time_);
Expand All @@ -109,7 +111,7 @@ void UrgNode::initSetup()
echoes_pub_ =
std::make_unique<laser_proc::LaserPublisher>(this->get_node_topics_interface(), 20);
} else {
laser_pub_ = this->create_publisher<sensor_msgs::msg::LaserScan>("scan", 20);
laser_pub_ = this->create_publisher<sensor_msgs::msg::LaserScan>(scan_topic_, 20);
}

status_service_ = this->create_service<std_srvs::srv::Trigger>(
Expand Down