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

Update meshcat_visualizer.py by adding set_property #1225

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
10 changes: 10 additions & 0 deletions bindings/python/visualize/meshcat_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,16 @@ def set_arrow_transform(self, origin, vector, shape_name="iDynTree"):
with self._animation.at_frame(self.viewer, self._current_frame) as frame:
frame[shape_name].set_transform(transform)

def set_primitive_geometry_property(
self, property_name, value, shape_name="iDynTree"
):
if self.__primitive_geometry_exists(shape_name):
if self._animation is None:
self.viewer[shape_name].set_property(key=property_name, value=value)
else:
with self._animation.at_frame(self.viewer, self._current_frame) as frame:
raise NotImplementedError("The set_property method is not implemented for animations.")

def load_model_from_file(
self, model_path: str, considered_joints=None, model_name="iDynTree", color=None
):
Expand Down
Loading