Skip to content

Commit

Permalink
Initial path types (#120)
Browse files Browse the repository at this point in the history
* Initial path types

* minimal types proposal

* trajectory dataclass

* Proposal for Path/Trajectory separation

* Initial path types: consensus

* fix dataclass TypeError

* make times required without default value

---------

Co-authored-by: Mathieu De Coster <mathieu.decoster@ugent.be>
Co-authored-by: Mathieu De Coster <mth.decoster@gmail.com>
Co-authored-by: Thomas Lips <37955681+tlpss@users.noreply.github.com>
  • Loading branch information
4 people authored Feb 12, 2024
1 parent 3c3cd38 commit 2ebeea3
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions airo-typing/airo_typing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Dict, Optional, Tuple, Union
from typing import Callable, Dict, List, Optional, Tuple, Union

import numpy as np

Expand Down Expand Up @@ -69,11 +69,63 @@
shorthand notation is ^C T^B_A, where C is the frame the velocity is measured in, B is the frame the velocity is expressed in.
"""

# manipulator types
#####################
# Manipulator types #
#####################

JointConfigurationType = np.ndarray
"""an (N,) numpy array that represents the joint angles for a robot"""

JointPathType = np.ndarray
""" a (T, N) array of joint states (can be position/velocity/acceleration) that describe a path in joint space"""

TimesType = np.ndarray
""" a (T,) array of monotonically increasing times (float), corresponding to a path"""


@dataclass
class JointPathContainer:
positions: Optional[JointPathType] = None
velocities: Optional[JointPathType] = None
accelerations: Optional[JointPathType] = None
efforts: Optional[JointPathType] = None


@dataclass
class SingleArmTrajectory:
times: TimesType # time (seconds) from start of trajectory
path: JointPathContainer
gripper_path: Optional[JointPathContainer] = None


@dataclass
class DualArmTrajectory:
times: TimesType # time (seconds) from start of trajectory
path_left: JointPathContainer
path_right: JointPathContainer
gripper_path_left: Optional[JointPathContainer] = None
gripper_path_right: Optional[JointPathContainer] = None


PosePathType = np.ndarray
""" a (T, 4, 4) list of homogeneous matrices that describe a path in cartesian space"""


@dataclass
class PoseTrajectory:
times: TimesType
poses: PosePathType


ForwardKinematicsFunctionType = Callable[[JointConfigurationType], HomogeneousMatrixType]
""" a function that computes the forward kinematics of a given joint configuration"""

InverseKinematicsFunctionType = Callable[[HomogeneousMatrixType], List[JointConfigurationType]]
""" a function that computes one or more inverse kinematics solutions of a given TCP pose"""

JointConfigurationCheckerType = Callable[[JointConfigurationType], bool]
""" a function that checks a certain condition on a joint configuration, e.g. collision checking"""

######################
# camera related types
######################
Expand Down

0 comments on commit 2ebeea3

Please sign in to comment.