Moveit2Python
The Moveit2Python class provides the core MoveIt2 interface for motion planning and execution. This is the low-level API that interfaces directly with MoveIt2 services and actions.
- class moveit2_sdk_python.moveit2_sdk_python.Moveit2Python(base_frame, ee_frame, group_name)[source]
Bases:
object
Initialize the Moveit2Python class.
- Parameters:
base_frame (str) – The name of the base frame of the robot.
ee_frame (str) – The name of the end-effector frame of the robot.
group_name (str) – The name of the move group to control.
- __init__(base_frame, ee_frame, group_name)[source]
Initialize the Moveit2Python class.
- Parameters:
base_frame (str) – The name of the base frame of the robot.
ee_frame (str) – The name of the end-effector frame of the robot.
group_name (str) – The name of the move group to control.
- __del__()[source]
Clean up resources when the Moveit2Python object is deleted.
This method shuts down the ROS 2 node, joins the node spinning thread, destroys the node, and attempts to shut down RCLPY.
- spin_node()[source]
Spin the ROS 2 node to process callbacks.
This method checks if RCLPY is initialized, initializes it if not, and then spins the node using the configured executor. This method is typically run in a separate thread.
- sub_joint_state_callback(msg: <MagicMock id='140299215925744'>)[source]
Callback function for the joint state subscriber.
Updates the internal robot_state with the received joint state message.
- Parameters:
msg (JointState) – The received JointState message.
- async move_group(names, positions)[source]
Move the robot to a specified joint configuration.
- Parameters:
names (list[str]) – A list of joint names.
positions (list[float]) – A list of corresponding joint positions.
- Returns:
The result of the MoveGroup action.
- Return type:
any
- async get_cartesian_path(waypoints: list[<MagicMock id='140299213116208'>])[source]
Compute a Cartesian path through a list of waypoints.
- Parameters:
waypoints (list[Pose]) – A list of Pose messages representing the waypoints.
- Returns:
The computed robot trajectory (solution) or None if planning failed.
- Return type:
RobotTrajectory or None