Change markers in downloaded package
Hello :)
I downloaded a github-package because I'll have to work with it from now on. I played around with the markers and tried to set the type from lines to arrows by changing the marker_msg.type and adding some marker.scale.* details. Nevertheless, when I start it, it still shows some lines instead of arrows. I'm aware that I might have changed it incorrectly so the arrows aren't displayed correctly - but why is it still getting and displaying the lines in rviz altough the msg.type has been changed?
Thanks for any hints & help!
Here's the Code I tried to change:
void LineExtractionROS::populateMarkerMsg(const std::vector<Line> &lines,
visualization_msgs::Marker &marker_msg)
/*SPHERE TRY{
marker_msg.ns = "line_extraction";
marker_msg.id = 0;
marker_msg.type = visualization_msgs::Marker::SPHERE;
marker_msg.action = visualization_msgs::Marker::ADD;
marker_msg.scale.x = 0.1;
marker_msg.scale.y = 0.1;
marker_msg.scale.z = 0.1;
marker_msg.color.r = 1.0;
marker_msg.color.g = 0.0;
marker_msg.color.b = 0.0;
marker_msg.color.a = 1.0;
for (std::vector<Line>::const_iterator cit = lines.begin(); cit != lines.end(); ++cit)
{
geometry_msgs::Point p_start;
p_start.x = cit->getStart()[0];
p_start.y = cit->getStart()[1];
p_start.z = 0;
marker_msg.pose.position.x = p_start;
geometry_msgs::Point p_end;
p_end.x = cit->getEnd()[0];
p_end.y = cit->getEnd()[1];
p_end.z = 0;
marker_msg.pose.position.y = p_end;
marker_msg.pose.position.z = 0.0;
}
marker_msg.pose.orientation.x = 0.0;
marker_msg.pose.orientation.y = 0.0;
marker_msg.pose.orientation.z = 0.0;
marker_msg.pose.orientation.w = 1.0;
marker_msg.header.frame_id = frame_id_;
marker_msg.header.stamp = ros::Time::now();
}*/
/*ORIGINAL CODE{
marker_msg.ns = "line_extraction";
marker_msg.id = 0;
marker_msg.type = visualization_msgs::Marker::ARROW;
marker_msg.scale.x = 0.1;
marker_msg.color.r = 1.0;
marker_msg.color.g = 0.0;
marker_msg.color.b = 0.0;
marker_msg.color.a = 1.0;
for (std::vector<Line>::const_iterator cit = lines.begin(); cit != lines.end(); ++cit)
{
geometry_msgs::Point p_start;
p_start.x = cit->getStart()[0];
p_start.y = cit->getStart()[1];
p_start.z = 0;
marker_msg.points.push_back(p_start);
geometry_msgs::Point p_end;
p_end.x = cit->getEnd()[0];
p_end.y = cit->getEnd()[1];
p_end.z = 0;
marker_msg.points.push_back(p_end);
}
marker_msg.header.frame_id = frame_id_;
marker_msg.header.stamp = ros::Time::now();
}*/
//Arrow try
{
marker_msg.ns = "line_extraction";
marker_msg.id = 0;
marker_msg.type = visualization_msgs::Marker::ARROW;
marker_msg.scale.x = 0.1;
marker_msg.scale.y = 0.1;
marker_msg.scale.z = 0.1;
marker_msg.color.r = 1.0;
marker_msg.color.g = 0.0;
marker_msg.color.b = 0.0;
marker_msg.color.a = 1.0;
for (std::vector<Line>::const_iterator cit = lines.begin(); cit != lines.end(); ++cit)
{
geometry_msgs::Point p_start;
p_start.x = cit->getStart()[0];
p_start.y = cit->getStart()[1];
p_start.z = 0;
marker_msg.points.push_back(p_start);
geometry_msgs::Point p_end;
p_end.x = cit->getEnd()[0];
p_end.y = cit->getEnd()[1];
p_end.z = 0;
marker_msg.points.push_back(p_end);
}
marker_msg.header.frame_id = frame_id_;
marker_msg.header.stamp = ros::Time::now();
}
Can you please update your question with a copy and paste of your attempts?