GithubHelp home page GithubHelp logo

moveit_python's Introduction

moveit_python

This is a set of pure-python bindings to the ROS interface of MoveIt! based on the earlier moveit_utils package that was developed as part of the chess_player package.

Overview

There are three interfaces currently:

  • MoveGroupInterface -- used to move the arm using the move_group action.
  • PlanningSceneInterface -- used to add/remove collision and attached objects. Can also set the colors of objects.
  • PickPlaceInterface -- used to interface to the pick and place actions.

MoveGroupInterface

The MoveGroupInterface is quite easy to use:

import rospy
from moveit_python import *

rospy.init_node("moveit_py")
g = MoveGroupInterface("planning_group_name", "base_link")

Obviously, you might need different values for base_link, and your planning group is probably not called "planning_group_name".

PlanningSceneInterface

The PlanningSceneInterface allows you to easily insert and remove objects from the MoveIt! planning scene. Unlike the moveit_commander, this module tracks when objects are added removed, and will re-attempt add/remove if a message is loss.

import rospy
from moveit_python import *

rospy.init_node("moveit_py")
# create a planning scene interface, provide name of root link
p = PlanningSceneInterface("base_link")

# add a cube of 0.1m size, at [1, 0, 0.5] in the base_link frame
p.addCube("my_cube", 0.1, 1, 0, 0.5)

# do something

# remove the cube
p.removeCollisionObject("my_cube")

Each time an object is added or removed, the planning scene interface will wait until it recieves confirmation that the request has been processed by MoveIt! If sending a large number of objects, it would be more efficient to only wait for synchronization at the end, this can be achieved by doing like so:

p.addCube("my_cube", 0.1, 1, 0, 0.5, wait=False)
p.addCube("my_other_cube", 0.1, 2, 0, 0.5, wait=False)
p.waitForSync()

PickPlaceInterface

import rospy
from moveit_python import *
from moveit_msgs.msg import Grasp, PlaceLocation

rospy.init_node("moveit_py")
# provide arm group and gripper group names
# also takes a third parameter "plan_only" which defaults to False
p = PickPlaceInterface("arm", "gripper")

g = Grasp()
# fill in g
# setup object named object_name using PlanningSceneInterface
p.pickup("object_name", [g, ], support_name = "supporting_surface")

l = PlaceLocation()
# fill in l
p.place("object_name" [l, ], goal_is_eef = True, support_name = "supporting_surface")

Migration from moveit_utils

  • GraspingInterface renamed to PickPlaceInterface
    • The pick/place functions now return the entire action result, in moveit_utils they returned only the error_code. To access the error code as it used to be returned, you would use result.error_code.val
  • ObjectManager renamed to PlanningSceneInterface
    • remove function is now removeCollisionObject and removeAttachedObject
  • ArmInterface renamed to MoveGroupInterface

moveit_python's People

Contributors

ablasdel avatar mikeferguson avatar mrath avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.