Skip to content

Old Python Interface

Simon edited this page Jan 18, 2024 · 1 revision

Setting goals

The class ''GiskardWrapper'' is a python wrapper around Giskard's action server interface. It can be imported like this

from giskardpy.python_interface import GiskardWrapper

Creating an instance will automatically wait for and connect to Giskard

giskard_wrapper = GiskardWrapper()

It has several functions to add goals e.g.

giskard_wrapper.set_joint_goal({'torso_lift_joint':0.2})

or

giskard_wrapper.set_cart_goal('torso_lift_link', 'r_gripper_tool_frame', PoseStamped())

All set_something_goal commands get automatically combined into a single motion task, until the following function is called to execute the command.

giskard_wrapper.plan_and_execute(wait=True)

Alternatively, you might want to set wait=False to have the command not block the program and use the following commands to stop the execution or check if it has finished.

  1. giskard_wrapper.get_result(self, timeout=rospy.Duration())
  2. giskard_wrapper.interrupt()

If you want to have a sequence of motions, you can use

giskard_wrapper.add_cmd()

to start a new motion task. A more complex script to show these functions in action can be found here. To run it, you need the PR2 in standalone mode.

Collision Avoidance

Use these functions to influence the collision avoidance.

giskard_wrapper.allow_all_collisions()
giskard_wrapper.allow_self_collision()
giskard_wrapper.avoid_all_collisions() # You only need this function, if you want to be specific, because it is the default.
giskard_wrapper.allow_collision(group1=CollisionEntry.ALL, group2=CollisionEntry.ALL)
giskard_wrapper.avoid_collision(group1=CollisionEntry.ALL, group2=CollisionEntry.ALL)

Look at World Tree for more information on groups.

Clone this wiki locally