Skip to content
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: 1 addition & 1 deletion src/clustering/rspcl_clustering_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
RspclClusteringComponent::RspclClusteringComponent() : Node("pclsub")
{
subscriber_ = this->create_subscription<sensor_msgs::msg::PointCloud2>(
"/camera/pointcloud",
"/Head/D435_H/depth/color/points",
10,
std::bind(&RspclClusteringComponent::timer_callback, this, std::placeholders::_1)\
);
Expand Down
2 changes: 1 addition & 1 deletion src/filter/rspcl_filter_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
RspclFilterComponent::RspclFilterComponent() : Node("pclsub")
{
subscriber_ = this->create_subscription<sensor_msgs::msg::PointCloud2>(
"/camera/pointcloud",
"/Head/D435_H/depth/color/points",
10,
std::bind(&RspclFilterComponent::timer_callback, this, std::placeholders::_1)\
);
Expand Down
47 changes: 40 additions & 7 deletions src/visualization_marker/rspcl_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PclSub : public rclcpp::Node
PclSub(): Node("pclsub")
{
sub_novel = this->create_subscription<sensor_msgs::msg::PointCloud2>(
"/camera/pointcloud",
"/Head/D435_H/depth/color/points",
10,
std::bind(&PclSub::topic_callback, this, std::placeholders::_1)\
);
Expand All @@ -53,7 +53,7 @@ class PclSub : public rclcpp::Node
{
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>);
pcl::fromROSMsg(*cloud_msg, *cloud);
RCLCPP_INFO(this->get_logger(), "cloud_size(%d)",cloud->points.size());
RCLCPP_INFO(this->get_logger(), "cloud_size(%ld)",cloud->points.size());
RCLCPP_INFO(this->get_logger(), "points_size(%d,%d)",cloud_msg->height,cloud_msg->width);

// define a new container for the data
Expand Down Expand Up @@ -110,7 +110,7 @@ class PclSub : public rclcpp::Node
marker.color.g = 1.0;
marker.color.b = 1.0;
marker.color.a = 1.0;
marker.lifetime = rclcpp::Duration(0.0);
// marker.lifetime = rclcpp::Duration(0.0);

// ARROW_r
visualization_msgs::msg::Marker arrow_r;
Expand All @@ -133,7 +133,7 @@ class PclSub : public rclcpp::Node
arrow_r.color.g = 0.0;
arrow_r.color.b = 0.0;
arrow_r.color.a = 1.0;
arrow_r.lifetime = rclcpp::Duration(0.0);
// arrow_r.lifetime = rclcpp::Duration(0.0);

// ARROW_g
visualization_msgs::msg::Marker arrow_g;
Expand All @@ -156,7 +156,7 @@ class PclSub : public rclcpp::Node
arrow_g.color.g = 1.0;
arrow_g.color.b = 0.0;
arrow_g.color.a = 1.0;
arrow_g.lifetime = rclcpp::Duration(0.0);
// arrow_g.lifetime = rclcpp::Duration(0.0);

// TEXT
visualization_msgs::msg::Marker text;
Expand All @@ -177,7 +177,7 @@ class PclSub : public rclcpp::Node
text.color.g = 1.0;
text.color.b = 1.0;
text.color.a = 1.0;
text.lifetime = rclcpp::Duration(0.0);
// text.lifetime = rclcpp::Duration(0.0);

// LINE STRIP
visualization_msgs::msg::Marker connection;
Expand All @@ -192,7 +192,7 @@ class PclSub : public rclcpp::Node
connection.color.g = 1.0;
connection.color.b = 0.0;
connection.color.a = 1.0;
connection.lifetime = rclcpp::Duration(0.0);
// connection.lifetime = rclcpp::Duration(0.0);
start_line.x = geometry_points[i].x;
start_line.y = geometry_points[i].y;
start_line.z = geometry_points[i].z;
Expand All @@ -209,6 +209,39 @@ class PclSub : public rclcpp::Node
// markers.markers.push_back(connection);
}

geometry_msgs::msg::Point point_1;
geometry_msgs::msg::Point point_2;
geometry_msgs::msg::Point point_3;
for(int i=0; i<1; i++){
visualization_msgs::msg::Marker triangle;
triangle.header.frame_id = "camera_color_optical_frame";
triangle.header.stamp = this->now();
triangle.ns = "triangle_list";
triangle.id = i;
triangle.type = visualization_msgs::msg::Marker::TRIANGLE_LIST;
triangle.action = visualization_msgs::msg::Marker::MODIFY;
triangle.scale.x = triangle.scale.y = triangle.scale.z = 1;
triangle.color.r = 0.0;
triangle.color.g = 1.0;
triangle.color.b = 0.0;
triangle.color.a = 1.0;
// triangle.lifetime = rclcpp::Duration(0.0);

point_1.x = geometry_points[i].x;
point_1.y = geometry_points[i].y;
point_1.z = geometry_points[i].z;
point_2.x = geometry_points[i+30].x;
point_2.y = geometry_points[i+30].y;
point_2.z = geometry_points[i+30].z;
point_3.x = geometry_points[i+31].x;
point_3.y = geometry_points[i+31].y;
point_3.z = geometry_points[i+31].z;
triangle.points.push_back(point_1);
triangle.points.push_back(point_2);
triangle.points.push_back(point_3);
markers.markers.push_back(triangle);
}

publisher_m->publish(markers);

sensor_msgs::msg::PointCloud2 sensor_msg;
Expand Down