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

[viz_marker_pub] added new manual marker publisher to just publish on… #144

Merged
merged 5 commits into from
May 22, 2024

Conversation

sunava
Copy link
Collaborator

@sunava sunava commented Apr 16, 2024

…e pose or object

This class, ManualMarkerPublisher, serves as a tool for manually adding and removing markers for objects and poses.

@sunava sunava requested review from Tigul and removed request for Tigul April 16, 2024 14:28
from std_msgs.msg import ColorRGBA

from pycram.datastructures.enums import AxisIdentifier
from pycram.world import World
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make these relative imports, its cleaner and in line with all other imports.

self.name = None
self.interval = interval

def publish(self, pose: Pose, color=None, bw_object=None, name=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing for optional parameter

duration = 2

while not stop_thread:
if time.time() - self.start_time > duration:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this correctly, this only publishes for 2 seconds?


rospy.sleep(self.interval)

def _publish_pose(self, name, pose, color=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing

self.create_marker(name=name, marker_type=Marker.ARROW, marker_pose=pose,
marker_scales=(0.05, 0.05, 0.05), color_rgba=color_rgba)
self.marker_array_pub.publish(self.marker_array)
rospy.logwarn("Marker array published")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a warning, shouldn't this be rospy.loginfo?

self._update_marker(self.marker_overview[name], new_pose=pose)
return

path = bw_real.bullet_world_object.urdf_object.links[0].visual.geometry.filename
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bullet_world_object was changed to world_object in the AbstractWorld merge.

This will also just work for Objects that are spawned from meshes, meaning Objects that have more than one link will not be displayed correctly.

new_marker.pose.position.x = marker_pose.pose.position.x
new_marker.pose.position.y = marker_pose.pose.position.y
new_marker.pose.position.z = marker_pose.pose.position.z
new_marker.pose.orientation = Quaternion(0.0, 0.0, 0.0, 1.0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the orientation of the marker_pose?

self.marker_overview[name] = new_marker.id
self.current_id += 1

def _update_marker(self, marker_id, new_pose):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing and return

rospy.logwarn(f"Marker {marker_id} not found for update")
return False

def remove_marker(self, bw_object=None, name=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing


self.marker_array_pub.publish(self.marker_array)
self.marker_array.markers.pop(marker_id)
self.marker_array_pub.publish(self.marker_array)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this published a second time? The marker should already be deleted.

@Tigul
Copy link
Collaborator

Tigul commented Apr 24, 2024

Just a general thought: If this should be used in multiple places of the code (for example to show the pose while pick_up) it could make sense to make this a Singelton.

@Tigul Tigul merged commit a0fcebc into cram2:dev May 22, 2024
1 of 2 checks passed
mkhoshnam pushed a commit to mkhoshnam/pycram that referenced this pull request Nov 26, 2024
[viz_marker_pub] added new manual marker publisher to just publish on…
mkhoshnam pushed a commit to mkhoshnam/pycram that referenced this pull request Nov 26, 2024
[viz_marker_pub] added new manual marker publisher to just publish on…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants