|
From: <rdi...@us...> - 2008-11-19 02:35:27
|
Revision: 6960
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=6960&view=rev
Author: rdiankov
Date: 2008-11-19 02:35:25 +0000 (Wed, 19 Nov 2008)
Log Message:
-----------
added parsing and loading tests for openrave robots
Modified Paths:
--------------
pkg/trunk/3rdparty/openrave/Makefile
pkg/trunk/robot_descriptions/openrave_robot_description/CMakeLists.txt
pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml
Added Paths:
-----------
pkg/trunk/robot_descriptions/openrave_robot_description/test/
pkg/trunk/robot_descriptions/openrave_robot_description/test/test_robots.cpp
Modified: pkg/trunk/3rdparty/openrave/Makefile
===================================================================
--- pkg/trunk/3rdparty/openrave/Makefile 2008-11-19 02:23:15 UTC (rev 6959)
+++ pkg/trunk/3rdparty/openrave/Makefile 2008-11-19 02:35:25 UTC (rev 6960)
@@ -2,7 +2,7 @@
SVN_DIR = openrave_svn
# Should really specify a revision
-SVN_REVISION = -r 473
+SVN_REVISION = -r 474
SVN_URL = https://openrave.svn.sourceforge.net/svnroot/openrave
include $(shell rospack find mk)/svn_checkout.mk
Modified: pkg/trunk/robot_descriptions/openrave_robot_description/CMakeLists.txt
===================================================================
--- pkg/trunk/robot_descriptions/openrave_robot_description/CMakeLists.txt 2008-11-19 02:23:15 UTC (rev 6959)
+++ pkg/trunk/robot_descriptions/openrave_robot_description/CMakeLists.txt 2008-11-19 02:35:25 UTC (rev 6960)
@@ -6,8 +6,11 @@
# find needed paths
find_ros_package(wg_robot_description)
find_ros_package(openrave_robot_description)
+find_ros_package(openrave)
get_target_property(urdf2openrave_exe urdf2openrave LOCATION)
+set(robot_files )
+
# process all urdf files
set(PR2_OUTPUT ${openrave_robot_description_PACKAGE_PATH}/robots/pr2.robot.xml)
set(PR2_INPUT ${wg_robot_description_PACKAGE_PATH}/pr2/pr2.xml)
@@ -16,6 +19,11 @@
COMMAND ${urdf2openrave_exe}
ARGS ${PR2_INPUT} ${PR2_OUTPUT} ../models
DEPENDS ${PR2_INPUT} urdf2openrave)
+set(robot_files ${robot_files} ${PR2_OUTPUT})
-add_custom_target(pr2_urdf ALL DEPENDS ${PR2_OUTPUT})
-add_dependencies(pr2_urdf urdf2openrave)
+add_custom_target(urdf_robots ALL DEPENDS ${robot_files})
+add_dependencies(urdf_robots urdf2openrave)
+
+# add the test package
+rospack_add_gtest(test_or_robots test/test_robots.cpp)
+set_target_properties(test_or_robots PROPERTIES COMPILE_FLAGS "-DROBOT_FILES=\\\"${robot_files}\\\" -DOPENRAVE_EXECUTABLE=\\\"${openrave_PACKAGE_PATH}/bin/openrave\\\"")
Added: pkg/trunk/robot_descriptions/openrave_robot_description/test/test_robots.cpp
===================================================================
--- pkg/trunk/robot_descriptions/openrave_robot_description/test/test_robots.cpp (rev 0)
+++ pkg/trunk/robot_descriptions/openrave_robot_description/test/test_robots.cpp 2008-11-19 02:35:25 UTC (rev 6960)
@@ -0,0 +1,50 @@
+#include <gtest/gtest.h>
+#include <cstdlib>
+#include <string>
+#include <iostream>
+using namespace std;
+
+int runExternalProcess(const std::string &executable, const std::string &args)
+{
+ return system((executable + " " + args).c_str());
+}
+
+vector<string> tokenizer(string str, string delims)
+{
+ vector<string> tokens;
+ int pos, pos2;
+ pos = str.find_first_not_of(delims, 0);
+
+ while (pos >= 0)
+ {
+ pos2 = str.find_first_of(delims, pos);
+ if (pos2 < 0) pos2 = str.length();
+ tokens.push_back(str.substr(pos, pos2-pos));
+ pos = str.find_first_not_of(delims, pos2);
+ }
+ return tokens;
+}
+
+TEST(URDF, LoadRobots)
+{
+ bool bSuccess = true;
+ vector<string> files = tokenizer(ROBOT_FILES,"; \r\n");
+ for(vector<string>::iterator it = files.begin(); it != files.end(); ++it) {
+ cout << "testing: " << *it << "... ";
+ int result = runExternalProcess(OPENRAVE_EXECUTABLE, *it + string(" -testscene"));
+ if( result != 0 ) {
+ bSuccess = false;
+ cout << "fail." << endl;
+ }
+ else
+ cout << "success." << endl;
+ }
+
+ EXPECT_TRUE(bSuccess);
+}
+
+int main(int argc, char **argv)
+{
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
Modified: pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml
===================================================================
--- pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml 2008-11-19 02:23:15 UTC (rev 6959)
+++ pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml 2008-11-19 02:35:25 UTC (rev 6960)
@@ -3,7 +3,7 @@
<description brief="Robot Descriptions">
This package contains XML descriptions of robots in the format
- defined at Willow Garage.
+ defined at Willow Garage along with the triangle meshes of each of the links (in stl format).
</description>
<author>Sachin Chitta, John Hsu</author>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|