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

Initial path types #120

Merged
merged 8 commits into from
Feb 12, 2024
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
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
Loading