Skip to content

Commit

Permalink
Merge pull request #4 from k-okada/catkin_support
Browse files Browse the repository at this point in the history
Catkin support
  • Loading branch information
fkanehiro committed Aug 28, 2014
2 parents 5d8109e + 437d872 commit 25dd3a3
Show file tree
Hide file tree
Showing 9 changed files with 450 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language:
- cpp
- python
python:
- "2.7"
compiler:
- gcc
before_install: # Use this to prepare the system to install prerequisites or dependencies
# Define some config vars
- export CI_SOURCE_PATH=$(pwd)
- export REPOSITORY_NAME=${PWD##*/}
- echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME"
- sudo sh -c 'echo "deb http://packages.ros.org/ros-shadow-fixed/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
- sudo apt-get update -qq
install: # Use this to install any prerequisites or dependencies necessary to run your build
- sudo apt-get install -qq -y f2c libf2c2 libf2c2-dev doxygen cmake libeigen3-dev libjpeg-dev collada-dom-dev git jython libatlas-base-dev libboost-all-dev libpng12-dev
- sudo apt-get install -qq -y ros-hydro-openrtm-aist ros-hydro-openrtm-aist-python ros-hydro-mk ros-hydro-rosbuild ros-hydro-rostest ros-hydro-roslang
- cd $CI_SOURCE_PATH
before_script: # Use this to prepare your build for testing e.g. copy database configurations, environment variables, etc.
- source /opt/ros/hydro/setup.bash
script: # All commands must exit with code 0 on success. Anything else is considered failure.
- mkdir -p ~/ws/src
- ln -sf ${CI_SOURCE_PATH} ~/ws/src/${REPOSITORY_NAME}
- cd ~/ws
- sudo ln -sf /opt/ros/hydro/lib/openrtm_aist/bin/rtm-config /opt/ros/hydro/bin/rtm-config ## temp code
- catkin_make
- catkin_make test
- catkin_make install
after_failure:
36 changes: 36 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package openhrp3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

3.1.5-6 (2014-04-15)
--------------------
* remove installed file if openhrp3_FOUND is not found
* Give installed libraries execute permissions
All shared object libraries should have execute permissions. Using install will default the permissions to be like a normal file, which typically doesn't have execute permissions.
* Fix python syntax errors
You cannot define a function called exec. This patch renames it to Exec.
* Handle non-existent lsb-release file
This file is not present on Fedora systems.
* test_openhrp3.py: add test for samplerobot walking pattern data file
* test_openhpr3.py: add test code to check hrpsys-base
* add test code to check if file exists
* add start_omninames.sh start starts omniNames for test code, use port 2809 for test
* add test sample1.wrl location
* Add rostest for rosbuid, also improve .travis.yml to check rosbulid/deb environment
* (Makefile.openhrp3) touch patched_no_makefile to avoid compile twice
* add PKG_CONFIG_PATH for rosbuild environment
* (.travis.yml) add rosbuild/deb test
* (`#32 <https://github.com/start-jsk/openhrp3/issues/32>`_) add roslang for manifest.xml and package.xml
* (`#24 <https://github.com/start-jsk/openhrp3/issues/24>`_) add rosbuild, see https://github.com/ros/ros/issues/47
* check rosdep until it succeeded
* Fix cblas on Linux.
* Fix Boost linker error (remove -mt suffix).
* add link to issues for each patchs
* update travis to check rosbuild/catkin, use_deb/use_source
* Contributors: Benjamin Chrétien, Kei Okada, Scott Logan, Isaac Isao Saito

3.1.5-5 (2014-03-04)
--------------------
* Fix to an issue that caused https://github.com/start-jsk/hrpsys/issues/25
* Initial commit of CHANGELOG.rst
* Contributors: Kei Okada, chen.jsk, Ryohei Ueda, Isaac Isao Saito, Hiroyuki Mikita, Iori Kumagai, Takuya Nakaoka, Shunichi Nozawa, Rosen Diankov, Yohei Kakiuchi
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -554,3 +554,26 @@ if(ENABLE_CPACK)
endif(GENERATE_DEBIANPACKAGE)
endif(ENABLE_CPACK)

#if catkin environment
if(CATKIN_DEVEL_PREFIX) # for catkin_make
message("[openhrp3] compile under catkin environment")

# create symlink for share
execute_process(COMMAND cmake -E make_directory share WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
execute_process(COMMAND cmake -E create_symlink ${PROJECT_SOURCE_DIR} share/OpenHRP-3.1 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})

## rostest
find_package(rostest)
if(rostest_FOUND)
add_rostest(test/test_openhrp3.test)
add_rostest(test/test_modelloader.test)
endif()

# install
install(FILES package.xml DESTINATION share/openhrp3/)
install(DIRECTORY test DESTINATION share/openhrp3 USE_SOURCE_PERMISSIONS)
install(DIRECTORY sample idl java DESTINATION share/openhrp3/share/OpenHRP-3.1 USE_SOURCE_PERMISSIONS)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/server/ModelLoader/openhrp-model-loader DESTINATION lib/openhrp3)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/server/ModelLoader/export-collada DESTINATION lib/openhrp3)

