Skip to content

Commit

Permalink
added debug flag for publishing visualization (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
im-a-robo authored Jan 17, 2024
1 parent 34ab6ba commit 4f18959
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/obj_tracker/ObjTrackerNode_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class ObjTrackerNode : public rclcpp::Node {
private:
/// Publishes visualisations if true
bool debug;

/// Filtered poses
rclcpp::Publisher<geometry_msgs::msg::PoseArray>::SharedPtr pose_pub;

Expand Down
6 changes: 3 additions & 3 deletions src/ObjTrackerNode_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ObjTrackerNode::ObjTrackerNode(const rclcpp::NodeOptions& options)
this->declare_parameter("inital_vx", -0.3f)) {
// Random params
this->declare_parameter("test_latency", false);
this->declare_parameter("visualize_ids", true);
debug = this->declare_parameter<bool>("debug", true);

// Pub Sub
this->pose_sub = this->create_subscription<geometry_msgs::msg::PoseArray>(
Expand Down Expand Up @@ -55,8 +55,8 @@ void ObjTrackerNode::pose_cb(geometry_msgs::msg::PoseArray::SharedPtr msg) {
filtered_arr.header = msg->header;
this->pose_pub->publish(filtered_arr);

// Visualize ids as text for rviz
if (this->get_parameter("visualize_ids").as_bool()) {
// publish visualization if running with debug
if (debug) {
visualization_msgs::msg::MarkerArray vis{};

for (auto& [id, point] : filtered) {
Expand Down

0 comments on commit 4f18959

Please sign in to comment.