coraplex.testing#

Attributes#

Classes#

StandaloneProcess

A component launched as its own process and stopped again when the test is done.

Functions#

selected_visualizations(ros_node) → list[cramph.executor.ExecutorExtension]

attach_tool(world, arm, tool_world, mount) → semantic_digital_twin.world_description.world_entity.Body

Rigidly attach a tool mesh to the arm's tool frame.

setup_world() → semantic_digital_twin.world.World

_make_sine_scan_poses(anchor[, lanes, lane_spacing, ...]) → list[krrood_spatial_math.spatial_types.Pose]

Generates a set of 3D poses following a sine wave pattern for scanning purposes.

Module Contents#

coraplex.testing.logger#
coraplex.testing.rclpy = None#
coraplex.testing.selected_visualizations(ros_node: rclpy.node.Node | None) → list[cramph.executor.ExecutorExtension]#
Parameters:

ros_node – The ROS node RViz publishes through.

Returns:

An RViz visualization when ROS is available and ros_node is given, as executor extensions; empty when headless.

Note

Add the same visualizations to every executor of one demo. Each call returns a new one.

coraplex.testing.attach_tool(world: semantic_digital_twin.world.World, arm: semantic_digital_twin.robots.robot_parts.Arm, tool_world: semantic_digital_twin.world.World, mount: dict) → semantic_digital_twin.world_description.world_entity.Body#

Rigidly attach a tool mesh to the arm’s tool frame.

Parameters:
  • world – The world the robot lives in.

  • arm – The arm the tool is mounted on.

  • tool_world – The world containing the parsed tool mesh.

  • mount – Keyword arguments describing the mount transform.

Returns:

The tool’s root body inside world.

coraplex.testing.setup_world() → semantic_digital_twin.world.World#
coraplex.testing._make_sine_scan_poses(anchor: krrood_spatial_math.spatial_types.Pose, lanes: int = 6, lane_spacing: float = 0.03, y_span: float = 0.18, amplitude: float = 0.005, wiggles: float = 1.0, points_per_lane: int = 16, lane_axis: str = 'z') → list[krrood_spatial_math.spatial_types.Pose]#

Generates a set of 3D poses following a sine wave pattern for scanning purposes.

This function creates a series of 3D positions and orientations based on a sine wave pattern. The generated poses are arranged into multiple parallel lanes, with configurable parameters such as lane spacing, sine wave amplitude, number of waves (wiggles), and number of points per lane. The lanes can be aligned along either the x-axis or z-axis, and the scanning pattern is centered around the anchor pose provided.

Parameters:
  • anchor – The starting pose that defines the reference frame, initial position, and orientation for the generated poses.

  • lanes – The number of parallel lanes to generate in the scanning pattern. Default is 6.

  • lane_spacing – The spacing between adjacent lanes. Default is 0.03.

  • y_span – The range of y-coordinates over which the sine wave pattern is distributed in each lane. Default is 0.18.

  • amplitude – The amplitude of the sine wave defining the deviation from the lane center. Default is 0.005.

  • wiggles – The number of complete sine wave oscillations in each lane. Default is 1.0.

  • points_per_lane – The number of discrete poses generated per lane. Default is 16.

  • lane_axis – The axis along which the lanes are arranged. Accepted values are “x” or “z”. Default is “z”.

Returns:

A list of PoseStamped objects, where each object defines a 3D pose in the generated scanning pattern.

coraplex.testing.READY_TIMEOUT = 180.0#
coraplex.testing.SHUTDOWN_TIMEOUT = 60.0#
class coraplex.testing.StandaloneProcess#

A component launched as its own process and stopped again when the test is done.

launcher_path: pathlib.Path#

Script to run.

is_ready: Callable[[], bool]#

Whether the launched component is up yet.

Supplied by the caller because only it knows what the component announces and which node to look from.

arguments: list[str] = []#

Command-line arguments passed to the script.

ready_timeout: float = 180.0#

How long to wait for is_ready to hold.

shutdown_timeout: float = 60.0#

How long to let the process shut down after SIGINT before killing it.

process: subprocess.Popen | None = None#

The launched process, once started.

start() → None#

Launch the process and block until it is ready.

wait_until_ready() → None#

Block until the launched component announces itself.

Raises:

TimeoutError – If it does not within ready_timeout.

stop() → None#

Interrupt the process, killing it if it outstays its shutdown budget.

__enter__() → StandaloneProcess#
__exit__(exception_type, exception, traceback) → None#