cant see markers in rviz2
Hi all. I am using ros2 foxy. I am trying to publish a marker to rviz, but it does not visualize it.
the marker code:
visualization_msgs::msg::Marker marker;
marker.id = 0;
marker.header.frame_id = "base_link";
marker.frame_locked = true;
marker.header.stamp = this->get_clock()->now();
marker.ns = "visual_box";
marker.type = visualization_msgs::msg::Marker::CUBE;
marker.action =visualization_msgs::msg::Marker::ADD;
marker.pose=object_pos;
marker.scale.x = object_size.x/100.0f;
marker.scale.y = object_size.y/100.0f;
marker.scale.z = (object_size.z)/100.0f;
marker.color.a = alpa; // Don't forget to set the alpha!
marker.color.r = rand()%100/100.0f;
marker.color.g = rand()%100/100.0f;
marker.color.b = rand()%100/100.0f;
this->box_marker_pub->publish(marker);
the msg is getting publish, if i echo it from the terminal i get:
picko@picko-koby:~/pickommerce_ws$ ros2 topic echo /packing_algorithm/visual_boxing
header:
stamp:
sec: 1666173251
nanosec: 528962951
frame_id: base_link
ns: visual_box
id: 0
type: 1
action: 0
pose:
position:
x: 0.555
y: 0.555
z: 0.5449999928474427
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
scale:
x: 1.1100000143051147
y: 1.1100000143051147
z: 1.1100000143051147
color:
r: 0.8299999833106995
g: 0.8600000143051147
b: 0.7699999809265137
a: 0.5
lifetime:
sec: 0
nanosec: 0
frame_locked: true
points: []
colors: []
text: ''
mesh_resource: ''
mesh_use_embedded_materials: false
---
the fix frame in rviz set to base_link. any idea?
@bodka the convention on this site is to not close questions unless there is a problem with it e.g. it is off-topic or an exact duplicate question. Instead, if an answer successfully helped you solve your problem, you should click on the "check mark" symbol in the gray circle on the left side of the answer. The icon will turn green to indicate which answer you selected.