coraplex.testing#

Attributes#

Classes#

StandaloneProcess

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

Functions#

start_visualization(→ None)

Publish the world to RViz.

attach_tool(...)

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

setup_world(→ semantic_digital_twin.world.World)

_make_sine_scan_poses(...)

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.start_visualization(world: semantic_digital_twin.world.World) None#

Publish the world to RViz.

Does nothing if ROS is not available.

coraplex.testing.attach_tool(world: semantic_digital_twin.world.World, robot: semantic_digital_twin.robots.robot_parts.AbstractRobot, arm: coraplex.datastructures.enums.Arms, 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.

  • robot – The robot holding the tool.

  • 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: semantic_digital_twin.spatial_types.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[semantic_digital_twin.spatial_types.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#