Skip to content

Commit

Permalink
added openrave-createplugin tool and minor fixes to openrave bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
rdiankov committed Apr 28, 2011
1 parent fdd818c commit e76a8c4
Show file tree
Hide file tree
Showing 21 changed files with 375 additions and 69 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES)

set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake python-dev libxml2-dev libboost-dev ffmpeg zlib1g-dev python-numpy "python-sympy (>=0.6.3)" desktop-file-utils libboost-filesystem-dev libboost-system-dev libboost-python-dev libboost-thread-dev libboost-date-time-dev octave3.2-headers "libcollada15dom-dev (>=2.3.1)" pkg-config)
# plugins
set(CPACK_DEBIAN_BUILD_DEPENDS ${CPACK_DEBIAN_BUILD_DEPENDS} libboost-iostreams-dev libboost-regex-dev libqt4-dev qt4-dev-tools libqhull-dev libavcodec-dev libavformat-dev libswscale-dev libsimage-dev libode-dev libsoqt4-dev libassimp-dev libbullet-dev)
set(CPACK_DEBIAN_BUILD_DEPENDS ${CPACK_DEBIAN_BUILD_DEPENDS} libboost-iostreams-dev libboost-regex-dev libqt4-dev qt4-dev-tools libqhull-dev libavcodec-dev libavformat-dev libswscale-dev libsimage-dev libode-dev libsoqt4-dev libassimp-dev)

# debian
set(CPACK_DEBIAN_PACKAGE_PRIORITY optional)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CMAKE_BUILD_TYPE=$(shell if [ $(DEBUG) ]; then echo Debug; else echo RelWithDebInfo; fi)

all:
@mkdir -p build; rm -f build/CMakeCache.txt rave/defines.h rave/classhashes.h
@mkdir -p build; rm -f build/CMakeCache.txt
@if [ $(prefix) ]; then \
cd build && cmake -DCMAKE_INSTALL_PREFIX=$(prefix) -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) ..; \
else \
Expand Down
23 changes: 23 additions & 0 deletions docs/en/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@
ChangeLog
#########

Version 0.3.2
=============

Subversion Revision: **Unreleased**

Initial Release: **Unreleased**

Core
----

* added openrave-robot.py which allows introspection into robot files. This deprecates openrave-hash.py. added bash completion for it.

* added openrave-createplugin.py which allows new users to easily setup the plugin directories and get something running. also works on creating executables. added bash completion for it.

* changed way of searching for collada to prepare for 2.3.1 release.

* small changes to the way symlinks are handled on install/uninstall

Testing
-------

* fixed bugs in multiprocess plugin

Version 0.3.1
=============

Expand Down
38 changes: 36 additions & 2 deletions docs/en/command_line_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Command Line Tools
==================

.. _tool-openravepy
openrave.py
-----------

Expand Down Expand Up @@ -75,8 +77,10 @@ Command-line

.. shell-block:: openrave.py --help

openrave-hash.py
----------------
.. _tool-openrave-robot
openrave-robot.py
-----------------

Queries information about OpenRAVE-loadable robots.

Expand All @@ -93,6 +97,24 @@ Command-line

.. shell-block:: openrave-robot.py --help

.. _tool-openrave-createplugin
openrave-createplugin.py
------------------------

Sets up a project directory and initial files for creating OpenRAVE plugins and executables. For example:

.. code-block:: bash
openrave-createplugin.py myplugin --problem MyNewProblem
Command-line
~~~~~~~~~~~~

.. shell-block:: openrave-createplugin.py --help

.. _tool-openrave
openrave
--------

Expand All @@ -104,3 +126,15 @@ Command-line
~~~~~~~~~~~~

.. shell-block:: openrave --help

.. _tool-openrave-config
openrave-config
---------------

Used to find the openrave installation directories, used libraries, headers, and shared files.

Command-line
~~~~~~~~~~~~

.. shell-block:: openrave-config --help
4 changes: 1 addition & 3 deletions docs/en/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ Getting Started Tutorials
command_line_tools
tutorials/openravepy_advanced
environment_variables
writing_plugins

.. htmlonly::
- `FindOpenRAVE.cmake`_ - searches for the OpenRAVE installation when using CMake build system.
- `Writing Plugins and Interfaces in C++ <../coreapihtml/writing_plugins.html>`_
- `Writing and Using Controllers in C++ <../coreapihtml/arch_controller.html>`_
- `Octave/MATLAB`_ Scripting
5 changes: 5 additions & 0 deletions docs/en/tutorials/writing_plugins.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Writing Plugins in C++
======================