endif()
52 changes: 52 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<package>
<name>openhrp3</name>
<version>3.1.5</version>
<description>
<p>This package does not only wrap <a href = "http://www.openrtp.jp/openhrp3/en/index.html">OpenHRP3</a> but actually provides the built artifact from the code from its <a href = "https://openrtp.jp/svn/hrg/openhrp">mainstream repository</a>. Being ROS-agnostic by itself, you can also use this via ROS together with the packages in <a href = "http://www.ros.org/wiki/rtmros_common">rtmros_common</a> that bridge between two framework.</p>
<p><i>OpenHRP3 (Open Architecture Human-centered Robotics Platform version 3) is an integrated software platform for robot simulations and software developments. It allows the users to inspect an original robot model and control program by dynamics simulation. In addition, OpenHRP3 provides various software components and calculation libraries that can be used for robotics related software developments</i> (<a href = "http://www.openrtp.jp/openhrp3/en/about.html">excerpts from here</a>). </p>
<p>The package version number is synchronized to that of mainstream, based on <a href = "http://code.google.com/p/rtm-ros-robotics/issues/detail?id=165#c5">this decision</a>.</p>
</description>
<maintainer email="[email protected]">Kei Okada</maintainer>
<maintainer email="[email protected]">Isao Isaac Saito</maintainer>
<author>AIST</author>
<author>General Robotix Inc.</author>
<author>Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo</author>
<license>EPL</license>

<url type="website">https://openrtp.jp/svn/hrg/openhrp/</url>
<url type="bugtracker">https://openrtp.jp/redmine/</url>

<buildtool_depend>cmake</buildtool_depend>

<build_depend>atlas</build_depend>
<build_depend>boost</build_depend>
<build_depend>collada-dom</build_depend>
<build_depend>doxygen</build_depend>
<build_depend>eigen</build_depend>
<build_depend>f2c</build_depend>
<build_depend>jython</build_depend>
<build_depend>libjpeg</build_depend>
<build_depend>libpng12-dev</build_depend>
<build_depend>openrtm_aist</build_depend>
<build_depend>openrtm_aist_python</build_depend>
<build_depend>git</build_depend>
<build_depend>mk</build_depend>
<build_depend>rosbuild</build_depend>
<build_depend>rostest</build_depend>
<build_depend>roslang</build_depend>

<run_depend>atlas</run_depend>
<run_depend>boost</run_depend>
<run_depend>collada-dom</run_depend>
<run_depend>eigen</run_depend>
<run_depend>f2c</run_depend>
<run_depend>jython</run_depend>
<run_depend>libjpeg</run_depend>
<run_depend>libpng12-dev</run_depend>
<run_depend>openrtm_aist</run_depend>
<run_depend>openrtm_aist_python</run_depend>

<export>

</export>
</package>
9 changes: 9 additions & 0 deletions test/start_omninames.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

PORT=${1:-2809}

mkdir -p /tmp/omniNames-logdir-$$

trap 'rm -fr /tmp/omniNames-logdir-$$' HUP INT QUIT TERM
omniNames -start $PORT -logdir /tmp/omniNames-logdir-$$ || echo -e "\e[31momniNames is laready running at $PORT\e[m"

157 changes: 157 additions & 0 deletions test/test_modelloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
#!/usr/bin/env python

PKG = 'openhrp3'
NAME = 'modelloader-test'

try: # catkin does not requires load_manifest
import openhrp3
except:
import roslib; roslib.load_manifest("openhrp3")

#import OpenRTM_aist.RTM_IDL # for catkin

from omniORB import CORBA, any, cdrUnmarshal, cdrMarshal
import CosNaming

import sys, os, socket

import OpenRTM_aist
from OpenHRP3 import *

import rospkg
import unittest
import rostest

rootrc = None
# set custom port for modelloader-test.launch
def initCORBA():
global rootnc
#nshost = socket.gethostname()
#nsport = 15005

