mbodied.hardware package

Submodules

mbodied.hardware.interface module

class mbodied.hardware.interface.HardwareInterface(**kwargs)[source]

Bases: ABC

Abstract base class for hardware interfaces.

This class provides a template for creating hardware interfaces that can control robots or other hardware devices.

capture(*args, **kwargs) None[source]

Captures continuous data from the hardware.

Parameters:
  • args – Arguments to pass to the hardware interface.

  • kwargs – Additional arguments to pass to the hardware interface.

abstract do(*args, **kwargs) None[source]

Executes motion.

Parameters:
  • args – Arguments to pass to the hardware interface.

  • kwargs – Additional arguments to pass to the hardware interface.

fetch(*args, **kwargs) None[source]

Fetches data from the hardware.

Parameters:
  • args – Arguments to pass to the hardware interface.

  • kwargs – Additional arguments to pass to the hardware interface.

mbodied.hardware.sim_interface module

class mbodied.hardware.sim_interface.SimInterface[source]

Bases: HardwareInterface

A simulated interface for testing and validating purposes.

This class simulates the interface between the robot arm and the control system.

home_pos

The home position of the robot arm.

current_pos

The current position of the robot arm.

capture(**_) Image[source]

Captures an image.

do(motion: HandControl) list[float][source]

Executes a given HandControl motion and returns the new position of the robot arm.

Parameters:

motion – The HandControl motion to be executed.

get_pose() list[float][source]

Gets the current pose of the robot arm.

Returns:

A list of the current pose values [x, y, z, r, p, y, grasp].

Return type:

list[float]

mbodied.hardware.xarm_interface module

class mbodied.hardware.xarm_interface.XarmInterface(ip: str = '192.168.1.228', record=False)[source]

Bases: RecordingHardwareInterface

Control the xArm robot arm with SDK.

Usage:

xarm = XarmInterface() xarm.do(HandControl(…))

ip

The IP address of the xArm robot.

arm

The XArmAPI instance for controlling the robot.

home_pos

The home position of the robot arm.

capture() Image[source]

Captures an image from the robot camera. Placeholder for real camera input.

do(motion: HandControl) None[source]

Executes a given HandControl motion.

HandControl is in meters and radians, so we convert it to mm and degrees here.

Parameters:

motion – The HandControl motion to be executed.

get_pose() HandControl[source]

Gets the current pose (absolute HandControl) of the robot arm.

Returns:

A list of the current pose values [x, y, z, r, p, y].

set_pose(motion: HandControl) None[source]

Sets the robot arm to a given absolute HandControl pose.

Module contents