platforms
Platform base classes and utilities.
This module defines the common platform abstraction used in robotblockset for mobile bases and related motion-control components. It provides state and command containers, default motion parameters, motion result codes, and the main platform base class with support for coordinate transforms, motion commands, attached robots, and asynchronous execution helpers.
- class robotblockset.platforms.platform(**kwargs: Any)[source]
Bases:
rbs_objectRepresents a mobile platform base class with state handling, frame transforms, and motion-control utilities.
- Attributes:
Name (str) – Name of the platform.
tsamp (float) – Sampling rate for the platform.
TRobotBase (HomogeneousMatrixType) – Transformation matrix of the attached robot base relative to the platform.
TObject (HomogeneousMatrixType) – Transformation matrix of the tracked or manipulated object.
Robot (Optional[robot]) – Robot attached to the platform, if any.
User (Optional[Any]) – User-defined data or object associated with the platform.
Tag (Optional[str]) – Tag associated with the platform.
Initialize the platform with default values and optional configuration arguments.
- Parameters:
**kwargs (Any) – Optional arguments for custom configuration or parameters.
- Return type:
None
- __init__(**kwargs: Any) None[source]
Initialize the platform with default values and optional configuration arguments.
- Parameters:
**kwargs (Any) – Optional arguments for custom configuration or parameters.
- Return type:
None
- reset_threads() None[source]
Resets the internal semaphore to its initial state.
This method reinitializes the semaphore with a value of 1, effectively allowing one thread to acquire it.
- Return type:
None
- jointvar(x: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...]) ndarray[source]
Validates and returns the input x if it has the proper shape for joint positions.
- Parameters:
x (ArrayLike) – Input array representing joint positions, which must have the shape (n, nj), where n is the number of samples and nj is the number of joints.
- Returns:
The input array x if it has the correct shape.
- Return type:
JointConfigurationType
- Raises:
TypeError – If the input x does not have the proper shape.
Notes
Assuming ‘nj’ represents the number of joints, defined elsewhere in the class
- spatial(x: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...]) ndarray[source]
Validates the shape of the input x and returns it in an appropriate format.
- Parameters:
x (ArrayLike) – The input array representing a spatial quantity, which can be one of the following shapes: - (7,) : pose (position and quaternion) - (4, 4) : transformation matrix - (3,) : position vector - (4,) : quaternion - (3, 3) : rotation matrix - (6,) : twist (linear and angular velocity) - (3, 4) : homogeneous matrix without the last row (assumed to be 3x4)
- Returns:
The input x in the validated shape, possibly modified if the shape was (3, 4).
- Return type:
np.ndarray
- Raises:
TypeError – If the input x does not have a valid shape.
- simtime() float[source]
Returns the current simulation time based on the system’s performance counter.
The perf_counter function provides a high-resolution timer that is useful for measuring time intervals. It is system-dependent and returns the time as a floating-point value in seconds.
- Returns:
The current simulation time in seconds since an arbitrary point (usually the start of the program).
- Return type:
float
- UseThreads(active: bool) None[source]
Enable or disable worker threads for platform control.
This method sets the _threads_active attribute, which controls whether the platform control system should use threads for asynchronous operations.
- Parameters:
active (bool) – A boolean value that indicates whether threads should be active. If True, threads are enabled. If False, threads are disabled.
- Returns:
This method does not return any value.
- Return type:
None
- SetTsamp(tsamp: float) None[source]
Set the sampling time for the platform control system.
This method updates the tsamp attribute and synchronizes the default wait interval.
- Parameters:
tsamp (float) – The new sampling time in seconds to set for the robot control system.
- Returns:
This method does not return any value.
- Return type:
None
- ResetTime() None[source]
Reset the platform timing reference to the current simulation time.
This method updates the internal time attributes _t0 and _tt0 to the current simulation time and current platform time, respectively.
- Returns:
This method does not return any value.
- Return type:
None
- isConnected() bool[source]
Checks if the platform is connected.
- Returns:
True if the platform is connected, False otherwise.
- Return type:
bool
- isReady() bool[source]
Check if the platform is ready for operation.
This method checks the _connected attribute to determine if the platform is connected and operational.
- Returns:
True if the robot is connected and ready for operations, otherwise False.
- Return type:
bool
- isActive() bool[source]
Check if the platform target is active.
This method always returns True, indicating that the platform target is in an active state. It can be overridden in subclasses for more complex behavior.
- Returns:
Always returns True, indicating the platform target is active.
- Return type:
bool
- inMotion() bool[source]
Check if the platform is in motion.
- Returns:
True indicating the platform is excetuting motion command.
- Return type:
bool
- Check(silent: bool = False) list[str][source]
Check the status of the platform.
- Parameters:
silent (bool, optional) – If True, suppress status messages while checking the platform state.
- Returns:
A list containing non-active status entries and descriptions.
- Return type:
list[str]
- HasError() bool[source]
Check whether the platform reports any errors.
- Returns:
TrueifCheck()returns at least one error entry, otherwiseFalse.- Return type:
bool
- property Time: float
Get the elapsed wall time since the platform was initialized.
- Returns:
Elapsed time in seconds.
- Return type:
float
- property t: float
Get the elapsed platform time.
- Returns:
Time difference in seconds.
- Return type:
float
- property command: _command
Get the commanded state of the platform.
- Returns:
A copy of the commanded state.
- Return type:
_command
- property actual: _actual
Get the actual state of the platform.
- Returns:
A copy of the actual state.
- Return type:
_actual
- property q: ndarray
Get the current joint positions.
- Returns:
Joint positions (nj,).
- Return type:
np.ndarray
- property qdot: ndarray
Get the current joint velocities.
- Returns:
Joint velocities (nj,).
- Return type:
np.ndarray
- property trq: ndarray
Get the current joint torques.
- Returns:
Joint torques (nj,).
- Return type:
np.ndarray
- property x: ndarray
Get the current platform pose.
- Returns:
Platform pose (7,).
- Return type:
np.ndarray
- property p: ndarray
Get the current planar platform position.
- Returns:
Platform position (2,).
- Return type:
np.ndarray
- property Q: ndarray
Get the current platform orientation as a quaternion.
- Returns:
Platform quaternion (4,).
- Return type:
np.ndarray
- property R: ndarray
Get the current platform orientation as a rotation matrix.
- Returns:
Platform rotation matrix (3, 3).
- Return type:
np.ndarray
- property T: ndarray
Get the current platform pose as a homogeneous transformation matrix.
- Returns:
Platform transformation matrix (4, 4).
- Return type:
np.ndarray
- property theta: float
Get the current platform yaw angle.
- Returns:
The rotation about the world z-axis extracted from the platform orientation.
- Return type:
float
- property v: ndarray
Get the current platform spatial velocity.
- Returns:
Platform velocity (6,).
- Return type:
np.ndarray
- property pdot: ndarray
Get the current planar platform linear velocity.
- Returns:
Platform linear velocity (2,).
- Return type:
np.ndarray
- property w: ndarray
Get the current platform angular velocity.
- Returns:
Platform angular velocity (3,).
- Return type:
np.ndarray
- property FT: ndarray
Get the current force/torque sensor data.
- Returns:
Force/Torque sensor data (6,).
- Return type:
np.ndarray
- property F: ndarray
Get the current force sensor data.
- Returns:
Force sensor data (3,) or (…, 3).
- Return type:
np.ndarray
- property Trq: ndarray
Get the current torque sensor data.
- Returns:
Torque sensor data (3,) or (…, 3).
- Return type:
np.ndarray
- property q_ref: ndarray
Get the commanded platform configuration.
- Returns:
Desired joint positions (nj,).
- Return type:
np.ndarray
- property qdot_ref: ndarray
Get the commanded platform configuration velocities.
- Returns:
Desired joint velocities (nj,).
- Return type:
np.ndarray
- property x_ref: ndarray
Get the commanded platform pose.
- Returns:
Desired platform pose (7,).
- Return type:
np.ndarray
- property p_ref: ndarray
Get the commanded planar platform position.
- Returns:
Desired platform position (2,).
- Return type:
np.ndarray
- property Q_ref: ndarray
Get the commanded platform orientation as a quaternion.
- Returns:
Desired platform quaternion (4,).
- Return type:
np.ndarray
- property R_ref: ndarray
Get the commanded platform orientation as a rotation matrix.
- Returns:
Desired platform rotation matrix (3, 3).
- Return type:
np.ndarray
- property T_ref: ndarray
Get the commanded platform pose as a homogeneous transformation matrix.
- Returns:
Desired platform transformation matrix (4, 4).
- Return type:
np.ndarray
- property theta_ref: float
Get the commanded platform yaw angle.
- Returns:
The rotation about the world z-axis extracted from the commanded orientation.
- Return type:
float
- property v_ref: ndarray
Get the commanded platform spatial velocity.
- Returns:
Commanded platform velocity (6,).
- Return type:
np.ndarray
- property pdot_ref: ndarray
Get the commanded planar platform linear velocity.
- Returns:
Commanded platform linear velocity (2,).
- Return type:
np.ndarray
- property w_ref: ndarray
Get the commanded platform angular velocity.
- Returns:
Desired platform angular velocity (3,) or (…, 3).
- Return type:
np.ndarray
- property FT_ref: ndarray
Get the desired force/torque sensor data.
- Returns:
Desired force/torque sensor data (6,).
- Return type:
np.ndarray
- property F_ref: ndarray
Get the desired force sensor data.
- Returns:
Desired force sensor data (3,).
- Return type:
np.ndarray
- property Trq_ref: ndarray
Get the desired torque sensor data.
- Returns:
Desired torque sensor data (3,).
- Return type:
np.ndarray
- property q_err: ndarray
Get the error in joint positions.
- Returns:
Error in joint positions (nj,).
- Return type:
np.ndarray
- property qdot_err: ndarray
Get the error in joint velocities.
- Returns:
Error in joint velocities (nj,).
- Return type:
np.ndarray
- property x_err: ndarray
Get the platform pose error.
- Returns:
Platform pose error (6,).
- Return type:
np.ndarray
- property p_err: ndarray
Get the platform position error.
- Returns:
Platform position error (2,).
- Return type:
np.ndarray
- property Q_err: ndarray
Get the platform quaternion error.
- Returns:
Platform quaternion error (3,).
- Return type:
np.ndarray
- property R_err: ndarray
Get the platform rotation matrix error.
- Returns:
Platform rotation matrix error (3, 3).
- Return type:
np.ndarray
- property T_err: ndarray
Get the platform transformation matrix error.
- Returns:
Platform transformation matrix error (6, ).
- Return type:
np.ndarray
- property theta_err: float
Property to calculate the difference between the reference orientation and the current orientation along z-axis.
- Returns:
The difference along z-axis between the reference and current orientation.
- Return type:
float
- property v_err: ndarray
Get the platform velocity error.
- Returns:
Platform velocity error (6,).
- Return type:
np.ndarray
- property pdot_err: ndarray
Get the platform linear velocity error.
- Returns:
Platform linear velocity error (2,).
- Return type:
np.ndarray
- property w_err: ndarray
Get the platform angular velocity error.
- Returns:
Platform angular velocity error (3,).
- Return type:
np.ndarray
- InitObject() None[source]
Initialize the platform command and actual state with zeros.
This method sets the initial values for joint positions, joint velocities, joint torques, platform pose, velocities, force/torque sensor data, control inputs, and other state variables.
- Returns:
This method modifies the internal state of the platform object.
- Return type:
None
- Init() None[source]
Initialize the platform state, current target, timing, and log message.
This method calls the following functions to initialize the platform: 1. InitObject() - Initializes the command and actual states with default values. 2. GetState() - Retrieves the current state of the platform. 3. ResetCurrentTarget() - Resets the current target position. 4. ResetTime() - Resets the platform internal time.
- Returns:
This method modifies the platform internal state and logs a message.
- Return type:
None
- GetState() None[source]
Update the platform state.
It has to be reimplemented in a concrete platform class.
It has to set: - Actual platform joint and task-space states - Platform sensor readings
This method sets the following attributes: - _tt: The current time, can be retrieved using simtime(). - _last_update: The last update time, retrieved using simtime().
- Returns:
This method modifies the internal state of the platform.
- Return type:
None
- Update() None[source]
Updates the platform’s state and optionally triggers a capture callback.
This method performs the following actions:
If
_do_updateisTrue, it callsGetState()to update the platform’s internal state.If
_do_captureisTrueand a capture callback function (_capture_callback) is defined, it calls the callback function, passing the platform object as an argument.
- Returns:
This method does not return any value. It modifies the internal state of the platform and may trigger a callback.
- Return type:
None
- EnableUpdate() None[source]
Enables the update of the platform’s internal state.
This method sets the _do_update attribute to True, which allows the platform’s state to be updated.
- Returns:
This method does not return any value. It modifies the internal state of the platform.
- Return type:
None
- DisableUpdate() None[source]
Disables the update of the platform’s internal state.
This method sets the _do_update attribute to False, which prevents the platform’s state from being updated.
- Returns:
This method does not return any value. It modifies the internal state of the platform.
- Return type:
None
- GetUpdateStatus() bool[source]
Returns the current status of the update flag.
This method returns the value of the _do_update attribute, which indicates whether the platform’s state update is enabled.
- Returns:
True if updates are enabled, False otherwise.
- Return type:
bool
- ResetCurrentTarget() None[source]
Resets the current target to the actual values of joint positions, velocities, torques, and other state variables.
- Return type:
None
- GetJointPos(state: str | None = None, refresh: bool | None = None) ndarray[source]
Get the joint positions of the robot based on the specified state.
- Parameters:
state (str, optional) – The state from which to retrieve joint positions. Can be ‘Actual’ or ‘Commanded’. If
None, the default state defined in the platform class is used.refresh (bool, optional) – If
True, update the platform state before retrieving joint positions.
- Returns:
The joint positions (q) from the specified state, copied to prevent external modifications.
- Return type:
np.ndarray
- Raises:
ValueError – If the state is not “Actual” or “Commanded”.
- GetJointVel(state: str | None = None, refresh: bool | None = None) ndarray[source]
Get the joint velocities of the robot based on the specified state.
- Parameters:
state (str, optional) – The state from which to retrieve joint velocities. Can be ‘Actual’ or ‘Commanded’. If
None, the default state defined in the platform class is used.refresh (bool, optional) – If
True, update the platform state before retrieving joint velocities.
- Returns:
The joint velocities (qdot) from the specified state, copied to prevent external modifications.
- Return type:
np.ndarray
- Raises:
ValueError – If the state is not “Actual” or “Commanded”.
- GetJointTrq(state: str | None = None, refresh: bool | None = None) ndarray[source]
Get the joint torques of the robot based on the specified state.
- Parameters:
state (str, optional) – The state from which to retrieve joint torques. Can be ‘Actual’ or ‘Commanded’. If
None, the default state defined in the platform class is used.refresh (bool, optional) – If
True, update the platform state before retrieving joint torques.
- Returns:
The joint torques (trq) from the specified state, copied to prevent external modifications.
- Return type:
np.ndarray
- Raises:
ValueError – If the state is not “Actual” or “Commanded”.
- GetPose(out: str | None = None, task_space: str | None = None, state: str | None = None, refresh: bool | None = None) ndarray[source]
Get platform pose
- Parameters:
out (str, optional) – Output form, by default “x” (“Pose”)
task_space (str, optional) – Task space frame, by default “World”
state (str, optional) – Variable state, by default “Actual”
refresh (bool, optional) – If
True, update the platform state before retrieving the pose.
- Returns:
Platform pose
- Return type:
array of floats
- GetPos(out: str | None = None, task_space: str | None = None, state: str | None = None) ndarray[source]
Get platform position
- Parameters:
out (str, optional) – Output form, by default “p” (“Position”)
task_space (str, optional) – Task space frame, by default “World”
state (str, optional) – Variable state, by default “Actual”
- Returns:
platform position (3,)
- Return type:
array of floats
- GetOri(out: str | None = None, task_space: str | None = None, state: str | None = None) ndarray[source]
Get platform orientation
- Parameters:
out (str, optional) – Output form, by default “Q” (“Quaternion”)
task_space (str, optional) – Task space frame, by default “World”
state (str, optional) – Variable state, by default “Actual”
- Returns:
platform orientation (4,) or (3,3)
- Return type:
array of floats
- GetVel(out: str | None = None, task_space: str | None = None, state: str | None = None, refresh: bool | None = None) ndarray[source]
Get platform velocity
- Parameters:
out (str, optional) – Output form, by default “Twist”
task_space (str, optional) – Task space frame, by default “World”
state (str, optional) – Variable state, by default “Actual”
refresh (bool, optional) – If
True, update the platform state before retrieving the velocity.
- Returns:
Platform velocity (6,) or (3,)
- Return type:
array of floats
- GetFT(out: str | None = None, task_space: str | None = None, state: str | None = None, avg_time: float = 0, refresh: bool | None = None) ndarray[source]
Get the platform force/torque data.
- Parameters:
out (str, optional) – Output form for the wrench. Supported values are
"Wrench","Force","Torque", and"2d".task_space (str, optional) – Task space frame to use. Supported values are
"World","Object", and"Platform".state (str, optional) – Platform state to use. Supported values are
"Actual"and"Commanded".avg_time (float, optional) – Averaging time in seconds. This base implementation accepts the argument for API compatibility but does not apply averaging.
refresh (bool, optional) – If
True, update the platform state before retrieving the data.
- Returns:
Force/torque data in the requested output form.
- Return type:
WrenchType
- Raises:
ValueError – If
state,task_space, oroutis not supported.
- Set_vel(v: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...], wait: float | None = None) int[source]
Command a planar platform velocity for one control interval.
- Parameters:
v (ArrayLike) – Planar velocity command
[linear_velocity, angular_velocity].wait (float, optional) – Time in seconds to hold the command. If
None,tsampis used.
- Returns:
Motion result code. The base implementation returns
MotionResultCodes.MOTION_SUCCESS.value.- Return type:
int
- CMoveToOri(rtheta: float, task_space: str | None = None, wait: float | None = None, vel_fac: float | None = None, ori_err: float | None = None, k_rot: float | None = None, asynchronous: bool = False) Thread | int[source]
Move the platform to a target planar orientation.
- Parameters:
rtheta (float) – Target yaw angle in radians.
task_space (str, optional) – Frame in which
rthetais expressed. Supported values are"World","Object", and"Platform". IfNone, the default task space is used.wait (float, optional) – Maximum motion duration in seconds. If
None, the default wait value is used and may be expanded based on the target distance.vel_fac (float, optional) – Velocity scaling factor. If
None, the default value is used.ori_err (float, optional) – Orientation tolerance in radians. If
None, the default value is used.k_rot (float, optional) – Proportional orientation-control gain. If
None, the default value is used.asynchronous (bool, optional) – If
True, execute the motion in a daemon thread and return that thread.
- Returns:
The worker thread for asynchronous execution, otherwise a motion result code.
- Return type:
Thread or int
- CMoveToLocation(rp: ndarray, rtheta: float | None = None, task_space: str | None = None, robot_as_a_sensor: bool = False, min_dist: float | None = None, approach_dist: float | None = None, final_orientation_correction: bool = True, wait: float | None = None, vel_fac: float | None = None, pos_err: float | None = None, ori_err: float | None = None, k_dist: float | None = None, k_dir: float | None = None, asynchronous: bool = False, allow_backward: bool = False, reach_check_fn: Callable[[...], bool] | None = None, **kwargs: Any) Thread | int[source]
Move the platform to a planar target location.
- Parameters:
rp (Vector2DType) – Target planar position
[x, y]. A three-element vector is also accepted, in which case the third element is used asrthetawhenrthetaisNone.rtheta (float, optional) – Target yaw angle in radians.
task_space (str, optional) – Frame in which
rpandrthetaare expressed. Supported values are"World","Object", and"Platform".robot_as_a_sensor (bool, optional) – If
True, use the attached robot pose to estimate the platform approach state.min_dist (float, optional) – Distance threshold at which the approach path shaping starts.
approach_dist (float, optional) – Distance used to shape the final approach direction.
final_orientation_correction (bool, optional) – If
Trueandrthetais provided, run a final orientation correction after reaching the position.wait (float, optional) – Maximum motion duration in seconds.
vel_fac (float, optional) – Velocity scaling factor.
pos_err (float, optional) – Position tolerance in meters.
ori_err (float, optional) – Orientation tolerance in radians.
k_dist (float, optional) – Proportional distance-control gain.
k_dir (float, optional) – Proportional heading-control gain.
asynchronous (bool, optional) – If
True, execute the motion in a daemon thread and return that thread.allow_backward (bool, optional) – If
True, allow the controller to drive backward when the goal is behind the platform.reach_check_fn (Callable, optional) – Callback used to stop the motion early. The callback receives the attached robot and
**kwargs.**kwargs (Any) – Additional arguments passed to
reach_check_fn.
- Returns:
The worker thread for asynchronous execution, otherwise a motion result code.
- Return type:
Thread or int
- PForward(d: float, t: float = 1, traj: str | None = None, asynchronous: bool = False) Thread | int | None[source]
Move the platform forward by a relative distance.
- Parameters:
d (float) – Relative forward distance in meters.
t (float, optional) – Nominal motion duration in seconds.
traj (str, optional) – Trajectory profile name. If
None, the default trajectory profile is used.asynchronous (bool, optional) – If
True, execute the motion in a daemon thread and return that thread.
- Returns:
The worker thread for asynchronous execution, otherwise a motion result code.
Nonemay be returned if the move is infeasible in the base implementation.- Return type:
Thread or int or None
- PTurn(ang: float, t: float = 1, traj: str | None = None, asynchronous: bool = False) Thread | int | None[source]
Rotate the platform by a relative planar angle.
- Parameters:
ang (float) – Relative rotation angle in radians.
t (float, optional) – Nominal motion duration in seconds.
traj (str, optional) – Trajectory profile name. If
None, the default trajectory profile is used.asynchronous (bool, optional) – If
True, execute the motion in a daemon thread and return that thread.
- Returns:
The worker thread for asynchronous execution, otherwise a motion result code.
Nonemay be returned if the turn is infeasible in the base implementation.- Return type:
Thread or int or None
- AutonomousMotion(callback: Callable[[...], int] | None = None, asynchronous: bool = True, **kwargs: Any) Thread | int | None[source]
Execute an autonomous platform motion callback.
- Parameters:
callback (Callable, optional) – Function that performs the autonomous motion and returns a motion result code.
asynchronous (bool, optional) – If
True, execute the callback in a daemon thread and return that thread.**kwargs (Any) – Additional keyword arguments passed to
callback.
- Returns:
The worker thread for asynchronous execution, the callback result code for blocking execution, or
Noneif the callback cannot be started.- Return type:
Thread or int or None
- AbortAutonomousMotion() None[source]
Request termination of the active autonomous motion.
- Return type:
None
- PlatformToWorld(x: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...], typ: str | None = None) ndarray[source]
Map from platform base frame to world frame
Supported arguments: pose (7,), homogeneous matrix (4, 4), rotation matrix (3, 3), position (3,), twist (6,) and JacobianType (6, nj)
- Parameters:
x (ArrayLike) – Value to map: - pose (7,) or (4, 4) - position (3, ) - orientation (4,) or (3, 3) - velocity or force (6, ) - JacobianType (6, nj) - 2D position (2,) - rotation (1,)
typ (str, optional) – Transformation type (None or
Wrench)
- Returns:
Mapped value.
- Return type:
array of floats
- Raises:
ValueError – Parameter shape not supported
Notes
2D position and scalar rotation can be used only if z-axis of both frames are colinear
- WorldToPlatform(x: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...], typ: str | None = None) ndarray[source]
Map from world frame to platform base frame
Supported arguments: pose (7,), homogeneous matrix (4, 4), rotation matrix (3, 3), position (3,), twist (6,) and JacobianType (6, nj)
- Parameters:
x (ArrayLike) – Value to map: - pose (7,) or (4, 4) - position (3, ) - orientation (4,) or (3, 3) - velocity or force (6, ) - JacobianType (6, nj) - 2D position (2,) - rotation (1,)
typ (str, optional) – Transformation type (None or
Wrench)
- Returns:
Mapped value.
- Return type:
array of floats
- Raises:
ValueError – Parameter shape not supported
Notes
2D position and scalar rotation can be used only if z-axis of both frames are colinear
- ObjectToWorld(x: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...], typ: str | None = None) ndarray[source]
Map from object frame to world frame
Supported arguments: pose (7,), homogeneous matrix (4, 4), rotation matrix (3, 3), position (3,), twist (6,) and JacobianType (6, nj)
- Parameters:
x (ArrayLike) – Value to map: - pose (7,) or (4, 4) - position (3, ) - orientation (4,) or (3, 3) - velocity or force (6, ) - JacobianType (6, nj) - 2D position (2,) - rotation (1,)
typ (str, optional) – Transformation type (None or
Wrench)
- Returns:
Mapped value.
- Return type:
array of floats
- Raises:
ValueError – Parameter shape not supported
Notes
2D position and scalar rotation can be used only if z-axis of both frames are colinear
- WorldToObject(x: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...], typ: str | None = None) ndarray[source]
Map from world frame to object frame
Supported arguments: pose (7,), homogeneous matrix (4, 4), rotation matrix (3, 3), position (3,), twist (6,) and JacobianType (6, nj)
- Parameters:
x (ArrayLike) – Value to map: - pose (7,) or (4, 4) - position (3, ) - orientation (4,) or (3, 3) - velocity or force (6, ) - JacobianType (6, nj) - 2D position (2,) - rotation (1,)
typ (str, optional) – Transformation type (None or
Wrench)
- Returns:
Mapped value.
- Return type:
array of floats
- Raises:
ValueError – Parameter shape not supported
Notes
2D position and scalar rotation can be used only if z-axis of both frames are colinear
- Kinmodel(q: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...] | None = None, out: str = 'x') Tuple[ndarray, ndarray][source]
Compute the base platform kinematic model.
- Parameters:
q (ArrayLike, optional) – Platform pose or configuration used for the kinematic model. If
None, the current platform pose is used.out (str, optional) – Pose output format passed to
map_pose().
- Returns:
Platform pose in the requested output format and the corresponding Jacobian matrix.
- Return type:
tuple of np.ndarray and JacobianType
- Jacobi() ndarray[source]
Get the platform Jacobian at the current pose.
- Returns:
Platform Jacobian matrix.
- Return type:
JacobianType
- SetObject(x: ndarray | None = None) None[source]
Set the object pose in the platform coordinate system.
- Parameters:
x (Union[Pose3DType, HomogeneousMatrixType], optional) – The object pose as a pose vector
(7,)or homogeneous matrix(4, 4). IfNone, the current actual platform pose is used.- Return type:
None
- Raises:
ValueError – If the pose shape is not supported or if the input pose z-axis is not aligned with
[0, 0, 1].
- GetObject(out: str = 'T', task_space: str | None = None) ndarray[source]
Get the object pose in the specified task space.
- Parameters:
out (str, optional) – The output format of the object pose. Default is
"T".task_space (str, optional) – The task space for the pose transformation. Supported values are
"World","Object", and"Platform".
- Returns:
The object pose in the requested output format.
- Return type:
Pose3DType or HomogeneousMatrixType or Vector3DType or QuaternionType or RotationMatrixType
- Raises:
ValueError – If the task space is not supported.
- AttachTo(robot: robot) None[source]
Attach a robot instance to the platform.
- Parameters:
robot (robot) – Robot instance to associate with this platform.
- Return type:
None
- GetAttachedRobot() robot | None[source]
Get the robot attached to platform.
- Returns:
The attached robot instance, or
None.- Return type:
Optional[robot]
- SetRobotBase(x: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...]) None[source]
Set the robot base pose relative to the platform.
- Parameters:
x (ArrayLike) – The robot base pose as a homogeneous matrix, pose vector, position, rotation matrix, or quaternion.
- Return type:
None
- Raises:
ValueError – If the base pose shape is not supported.
- GetRobotBase(out: str = 'T') ndarray[source]
Get the robot base pose relative to the platform.
- Parameters:
out (str, optional) – The output format of the base pose. Default is
"T".- Returns:
The robot base pose in the requested output format.
- Return type:
Pose3DType or HomogeneousMatrixType or Vector3DType or QuaternionType or RotationMatrixType
- GetRobotBasePose(out: str | None = None) ndarray[source]
Get the attached robot base pose in the world frame.
- Parameters:
out (str, optional) – The output format of the base pose. If
None, the default task pose format is used.- Returns:
The robot base pose in the world frame.
- Return type:
Pose3DType or HomogeneousMatrixType or Vector3DType or QuaternionType or RotationMatrixType
- Start() bool[source]
Start platform motion execution.
- Returns:
Trueif the platform is ready and motion execution was started, otherwiseFalse.- Return type:
bool
- Abort(abort: bool = True) None[source]
Abort or release the current platform motion.
- Parameters:
abort (bool, optional) – If
True, request motion abort and switch the command mode toCommandModeCodes.ABORT.value. IfFalse, clear the abort flag.- Return type:
None
- WaitUntilStopped(eps: float = 0.001) None[source]
Block until the platform joint velocity norm is below a threshold.
- Parameters:
eps (float, optional) – Velocity norm threshold used to decide that the platform has stopped.
- Return type:
None
- Wait(wait: float, dt: float | None = None) int | None[source]
Hold the current command mode for a fixed duration.
- Parameters:
wait (float) – Duration in seconds.
dt (float, optional) – Polling interval in seconds. If
None,tsampis used.
- Returns:
MotionResultCodes.ACTIVE_THREADS.valueif another threaded motion is active, otherwiseNone.- Return type:
int or None
- SetMotionCheckCallback(fun: Callable[[...], int]) None[source]
Set the motion-check callback.
- Parameters:
fun (Callable) – Callback invoked during supported motion loops. It should return a motion result code.
- Return type:
None
- EnableMotionCheck(check: bool = True) None[source]
Enable or disable motion-check callbacks.
- Parameters:
check (bool, optional) – If
True, enable motion checks. IfFalse, disable them.- Return type:
None
- SetCaptureCallback(fun: Callable[[...], None]) None[source]
Set the callback used during capture updates.
- Parameters:
fun (Callable) – Callback invoked with this platform instance during capture updates.
- Return type:
None
- robotblockset.platforms.isplatform(obj: object) bool[source]
Check whether an object is a platform instance.
- Parameters:
obj (object) – Object to test.
- Returns:
Trueif obj is an instance ofplatform, otherwiseFalse.- Return type:
bool
Functions
|
Check whether an object is a platform instance. |
Classes
|
Represents a mobile platform base class with state handling, frame transforms, and motion-control utilities. |