# initCORBA
#os.environ['ORBInitRef'] = 'NameService=corbaloc:iiop:{0}:{1}/NameService'.format(nshost,nsport)
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)

nameserver = orb.resolve_initial_references("NameService");
rootnc = nameserver._narrow(CosNaming.NamingContext)

def findModelLoader():
global rootnc
try:
obj = rootnc.resolve([CosNaming.NameComponent('ModelLoader', '')])
return obj._narrow(ModelLoader_idl._0_OpenHRP__POA.ModelLoader)
except:
print "Could not find ModelLoader", sys.exc_info()[0]
exit

def equal(a, b, tol = 1e-4):
if type(a) == float and type(b) == float:
return abs(a - b) < tol
if type(a) == list and type(b) == list:
return all(equal(x,y) for (x,y) in zip(a,b))
else:
return True

def norm(a):
r = 0
for e in a:
r = r + e*e
return r/len(a)

class TestModelLoaderBase(unittest.TestCase):
ml = None
wrl_url = None
dae_url = None
wrl_binfo = None
dae_binfo = None
wrl_links = None
dae_links = None

def setUp(self):
initCORBA()
self.ml = findModelLoader()

def print_ok(self, fmt, ok):
s = '\033[0m' if ok else '\033[91m'
e = '\033[0m'
str = s+"{0:70} {1}".format(fmt, ok)+e
print str
self.assertTrue(ok,str)

def loadFiles(self, wrl_file, dae_file):
""" Override this method for loading model files from another directory """
self.wrl_url = rospkg.RosPack().get_path("openhrp3")+"/share/OpenHRP-3.1/sample/model/"+wrl_file
self.dae_url = rospkg.RosPack().get_path("openhrp3")+"/share/OpenHRP-3.1/sample/model/"+dae_file
self.wrl_binfo = self.ml.getBodyInfo(self.wrl_url)
self.dae_binfo = self.ml.getBodyInfo(self.dae_url)
self.wrl_links = self.wrl_binfo._get_links()
self.dae_links = self.dae_binfo._get_links()

