{"library":"placo","title":"PlaCo: Rhoban Planning and Control Library","description":"PlaCo (Planning and Control) is a Python library developed by Rhoban for motion planning and control, particularly in robotics applications. It provides tools for inverse kinematics, contact planning, and motion generation, building upon `pinocchio` and `eigenpy`. The library is currently at version 0.9.20 and has an active but somewhat irregular release cadence, often with minor updates.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install placo"],"cli":null},"imports":["import placo\nrobot = placo.RobotWrapper(...)","import placo\nsolver = placo.KinematicsSolver(...)","import placo\ntask = placo.PositionTask(...)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import placo\nimport numpy as np\n\n# Create a robot wrapper from an online URDF (e.g., UR5 robot)\n# This avoids local file dependencies for a quick test.\n# Ensure internet connectivity for the URDF download.\nrobot = placo.RobotWrapper(\n    \"https://raw.githubusercontent.com/ros-industrial/universal_robot/kinetic-devel/ur_description/urdf/ur5_robot.urdf\",\n    placo.Flags.FLOATING_BASE # Set to true if the robot base is free-floating (e.g., a humanoid)\n)\n\n# Set an initial configuration for the robot's joints\nrobot.set_joint_positions({\n    \"shoulder_pan_joint\": 0.0,\n    \"shoulder_lift_joint\": -np.pi / 2,\n    \"elbow_joint\": np.pi / 2,\n    \"wrist_1_joint\": -np.pi / 2,\n    \"wrist_2_joint\": -np.pi / 2,\n    \"wrist_3_joint\": 0.0\n})\nrobot.update_kinematics() # Update the robot's internal kinematics based on current joint positions\n\n# Get the current transform (position and orientation) of the 'tool0' end-effector\nT_tool0_world = robot.get_transform(\"tool0\")\ncurrent_position = T_tool0_world.translation\ncurrent_orientation = T_tool0_world.rotation # as a 3x3 rotation matrix\n\n# Define a target for the end-effector: move it slightly forward and up\ntarget_position = current_position + np.array([0.1, 0.0, 0.05]) # Move 10cm in X, 5cm in Z\ntarget_orientation = current_orientation # Keep the current orientation\n\n# Create a kinematics solver instance\nsolver = placo.KinematicsSolver(robot)\n\n# Add tasks to the solver\n# PositionTask: Make the 'tool0' frame reach the target_position\nposition_task = placo.PositionTask(robot.frame_id(\"tool0\"), target_position)\nposition_task.set_weight(1.0) # Set task weight (importance)\nsolver.add_task(position_task)\n\n# OrientationTask: Make the 'tool0' frame match the target_orientation\norientation_task = placo.OrientationTask(robot.frame_id(\"tool0\"), target_orientation)\norientation_task.set_weight(0.5) # Orientation is less critical than position\nsolver.add_task(orientation_task)\n\n# Solve the inverse kinematics problem\nsolver.solve(verbose=False) # Set verbose=True for detailed solver output\nrobot.update_kinematics() # Apply the newly calculated joint positions to the robot model\n\n# Print the results\nnew_T_tool0_world = robot.get_transform(\"tool0\")\nprint(f\"Initial tool0 position: {current_position.round(3)}\")\nprint(f\"Target tool0 position:  {target_position.round(3)}\")\nprint(f\"Final tool0 position:   {new_T_tool0_world.translation.round(3)}\")","lang":"python","description":"This quickstart demonstrates how to instantiate a robot from an online URDF, set an initial configuration, define an inverse kinematics problem with position and orientation tasks for an end-effector, and solve it using PlaCo's `KinematicsSolver`. It then prints the initial, target, and final positions of the end-effector.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}