libhsrmoveit
Library for MoveIt of HSR.
- class libhsrmoveit.LibHSRMoveit(libtf, libhsrutil, libhsrpub)
Bases:
objectHSR MoveIt library for WRS simlator.
- add_box(name, frame, pose, size)
Add a box to the planning scene.
- Parameters
name (str) – The name of box.
frame (str) – The name of frame.
pose (geometry_msgs/Point, geometry_msgs/Pose) – Coordinates to add a box.
size (list[float]) – The size of box. The size is given as a (x, y, z).
Examples
add_box(“box_0”, “world”, Point(0.0, 0.1, 0.2), (0.1, 0.1, 0.1))
- add_cylinder(name, frame, pose, height, radius)
Add a cylinder to the planning scene.
- Parameters
name (str) – The name of box.
frame (str) – The name of frame.
pose (geometry_msgs/Point, geometry_msgs/Pose) – Coordinates to add a cylinder.
height (float) – The height of cylinder.
radius (float) – The radius of cylinder.
Examples
add_cylinder(“cylinder_0”, “world”, Point(0.0, 0.1, 0.2), (0.1, 0.1, 0.1))
- add_model_from_sdf(frame, point, euler, sdf)
Add a model from sdf to the planning scene.
- Parameters
frame (str) – The name of frame.
point (geometry_msgs/Point) – Coordinates to add a model.
euler (geometry_msgs/Point) – Euler angles of the model to be added.
sdf (str) – SDF file path.
Examples
add_model_from_sdf(“world”, Point(0.0, 0.1, 0.2), Point(0.0, 0.0, 1.57))
- all_close(goal, actual, pos_tolerance, ori_tolerance)
Judges whether the actual value is within the tolerance for the goal value.
- Parameters
goal (list[float], geometry_msgs/Pose, geometry_msgs/PoseStamped) – The goal value.
actual (list[float], geometry_msgs/Pose, geometry_msgs/PoseStamped) – The actual value.
pos_tolerance (float) – The tolerance of positions.
ori_tolerance (float) – The tolerance of orientations.
- Returns
Return True if the value is within the tolerance.
- Return type
bool
- arm_go()
Transition to go posture.
- Returns
Execution result.
- Return type
bool
- arm_neutral()
Transition to neutral posture.
- Returns
Execution result.
- Return type
bool
- base_go_abs(pose, frame='map', motion_synthesis_config={})
Move in absolute coordinates. It loops infinitely until the goal is reached.
- Parameters
pose (geometry_msgs/Pose2D, list[geometry_msgs/Pose2D]) – Goal place positions. Multiple positions can also be specified in a list. In such a case, the robot is moved in order.
frame (str) – The name of reference frame.
motion_synthesis_config (dict, optional) –
If you want to apply the motion synthesis, set the configuration. Defaults to {} (Disable). The keys for config are as follows,
- start_pose: Transition posture at start.
If “auto” is specified, it is automatically set to the go posture of HSR.
goal_pose: Transition posture at goal. exec_from_first: Joint name list to transition from the first.
If “all” is specified, all specified joints execute from first.
goal_tolerance: Timing of starting motion synthesis (distance from the goal).
Examples
>>> base_go_abs(Pose2D(0.0, 1.0, 1.57), motion_synthesis_config={"start_pose":"auto", "goal_pose":{"arm_lift_joint": 0.1, ...}, "exec_from_first": ["arm_lift_joint"]}, "goal_tolerance": Point(0.3, 0.3, 0.0))
- delete()
- gripper_command(val, is_sync=True, time=1.0)
Change the gripper opening width to a specified value.
- Parameters
val (float) – Opening width. (Effective range: -0.785[rad] to 1.047[rad])
is_sync (bool, optional) – Synchronous/asynchronous settings. Defaults to True.
time (float, optional) – Wait time, valid only when wait=True. Defaults to 1.0.
- Returns
Execution result.
- Return type
bool
- head_tilt(val)
Change the head tilt joint.
- Parameters
val (float) – Angle of head tilt. (Effective range: ??[rad] to ??[rad])
- Returns
Execution result.
- Return type
bool
- set_base_acc(acc=1.0)
Set the maximum acceleration of the base.
- Parameters
vel (float, optional) – Maximum acceleration value. The value must be between 0.0 and 1.0. Defaults to 1.0.
- set_base_vel(vel=1.0)
Set the maximum speed of the base.
- Parameters
vel (float, optional) – Maximum speed value. The value must be between 0.0 and 1.0. Defaults to 1.0.
- set_whole_body_acc(acc=1.0)
Set the maximum acceleration of the whole_body.
- Parameters
vel (float, optional) – Maximum acceleration value. The value must be between 0.0 and 1.0. Defaults to 1.0.
- set_whole_body_vel(vel=1.0)
Set the maximum speed of the whole_body.
- Parameters
vel (float, optional) – Maximum speed value. The value must be between 0.0 and 1.0. Defaults to 1.0.
- whole_body_IK(x, y, z, roll, pitch, yaw, frame='odom', pos_tolerance=0.02, ori_tolerance=0.17)
Inverse kinematics control of the whole body.
- Parameters
x (float) – Target x of end-effector.
y (float) – Target y of end-effector.
z (float) – Target z of end-effector.
roll (float) – Target roll of end-effector.
pitch (float) – Target pitch of end-effector.
yaw (float) – Target yae of end-effector.
frame (str, optional) – The name of reference frame. Defaults to “odom”.
pos_tolerance (float) – The tolerance of positions. Defaults to 0.02[m].
ori_tolerance (float) – The tolerance of orientations. Defaults to 0.17[rad].
- Returns
Execution result.
- Return type
bool
- whole_body_IK_cartesian(x, y, z, roll, pitch, yaw, is_avoid_obstacle=True, eef_step=0.01, fraction_th=0.5, pos_tolerance=0.02, ori_tolerance=0.17)
Inverse kinematics control of the whole body for multiple coordinates.
- Parameters
x (float) – Target x of end-effector.
y (float) – Target y of end-effector.
z (float) – Target z of end-effector.
roll (float) – Target roll of end-effector.
pitch (float) – Target pitch of end-effector.
yaw (float) – Target yae of end-effector.
is_avoid_obstacle (str, optional) – Whether or not to avoid obstacles using planning scene. Defaults to True.
eef_step (float, optional) – Operating calculation steps. Defaults to 0.01[m].
fraction_th (float, optional) – This function is not executed if the calculated fraction is below the threshold. If the calculation was incomplete, fraction indicates the percentage of paths calculated (number of waypoints passed). Defaults to 0.5[m].
pos_tolerance (float) – The tolerance of positions. Defaults to 0.02[m].
ori_tolerance (float) – The tolerance of orientations. Defaults to 0.17[rad].
- Returns
Execution result.
- Return type
bool
- whole_body_IK_cartesian_with_timeout(x, y, z, roll, pitch, yaw, is_avoid_obstacle=True, eef_step=0.01, fraction_th=0.5, pos_tolerance=0.02, ori_tolerance=0.17, timeout=5.0)
Inverse kinematics control of the whole body for multiple coordinates with timeout.
- Parameters
x (float) – Target x of end-effector.
y (float) – Target y of end-effector.
z (float) – Target z of end-effector.
roll (float) – Target roll of end-effector.
pitch (float) – Target pitch of end-effector.
yaw (float) – Target yae of end-effector.
is_avoid_obstacle (str, optional) – Whether or not to avoid obstacles using planning scene. Defaults to True.
eef_step (float, optional) – Operating calculation steps. Defaults to 0.01[m].
fraction_th (float, optional) – This function is not executed if the calculated fraction is below the threshold. If the calculation was incomplete, fraction indicates the percentage of paths calculated (number of waypoints passed). Defaults to 0.5[m].
pos_tolerance (float, optional) – The tolerance of positions. Defaults to 0.02[m].
ori_tolerance (float, optional) – The tolerance of orientations. Defaults to 0.17[rad].
timeout (float, optional) – Timeout time. Defaults to 5.0[sec].
- Returns
Execution result.
- Return type
bool