def checkModels(self, wrl_file, dae_file):
self.loadFiles(wrl_file, dae_file)
ret = True
print "%16s %16s"%(wrl_file, dae_file)
for (wrl_l, dae_l) in zip(self.wrl_links, self.dae_links) :
# 'centerOfMass', 'childIndices', 'climit', 'encoderPulse', 'gearRatio', 'hwcs', 'inertia', 'inlinedShapeTransformMatrices', 'jointAxis', 'jointId', 'jointType', 'jointValue', 'lights', 'llimit', 'lvlimit', 'mass', 'name', 'parentIndex', 'rotation', 'rotorInertia', 'rotorResistor', 'segments', 'sensors', 'shapeIndices', 'specFiles', 'torqueConst', 'translation', 'ulimit', 'uvlimit'
print ";; %s %d,%d"%(dae_l.name, dae_l.jointId, dae_l.parentIndex);
name_ok = wrl_l.name == dae_l.name
translation_ok = equal(wrl_l.translation, dae_l.translation)
rotation_ok = equal(norm(wrl_l.rotation), norm(dae_l.rotation))
mass_ok = equal(wrl_l.mass, dae_l.mass)
centerOfMass_ok = equal(wrl_l.centerOfMass, dae_l.centerOfMass)
inertia_ok = equal(wrl_l.inertia, dae_l.inertia)
llimit_ok = equal(wrl_l.llimit, dae_l.llimit) if wrl_l.parentIndex > 0 else True
ulimit_ok = equal(wrl_l.ulimit, dae_l.ulimit) if wrl_l.parentIndex > 0 else True
lvlimit_ok = equal(wrl_l.lvlimit, dae_l.lvlimit) if wrl_l.parentIndex > 0 else True
uvlimit_ok = equal(wrl_l.uvlimit, dae_l.uvlimit) if wrl_l.parentIndex > 0 else True
climit_ok = equal(wrl_l.climit, dae_l.climit) if wrl_l.parentIndex > 0 else True
torqueConst_ok = equal(wrl_l.torqueConst, dae_l.torqueConst) if wrl_l.parentIndex > 0 else True
gearRatio_ok = equal(wrl_l.gearRatio, dae_l.gearRatio) if wrl_l.parentIndex > 0 else True
ret = all([ret, name_ok, translation_ok, rotation_ok, mass_ok, centerOfMass_ok])
self.print_ok("name {0:24s} {1:24s} ".format(wrl_l.name, dae_l.name), True)#) ## not fixed yet
self.print_ok(" tran {0:24} {1:24}".format(wrl_l.translation, dae_l.translation), translation_ok)
self.print_ok(" rot {0:24} {1:24}".format(wrl_l.rotation, dae_l.rotation), rotation_ok)
self.print_ok(" mass {0:<24} {1:<24}".format(wrl_l.mass, dae_l.mass), mass_ok)
self.print_ok(" CoM {0:24} {1:24}".format(wrl_l.centerOfMass, dae_l.centerOfMass), centerOfMass_ok)
self.print_ok(" iner {0:50}\n {1:50}".format(wrl_l.inertia, dae_l.inertia), inertia_ok)
self.print_ok(" llim {0:24} {1:24}".format(wrl_l.llimit, dae_l.llimit), llimit_ok)
self.print_ok(" ulim {0:24} {1:24}".format(wrl_l.ulimit, dae_l.ulimit), ulimit_ok)
self.print_ok(" lvlim {0:24} {1:24}".format(wrl_l.lvlimit, dae_l.lvlimit), lvlimit_ok)
self.print_ok(" uvlim {0:24} {1:24}".format(wrl_l.uvlimit, dae_l.uvlimit), uvlimit_ok)
self.print_ok(" clim {0:24} {1:24}".format(wrl_l.climit, dae_l.climit), climit_ok)
self.print_ok(" trqcnt {0:24} {1:24}".format(wrl_l.torqueConst, dae_l.torqueConst), torqueConst_ok)
self.print_ok(" gratio {0:24} {1:24}".format(wrl_l.gearRatio, dae_l.gearRatio), gearRatio_ok)
for (wrl_s, dae_s) in zip(wrl_l.segments, dae_l.segments):
# name, mass, centerOfMass, inertia, transformMatrix, shapeIndices
name_ok = wrl_s.name == dae_s.name
mass_ok = equal(wrl_s.mass, dae_s.mass)
centerOfMass_ok = equal(wrl_s.centerOfMass, dae_s.centerOfMass)
inertia_ok = equal(wrl_s.inertia, dae_s.inertia)
transformMatrix_ok = equal(wrl_s.transformMatrix, dae_s.transformMatrix)
shapeIndices_ok = equal(wrl_s.shapeIndices, dae_s.shapeIndices)
ret = all([ret, name_ok, mass_ok, centerOfMass_ok,inertia_ok, transformMatrix_ok, shapeIndices_ok])
self.print_ok(" name {0:24s} {1:24s} ".format(wrl_s.name, dae_s.name), name_ok)
self.print_ok(" mass {0:<24} {1:<24}".format(wrl_s.mass, dae_s.mass), mass_ok)
self.print_ok(" CoM {0:24} {1:24}".format(wrl_s.centerOfMass, dae_s.centerOfMass), centerOfMass_ok)
self.print_ok(" iner {0:50}\n {1:50}".format(wrl_s.inertia, dae_s.inertia), inertia_ok)
self.print_ok(" trans {0:50}\n {1:50}".format(wrl_s.transformMatrix, dae_s.transformMatrix), transformMatrix_ok)
self.print_ok(" shape {0:24} {1:24}".format(wrl_s.shapeIndices, dae_s.shapeIndices), shapeIndices_ok)

if not ret:
print "===========\n== ERROR == {0} and {1} differs\n===========".format(wrl_file, dae_file)
return ret

class TestModelLoader(TestModelLoaderBase):
""" Make class for testing by inheriting TestModelLoaderBase """
def test_sample_models(self):
self.checkModels("sample.wrl","sample.dae")

def test_pa10(self):
self.checkModels("PA10/pa10.main.wrl","PA10/pa10.dae")

#def test_3dof_arm(self):
# self.checkModels("sample3dof.wrl","sample3dof.dae")

if __name__ == '__main__':
rostest.run(PKG, NAME, TestModelLoader, sys.argv)
12 changes: 12 additions & 0 deletions test/test_modelloader.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<launch>
<!-- BEGIN:common setting -->
<env name="LANG" value="C" />
<env name="ORBgiopMaxMsgSize" value="2147483648" />
<!-- END:common setting -->

<node name="start_omninames" pkg="openhrp3" type="start_omninames.sh" args="2809" />

<node name="modelloader" pkg="openhrp3" type="openhrp-model-loader" />

<test test-name="test_modelloader" pkg="openhrp3" type="test_modelloader.py" />
</launch>
Loading

0 comments on commit 25dd3a3

Please sign in to comment.