.. htmlonly::
- `Writing Plugins and Interfaces in C++ <../coreapihtml/writing_plugins.html>`_
4 changes: 3 additions & 1 deletion include/openrave/openrave.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2006-2011 Rosen Diankov (rosen.diankov@gmail.com)
// Copyright (C) 2006-2011 Rosen Diankov <rosen.diankov@gmail.com>
//
// This file is part of OpenRAVE.
// OpenRAVE is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -591,6 +591,7 @@ enum InterfaceType
PT_SensorSystem=3, ///< describes \ref SensorSystemBase interface
PT_Controller=4, ///< describes \ref ControllerBase interface
PT_ProblemInstance=5, ///< describes \ref ProblemInstance interface
PT_IkSolver=6, ///< describes \ref IkSolverBase interface
PT_InverseKinematicsSolver=6, ///< describes \ref IkSolverBase interface
PT_KinBody=7, ///< describes \ref KinBody
PT_PhysicsEngine=8, ///< describes \ref PhysicsEngineBase
Expand Down Expand Up @@ -1186,6 +1187,7 @@ OPENRAVE_API PlannerBasePtr RaveCreatePlanner(EnvironmentBasePtr penv, const std
OPENRAVE_API SensorSystemBasePtr RaveCreateSensorSystem(EnvironmentBasePtr penv, const std::string& name);
OPENRAVE_API ControllerBasePtr RaveCreateController(EnvironmentBasePtr penv, const std::string& name);
OPENRAVE_API ProblemInstancePtr RaveCreateProblem(EnvironmentBasePtr penv, const std::string& name);
OPENRAVE_API ProblemInstancePtr RaveCreateProblemInstance(EnvironmentBasePtr penv, const std::string& name);
OPENRAVE_API IkSolverBasePtr RaveCreateIkSolver(EnvironmentBasePtr penv, const std::string& name);
OPENRAVE_API PhysicsEngineBasePtr RaveCreatePhysicsEngine(EnvironmentBasePtr penv, const std::string& name);
OPENRAVE_API SensorBasePtr RaveCreateSensor(EnvironmentBasePtr penv, const std::string& name);
Expand Down
20 changes: 8 additions & 12 deletions modules-cmake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ENDFOREACH(file)
12 changes: 10 additions & 2 deletions openrave_completion.bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function _complete_openravepy {
esac

# not processing a current option, so offer all the options again
opts="--loadplugin --collision --physics --viewer --server --serverport --level --ipython --pythoncmd --listinterfaces --listplugins --listdatabases --listexamples"
opts="--loadplugin --collision --physics --viewer --server --serverport --level --ipython --pythoncmd --listinterfaces --listplugins --listdatabases --listexamples --help"
if [[ $COMP_CWORD == 1 ]]; then
# these options transfer the args to another program
opts="$opts --database --example"
Expand Down Expand Up @@ -116,15 +116,23 @@ function _complete_openrave_robotpy {
esac

# not processing a current option, so offer all the options again
opts="--manipname --sensorname --hash --info --list"
opts="--manipname --sensorname --hash --info --list --help"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
if [[ ${cur} != -* ]] ; then
# add in xml and dae and zae files
COMPREPLY=($(compgen -f -X "!*.+(dae|zae|xml)" -- ${cur}) ${COMPREPLY[@]})
fi
}

function _complete_openrave_createpluginpy {
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--usecore --planner --robot --sensorsystem --controller --probleminstance --iksolver --kinbody --physicsengine --sensor --collisionchecker --trajectory --help"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
}
complete -F "_complete_openravepy" -o filenames -o plusdirs "openrave.py"
complete -F "_complete_openrave_robotpy" -o filenames -o plusdirs "openrave-robot.py"
complete -F "_complete_openrave_createpluginpy" "openrave-createplugin.py"
complete -F "_complete_openravepy" -o filenames -o plusdirs "openrave@OPENRAVE_BIN_SUFFIX@.py"
complete -F "_complete_openrave_robotpy" -o filenames -o plusdirs "openrave@OPENRAVE_BIN_SUFFIX@-robot.py"
complete -F "_complete_openrave_createpluginpy" "openrave@OPENRAVE_BIN_SUFFIX@-createplugin.py"
28 changes: 14 additions & 14 deletions plugins/ikfastsolvers/ikfastsolvers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace katana5d_trans { IkSolverBasePtr CreateIkSolver(EnvironmentBasePtr, co
InterfaceBasePtr CreateInterfaceValidated(InterfaceType type, const std::string& interfacename, std::istream& sinput, EnvironmentBasePtr penv)
{
switch(type) {
case PT_InverseKinematicsSolver: {
case PT_IkSolver: {
if( interfacename == "ikfast" ) {
string ikfastname;
sinput >> ikfastname;
Expand Down Expand Up @@ -104,19 +104,19 @@ InterfaceBasePtr CreateInterfaceValidated(InterfaceType type, const std::string&
void GetPluginAttributesValidated(PLUGININFO& info)
{
info.interfacenames[PT_ProblemInstance].push_back("ikfast");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast");
info.interfacenames[PT_InverseKinematicsSolver].push_back("wam7ikfast");
info.interfacenames[PT_InverseKinematicsSolver].push_back("pa10ikfast");
info.interfacenames[PT_InverseKinematicsSolver].push_back("pumaikfast");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_pr2_head");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_pr2_head_torso");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_pr2_rightarm");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_pr2_rightarm_torso");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_pr2_leftarm");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_pr2_leftarm_torso");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_schunk_lwa3");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_katana5d");
info.interfacenames[PT_InverseKinematicsSolver].push_back("ikfast_katana5d_trans");
info.interfacenames[PT_IkSolver].push_back("ikfast");
info.interfacenames[PT_IkSolver].push_back("wam7ikfast");
info.interfacenames[PT_IkSolver].push_back("pa10ikfast");
info.interfacenames[PT_IkSolver].push_back("pumaikfast");
info.interfacenames[PT_IkSolver].push_back("ikfast_pr2_head");
info.interfacenames[PT_IkSolver].push_back("ikfast_pr2_head_torso");
info.interfacenames[PT_IkSolver].push_back("ikfast_pr2_rightarm");
info.interfacenames[PT_IkSolver].push_back("ikfast_pr2_rightarm_torso");
info.interfacenames[PT_IkSolver].push_back("ikfast_pr2_leftarm");
info.interfacenames[PT_IkSolver].push_back("ikfast_pr2_leftarm_torso");
info.interfacenames[PT_IkSolver].push_back("ikfast_schunk_lwa3");
info.interfacenames[PT_IkSolver].push_back("ikfast_katana5d");
info.interfacenames[PT_IkSolver].push_back("ikfast_katana5d_trans");
}

OPENRAVE_PLUGIN_API void DestroyPlugin()
Expand Down
5 changes: 5 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink openrav
install(FILES openrave-robot.py DESTINATION bin PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ COMPONENT ${COMPONENT_PREFIX}python RENAME openrave${OPENRAVE_BIN_SUFFIX}-robot.py)
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink openrave${OPENRAVE_BIN_SUFFIX}-robot.py openrave-robot.py WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)" COMPONENT ${COMPONENT_PREFIX}python)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../src/cppexamples/FindOpenRAVE.cmake" FindOpenRAVE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/openrave-createplugin.py.in" "${CMAKE_CURRENT_BINARY_DIR}/openrave${OPENRAVE_BIN_SUFFIX}-createplugin.py" IMMEDIATE @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/openrave${OPENRAVE_BIN_SUFFIX}-createplugin.py" DESTINATION bin PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ COMPONENT ${COMPONENT_PREFIX}python)
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink openrave${OPENRAVE_BIN_SUFFIX}-createplugin.py openrave-createplugin.py WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)" COMPONENT ${COMPONENT_PREFIX}python)

# install rest python files
install(FILES __init__.py metaclass.py openravepy_ext.py DESTINATION ${OPENRAVEPY_INSTALL_DIR} COMPONENT ${COMPONENT_PREFIX}python)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples" DESTINATION ${OPENRAVEPY_INSTALL_DIR} FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ COMPONENT ${COMPONENT_PREFIX}python PATTERN ".svn" EXCLUDE PATTERN ".pyc" EXCLUDE)
Expand Down
13 changes: 7 additions & 6 deletions python/bindings/openravepy_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
case PT_SensorSystem: return PySensorSystemBasePtr(new PySensorSystemBase(boost::static_pointer_cast<SensorSystemBase>(pinterface),shared_from_this()));
case PT_Controller: return PyControllerBasePtr(new PyControllerBase(boost::static_pointer_cast<ControllerBase>(pinterface),shared_from_this()));
case PT_ProblemInstance: return PyProblemInstancePtr(new PyProblemInstance(boost::static_pointer_cast<ProblemInstance>(pinterface),shared_from_this()));
case PT_InverseKinematicsSolver: return PyIkSolverBasePtr(new PyIkSolverBase(boost::static_pointer_cast<IkSolverBase>(pinterface),shared_from_this()));
case PT_IkSolver: return PyIkSolverBasePtr(new PyIkSolverBase(boost::static_pointer_cast<IkSolverBase>(pinterface),shared_from_this()));
case PT_KinBody: return PyKinBodyPtr(new PyKinBody(boost::static_pointer_cast<KinBody>(pinterface),shared_from_this()));
case PT_PhysicsEngine: return PyPhysicsEngineBasePtr(new PyPhysicsEngineBase(boost::static_pointer_cast<PhysicsEngineBase>(pinterface),shared_from_this()));
case PT_Sensor: return PySensorBasePtr(new PySensorBase(boost::static_pointer_cast<SensorBase>(pinterface),shared_from_this()));
Expand Down Expand Up @@ -2723,7 +2723,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
PyProblemInstancePtr CreateProblem(const string& name)
{
RAVELOG_WARN("Environment.CreateProblem deprecated, use RaveCreateProblem\n");
return openravepy::RaveCreateProblem(shared_from_this(),name);
return openravepy::RaveCreateProblemInstance(shared_from_this(),name);
}
PyIkSolverBasePtr CreateIkSolver(const string& name)
{
Expand Down Expand Up @@ -3641,9 +3641,9 @@ namespace openravepy
return PyControllerBasePtr(new PyControllerBase(p,pyenv));
}

PyProblemInstancePtr RaveCreateProblem(PyEnvironmentBasePtr pyenv, const std::string& name)
PyProblemInstancePtr RaveCreateProblemInstance(PyEnvironmentBasePtr pyenv, const std::string& name)
{
ProblemInstancePtr p = OpenRAVE::RaveCreateProblem(pyenv->GetEnv(), name);
ProblemInstancePtr p = OpenRAVE::RaveCreateProblemInstance(pyenv->GetEnv(), name);
if( !p ) {
return PyProblemInstancePtr();
}
Expand Down Expand Up @@ -3783,7 +3783,7 @@ BOOST_PYTHON_MODULE(openravepy_int)
.value(RaveGetInterfaceName(PT_SensorSystem).c_str(),PT_SensorSystem)
.value(RaveGetInterfaceName(PT_Controller).c_str(),PT_Controller)
.value(RaveGetInterfaceName(PT_ProblemInstance).c_str(),PT_ProblemInstance)
.value(RaveGetInterfaceName(PT_InverseKinematicsSolver).c_str(),PT_InverseKinematicsSolver)
.value(RaveGetInterfaceName(PT_IkSolver).c_str(),PT_IkSolver)
.value(RaveGetInterfaceName(PT_KinBody).c_str(),PT_KinBody)
.value(RaveGetInterfaceName(PT_PhysicsEngine).c_str(),PT_PhysicsEngine)
.value(RaveGetInterfaceName(PT_Sensor).c_str(),PT_Sensor)
Expand Down Expand Up @@ -4833,7 +4833,8 @@ In python, the syntax is::\n\n\
def("RaveCreatePlanner",openravepy::RaveCreatePlanner,args("env","name"),DOXY_FN1(RaveCreatePlanner));
def("RaveCreateSensorSystem",openravepy::RaveCreateSensorSystem,args("env","name"),DOXY_FN1(RaveCreateSensorSystem));
def("RaveCreateController",openravepy::RaveCreateController,args("env","name"),DOXY_FN1(RaveCreateController));
def("RaveCreateProblem",openravepy::RaveCreateProblem,args("env","name"),DOXY_FN1(RaveCreateProblem));
def("RaveCreateProblem",openravepy::RaveCreateProblemInstance,args("env","name"),DOXY_FN1(RaveCreateProblemInstance));
def("RaveCreateProblemInstance",openravepy::RaveCreateProblemInstance,args("env","name"),DOXY_FN1(RaveCreateProblemInstance));
def("RaveCreateIkSolver",openravepy::RaveCreateIkSolver,args("env","name"),DOXY_FN1(RaveCreateIkSolver));
def("RaveCreatePhysicsEngine",openravepy::RaveCreatePhysicsEngine,args("env","name"),DOXY_FN1(RaveCreatePhysicsEngine));
def("RaveCreateSensor",openravepy::RaveCreateSensor,args("env","name"),DOXY_FN1(RaveCreateSensor));
Expand Down
2 changes: 1 addition & 1 deletion python/bindings/openravepy_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ namespace openravepy
PyPlannerBasePtr RaveCreatePlanner(PyEnvironmentBasePtr pyenv, const std::string& name);
PySensorSystemBasePtr RaveCreateSensorSystem(PyEnvironmentBasePtr pyenv, const std::string& name);
PyControllerBasePtr RaveCreateController(PyEnvironmentBasePtr pyenv, const std::string& name);
PyProblemInstancePtr RaveCreateProblem(PyEnvironmentBasePtr pyenv, const std::string& name);
PyProblemInstancePtr RaveCreateProblemInstance(PyEnvironmentBasePtr pyenv, const std::string& name);
PyIkSolverBasePtr RaveCreateIkSolver(PyEnvironmentBasePtr pyenv, const std::string& name);
PyPhysicsEngineBasePtr RaveCreatePhysicsEngine(PyEnvironmentBasePtr pyenv, const std::string& name);
PySensorBasePtr RaveCreateSensor(PyEnvironmentBasePtr pyenv, const std::string& name);
Expand Down
Loading

0 comments on commit e76a8c4

Please sign in to comment.