Skip to content

Commit

Permalink
fixed for ubuntu 8.04 and python 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
rdiankov committed Jan 6, 2012
1 parent f21e54c commit 33a19b4
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 43 deletions.
15 changes: 12 additions & 3 deletions CMakeLists.txt
Expand Up @@ -98,8 +98,9 @@ if( OPT_PYTHON )
OUTPUT_VARIABLE _python_distpackage OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _python_failed1)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; from os.path import relpath; print relpath(get_python_lib(1,prefix='${CMAKE_INSTALL_PREFIX}'),'${CMAKE_INSTALL_PREFIX}')"
COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; from myrelpath import relpath; print relpath(get_python_lib(1,prefix='${CMAKE_INSTALL_PREFIX}'),'${CMAKE_INSTALL_PREFIX}')"
OUTPUT_VARIABLE OPENRAVE_PYTHON_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE _python_failed2)

if( ${_python_failed0} EQUAL 0 AND ${_python_failed1} EQUAL 0 AND ${_python_failed2} EQUAL 0 )
Expand All @@ -125,7 +126,7 @@ if( OPT_PYTHON )
message(STATUS "failed to get python version")
endif()
else()
message(STATUS "failed to get python site-package directories via get_pytho_lib")
message(STATUS "failed to get python site-package directories via get_python_lib")
set(PYTHON_EXECUTABLE)
endif()
endif()
Expand Down Expand Up @@ -407,9 +408,17 @@ add_custom_target(interfacehashes_target ALL DEPENDS ${interfacehashes_h} ${EXTR
# math libraries
find_package(GMP)
find_package(GMPXX)
find_package(MPFR)
find_package(MPFR 2.4)
if( MPFR_FOUND )
check_library_exists(${MPFR_LIBRARIES} mpfr_div_d "${MPFR_LIBRARIES_DIR}" MPFR_DIV_D_FOUND)
if( NOT MPFR_DIV_D_FOUND )
message(WARNING "MPFR verison too old, does not support mpfr_div_d function")
set(MPFR_FOUND 0)
endif()
endif()
find_package(MPFI)


if( OPT_ACCURATEMATH AND NOT MSVC )
check_library_exists(crlibm crlibm_init "" CRLIBM_FOUND_LIB)
check_include_file(crlibm.h HAVE_CRLIBM_H)
Expand Down
2 changes: 2 additions & 0 deletions docs/en/changelog.rst
Expand Up @@ -129,6 +129,8 @@ Misc

* fixed qtcoin :meth:`.Viewer.GetCameraTransform` function. now compatible with :meth:`.Viewer.GetCameraImage`

* everything compiles with Ubuntu 8.04/Python 2.5.

Version 0.4.2
=============

Expand Down
2 changes: 1 addition & 1 deletion docs/en/tutorials/openravepy_examples.rst
Expand Up @@ -18,7 +18,7 @@ Loads up an environment, attaches a viewer, loads a scene, and requests informat
robot = env.GetRobots()[0] # get the first robot
with env: # lock the environment since robot will be used
print "Robot ",robot.GetName()," has ",robot.GetDOF()," joints with values:\\n",robot.GetJointValues()
print "Robot ",robot.GetName()," has ",robot.GetDOF()," joints with values:\\n",robot.GetDOFValues()
robot.SetDOFValues([0.5],[0]) # set joint 0 to value 0.5
T = robot.GetLinks()[1].GetTransform() # get the transform of link 1
print "The transformation of link 1 is:\n",T
Expand Down
18 changes: 17 additions & 1 deletion docs/install.dox
Expand Up @@ -192,6 +192,16 @@ sudo apt-get update
sudo apt-get build-dep openrave
\endverbatim

\subsection ilinux_ubuntu804 Ubuntu 8.04 or earlier

Install as many packages as possible:

\verbatim
sudo apt-get install g++ libqt4-dev qt4-dev-tools ffmpeg libavcodec-dev libavformat-dev libxvidcore-dev libx264-dev libfaac-dev libogg-dev libvorbis-dev libdc1394-dev liblame-dev libgsm1-dev libboost-dev libboost-regex-dev libxml2-dev libglew-dev libboost-graph-dev libboost-wave-dev libboost-serialization-dev libboost-filesystem-dev libpcre3-dev libboost-thread-dev libmpfr-dev libboost-date-time-dev libqhull-dev libswscale-dev
\endverbatim

- CMake - need to use version >=2.6.0, default cmake in ubuntu 8.04 is 2.47, which will not work.

\en \subsection ilinux_fedora Fedora Core Users

Might need to add the livna yum repository for ffmpeg. To install the necessary packages type
Expand Down Expand Up @@ -264,7 +274,13 @@ In order to use the python bindings through the \openravepy{openravepy} module,
\openravepy{openravepy}を利用するために%OpenRAVEをコンパイルする前に以下のパッケージをインストールしてください.

\verbatim
sudo apt-get install libboost-python-dev python python-dev python-numpy python-scipy ipython
sudo apt-get install libboost-python-dev python python-dev python-numpy ipython
\endverbatim

Optional:

\verbatim
sudo apt-get install python-scipy
\endverbatim

Pythonパスを設定するために,bashファイルに以下の行を追加してください.
Expand Down
8 changes: 8 additions & 0 deletions plugins/logging/viewerrecorder.cpp
Expand Up @@ -607,7 +607,11 @@ class ViewerRecorder : public ModuleBase
s_pVideoGlobalState.reset(new VideoGlobalState());
}
lcodecs.clear();
#if LIBAVFORMAT_VERSION_INT >= (52<<16)
AVOutputFormat *fmt = av_oformat_next(NULL); //first_oformat;
#else
AVOutputFormat *fmt = first_oformat;
#endif
while (fmt != NULL) {
lcodecs.push_back(make_pair((int)fmt->video_codec,fmt->long_name));
fmt = fmt->next;
Expand All @@ -624,7 +628,11 @@ class ViewerRecorder : public ModuleBase
AVCodec *codec;

CodecID video_codec = codecid == -1 ? CODEC_ID_MPEG4 : (CodecID)codecid;
#if LIBAVFORMAT_VERSION_INT >= (52<<16)
AVOutputFormat *fmt = av_oformat_next(NULL); //first_oformat;
#else
AVOutputFormat *fmt = first_oformat;
#endif
while (fmt != NULL) {
if (fmt->video_codec == video_codec) {
break;
Expand Down
20 changes: 10 additions & 10 deletions python/bindings/openravepy_int.cpp
Expand Up @@ -207,7 +207,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
if( !!plink ) {
return _penv->CheckCollision(plink);
}
KinBodyPtr pbody = openravepy::GetKinBody(o1);
KinBodyConstPtr pbody = openravepy::GetKinBody(o1);
if( !!pbody ) {
return _penv->CheckCollision(pbody);
}
Expand All @@ -223,7 +223,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
bCollision = _penv->CheckCollision(plink,openravepy::GetCollisionReport(pReport));
}
else {
KinBodyPtr pbody = openravepy::GetKinBody(o1);
KinBodyConstPtr pbody = openravepy::GetKinBody(o1);
if( !!pbody ) {
bCollision = _penv->CheckCollision(pbody,openravepy::GetCollisionReport(pReport));
}
Expand All @@ -245,7 +245,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
if( !!plink2 ) {
return _penv->CheckCollision(plink,plink2);
}
KinBodyPtr pbody2 = openravepy::GetKinBody(o2);
KinBodyConstPtr pbody2 = openravepy::GetKinBody(o2);
if( !!pbody2 ) {
return _penv->CheckCollision(plink,pbody2);
}
Expand All @@ -257,13 +257,13 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
}
throw OPENRAVE_EXCEPTION_FORMAT0("invalid argument 2",ORE_InvalidArguments);
}
KinBodyPtr pbody = openravepy::GetKinBody(o1);
KinBodyConstPtr pbody = openravepy::GetKinBody(o1);
if( !!pbody ) {
KinBody::LinkConstPtr plink2 = openravepy::GetKinBodyLinkConst(o2);
if( !!plink2 ) {
return _penv->CheckCollision(plink2,pbody);
}
KinBodyPtr pbody2 = openravepy::GetKinBody(o2);
KinBodyConstPtr pbody2 = openravepy::GetKinBody(o2);
if( !!pbody2 ) {
return _penv->CheckCollision(pbody,pbody2);
}
Expand All @@ -289,7 +289,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
bCollision = _penv->CheckCollision(plink,plink2, openravepy::GetCollisionReport(pReport));
}
else {
KinBodyPtr pbody2 = openravepy::GetKinBody(o2);
KinBodyConstPtr pbody2 = openravepy::GetKinBody(o2);
if( !!pbody2 ) {
bCollision = _penv->CheckCollision(plink,pbody2, openravepy::GetCollisionReport(pReport));
}
Expand All @@ -299,14 +299,14 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
}
}
{
KinBodyPtr pbody = openravepy::GetKinBody(o1);
KinBodyConstPtr pbody = openravepy::GetKinBody(o1);
if( !!pbody ) {
KinBody::LinkConstPtr plink2 = openravepy::GetKinBodyLinkConst(o2);
if( !!plink2 ) {
bCollision = _penv->CheckCollision(plink2,pbody, openravepy::GetCollisionReport(pReport));
}
else {
KinBodyPtr pbody2 = openravepy::GetKinBody(o2);
KinBodyConstPtr pbody2 = openravepy::GetKinBody(o2);
if( !!pbody2 ) {
bCollision = _penv->CheckCollision(pbody,pbody2, openravepy::GetCollisionReport(pReport));
}
Expand All @@ -332,7 +332,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
if( !!plink ) {
return _penv->CheckCollision(plink,pbody2);
}
KinBodyPtr pbody1 = openravepy::GetKinBody(o1);
KinBodyConstPtr pbody1 = openravepy::GetKinBody(o1);
if( !!pbody1 ) {
return _penv->CheckCollision(pbody1,pbody2);
}
Expand All @@ -350,7 +350,7 @@ class PyEnvironmentBase : public boost::enable_shared_from_this<PyEnvironmentBas
bCollision = _penv->CheckCollision(plink,pbody2,openravepy::GetCollisionReport(pReport));
}
else {
KinBodyPtr pbody1 = openravepy::GetKinBody(o1);
KinBodyConstPtr pbody1 = openravepy::GetKinBody(o1);
if( !!pbody1 ) {
bCollision = _penv->CheckCollision(pbody1,pbody2,openravepy::GetCollisionReport(pReport));
}
Expand Down
19 changes: 12 additions & 7 deletions python/databases/__init__.py
Expand Up @@ -208,10 +208,15 @@ def RunFromParser(Model=None,env=None,parser=None,args=None,robotatts=dict(),def
if destroyenv and env is not None:
env.Destroy()

import convexdecomposition
import linkstatistics
import grasping
import inversekinematics
import kinematicreachability
import inversereachability
import visibilitymodel
# python 2.5 raises 'import *' not allowed with 'from .'
from sys import version_info
if version_info[0:3]>=(2,6,0):
import convexdecomposition
import linkstatistics
import grasping
import inversekinematics
import kinematicreachability
import inversereachability
import visibilitymodel
else:
print 'openravepy.datbases cannot be used python versions < 2.6'
7 changes: 5 additions & 2 deletions python/examples/cubeassembly.py
Expand Up @@ -39,7 +39,10 @@
else:
from numpy import eye

import multiprocessing
try:
from multiprocessing import cpu_count
except:
def cpu_count(): return 1

from openravepy.examples import graspplanning

Expand Down Expand Up @@ -97,7 +100,7 @@ def CreateBlocks(self,side=0.015,T=eye(4),generategrasps=True):
if generategrasps:
if not gmodel.load():
approachrays = gmodel.computeBoxApproachRays(delta=0.01,normalanglerange=0,directiondelta=0)
gmodel.numthreads = multiprocessing.cpu_count()
gmodel.numthreads = cpu_count()
gmodel.generate(standoffs=array([0,0.04,0.08]),approachrays=approachrays, friction=0.1)
gmodel.save()
self.gmodels.append(gmodel)
Expand Down
8 changes: 6 additions & 2 deletions python/examples/fastgraspingthreaded.py
Expand Up @@ -32,7 +32,11 @@
from openravepy import *
from numpy import *

import multiprocessing
try:
from multiprocessing import cpu_count
except:
def cpu_count(): return 1

import time

class FastGraspingThreaded:
Expand Down Expand Up @@ -132,7 +136,7 @@ def computeGrasp(self):
forceclosurethreshold=1e-9
avoidlinks = []
friction = 0.4
numthreads = multiprocessing.cpu_count()
numthreads = cpu_count()
maxgrasps = 1
checkik = True
grasps = []
Expand Down
8 changes: 6 additions & 2 deletions python/examples/graspplanning.py
Expand Up @@ -98,7 +98,11 @@
from openravepy import *
from numpy import *

import multiprocessing
try:
from multiprocessing import cpu_count
except:
def cpu_count(): return 1


class GraspPlanning:
def __init__(self,robot,randomize=False,dests=None,nodestinations=False,switchpatterns=None,plannername=None,minimumgoalpaths=1):
Expand Down Expand Up @@ -136,7 +140,7 @@ def __init__(self,robot,randomize=False,dests=None,nodestinations=False,switchpa
if len(targets) > 0:
gmodel = databases.grasping.GraspingModel(robot=self.robot,target=targets[0])
if not gmodel.load():
gmodel.numthreads = multiprocessing.cpu_count()
gmodel.numthreads = cpu_count()
gmodel.autogenerate()
self.graspables = self.getGraspables(dests=dests)

Expand Down
7 changes: 5 additions & 2 deletions python/interfaces/BaseManipulation.py
Expand Up @@ -12,10 +12,13 @@
__author__ = 'Rosen Diankov'
__copyright__ = 'Copyright (C) 2009-2011 Rosen Diankov <rosen.diankov@gmail.com>'
__license__ = 'Apache License, Version 2.0'
from ..openravepy_ext import *
from ..openravepy_int import *
# python 2.5 raises 'import *' not allowed with 'from .'
from ..openravepy_int import RaveCreateModule, RaveCreateTrajectory
from ..openravepy_ext import planning_error

import numpy
from copy import copy as shallowcopy

class BaseManipulation:
"""Interface wrapper for :ref:`module-basemanipulation`
"""
Expand Down
6 changes: 4 additions & 2 deletions python/interfaces/Grasper.py
Expand Up @@ -12,8 +12,10 @@
__author__ = 'Rosen Diankov'
__copyright__ = 'Copyright (C) 2009-2011 Rosen Diankov <rosen.diankov@gmail.com>'
__license__ = 'Apache License, Version 2.0'
from ..openravepy_ext import *
from ..openravepy_int import *
# python 2.5 raises 'import *' not allowed with 'from .'
from ..openravepy_int import RaveCreateModule, RaveCreateTrajectory
from ..openravepy_ext import planning_error

from numpy import *
from copy import copy as shallowcopy

Expand Down
6 changes: 4 additions & 2 deletions python/interfaces/TaskManipulation.py
Expand Up @@ -12,8 +12,10 @@
__author__ = 'Rosen Diankov'
__copyright__ = 'Copyright (C) 2009-2011 Rosen Diankov <rosen.diankov@gmail.com>'
__license__ = 'Apache License, Version 2.0'
from ..openravepy_ext import *
from ..openravepy_int import *
# python 2.5 raises 'import *' not allowed with 'from .'
from ..openravepy_int import RaveCreateModule, RaveCreateTrajectory
from ..openravepy_ext import planning_error

from numpy import *
from copy import copy as shallowcopy
class TaskManipulation:
Expand Down
6 changes: 4 additions & 2 deletions python/interfaces/VisualFeedback.py
Expand Up @@ -12,9 +12,11 @@
__author__ = 'Rosen Diankov'
__copyright__ = 'Copyright (C) 2009-2011 Rosen Diankov <rosen.diankov@gmail.com>'
__license__ = 'Apache License, Version 2.0'
# python 2.5 raises 'import *' not allowed with 'from .
from ..openravepy_int import RaveCreateModule, RaveCreateTrajectory
from ..openravepy_ext import planning_error

import numpy
from ..openravepy_ext import *
from ..openravepy_int import *
from copy import copy as shallowcopy

class VisualFeedback:
Expand Down
8 changes: 4 additions & 4 deletions python/openrave.py.in
Expand Up @@ -86,8 +86,8 @@ if __name__ == "__main__":
m=__import__('openravepy.databases.'+name)
if type(m) is ModuleType:
print name
except ImportError:
pass
except ImportError, e:
print e

RaveDestroy()
sys.exit(0)
Expand All @@ -99,8 +99,8 @@ if __name__ == "__main__":
m=__import__('openravepy.examples.'+name)
if type(m) is ModuleType:
print name
except ImportError:
pass
except ImportError, e:
print e

RaveDestroy()
sys.exit(0)
Expand Down
1 change: 1 addition & 0 deletions src/libopenrave/libopenrave.h
Expand Up @@ -48,6 +48,7 @@
#include <set>
#include <string>
#include <algorithm>
#include <complex>

#define FOREACH(it, v) for(typeof((v).begin())it = (v).begin(), __itend__=(v).end(); it != __itend__; (it)++)
#define FOREACH_NOINC(it, v) for(typeof((v).begin())it = (v).begin(), __itend__=(v).end(); it != __itend__; )
Expand Down

0 comments on commit 33a19b4

Please sign in to comment.