Skip to content

Commit

Permalink
Add set target position/orientation shorthands
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-caron committed Feb 22, 2024
1 parent cb43e5b commit 84f1d5b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ All notable changes to this project will be documented in this file.
- Distribute package on conda-forge
- Example on how differential IK may converge to a local constrained optimum
- Expose all tasks from the top-level `pink` module
- Frame task: ``set_target_orientation`` method
- Frame task: ``set_target_position`` method
- Handle unbounded joints in custom configuration vectors
- Unit test for posture task Jacobian

Expand Down
21 changes: 21 additions & 0 deletions pink/tasks/frame_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import numpy as np
import pinocchio as pin
from numpy.typing import NDArray

from ..configuration import Configuration
from .exceptions import TargetNotSet, TaskDefinitionError
Expand Down Expand Up @@ -135,6 +136,26 @@ def set_target(
"""
self.transform_target_to_world = transform_target_to_world.copy()

def set_target_orientation(
self, rotation_target_to_world: NDArray[float]
) -> None:
"""Set the orientation of the target frame in the world frame.
Args:
rotation_target_to_world: Orientation of the task target frame in
the world frame.
"""
self.transform_target_to_world.rotation = rotation_target_to_world

def set_target_position(self, translation_world_to_target_in_world: NDArray[float]) -> None:
"""Set the position of the target frame in the world frame.
Args:
translation_world_to_target_in_world: Position of the task target
frame in the world frame.
"""
self.transform_target_to_world.translation = translation_world_to_target_in_world

def set_target_from_configuration(
self, configuration: Configuration
) -> None:
Expand Down

0 comments on commit 84f1d5b

Please sign in to comment.