|
From: <vij...@us...> - 2008-12-18 07:48:30
|
Revision: 8325
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8325&view=rev
Author: vijaypradeep
Date: 2008-12-18 07:48:25 +0000 (Thu, 18 Dec 2008)
Log Message:
-----------
Lots of changes to point_cloud_assembler:
- point_cloud_assembler renamed to laser_scan_assembler_srv
- Added more parameters
- TF Exceptions for nicely handled
- No more printfs. using rosout messages instead. Better diagnostic messages being outputted
Added a PointCloudAssemblerSrv to combine clouds from filters like the ScanShadowFilter.
Removed printfs from the snapshotter.
Updated example launch scripts for building snapshots.
Fixed some scripts because of the laser_controller->laser_tilt_controller name change
Forgot to add unsubscribe call to snapshotter
Modified Paths:
--------------
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_snapshotter.cpp
pkg/trunk/robot_descriptions/wg_robot_description/laser_tilt/control_laser_tilt_roslaunch.xml
pkg/trunk/robot_descriptions/wg_robot_description/tilt_laser_deprecated/build_snapshots.launch
Added Paths:
-----------
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp
Removed Paths:
-------------
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler.cpp
Modified: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt 2008-12-18 07:25:32 UTC (rev 8324)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt 2008-12-18 07:48:25 UTC (rev 8325)
@@ -3,7 +3,8 @@
rospack(point_cloud_assembler)
gensrv()
-rospack_add_executable(point_cloud_assembler src/point_cloud_assembler.cpp)
+rospack_add_executable(laser_scan_assembler_srv src/laser_scan_assembler_srv.cpp)
+rospack_add_executable(point_cloud_assembler_srv src/point_cloud_assembler_srv.cpp)
rospack_add_executable(grab_cloud_data src/grab_cloud_data.cpp)
rospack_add_executable(point_cloud_snapshotter src/point_cloud_snapshotter.cpp)
Copied: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp (from rev 8322, pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler.cpp)
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp (rev 0)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp 2008-12-18 07:48:25 UTC (rev 8325)
@@ -0,0 +1,268 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+* Copyright (c) 2008, Willow Garage, Inc.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of the Willow Garage nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+
+
+/**
+
+@mainpage
+
+@htmlinclude manifest.html
+
+@b LaserScanAssemblerSrv accumulates scan lines from a laser range finder mounted on a tilting stage and generates 3D point clouds.
+
+<hr>
+
+@section usage Usage
+
+To use this node, the tilting stage and laser have to be started. A convenient method for starting them is on the way, perhaps as a script.
+
+@par Example
+
+<hr>
+
+@section topic ROS topics
+
+Subscribes to (name/type):
+- @b "scan"/<a href="../../std_msgs/html/classstd__msgs_1_1LaserScan.html">LaserScan</a> : laser scan data
+
+<hr>
+
+@section parameters ROS parameters
+
+ **/
+
+
+#include "ros/node.h"
+#include "tf/transform_listener.h"
+#include "std_msgs/LaserScan.h"
+#include "std_msgs/PointCloud.h"
+
+#include <deque>
+
+
+// Service
+#include "point_cloud_assembler/BuildCloud.h"
+
+// Laser projection
+#include "laser_scan/laser_scan.h"
+
+#include "math.h"
+
+using namespace std_msgs;
+
+using namespace std ;
+
+namespace point_cloud_assembler
+{
+
+/**
+ * \brief Maintains a history of laser scans and generates a point cloud upon request
+ * \todo Clean up the doxygen part of this header
+ * params
+ * * "~tf_cache_time_secs" (double) - The cache time (in seconds) to holds past transforms
+ * * "~tf_extrap_limit" (double) - The extrapolation limit for TF (in seconds)
+ * * "~max_scans" (unsigned int) - The number of scans to store in the assembler's history, until they're thrown away
+ * * "~ignore_laser_skew" (bool) - Specifies the method to project laser data
+ * * true -> Account for laser skew, and compute the transform for each laser point (This is currently really slow!)
+ * * false-> Don't account for laser skew, and use 1 transform per scanline. (This might have a little error when moving fast)
+ */
+class LaserScanAssemblerSrv : public ros::node
+{
+public:
+
+ tf::TransformListener* tf_;
+ laser_scan::LaserProjection projector_;
+
+ LaserScan scan_;
+
+ unsigned int max_scans_ ;
+ bool ignore_laser_skew_ ;
+
+ deque<LaserScan> scan_hist_ ; //!< Stores history of scans. We want them in time-ordered, which is (in most situations) the same as time-of-receipt-ordered
+ unsigned int total_pts_ ; //!< Stores the total number of range points in the entire stored history of scans. Useful for estimating points/scan
+
+
+ LaserScanAssemblerSrv() : ros::node("point_cloud_assembler")
+ {
+ // **** Initialize TransformListener ****
+ double tf_cache_time_secs ;
+ param("~tf_cache_time_secs", tf_cache_time_secs, 10.0) ;
+ if (tf_cache_time_secs < 0)
+ ROS_ERROR("Parameter tf_cache_time_secs<0 (%f)", tf_cache_time_secs) ;
+ unsigned long long tf_cache_time = tf_cache_time_secs*1000000000ULL ;
+ tf_ = new tf::TransformListener(*this, true, tf_cache_time) ;
+ ROS_INFO("TF Cache Time: %f Seconds", tf_cache_time_secs) ;
+
+ // **** Set TF Extrapolation Limit ****
+ double tf_extrap_limit_secs ;
+ param("~tf_extrap_limit", tf_extrap_limit_secs, 0.01) ;
+ if (tf_extrap_limit_secs < 0.0)
+ ROS_ERROR("Parameter tf_extrap_limit<0 (%f)", tf_extrap_limit_secs) ;
+
+ ros::Duration extrap_limit ;
+ extrap_limit.fromSec(tf_extrap_limit_secs) ;
+ tf_->setExtrapolationLimit(extrap_limit) ;
+ ROS_INFO("TF Extrapolation Limit: %f Seconds", tf_extrap_limit_secs) ;
+
+ // ***** Set max_scans *****
+ const int default_max_scans = 400 ;
+ int tmp_max_scans;
+ param("~max_scans", tmp_max_scans, default_max_scans) ;
+ if (tmp_max_scans < 0)
+ {
+ ROS_ERROR("Parameter max_scans<0 (%i)", tmp_max_scans) ;
+ tmp_max_scans = default_max_scans ;
+ }
+ max_scans_ = tmp_max_scans;
+ ROS_INFO("Max Scans in History: %u", max_scans_) ;
+ total_pts_ = 0 ; // We're always going to start with no points in our history
+
+ // ***** Set Laser Projection Method *****
+ param("~ignore_laser_skew", ignore_laser_skew_, true) ;
+
+ // ***** Start Services *****
+ advertise_service(get_name()+"/build_cloud", &LaserScanAssemblerSrv::buildCloud, this, 0) ; // Don't spawn threads so that we can avoid dealing with mutexing [for now]
+ subscribe("scan", scan_, &LaserScanAssemblerSrv::scans_callback, 40) ; // Choose something reasonably large, so data doesn't get dropped
+ }
+
+ ~LaserScanAssemblerSrv()
+ {
+ unadvertise_service(get_name()+"/build_cloud") ;
+ unsubscribe("scan") ;
+ delete tf_ ;
+ }
+
+ void scans_callback()
+ {
+ if (scan_hist_.size() == max_scans_) // Is our deque full?
+ {
+ total_pts_ -= scan_hist_.front().get_ranges_size() ; // We're removing an elem, so this reduces our total point count
+ scan_hist_.pop_front() ; // The front of the deque has the oldest elem, so we can get rid of it
+ }
+
+ scan_hist_.push_back(scan_) ; // Add the newest scan to the back of the deque
+ total_pts_ += scan_.get_ranges_size() ; // Add the new scan to the running total of points
+
+ //printf("LaserScanAssemblerSrv:: Got Scan: TotalPoints=%u", total_pts_) ;
+ }
+
+ bool buildCloud(BuildCloud::request& req, BuildCloud::response& resp)
+ {
+ // Allocate space for the cloud
+ resp.cloud.set_pts_size( total_pts_ ) ; // There's no way to have a point cloud bigger than our entire history of scans.
+ resp.cloud.set_chan_size(1) ;
+ resp.cloud.chan[0].name = "intensities" ;
+ resp.cloud.chan[0].set_vals_size( total_pts_ ) ;
+
+ unsigned int cloud_count = 0 ; // Store the number of points in the current cloud
+
+ PointCloud projector_cloud ; // Stores the current scan after being projected into the laser frame
+ PointCloud target_frame_cloud ; // Stores the current scan in the target frame
+
+ unsigned int i = 0 ;
+
+ // Find the beginning of the request. Probably should be a search
+ while ( i < scan_hist_.size() && // Don't go past end of deque
+ scan_hist_[i].header.stamp < req.begin ) // Keep stepping until we've exceeded the start time
+ {
+ i++ ;
+ }
+
+ unsigned int start_index = i ;
+
+ unsigned int tf_ex_count = 0 ; // Keep a count of how many TF exceptions we got (for diagnostics)
+ unsigned int scan_lines_count = 0 ; // Keep a count of how many scan lines we agregated (for diagnostics)
+
+ // Populate the cloud
+ while ( i < scan_hist_.size() && // Don't go past end of deque
+ scan_hist_[i].header.stamp < req.end ) // Don't go past the end-time of the request
+ {
+ const LaserScan& cur_scan = scan_hist_[i] ;
+
+ try
+ {
+ if (ignore_laser_skew_) // Do it the fast (approximate) way
+ {
+ projector_.projectLaser(cur_scan, projector_cloud) ;
+ tf_->transformPointCloud(req.target_frame_id, projector_cloud, target_frame_cloud) ;
+ }
+ else // Do it the slower (more accurate) way
+ {
+ projector_.transformLaserScanToPointCloud(req.target_frame_id, target_frame_cloud, cur_scan, *tf_) ;
+ }
+
+ for(unsigned int j = 0; j < target_frame_cloud.get_pts_size(); j++) // Populate full_cloud from the cloud
+ {
+ resp.cloud.pts[cloud_count].x = target_frame_cloud.pts[j].x ;
+ resp.cloud.pts[cloud_count].y = target_frame_cloud.pts[j].y ;
+ resp.cloud.pts[cloud_count].z = target_frame_cloud.pts[j].z ;
+ resp.cloud.chan[0].vals[cloud_count] = target_frame_cloud.chan[0].vals[j] ;
+ cloud_count++ ;
+ }
+ resp.cloud.header = target_frame_cloud.header ; // Find a better place to do this/way to do this
+ }
+ catch(tf::TransformException& ex)
+ {
+ //ROS_WARN("Transform Exception %s", ex.what()) ;
+ tf_ex_count++ ;
+ }
+
+ scan_lines_count++ ;
+ i++ ; // Check the next scan in the scan history
+ }
+ int end_index = i ;
+
+ resp.cloud.set_pts_size( cloud_count ) ; // Resize the output accordingly
+ resp.cloud.chan[0].set_vals_size( cloud_count ) ;
+
+ ROS_INFO("Point Cloud Results: Agregated from index %u->%u. Total ScanLines: %u. BufferSize: %u", start_index, end_index, scan_lines_count, scan_hist_.size()) ;
+ if (tf_ex_count > 0)
+ ROS_WARN("%u TF Exceptions while generating Point Cloud", tf_ex_count) ;
+
+ return true ;
+ }
+};
+
+}
+
+using namespace point_cloud_assembler ;
+
+int main(int argc, char **argv)
+{
+ ros::init(argc, argv);
+ LaserScanAssemblerSrv pc_assembler;
+ pc_assembler.spin();
+ ros::fini();
+ return 0;
+}
Deleted: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler.cpp
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler.cpp 2008-12-18 07:25:32 UTC (rev 8324)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler.cpp 2008-12-18 07:48:25 UTC (rev 8325)
@@ -1,227 +0,0 @@
-/*********************************************************************
-* Software License Agreement (BSD License)
-*
-* Copyright (c) 2008, Willow Garage, Inc.
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of the Willow Garage nor the names of its
-* contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*********************************************************************/
-
-
-/**
-
-@mainpage
-
-@htmlinclude manifest.html
-
-@b point_cloud_assembler accumulates scan lines from a laser range finder mounted on a tilting stage and generates 3D point clouds.
-
-<hr>
-
-@section usage Usage
-
-To use this node, the tilting stage and laser have to be started. A convenient method for starting them is on the way, perhaps as a script.
-
-@par Example
-
-<hr>
-
-@section topic ROS topics
-
-Subscribes to (name/type):
-- @b "scan"/<a href="../../std_msgs/html/classstd__msgs_1_1LaserScan.html">LaserScan</a> : laser scan data
-
-<hr>
-
-@section parameters ROS parameters
-
- **/
-
-
-#include "ros/node.h"
-#include "tf/transform_listener.h"
-#include "std_msgs/LaserScan.h"
-#include "std_msgs/PointCloud.h"
-
-#include <deque>
-
-
-// Service
-#include "point_cloud_assembler/BuildCloud.h"
-
-// Laser projection
-#include "laser_scan/laser_scan.h"
-
-#include "math.h"
-
-using namespace std_msgs;
-
-using namespace std ;
-
-namespace point_cloud_assembler
-{
-
-class PointCloudAssembler : public ros::node
-{
-public:
-
- tf::TransformListener tf_;
- laser_scan::LaserProjection projector_;
-
- LaserScan scan_;
-
- unsigned int max_scans_ ;
- bool ignore_laser_skew_ ;
-
- deque<LaserScan> scan_hist_ ; //!< Stores history of scans. We want them in time-ordered, which is (in most situations) the same as time-of-receipt-ordered
- unsigned int total_pts_ ; //!< Stores the total number of range points in the entire stored history of scans. Useful for estimating points/scan
-
-
- PointCloudAssembler() : ros::node("point_cloud_assembler"), tf_(*this)
- {
- tf_.setExtrapolationLimit(ros::Duration().fromSec(1.0)) ;
-
- advertise_service("build_cloud", &PointCloudAssembler::buildCloud, this, 0) ; // Don't spawn threads so that we can avoid dealing with mutexing [for now]
- subscribe("scan", scan_, &PointCloudAssembler::scans_callback, 40) ;
-
- int tmp_max_scans;
- param("point_cloud_assembler/max_scans", tmp_max_scans, 400) ;
- if (tmp_max_scans < 0)
- tmp_max_scans = 400;
-
- max_scans_ = tmp_max_scans;
-
- param("~ignore_laser_skew", ignore_laser_skew_, true) ;
-
- total_pts_ = 0 ; // We're always going to start with no points in our history
- }
-
- virtual ~PointCloudAssembler()
- {
- unadvertise_service("build_cloud") ;
- unsubscribe("scan") ;
- }
-
- void scans_callback()
- {
- if (scan_hist_.size() == max_scans_) // Is our deque full?
- {
- total_pts_ -= scan_hist_.front().get_ranges_size() ; // We're removing an elem, so this reduces our total point count
- scan_hist_.pop_front() ; // The front of the deque has the oldest elem, so we can get rid of it
- }
-
- scan_hist_.push_back(scan_) ; // Add the newest scan to the back of the deque
- total_pts_ += scan_.get_ranges_size() ; // Add the new scan to the running total of points
-
- //printf("PointCloudAssembler:: Got Scan: TotalPoints=%u", total_pts_) ;
- }
-
- bool buildCloud(BuildCloud::request& req, BuildCloud::response& resp)
- {
- // Allocate space for the cloud
- resp.cloud.set_pts_size( total_pts_ ) ; // There's no way to have a point cloud bigger than our entire history of scans.
- resp.cloud.set_chan_size(1) ;
- resp.cloud.chan[0].name = "intensities" ;
- resp.cloud.chan[0].set_vals_size( total_pts_ ) ;
-
- unsigned int cloud_count = 0 ; // Store the number of points in the current cloud
-
- PointCloud projector_cloud ; // Stores the current scan after being projected into the laser frame
- PointCloud target_frame_cloud ; // Stores the current scan in the target frame
-
- unsigned int i = 0 ;
-
- // Find the beginning of the request. Probably should be a search
- while ( i < scan_hist_.size() && // Don't go past end of deque
- scan_hist_[i].header.stamp < req.begin ) // Keep stepping until we've exceeded the start time
- {
- i++ ;
- }
-
- printf(" Start i=%u\n", i) ;
-
- // Populate the cloud
- while ( i < scan_hist_.size() && // Don't go past end of deque
- scan_hist_[i].header.stamp < req.end ) // Don't go past the end-time of the request
- {
- const LaserScan& cur_scan = scan_hist_[i] ;
-
- try
- {
- if (ignore_laser_skew_) // Do it the fast (approximate) way
- {
- projector_.projectLaser(cur_scan, projector_cloud) ;
- tf_.transformPointCloud(req.target_frame_id, projector_cloud, target_frame_cloud) ;
- }
- else // Do it the slower (more accurate) way
- {
- projector_.transformLaserScanToPointCloud(req.target_frame_id, target_frame_cloud, cur_scan, tf_) ;
- }
-
- for(unsigned int j = 0; j < target_frame_cloud.get_pts_size(); j++) // Populate full_cloud from the cloud
- {
- resp.cloud.pts[cloud_count].x = target_frame_cloud.pts[j].x ;
- resp.cloud.pts[cloud_count].y = target_frame_cloud.pts[j].y ;
- resp.cloud.pts[cloud_count].z = target_frame_cloud.pts[j].z ;
- resp.cloud.chan[0].vals[cloud_count] = target_frame_cloud.chan[0].vals[j] ;
- cloud_count++ ;
- }
- }
- catch(tf::TransformException& ex)
- {
- ROS_WARN("Transform Exception %s", ex.what()) ;
-
- return true ;
- }
-
- resp.cloud.header = target_frame_cloud.header ; // Find a better place to do this/way to do this
-
- i++ ; // Check the next scan in the scan history
- }
-
- printf(" End i=%u\n", i) ;
-
- resp.cloud.set_pts_size( cloud_count ) ; // Resize the output accordingly
- resp.cloud.chan[0].set_vals_size( cloud_count ) ;
-
- return true ;
- }
-};
-
-}
-
-using namespace point_cloud_assembler ;
-
-int main(int argc, char **argv)
-{
- ros::init(argc, argv);
- PointCloudAssembler pc_assembler;
- pc_assembler.spin();
- ros::fini();
- return 0;
-}
Copied: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp (from rev 8322, pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler.cpp)
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp (rev 0)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp 2008-12-18 07:48:25 UTC (rev 8325)
@@ -0,0 +1,218 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+* Copyright (c) 2008, Willow Garage, Inc.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of the Willow Garage nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+
+#include "ros/node.h"
+#include "tf/transform_listener.h"
+#include "std_msgs/PointCloud.h"
+
+#include <deque>
+
+// Service
+#include "point_cloud_assembler/BuildCloud.h"
+
+// Laser projection
+#include "laser_scan/laser_scan.h"
+
+#include "math.h"
+
+using namespace std_msgs;
+
+using namespace std ;
+
+namespace point_cloud_assembler
+{
+
+/**
+ * \brief Maintains a history of point clouds and generates an aggregate point cloud upon request
+ * \todo Clean up the doxygen part of this header
+ * params
+ * * "~tf_cache_time_secs" (double) - The cache time (in seconds) to holds past transforms
+ * * "~tf_extrap_limit" (double) - The extrapolation limit for TF (in seconds)
+ * * "~max_scans" (unsigned int) - The number of scans to store in the assembler's history, until they're thrown away
+ */
+class PointCloudAssemblerSrv : public ros::node
+{
+public:
+
+ tf::TransformListener* tf_ ;
+
+ PointCloud scan_ ;
+
+ unsigned int max_scans_ ;
+ bool ignore_laser_skew_ ;
+
+ deque<PointCloud> scan_hist_ ; //!< Stores history of scans. We want them in time-ordered, which is (in most situations) the same as time-of-receipt-ordered
+ unsigned int total_pts_ ; //!< Stores the total number of range points in the entire stored history of scans. Useful for estimating points/scan
+
+ PointCloudAssemblerSrv() : ros::node("point_cloud_assembler_srv")
+ {
+ // **** Initialize TransformListener ****
+ double tf_cache_time_secs ;
+ param("~tf_cache_time_secs", tf_cache_time_secs, 10.0) ;
+ if (tf_cache_time_secs < 0)
+ ROS_ERROR("Parameter tf_cache_time_secs<0 (%f)", tf_cache_time_secs) ;
+ unsigned long long tf_cache_time = tf_cache_time_secs*1000000000ULL ;
+ tf_ = new tf::TransformListener(*this, true, tf_cache_time) ;
+ ROS_INFO("TF Cache Time: %f Seconds", tf_cache_time_secs) ;
+
+ // **** Set TF Extrapolation Limit ****
+ double tf_extrap_limit_secs ;
+ param("~tf_extrap_limit", tf_extrap_limit_secs, 0.01) ;
+ if (tf_extrap_limit_secs < 0.0)
+ ROS_ERROR("Parameter tf_extrap_limit<0 (%f)", tf_extrap_limit_secs) ;
+
+ ros::Duration extrap_limit ;
+ extrap_limit.fromSec(tf_extrap_limit_secs) ;
+ tf_->setExtrapolationLimit(extrap_limit) ;
+ ROS_INFO("TF Extrapolation Limit: %f Seconds", tf_extrap_limit_secs) ;
+
+ // ***** Set max_scans *****
+ const int default_max_scans = 400 ;
+ int tmp_max_scans ;
+ param("~max_scans", tmp_max_scans, default_max_scans) ;
+ if (tmp_max_scans < 0)
+ {
+ ROS_ERROR("Parameter max_scans<0 (%i)", tmp_max_scans) ;
+ tmp_max_scans = default_max_scans ;
+ }
+ max_scans_ = tmp_max_scans ;
+ ROS_INFO("Max Scans in History: %u", max_scans_) ;
+ total_pts_ = 0 ; // We're always going to start with no points in our history
+
+ // ***** Start Services *****
+ advertise_service(get_name()+"/build_cloud", &PointCloudAssemblerSrv::buildCloud, this, 0) ; // Don't spawn threads so that we can avoid dealing with mutexing [for now]
+ subscribe("cloud_in", scan_, &PointCloudAssemblerSrv::scans_callback, 40) ; // Choose something reasonably large, so data doesn't get dropped
+ }
+
+ ~PointCloudAssemblerSrv()
+ {
+ unadvertise_service(get_name()+"/build_cloud") ;
+ unsubscribe("cloud_in") ;
+ delete tf_ ;
+ }
+
+ void scans_callback()
+ {
+ if (scan_hist_.size() == max_scans_) // Is our deque full?
+ {
+ total_pts_ -= scan_hist_.front().get_pts_size() ; // We're removing an elem, so this reduces our total point count
+ scan_hist_.pop_front() ; // The front of the deque has the oldest elem, so we can get rid of it
+ }
+
+ scan_hist_.push_back(scan_) ; // Add the newest scan to the back of the deque
+ total_pts_ += scan_.get_pts_size() ; // Add the new scan to the running total of points
+
+ //printf("LaserScanAssemblerSrv:: Got Scan: TotalPoints=%u", total_pts_) ;
+ }
+
+ bool buildCloud(BuildCloud::request& req, BuildCloud::response& resp)
+ {
+ // Allocate space for the cloud
+ resp.cloud.set_pts_size( total_pts_ ) ; // There's no way to have a point cloud bigger than our entire history of scans.
+ resp.cloud.set_chan_size(1) ;
+ resp.cloud.chan[0].name = "intensities" ; //! \todo More smartly deal with multiple channels
+ resp.cloud.chan[0].set_vals_size( total_pts_ ) ;
+
+ unsigned int cloud_count = 0 ; // Store the number of points in the current cloud
+
+ PointCloud target_frame_cloud ; // Stores the current scan in the target frame
+
+ unsigned int i = 0 ;
+
+ // Find the beginning of the request. Probably should be a search
+ while ( i < scan_hist_.size() && // Don't go past end of deque
+ scan_hi...
[truncated message content] |
|
From: <rdi...@us...> - 2008-12-18 16:56:55
|
Revision: 8328
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8328&view=rev
Author: rdiankov
Date: 2008-12-18 16:56:50 +0000 (Thu, 18 Dec 2008)
Log Message:
-----------
openrave interface to process phasespace system messages
Modified Paths:
--------------
pkg/trunk/3rdparty/openrave/Makefile
pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m
pkg/trunk/openrave_planning/openraveros/src/rosserver.h
pkg/trunk/openrave_planning/ormanipulation/data/pr2table.env.xml
pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml
pkg/trunk/openrave_planning/ormanipulation/data/willow_table.kinbody.xml
pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml
pkg/trunk/openrave_planning/orrosplanning/manifest.xml
pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp
pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h
pkg/trunk/openrave_planning/orrosplanning/src/rosarmik.h
pkg/trunk/robot_descriptions/openrave_robot_description/src/urdf2openrave.cpp
Added Paths:
-----------
pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
pkg/trunk/openrave_planning/orrosplanning/src/rosplanningproblem.h
pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
Modified: pkg/trunk/3rdparty/openrave/Makefile
===================================================================
--- pkg/trunk/3rdparty/openrave/Makefile 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/3rdparty/openrave/Makefile 2008-12-18 16:56:50 UTC (rev 8328)
@@ -2,7 +2,7 @@
SVN_DIR = openrave_svn
# Should really specify a revision
-SVN_REVISION = -r 562
+SVN_REVISION = -r 573
SVN_URL = https://openrave.svn.sourceforge.net/svnroot/openrave
include $(shell rospack find mk)/svn_checkout.mk
@@ -11,7 +11,7 @@
build: SVN_UP openrave
openrave: SVN_UP
- @cd $(SVN_DIR) && export PATH="$(shell rospack find soqt)/bin:$(shell rospack find opende)/opende/bin:$(PATH)" && export CPATH="$(shell rospack find bullet)/include" && export LD_LIBRARY_PATH=$(shell rospack find bullet)/lib:$(LD_LIBRARY_PATH) && export BOOST_ROOT=$(shell rospack find boost)/boost && svn up && mkdir -p build && cd build && $(shell rospack find cmake)/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$(PWD) -DCMAKE_BUILD_TYPE=Release .. && make install
+ @cd $(SVN_DIR) && export PATH="$(shell rospack find soqt)/bin:$(shell rospack find opende)/opende/bin:$(PATH)" && export CPATH="$(shell rospack find bullet)/include" && export LD_LIBRARY_PATH=$(shell rospack find bullet)/lib:$(LD_LIBRARY_PATH) && export BOOST_ROOT=$(shell rospack find boost)/boost && mkdir -p build && cd build && $(shell rospack find cmake)/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$(PWD) -DCMAKE_BUILD_TYPE=Release .. && make install
clean:
make -C $(SVN_DIR) clean
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m 2008-12-18 16:56:50 UTC (rev 8328)
@@ -14,9 +14,8 @@
% move. This is useful when visualizing internal C++ states. When off, the GUI
% will only reflect the state of robots after all calls to stepsimulation and
% server send messages have been done. The default is off.
-% - debug [debug level] - toggles debugging messages by RAVELOG.
-% 0 - only RAVEPRINT statements show
-% 1+ - RAVELOG statements with various debug levels show
+% - debug [debuglevel] - toggles debugging messages by RAVELOG_X. Can be one of
+%% fatal, error, warn, info, debug, verbose
% - quit - closes the openrave instance
function success = orEnvSetOptions(options)
Modified: pkg/trunk/openrave_planning/openraveros/src/rosserver.h
===================================================================
--- pkg/trunk/openrave_planning/openraveros/src/rosserver.h 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/openraveros/src/rosserver.h 2008-12-18 16:56:50 UTC (rev 8328)
@@ -1005,6 +1005,7 @@
mlevels["info"] = Level_Info;
mlevels["warn"] = Level_Warn;
mlevels["debug"] = Level_Debug;
+ mlevels["verbose"] = Level_Verbose;
DebugLevel level = GetEnv()->GetDebugLevel();
if( mlevels.find(req.debuglevel) != mlevels.end() )
level = mlevels[req.debuglevel];
Modified: pkg/trunk/openrave_planning/ormanipulation/data/pr2table.env.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/data/pr2table.env.xml 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/ormanipulation/data/pr2table.env.xml 2008-12-18 16:56:50 UTC (rev 8328)
@@ -4,7 +4,7 @@
<camrotaxis>-0.092050 -0.490650 -0.866481 211</camrotaxis>
<Robot file="robots/pr2full.robot.xml">
- <translation>-0.708 0.005 0.012</translation>
+ <translation>-0.708 0.005 0.0102</translation>
<jointvalues> 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.582704 1.081165 0.000000 2.299995 -0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.979114 -0.400000 0.000000 1.535151 0.000000 0.000000 0.000000 0.000000 0.000000</jointvalues>
</Robot>
Modified: pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml 2008-12-18 16:56:50 UTC (rev 8328)
@@ -1,12 +1,17 @@
<Environment>
- <bkgndcol>0.3 0.7 0.8</bkgndcol>
- <camtrans>0.792115 1.544696 2.088982</camtrans>
- <camrotaxis>-0.092050 -0.490650 -0.866481 211</camrotaxis>
+ <bkgndcolor>1 1 1</bkgndcolor>
+ <camtrans> -0.285786 -4.231486 0.296317</camtrans>
+ <camrotaxis>-0.998283 0.046406 0.035754 265</camrotaxis>
+
+<!-- <camtrans>0.792115 1.544696 2.088982</camtrans>
+ <camrotaxis>-0.092050 -0.490650 -0.866481 211</camrotaxis> -->
<Robot file="robots/pr2full.robot.xml">
<translation>-0.708 0.005 0.0</translation>
</Robot>
-
+
+ <Kinbody file="willow_table.kinbody.xml"/>
+
<Kinbody name="floor">
<Body>
<Geom type="box">
Modified: pkg/trunk/openrave_planning/ormanipulation/data/willow_table.kinbody.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/data/willow_table.kinbody.xml 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/ormanipulation/data/willow_table.kinbody.xml 2008-12-18 16:56:50 UTC (rev 8328)
@@ -1,5 +1,5 @@
<KinBody name="willow_table">
- <Body>
+ <Body name="base">
<Geom type="box">
<extents>0.38 0.62 0.035</extents>
<translation>0 0 0.711</translation>
@@ -13,4 +13,10 @@
<translation>0 0.555 0.35</translation>
</Geom>
</Body>
+ <phasespace>
+ <offsetlink>base</offsetlink>
+ <id>1</id>
+ <pretranslation>0.27 0.3425 -0.75</pretranslation>
+ <prerotationaxis>0 0 1 -90</prerotationaxis>
+ </phasespace>
</KinBody>
Modified: pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml 2008-12-18 16:56:50 UTC (rev 8328)
@@ -1,6 +1,6 @@
<launch>
<!-- start openraveros server and set all the correct paths -->
- <node pkg="openraveros" type="openraveros">
+ <node pkg="openraveros" type="openraveros" output="screen">
<env name="OPENRAVE_DATA" value="$(env OPENRAVE_DATA):$(find openrave)/share/openrave:$(find openrave_robot_description):$(find ormanipulation)"/>
<env name="OPENRAVE_PLUGINS" value="$(env OPENRAVE_PLUGINS):$(find openrave)/share/openrave/plugins:$(find orplugins)"/>
</node>
Modified: pkg/trunk/openrave_planning/orrosplanning/manifest.xml
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-18 16:56:50 UTC (rev 8328)
@@ -6,6 +6,7 @@
<license>BSD</license>
<depend package="roscpp"/>
<depend package="openrave"/>
+ <depend package="phase_space"/>
<depend package="openrave_robot_description"/>
<depend package="libKinematics"/>
<depend package="boost"/>
Modified: pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp 2008-12-18 16:56:50 UTC (rev 8328)
@@ -26,6 +26,8 @@
#include "plugindefs.h"
#include "rosarmik.h"
+#include "phasespacesystem.h"
+#include "rosplanningproblem.h"
// declaring variables with stdcall can be a little complex
#ifdef _MSC_VER
@@ -53,7 +55,12 @@
if( wcsicmp(name, L"ROSArmIK") == 0 )
return new ROSArmIK(penv);
break;
-
+ case PT_ProblemInstance:
+ if( wcsicmp(name, L"ROSPlanningProblem") == 0 )
+ return new ROSPlanningProblem(penv);
+ case PT_SensorSystem:
+ if( wcsicmp(name, L"PhaseSpace") == 0 )
+ return new PhaseSpaceMocapClient(penv);
default:
break;
}
@@ -70,6 +77,9 @@
}
pinfo->iksolvers.push_back(L"ROSArmIK");
+ pinfo->sensorsystems.push_back(L"PhaseSpace");
+ pinfo->problems.push_back(L"ROSPlanningProblem");
+
return true;
}
Added: pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h (rev 0)
+++ pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h 2008-12-18 16:56:50 UTC (rev 8328)
@@ -0,0 +1,177 @@
+// Software License Agreement (BSD License)
+// Copyright (c) 2008, Willow Garage, Inc.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * The name of the author may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// author: Rosen Diankov
+#ifndef PHASESPACE_MOCAP_SYSTEM
+#define PHASESPACE_MOCAP_SYSTEM
+
+#include "simplesensorsystem.h"
+#include "phase_space/PhaseSpaceSnapshot.h"
+
+using namespace ros;
+
+// used to update objects through a mocap system
+class PhaseSpaceMocapClient : public SimpleSensorSystem
+{
+public:
+ PhaseSpaceMocapClient(EnvironmentBase* penv) : SimpleSensorSystem(penv, "phasespace"), _bSubscribed(false)
+ {
+ RegisterXMLReader(GetEnv()); // just in case, register again
+ }
+ virtual ~PhaseSpaceMocapClient() {
+ Destroy();
+ }
+
+ virtual bool Init(istream& sinput)
+ {
+ if( !SimpleSensorSystem::Init(sinput) )
+ return false;
+
+ _phasespacetopic = "phase_space_snapshot";
+ sinput >> _phasespacetopic;
+ startsubscriptions();
+ return _bSubscribed;
+ }
+
+ virtual void Destroy()
+ {
+ stopsubscriptions();
+ SimpleSensorSystem::Destroy();
+ }
+
+ static void RegisterXMLReader(EnvironmentBase* penv)
+ {
+ if( penv != NULL )
+ penv->RegisterXMLReader("phasespace", PhaseSpaceMocapClient::CreateMocapReader);
+ }
+
+ static BaseXMLReader* CreateMocapReader(KinBody* parent, const char **atts)
+ {
+ return new MocapXMLReader("phasespace", NULL, atts);
+ }
+
+private:
+ node* check_roscpp()
+ {
+ // start roscpp
+ ros::node* pnode = ros::node::instance();
+
+ if( pnode && !pnode->checkMaster() ) {
+ ros::fini();
+ delete pnode;
+ return NULL;
+ }
+
+ if (!pnode) {
+ int argc = 0;
+ char strname[256] = "nohost";
+ gethostname(strname, sizeof(strname));
+ strcat(strname,"_rosoct");
+
+ ros::init(argc,NULL);
+
+ pnode = new ros::node(strname, ros::node::DONT_HANDLE_SIGINT|ros::node::ANONYMOUS_NAME|ros::node::DONT_ADD_ROSOUT_APPENDER);
+
+ bool bCheckMaster = pnode->checkMaster();
+ ros::fini();
+ delete pnode;
+
+ if( !bCheckMaster ) {
+ RAVELOG_ERRORA("ros not present");
+ return NULL;
+ }
+
+ ros::init(argc,NULL);
+ pnode = new ros::node(strname, ros::node::DONT_HANDLE_SIGINT|ros::node::ANONYMOUS_NAME);
+ RAVELOG_DEBUGA("new roscpp node started");
+ }
+
+ return pnode;
+ }
+
+ void startsubscriptions()
+ {
+ // check if thread launched
+ _bSubscribed = false;
+ ros::node* pnode = check_roscpp();
+ if( pnode != NULL ) {
+ _bSubscribed = pnode->subscribe(_phasespacetopic, _snapshot, &PhaseSpaceMocapClient::newdatacb, this, 1);
+ if( _bSubscribed )
+ RAVELOG_DEBUGA("subscribed to %s\n", _phasespacetopic.c_str());
+ else
+ RAVELOG_ERRORA("failed to subscribe to %s\n", _phasespacetopic.c_str());
+ }
+ }
+
+ void stopsubscriptions()
+ {
+ if( _bSubscribed ) {
+ ros::node* pnode = ros::node::instance();
+ if( pnode && pnode->checkMaster() ) {
+ pnode->unsubscribe(_phasespacetopic.c_str());
+ RAVELOG_DEBUGA("unsubscribe from %s\n", _phasespacetopic.c_str());
+ }
+ _bSubscribed = false;
+ }
+ }
+
+ void newdatacb()
+ {
+ list< SNAPSHOT > listbodies;
+ boost::mutex::scoped_lock lock(_mutex);
+ RAVELOG_VERBOSEA("cb\n");
+
+ for (unsigned int i=0; i<_snapshot.get_bodies_size(); i++) {
+ const phase_space::PhaseSpaceBody& psbody = _snapshot.bodies[i];
+
+ boost::shared_ptr<BODY> b;
+ FOREACH(it, _mapbodies) {
+ if( it->second->_initdata.id == psbody.id ) {
+ b = it->second;
+ break;
+ }
+ }
+
+ if( !b || !b->IsEnabled() )
+ continue;
+
+ listbodies.push_back(SNAPSHOT(b, GetTransform(psbody.pose)));
+ }
+
+ UpdateBodies(listbodies);
+
+ // try to add the left-over objects
+ }
+
+ Transform GetTransform(const std_msgs::Transform& pose)
+ {
+ return Transform(Vector(pose.rotation.w, pose.rotation.x, pose.rotation.y, pose.rotation.z), Vector(pose.translation.x, pose.translation.y, pose.translation.z));
+ }
+
+ phase_space::PhaseSpaceSnapshot _snapshot;
+ string _phasespacetopic;
+ bool _bSubscribed;
+};
+
+#endif
Modified: pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h 2008-12-18 16:56:50 UTC (rev 8328)
@@ -22,6 +22,7 @@
#include <cstdio>
#include <cmath>
#include <cstdlib>
+#include <cstring>
#ifdef _MSC_VER
#include <boost/typeof/std/string.hpp>
@@ -141,7 +142,21 @@
#endif
+inline std::wstring _ravembstowcs(const char* pstr)
+{
+ size_t len = mbstowcs(NULL, pstr, 0);
+ std::wstring w; w.resize(len);
+ mbstowcs(&w[0], pstr, len);
+ return w;
+}
+
#include <rave/rave.h>
using namespace OpenRAVE;
+#include <ros/node.h>
+#include <ros/time.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/thread/mutex.hpp>
+
#endif
Modified: pkg/trunk/openrave_planning/orrosplanning/src/rosarmik.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/rosarmik.h 2008-12-18 09:42:07 UTC (rev 8327)
+++ pkg/trunk/openrave_planning/orrosplanning/src/rosarmik.h 2008-12-18 16:56:50 UTC (rev 8328)
@@ -27,7 +27,6 @@
#define OPENRAVE_ROSARMIK_H
#include <libKinematics/pr2_ik.h>
-#include <boost/shared_ptr.hpp>
class ROSArmIK : public IkSolverBase
{
Added: pkg/trunk/openrave_planning/orrosplanning/src/rosplanningproblem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/rosplanningproblem.h (rev 0)
+++ pkg/trunk/openrave_planning/orrosplanning/src/rosplanningproblem.h 2008-12-18 16:56:50 UTC (rev 8328)
@@ -0,0 +1,50 @@
+#ifndef OPENRAVE_ROS_PLANNING_PROBLEM
+#define OPENRAVE_ROS_PLANNING_PROBLEM
+
+class ROSPlanningProblem : public CmdProblemInstance
+{
+public:
+ ROSPlanningProblem(EnvironmentBase* penv) : CmdProblemInstance(penv)
+ {
+ PhaseSpaceMocapClient::RegisterXMLReader(GetEnv());
+
+ RegisterCommand("createsystem",(CommandFn)&ROSPlanningProblem::CreateSystem, "creates a sensor system and initializes it with the current bodies");
+ }
+
+ virtual void Destroy()
+ {
+ listsystems.clear();
+ }
+
+ int main(const char* cmd)
+ {
+ return 0;
+ }
+
+ bool CreateSystem(ostream& sout, istream& sinput)
+ {
+ string systemname;
+ sinput >> systemname;
+ if( !sinput )
+ return false;
+
+ boost::shared_ptr<SensorSystemBase> psystem(GetEnv()->CreateSensorSystem(systemname.c_str()));
+ if( !psystem )
+ return false;
+
+ if( !psystem->Init(sinput) )
+ return false;
+
+ psystem->AddRegisteredBodies(GetEnv()->GetBodies());
+ listsystems.push_back(psystem);
+
+ RAVELOG_DEBUGA("added %s system\n", systemname.c_str());
+ sout << 1; // signal success
+ return true;
+ }
+
+protected:
+ list<boost::shared_ptr<SensorSystemBase> > listsystems;
+};
+
+#endif
Added: pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h (rev 0)
+++ pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h 2008-12-18 16:56:50 UTC (rev 8328)
@@ -0,0 +1,321 @@
+// Software License Agreement (BSD License)
+// Copyright (c) 2008, Willow Garage, Inc.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * The name of the author may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// author: Rosen Diankov
+#ifndef OPENRAVE_SIMPLE_SENSOR_SYSTEM
+#define OPENRAVE_SIMPLE_SENSOR_SYSTEM
+
+using namespace std;
+
+// used to update objects through a mocap system
+class SimpleSensorSystem : public SensorSystemBase
+{
+ public:
+ class MocapData : public XMLReadable
+ {
+ public:
+ MocapData(const string& xmlid) : _xmlid(xmlid) {}
+ virtual const char* GetXMLId() { return _xmlid.c_str(); }
+
+ string sid; ///< global id for the system id
+ int id;
+ std::wstring strOffsetLink; ///< the link where the markers are attached (if any)
+ Transform transOffset,transPreOffset; // final offset = transOffset * transReturnedFromVision * transPreOffset
+
+ private:
+ string _xmlid;
+ };
+
+ class BODY : public BODYBASE
+ {
+ public:
+ BODY(KinBody* pbody, const MocapData& initdata, const string& xmlid) : BODYBASE(), _initdata(xmlid)
+ {
+ assert( pbody != NULL );
+ _initdata = initdata;
+ pOffsetLink = pbody->GetLink(_initdata.strOffsetLink.c_str());
+ if( pOffsetLink == NULL )
+ pOffsetLink = pbody->GetLinks().front();
+
+ bPresent = false;
+ bEnabled = true;
+ bLock = false;
+ }
+
+ virtual void SetEnable(bool bNewEnable) { bEnabled = bNewEnable; }
+ virtual void SetPresent(bool bNewPresent) { bPresent = bNewPresent; }
+
+ virtual void* GetInitData(int* psize) { if( psize ) *psize = sizeof(_initdata); return &_initdata; }
+ ros::Time lastupdated;
+ MocapData _initdata;
+ };
+
+ class MocapXMLReader : public BaseXMLReader
+ {
+ public:
+ MocapXMLReader(const string& xmlid, MocapData* pMocap, const char **atts) : _xmlid(xmlid) {
+ _pMocap = pMocap;
+ if( _pMocap == NULL )
+ _pMocap = new MocapData(_xmlid);
+ }
+ virtual ~MocapXMLReader() { delete _pMocap; }
+
+ void* Release() { MocapData* temp = _pMocap; _pMocap = NULL; return temp; }
+
+ virtual void startElement(void *ctx, const char *name, const char **atts) {}
+ virtual bool endElement(void *ctx, const char *name)
+ {
+ if( stricmp((const char*)name, _xmlid.c_str()) == 0 )
+ return true;
+
+ if( stricmp((const char*)name, "offsetlink") == 0 ) {
+ string linkname;
+ ss >> linkname;
+ _pMocap->strOffsetLink = _ravembstowcs(linkname.c_str());
+ }
+ else if( stricmp((const char*)name, "id") == 0 )
+ ss >> _pMocap->id;
+ else if( stricmp((const char*)name, "sid") == 0 )
+ ss >> _pMocap->sid;
+ else if( stricmp((const char*)name, "translation") == 0 )
+ ss >> _pMocap->transOffset.trans.x >> _pMocap->transOffset.trans.y >> _pMocap->transOffset.trans.z;
+ else if( stricmp((const char*)name, "rotationmat") == 0 ) {
+ TransformMatrix m;
+ ss >> m.m[0] >> m.m[1] >> m.m[2] >> m.m[4] >> m.m[5] >> m.m[6] >> m.m[8] >> m.m[9] >> m.m[10];
+ _pMocap->transOffset.rot = Transform(m).rot;
+ }
+ else if( stricmp((const char*)name, "rotationaxis") == 0 ) {
+ Vector axis; dReal fang;
+ ss >> axis.x >> axis.y >> axis.z >> fang;
+ _pMocap->transOffset.rotfromaxisangle(axis,fang*(PI/180.0f));
+ }
+ else if( stricmp((const char*)name, "quat") == 0 )
+ ss >> _pMocap->transOffset.rot;
+ else if( stricmp((const char*)name, "pretranslation") == 0 )
+ ss >> _pMocap->transPreOffset.trans.x >> _pMocap->transPreOffset.trans.y >> _pMocap->transPreOffset.trans.z;
+ else if( stricmp((const char*)name, "prerotationmat") == 0 ) {
+ TransformMatrix m;
+ ss >> m.m[0] >> m.m[1] >> m.m[2] >> m.m[4] >> m.m[5] >> m.m[6] >> m.m[8] >> m.m[9] >> m.m[10];
+ _pMocap->transPreOffset.rot = Transform(m).rot;
+ }
+ else if( stricmp((const char*)name, "prerotationaxis") == 0 ) {
+ Vector axis; dReal fang;
+ ss >> axis.x >> axis.y >> axis.z >> fang;
+ _pMocap->transPreOffset.rotfromaxisangle(axis,fang*(PI/180.0f));
+ }
+ else if( stricmp((const char*)name, "prequat") == 0 )
+ ss >> _pMocap->transPreOffset.rot;
+ else
+ RAVELOG_ERRORA("unknown field %s\n", name);
+
+ if( !ss )
+ RAVELOG_ERRORA("MocapXMLReader error parsing %s\n", name);
+
+ return false;
+ }
+
+ virtual void characters(void *ctx, const char *ch, int len)
+ {
+ if( len > 0 ) {
+ ss.clear();
+ ss.str(string(ch, len));
+ }
+ else
+ ss.str(""); // reset
+ }
+
+ protected:
+ MocapData* _pMocap;
+ stringstream ss;
+ string _xmlid;
+ };
+
+ SimpleSensorSystem(EnvironmentBase* penv, const string& xmlid) : SensorSystemBase(penv), _expirationtime(2,0), _xmlid(xmlid)
+ {
+ }
+ virtual ~SimpleSensorSystem() {
+ Destroy();
+ }
+
+ virtual bool Init(istream& sinput)
+ {
+ return true;
+ }
+
+ virtual void Destroy()
+ {
+ boost::mutex::scoped_lock lock(_mutex);
+ _mapbodies.clear();
+ }
+
+ virtual void AddRegisteredBodies(const std::vector<KinBody*>& vbodies)
+ {
+ // go through all bodies in the environment and check for mocap data
+ FOREACHC(itbody, vbodies) {
+ MocapData* pmocapdata = (MocapData*)((*itbody)->GetExtraInterface(GetXMLId()));
+ if( pmocapdata != NULL ) {
+ BODY* p = AddKinBody(*itbody, pmocapdata);
+ if( p != NULL ) {
+ assert( p->GetOffsetLink() != NULL );
+ p->Lock(true);
+ }
+ }
+ }
+ }
+
+ virtual BODY* AddKinBody(KinBody* pbody, const void* _pdata)
+ {
+ if( _pdata == NULL || pbody == NULL )
+ return false;
+ assert( pbody->GetEnv() == GetEnv() );
+
+ const MocapData* pdata = (const MocapData*)_pdata;
+
+ boost::mutex::scoped_lock lock(_mutex);
+ if( _mapbodies.find(pbody->GetNetworkId()) != _mapbodies.end() ) {
+ RAVELOG_WARNA("body %S already added\n", pbody->GetName());
+ return NULL;
+ }
+
+ BODY* b = new BODY(pbody, *pdata, _xmlid);
+ _mapbodies[pbody->GetNetworkId()].reset(b);
+ RAVELOG_DEBUGA("system adding body %S\n", pbody->GetName());
+ return b;
+ }
+
+ virtual bool RemoveKinBody(KinBody* pbody)
+ {
+ if( pbody == NULL )
+ return false;
+ assert( pbody->GetEnv() == GetEnv() );
+
+ boost::mutex::scoped_lock lock(_mutex);
+ bool bSuccess = _mapbodies.erase(pbody->GetNetworkId());
+ RAVELOG_DEBUGA("system removing body %S %s\n", pbody->GetName(), bSuccess?"succeeded":"failed");
+ return bSuccess;
+ }
+
+ virtual bool IsBodyPresent(KinBody* pbody)
+ {
+ if( pbody == NULL )
+ return false;
+ assert( pbody->GetEnv() == GetEnv() );
+
+ boost::mutex::scoped_lock lock(_mutex);
+ return _mapbodies.find(pbody->GetNetworkId()) != _mapbodies.end();
+ }
+
+ virtual bool EnableBody(KinBody* pbody, bool bEnable)
+ {
+ boost::mutex::scoped_lock lock(_mutex);
+ if( pbody == NULL )
+ return false;
+ assert( pbody->GetEnv() == GetEnv() );
+
+ map<int,boost::shared_ptr<BODY> >::iterator it = _mapbodies.find(pbody->GetNetworkId());
+ if( it == _mapbodies.end() ) {
+ RAVELOG_WARNA("trying to %s body %S that is not in system\n", bEnable?"enable":"disable", pbody->GetName());
+ return false;
+ }
+
+ it->second->SetEnable(bEnable);
+ return true;
+ }
+
+ virtual BODY* GetBody(KinBody* pbody)
+ {
+ if( pbody == NULL )
+ return false;
+ assert( pbody->GetEnv() == GetEnv() );
+
+ boost::mutex::scoped_lock lock(_mutex);
+ map<int,boost::shared_ptr<BODY> >::iterator it = _mapbodies.find(pbody->GetNetworkId());
+ return it != _mapbodies.end() ? it->second.get() : NULL;
+ }
+
+ virtual const char* GetXMLId() { return _xmlid.c_str(); }
+
+protected:
+
+ typedef pair<boost::shared_ptr<BODY>, Transform > SNAPSHOT;
...
[truncated message content] |
|
From: <vij...@us...> - 2008-12-18 19:00:24
|
Revision: 8338
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8338&view=rev
Author: vijaypradeep
Date: 2008-12-18 19:00:22 +0000 (Thu, 18 Dec 2008)
Log Message:
-----------
Removed TF extrap from point_cloud_assembler
Modified Paths:
--------------
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp
pkg/trunk/robot_descriptions/wg_robot_description/tilt_laser_deprecated/build_snapshots.launch
Modified: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp 2008-12-18 18:58:53 UTC (rev 8337)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp 2008-12-18 19:00:22 UTC (rev 8338)
@@ -126,7 +126,7 @@
// **** Set TF Extrapolation Limit ****
double tf_extrap_limit_secs ;
- param("~tf_extrap_limit", tf_extrap_limit_secs, 0.01) ;
+ param("~tf_extrap_limit", tf_extrap_limit_secs, 0.00) ;
if (tf_extrap_limit_secs < 0.0)
ROS_ERROR("Parameter tf_extrap_limit<0 (%f)", tf_extrap_limit_secs) ;
Modified: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp 2008-12-18 18:58:53 UTC (rev 8337)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp 2008-12-18 19:00:22 UTC (rev 8338)
@@ -88,7 +88,7 @@
// **** Set TF Extrapolation Limit ****
double tf_extrap_limit_secs ;
- param("~tf_extrap_limit", tf_extrap_limit_secs, 0.01) ;
+ param("~tf_extrap_limit", tf_extrap_limit_secs, 0.00) ;
if (tf_extrap_limit_secs < 0.0)
ROS_ERROR("Parameter tf_extrap_limit<0 (%f)", tf_extrap_limit_secs) ;
Modified: pkg/trunk/robot_descriptions/wg_robot_description/tilt_laser_deprecated/build_snapshots.launch
===================================================================
--- pkg/trunk/robot_descriptions/wg_robot_description/tilt_laser_deprecated/build_snapshots.launch 2008-12-18 18:58:53 UTC (rev 8337)
+++ pkg/trunk/robot_descriptions/wg_robot_description/tilt_laser_deprecated/build_snapshots.launch 2008-12-18 19:00:22 UTC (rev 8338)
@@ -4,7 +4,6 @@
<node pkg="point_cloud_assembler" type="laser_scan_assembler_srv" output="screen" name="laser_scan_assembler">
<remap from="scan" to="tilt_scan"/>
<param name="tf_cache_time_secs" type="double" value="10.0" />
- <param name="tf_extrap_limit" type="double" value="0.01" />
<param name="max_scans" type="int" value="400" />
<param name="ignore_laser_skew" type="bool" value="true" />
</node>
@@ -13,7 +12,6 @@
<node pkg="point_cloud_assembler" type="point_cloud_assembler_srv" output="screen" name="point_cloud_assembler">
<remap from="cloud_in" to="tilt_laser_cloud_filtered" />
<param name="tf_cache_time_secs" type="double" value="10.0" />
- <param name="tf_extrap_limit" type="double" value="0.01" />
<param name="max_scans" type="int" value="400" />
</node>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rdi...@us...> - 2008-12-19 06:26:30
|
Revision: 8406
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8406&view=rev
Author: rdiankov
Date: 2008-12-19 06:26:26 +0000 (Fri, 19 Dec 2008)
Log Message:
-----------
openrave parallel builds now
Modified Paths:
--------------
pkg/trunk/3rdparty/openrave/Makefile
pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m
pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml
Modified: pkg/trunk/3rdparty/openrave/Makefile
===================================================================
--- pkg/trunk/3rdparty/openrave/Makefile 2008-12-19 06:15:52 UTC (rev 8405)
+++ pkg/trunk/3rdparty/openrave/Makefile 2008-12-19 06:26:26 UTC (rev 8406)
@@ -2,7 +2,7 @@
SVN_DIR = openrave_svn
# Should really specify a revision
-SVN_REVISION = -r 573
+SVN_REVISION = -r 574
SVN_URL = https://openrave.svn.sourceforge.net/svnroot/openrave
include $(shell rospack find mk)/svn_checkout.mk
@@ -11,7 +11,7 @@
build: SVN_UP openrave
openrave: SVN_UP
- @cd $(SVN_DIR) && export PATH="$(shell rospack find soqt)/bin:$(shell rospack find opende)/opende/bin:$(PATH)" && export CPATH="$(shell rospack find bullet)/include" && export LD_LIBRARY_PATH=$(shell rospack find bullet)/lib:$(LD_LIBRARY_PATH) && export BOOST_ROOT=$(shell rospack find boost)/boost && mkdir -p build && cd build && $(shell rospack find cmake)/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$(PWD) -DCMAKE_BUILD_TYPE=Release .. && make install
+ @cd $(SVN_DIR) && export PATH="$(shell rospack find soqt)/bin:$(shell rospack find opende)/opende/bin:$(PATH)" && export CPATH="$(shell rospack find bullet)/include" && export LD_LIBRARY_PATH=$(shell rospack find bullet)/lib:$(LD_LIBRARY_PATH) && export BOOST_ROOT=$(shell rospack find boost)/boost && mkdir -p build && cd build && $(shell rospack find cmake)/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$(PWD) -DCMAKE_BUILD_TYPE=Release .. && make $(PARALLEL_JOBS) install
clean:
make -C $(SVN_DIR) clean
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m 2008-12-19 06:15:52 UTC (rev 8405)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m 2008-12-19 06:26:26 UTC (rev 8406)
@@ -1,11 +1,10 @@
#!/usr/bin/env octave
global probs
-cd('octave')
-
+cd(getenv('OCTAVE_WORKINGDIR'));
startup;
orEnvLoadScene('',1); % reset the scene
-orEnvSetOptions('debug debug');
+#orEnvSetOptions('debug debug');
%% create problem before everything so resources can init!
probs.rosplan = orEnvCreateProblem('ROSPlanningProblem');
Modified: pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml 2008-12-19 06:15:52 UTC (rev 8405)
+++ pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml 2008-12-19 06:26:26 UTC (rev 8406)
@@ -3,5 +3,7 @@
<include file="$(find ormanipulation)/startopenrave.ros.xml"/>
<node pkg="phase_space" type="phase_space_node"/>
<!-- launch octave scripts to start the openrave client -->
- <node pkg="ormanipulation" type="testscene.m"/>
+ <node pkg="ormanipulation" type="testscene.m" output="screen">
+ <env name="OCTAVE_WORKINGDIR" value="$(find ormanipulation)/octave"/>
+ </node>
</launch>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rdi...@us...> - 2008-12-20 03:33:35
|
Revision: 8479
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8479&view=rev
Author: rdiankov
Date: 2008-12-20 03:33:29 +0000 (Sat, 20 Dec 2008)
Log Message:
-----------
added a checkerboard detector that can be configured to detect any number of checkerboards, added an openrave sensor system ObjectTransform to connect to the ROS network and get the detection data, added openrave scripts to connect to the camera and manage the detected boxes in the openrave environment
Modified Paths:
--------------
pkg/trunk/openrave_planning/openraveros/manifest.xml
pkg/trunk/openrave_planning/openraveros/src/rosserver.h
pkg/trunk/openrave_planning/openraveros/src/session.h
pkg/trunk/openrave_planning/ormanipulation/data/ricebox.kinbody.xml
pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m
pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml
pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml
pkg/trunk/openrave_planning/orrosplanning/manifest.xml
pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp
pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h
pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
Added Paths:
-----------
pkg/trunk/openrave_planning/ormanipulation/startcameras.ros.xml
pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml
pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h
pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h
pkg/trunk/vision/checkerboard_detector/
pkg/trunk/vision/checkerboard_detector/CMakeLists.txt
pkg/trunk/vision/checkerboard_detector/Makefile
pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp
pkg/trunk/vision/checkerboard_detector/manifest.xml
pkg/trunk/vision/checkerboard_detector/math.h
pkg/trunk/vision/checkerboard_detector/msg/
pkg/trunk/vision/checkerboard_detector/msg/Object6DPose.msg
pkg/trunk/vision/checkerboard_detector/msg/ObjectDetection.msg
Modified: pkg/trunk/openrave_planning/openraveros/manifest.xml
===================================================================
--- pkg/trunk/openrave_planning/openraveros/manifest.xml 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/openraveros/manifest.xml 2008-12-20 03:33:29 UTC (rev 8479)
@@ -10,4 +10,5 @@
<depend package="openrave"/>
<depend package="std_msgs"/>
<depend package="rosoct"/>
+ <url>http://pr.willowgarage.com/wiki/openrave</url>
</package>
Modified: pkg/trunk/openrave_planning/openraveros/src/rosserver.h
===================================================================
--- pkg/trunk/openrave_planning/openraveros/src/rosserver.h 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/openraveros/src/rosserver.h 2008-12-20 03:33:29 UTC (rev 8479)
@@ -544,14 +544,18 @@
KinBody* pbody = GetEnv()->CreateKinBody();
if( req.file.size() > 0 ) {
- if( !pbody->Init(req.file.c_str(), NULL) )
+ if( !pbody->Init(req.file.c_str(), NULL) ) {
+ delete pbody;
return false;
+ }
}
pbody->SetName(req.name.c_str());
- if( !GetEnv()->AddKinBody(pbody) )
+ if( !GetEnv()->AddKinBody(pbody) ) {
+ delete pbody;
return false;
+ }
res.bodyid = pbody->GetNetworkId();
return true;
Modified: pkg/trunk/openrave_planning/openraveros/src/session.h
===================================================================
--- pkg/trunk/openrave_planning/openraveros/src/session.h 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/openraveros/src/session.h 2008-12-20 03:33:29 UTC (rev 8479)
@@ -36,7 +36,7 @@
{ \
SessionState state = getstate(req); /* need separate copy in order to guarantee thread safety */ \
if( !state._pserver ) { \
- RAVELOG_INFOA("failed to find session for service %s", #srvname); \
+ RAVELOG_INFOA("failed to find session for service %s\n", #srvname); \
return false; \
} \
return state._pserver->srvname##_srv(req,res); \
@@ -330,7 +330,7 @@
boost::mutex::scoped_lock lock(_mutexsession);
if( _mapsessions.find(req.sessionid) != _mapsessions.end() ) {
_mapsessions.erase(req.sessionid);
- RAVELOG_INFOA("destroyed openrave session: %d", req.sessionid);
+ RAVELOG_INFOA("destroyed openrave session: %d\n", req.sessionid);
return true;
}
@@ -352,14 +352,14 @@
}
if( !clonestate._penv )
- RAVELOG_INFOA("failed to find session %d", req.clone_sessionid);
+ RAVELOG_INFOA("failed to find session %d\n", req.clone_sessionid);
else
state._penv.reset(clonestate._penv->CloneSelf(req.clone_options));
}
if( !state._penv ) {
// cloning from parent
- RAVELOG_DEBUGA("cloning from parent");
+ RAVELOG_DEBUGA("cloning from parent\n");
state._penv.reset(_pParentEnvironment->CloneSelf(0));
}
@@ -368,7 +368,7 @@
_mapsessions[id] = state;
res.sessionid = id;
- RAVELOG_INFOA("started openrave session: %d, total: %d", id, _mapsessions.size());
+ RAVELOG_INFOA("started openrave session: %d, total: %d\n", id, _mapsessions.size());
return true;
}
Modified: pkg/trunk/openrave_planning/ormanipulation/data/ricebox.kinbody.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/data/ricebox.kinbody.xml 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/ormanipulation/data/ricebox.kinbody.xml 2008-12-20 03:33:29 UTC (rev 8479)
@@ -1,9 +1,14 @@
<Kinbody name="ricebox">
- <Body>
+ <Body name="base">
<Geom type="box">
- <extents>0.03 0.0525 0.1125</extents>
- <translation>0 0 0.1125</translation>
+ <extents>0.1125 0.0525 0.03</extents>
+ <translation>0 0 0.03</translation>
<diffusecolor>0.1 0.6 1</diffusecolor>
</Geom>
</Body>
+ <objecttransform>
+ <offsetlink>base</offsetlink>
+ <sid>data/ricebox.kinbody.xml</sid>
+ <pretranslation>-0.0155 0.0205 0</pretranslation>
+ </objecttransform>
</Kinbody>
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m 2008-12-20 03:33:29 UTC (rev 8479)
@@ -3,8 +3,9 @@
cd(getenv('OCTAVE_WORKINGDIR'));
startup;
+openraveros_restart();
orEnvLoadScene('',1); % reset the scene
-#orEnvSetOptions('debug debug');
+orEnvSetOptions('debug debug');
%% create problem before everything so resources can init!
probs.rosplan = orEnvCreateProblem('ROSPlanningProblem');
@@ -14,6 +15,11 @@
orEnvLoadScene('data/pr2table_real.env.xml');
+out = orProblemSendCommand('createsystem ObjectTransform /checkerdetector/ObjectDetection 0.1',probs.rosplan);
+if( isempty(out) )
+ error('failed to create checkerboard detector');
+end
+
out = orProblemSendCommand('createsystem PhaseSpace phase_space_snapshot',probs.rosplan);
if( isempty(out) )
error('failed to create phasespace');
Modified: pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml 2008-12-20 03:33:29 UTC (rev 8479)
@@ -1,9 +1,13 @@
<launch>
+ <machine name="localhost" address="localhost" default="true"/>
+
<!-- start openraveros server and set all the correct paths -->
<include file="$(find ormanipulation)/startopenrave.ros.xml"/>
+ <include file="$(find ormanipulation)/startchecker.ros.xml"/>
+
<node pkg="phase_space" type="phase_space_node"/>
<!-- launch octave scripts to start the openrave client -->
- <node pkg="ormanipulation" type="testscene.m" output="screen">
+<!-- <node pkg="ormanipulation" type="testscene.m" output="screen">
<env name="OCTAVE_WORKINGDIR" value="$(find ormanipulation)/octave"/>
- </node>
+ </node> -->
</launch>
Added: pkg/trunk/openrave_planning/ormanipulation/startcameras.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/startcameras.ros.xml (rev 0)
+++ pkg/trunk/openrave_planning/ormanipulation/startcameras.ros.xml 2008-12-20 03:33:29 UTC (rev 8479)
@@ -0,0 +1,19 @@
+<launch>
+ <machine name="cameras" address="ahc" default="false" user="rdiankov"/>
+ <node machine="cameras" name="dcam" pkg="dcam" type="dcam" respawn="false">
+ <!-- video_mode should be one of the following:
+ 640x480_videre_rectified: Provides rectified images from the hw
+ Provides: left mono image
+ 640x480_videre_disparity: Disparity and rectification done on chip.
+ Provides: Disparity and left mono image
+ 640x480_videre_disparity_raw: Disparity done on chip (debayer and rectification in software).
+ Provides: disparity and left color image.
+ 640x480_videre_none: No stereo on chip (all processing done in software).
+ Provides: all 3 images available
+ -->
+ <param name="video_mode" type="str" value="640x480_videre_rectified"/>
+ <param name="do_rectify" type="bool" value="False"/>
+ <param name="do_stereo" type="bool" value="False"/>
+ <param name="do_calc_points" type="bool" value="False"/>
+ </node>
+</launch>
Added: pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml (rev 0)
+++ pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml 2008-12-20 03:33:29 UTC (rev 8479)
@@ -0,0 +1,33 @@
+<launch>
+ <machine name="cameras" address="ahc" default="false" user="rdiankov"/>
+
+ <node machine="cameras" name="dcam" pkg="dcam" type="dcam" respawn="false">
+ <!-- video_mode should be one of the following:
+ 640x480_videre_rectified: Provides rectified images from the hw
+ Provides: left mono image
+ 640x480_videre_disparity: Disparity and rectification done on chip.
+ Provides: Disparity and left mono image
+ 640x480_videre_disparity_raw: Disparity done on chip (debayer and rectification in software).
+ Provides: disparity and left color image.
+ 640x480_videre_none: No stereo on chip (all processing done in software).
+ Provides: all 3 images available
+ -->
+ <param name="video_mode" type="str" value="640x480_videre_rectified"/>
+ <param name="do_rectify" type="bool" value="False"/>
+ <param name="do_stereo" type="bool" value="False"/>
+ <param name="do_calc_points" type="bool" value="False"/>
+ </node>
+ <group ns="checkerdetector" clear_params="true">
+ <param name="display" type="int" value="1"/>
+ <param name="rect0_size_x" type="double" value="0.02133"/>
+ <param name="rect0_size_y" type="double" value="0.021"/>
+ <param name="grid0_size_x" type="int" value="4"/>
+ <param name="grid0_size_y" type="int" value="3"/>
+ <param name="type0" type="string" value="data/ricebox.kinbody.xml"/>
+ <node machine="cameras" pkg="checkerboard_detector" type="checkerboard_detector" respawn="true" output="screen">
+ <remap from="CamInfo" to="/dcam/left/cam_info"/>
+ <remap from="Image" to="/dcam/left/image_rect"/>
+ <env name="DISPLAY" value=":0.0"/>
+ </node>
+ </group>
+</launch>
Modified: pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml 2008-12-20 03:33:29 UTC (rev 8479)
@@ -1,6 +1,8 @@
<launch>
+ <machine name="localhost-openrave" address="localhost"/>
+
<!-- start openraveros server and set all the correct paths -->
- <node pkg="openraveros" type="openraveros" output="screen">
+ <node machine="localhost-openrave" pkg="openraveros" type="openraveros" output="screen">
<env name="OPENRAVE_DATA" value="$(env OPENRAVE_DATA):$(find openrave)/share/openrave:$(find openrave_robot_description):$(find ormanipulation)"/>
<env name="OPENRAVE_PLUGINS" value="$(env OPENRAVE_PLUGINS):$(find openrave)/share/openrave/plugins:$(find orplugins)"/>
</node>
Modified: pkg/trunk/openrave_planning/orrosplanning/manifest.xml
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-20 03:33:29 UTC (rev 8479)
@@ -10,4 +10,5 @@
<depend package="openrave_robot_description"/>
<depend package="libKinematics"/>
<depend package="boost"/>
+ <depend package="checkerboard_detector"/>
</package>
Added: pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h (rev 0)
+++ pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h 2008-12-20 03:33:29 UTC (rev 8479)
@@ -0,0 +1,141 @@
+// Software License Agreement (BSD License)
+// Copyright (c) 2008, Willow Garage, Inc.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * The name of the author may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// author: Rosen Diankov
+#ifndef OBJECTTRANSFORM_SENSOR_SYSTEM
+#define OBJECTTRANSFORM_SENSOR_SYSTEM
+
+#include "rossensorsystem.h"
+#include "checkerboard_detector/ObjectDetection.h"
+
+using namespace ros;
+
+// used to update objects through a mocap system
+class ObjectTransformXMLID
+{
+public:
+ static const char* GetXMLId() { return "objecttransform"; }
+};
+
+class ObjectTransformSystem : public ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>
+{
+public:
+ ObjectTransformSystem(EnvironmentBase* penv)
+ : ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>(penv)
+ {
+ }
+
+ virtual bool Init(istream& sinput)
+ {
+ _topic = "ObjectDetection";
+ bool bSuccess = ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>::Init(sinput);
+ if( !bSuccess )
+ return false;
+ _fThreshSqr = 0.05*0.05f;
+ sinput >> _fThreshSqr;
+ return true;
+ }
+
+private:
+ void newdatacb()
+ {
+ list< SNAPSHOT > listbodies;
+ list< const checkerboard_detector::Object6DPose* > listnewobjs;
+
+ {
+ boost::mutex::scoped_lock lock(_mutex);
+ TYPEOF(_mapbodies) mapbodies = _mapbodies;
+
+ FOREACHC(itobj, _topicmsg.objects) {
+ boost::shared_ptr<BODY> b;
+ Transform tnew = GetTransform(itobj->pose);
+
+ FOREACH(it, mapbodies) {
+ if( it->second->_initdata.sid == itobj->type ) {
+
+ // same type matched, need to check proximity
+ Transform tbody = it->second->GetOffsetLink()->GetParent()->GetTransform();
+ if( (tbody.trans-tnew.trans).lengthsqr3() > _fThreshSqr )
+ break;
+
+ b = it->second;
+ mapbodies.erase(it);
+ break;
+ }
+ }
+
+ if( !b ) {
+ listnewobjs.push_back(&(*itobj));
+ }
+ else {
+ if( !b->IsEnabled() )
+ continue;
+
+ listbodies.push_back(SNAPSHOT(b, tnew));
+ }
+ }
+
+ UpdateBodies(listbodies);
+ }
+
+ // try to add the left-over objects
+ if( listnewobjs.size() > 0 ) {
+ GetEnv()->LockPhysics(true);
+ FOREACH(itobj, listnewobjs) {
+
+ KinBody* pbody = GetEnv()->CreateKinBody();
+
+ if( !pbody->Init( (*itobj)->type.c_str(), NULL ) ) {
+ RAVELOG_ERRORA("failed to create object %s\n", (*itobj)->type.c_str());
+ delete pbody;
+ continue;
+ }
+
+ if( !GetEnv()->AddKinBody(pbody) ) {
+ RAVELOG_ERRORA("failed to add body %S\n", pbody->GetName());
+ delete pbody;
+ continue;
+ }
+
+ if( AddKinBody(pbody, NULL) == NULL ) {
+ delete pbody;
+ continue;
+ }
+
+ pbody->SetTransform(GetTransform((*itobj)->pose));
+ }
+ GetEnv()->LockPhysics(false);
+ }
+ }
+
+ Transform GetTransform(const std_msgs::Transform& pose)
+ {
+ return Transform(Vector(pose.rotation.w, pose.rotation.x, pose.rotation.y, pose.rotation.z), Vector(pose.translation.x, pose.translation.y, pose.translation.z));
+ }
+
+ dReal _fThreshSqr;
+};
+
+#endif
+
Modified: pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp 2008-12-20 03:33:29 UTC (rev 8479)
@@ -27,6 +27,8 @@
#include "rosarmik.h"
#include "phasespacesystem.h"
+#include "objecttransformsystem.h"
+
#include "rosplanningproblem.h"
// declaring variables with stdcall can be a little complex
@@ -61,6 +63,8 @@
case PT_SensorSystem:
if( wcsicmp(name, L"PhaseSpace") == 0 )
return new PhaseSpaceMocapClient(penv);
+ if( wcsicmp(name, L"ObjectTransform") == 0 )
+ return new ObjectTransformSystem(penv);
default:
break;
}
@@ -78,6 +82,7 @@
pinfo->iksolvers.push_back(L"ROSArmIK");
pinfo->sensorsystems.push_back(L"PhaseSpace");
+ pinfo->sensorsystems.push_back(L"ObjectTransform");
pinfo->problems.push_back(L"ROSPlanningProblem");
return true;
Modified: pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h 2008-12-20 03:33:29 UTC (rev 8479)
@@ -26,141 +26,68 @@
#ifndef PHASESPACE_MOCAP_SYSTEM
#define PHASESPACE_MOCAP_SYSTEM
-#include "simplesensorsystem.h"
+#include "rossensorsystem.h"
#include "phase_space/PhaseSpaceSnapshot.h"
using namespace ros;
// used to update objects through a mocap system
-class PhaseSpaceMocapClient : public SimpleSensorSystem
+class PhaseSpaceXMLID
{
public:
- PhaseSpaceMocapClient(EnvironmentBase* penv) : SimpleSensorSystem(penv, "phasespace"), _bSubscribed(false)
+ static const char* GetXMLId() { return "phasespace"; }
+};
+
+class PhaseSpaceMocapClient : public ROSSensorSystem<phase_space::PhaseSpaceSnapshot, PhaseSpaceXMLID>
+{
+public:
+ PhaseSpaceMocapClient(EnvironmentBase* penv)
+ : ROSSensorSystem<phase_space::PhaseSpaceSnapshot, PhaseSpaceXMLID>(penv)
{
- RegisterXMLReader(GetEnv()); // just in case, register again
}
- virtual ~PhaseSpaceMocapClient() {
- Destroy();
- }
virtual bool Init(istream& sinput)
{
- if( !SimpleSensorSystem::Init(sinput) )
- return false;
-
- _phasespacetopic = "phase_space_snapshot";
- sinput >> _phasespacetopic;
- startsubscriptions();
- return _bSubscribed;
+ _topic = "phase_space_snapshot";
+ return ROSSensorSystem<phase_space::PhaseSpaceSnapshot, PhaseSpaceXMLID>::Init(sinput);
}
- virtual void Destroy()
- {
- stopsubscriptions();
- SimpleSensorSystem::Destroy();
- }
-
- static void RegisterXMLReader(EnvironmentBase* penv)
- {
- if( penv != NULL )
- penv->RegisterXMLReader("phasespace", PhaseSpaceMocapClient::CreateMocapReader);
- }
-
- static BaseXMLReader* CreateMocapReader(KinBody* parent, const char **atts)
- {
- return new MocapXMLReader("phasespace", NULL, atts);
- }
-
private:
- node* check_roscpp()
+ void newdatacb()
{
- // start roscpp
- ros::node* pnode = ros::node::instance();
+ list< SNAPSHOT > listbodies;
+ list< const phase_space::PhaseSpaceBody* > listnewbodies;
- if( pnode && !pnode->check_master() ) {
- ros::fini();
- delete pnode;
- return NULL;
- }
+ {
+ boost::mutex::scoped_lock lock(_mutex);
- if (!pnode) {
- int argc = 0;
- char strname[256] = "nohost";
- gethostname(strname, sizeof(strname));
- strcat(strname,"_rosoct");
+ for (unsigned int i=0; i<_topicmsg.get_bodies_size(); i++) {
+ const phase_space::PhaseSpaceBody& psbody = _topicmsg.bodies[i];
- ros::init(argc,NULL);
-
- pnode = new ros::node(strname, ros::node::DONT_HANDLE_SIGINT|ros::node::ANONYMOUS_NAME|ros::node::DONT_ADD_ROSOUT_APPENDER);
-
- bool bCheckMaster = pnode->check_master();
- ros::fini();
- delete pnode;
+ boost::shared_ptr<BODY> b;
+ Transform tnew = GetTransform(psbody.pose);
- if( !bCheckMaster ) {
- RAVELOG_ERRORA("ros not present");
- return NULL;
- }
-
- ros::init(argc,NULL);
- pnode = new ros::node(strname, ros::node::DONT_HANDLE_SIGINT|ros::node::ANONYMOUS_NAME);
- RAVELOG_DEBUGA("new roscpp node started");
- }
+ FOREACH(it, _mapbodies) {
+ if( it->second->_initdata.id == psbody.id ) {
+ b = it->second;
+ break;
+ }
+ }
- return pnode;
- }
-
- void startsubscriptions()
- {
- // check if thread launched
- _bSubscribed = false;
- ros::node* pnode = check_roscpp();
- if( pnode != NULL ) {
- _bSubscribed = pnode->subscribe(_phasespacetopic, _snapshot, &PhaseSpaceMocapClient::newdatacb, this, 10);
- if( _bSubscribed )
- RAVELOG_DEBUGA("subscribed to %s\n", _phasespacetopic.c_str());
- else
- RAVELOG_ERRORA("failed to subscribe to %s\n", _phasespacetopic.c_str());
- }
- }
-
- void stopsubscriptions()
- {
- if( _bSubscribed ) {
- ros::node* pnode = ros::node::instance();
- if( pnode && pnode->check_master() ) {
- pnode->unsubscribe(_phasespacetopic.c_str());
- RAVELOG_DEBUGA("unsubscribe from %s\n", _phasespacetopic.c_str());
- }
- _bSubscribed = false;
- }
- }
-
- void newdatacb()
- {
- list< SNAPSHOT > listbodies;
- boost::mutex::scoped_lock lock(_mutex);
- RAVELOG_VERBOSEA("cb\n");
-
- for (unsigned int i=0; i<_snapshot.get_bodies_size(); i++) {
- const phase_space::PhaseSpaceBody& psbody = _snapshot.bodies[i];
-
- boost::shared_ptr<BODY> b;
- FOREACH(it, _mapbodies) {
- if( it->second->_initdata.id == psbody.id ) {
- b = it->second;
- break;
+ if( !b ) {
+ listnewbodies.push_back(&psbody);
}
+ else {
+ if( !b->IsEnabled() )
+ continue;
+
+ listbodies.push_back(SNAPSHOT(b, tnew));
+ }
}
- if( !b || !b->IsEnabled() )
- continue;
-
- listbodies.push_back(SNAPSHOT(b, GetTransform(psbody.pose)));
+ UpdateBodies(listbodies);
}
- UpdateBodies(listbodies);
-
// try to add the left-over objects
}
@@ -168,10 +95,6 @@
{
return Transform(Vector(pose.rotation.w, pose.rotation.x, pose.rotation.y, pose.rotation.z), Vector(pose.translation.x, pose.translation.y, pose.translation.z));
}
-
- phase_space::PhaseSpaceSnapshot _snapshot;
- string _phasespacetopic;
- bool _bSubscribed;
};
#endif
Modified: pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h 2008-12-20 03:25:40 UTC (rev 8478)
+++ pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h 2008-12-20 03:33:29 UTC (rev 8479)
@@ -34,6 +34,7 @@
#define FOREACH(it, v) for(BOOST_TYPEOF(v)::iterator it = (v).begin(); it != (v).end(); (it)++)
#define FOREACHC(it, v) for(BOOST_TYPEOF(v)::const_iterator it = (v).begin(); it != (v).end(); (it)++)
#define RAVE_REGISTER_BOOST
+#define TYPEOF BOOST_TYPEOF
#else
#include <string>
@@ -44,7 +45,7 @@
#define FOREACH(it, v) for(typeof((v).begin()) it = (v).begin(); it != (v).end(); (it)++)
#define FOREACHC FOREACH
-
+#define TYPEOF typeof
#endif
#include <fstream>
@@ -159,4 +160,48 @@
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
+inline ros::node* check_roscpp()
+{
+ // start roscpp
+ ros::node* pnode = ros::node::instance();
+
+ if( pnode && !pnode->check_master() ) {
+ ros::fini();
+ delete pnode;
+ return NULL;
+ }
+
+ if (!pnode) {
+ int argc = 0;
+ char strname[256] = "nohost";
+ gethostname(strname, sizeof(strname));
+ strcat(strname,"_openrave");
+
+ ros::init(argc,NULL);
+
+ pnode = new ros::node(strname, ros::node::DONT_HANDLE_SIGINT|ros::node::ANONYMOUS_NAME|ros::node::DONT_ADD_ROSOUT_APPENDER);
+
+ bool bCheckMaster = pnode->check_master();
+ ros::fini();
+ delete pnode;
+
+ if( !bCheckMaster ) {
+ RAVELOG_ERRORA("ros not present");
+ return NULL;
+ }
+
+ ros::init(argc,NULL);
+ pnode = new ros::node(strname, ros::node::DONT_HANDLE_SIGINT|ros::node::ANONYMOUS_NAME);
+ RAVELOG_DEBUGA("new roscpp node started");
+ }
+
+ return pnode;
+}
+
+inline ros::node* check_roscpp_nocreate()
+{
+ ros::node* pnode = ros::node::instance();
+ return (pnode && pnode->check_master()) ? pnode : NULL;
+}
+
#endif
Added: pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h (rev 0)
+++ pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h 2008-12-20 03:33:29 UTC (rev 8479)
@@ -0,0 +1,98 @@
+// Software License Agreement (BSD License)
+// Copyright (c) 2008, Willow Garage, Inc.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * The name of the author may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR...
[truncated message content] |
|
From: <tf...@us...> - 2008-12-22 18:36:03
|
Revision: 8496
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8496&view=rev
Author: tfoote
Date: 2008-12-22 18:35:59 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
renaming IBPS to ocean as per API review
Modified Paths:
--------------
pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml
pkg/trunk/robot_descriptions/pr2_alpha/pre.launch
pkg/trunk/robot_descriptions/pr2_alpha/prf.launch
pkg/trunk/robot_descriptions/pr2_alpha/prg.launch
pkg/trunk/visualization/pr2_gui/manifest.xml
pkg/trunk/visualization/pr2_gui/src/pr2_gui/hardware_panel.py
Added Paths:
-----------
pkg/trunk/drivers/robot/pr2/ocean_battery_driver/
Removed Paths:
-------------
pkg/trunk/drivers/robot/pr2/IBPSBatteryInterface/
Modified: pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml 2008-12-22 18:30:31 UTC (rev 8495)
+++ pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml 2008-12-22 18:35:59 UTC (rev 8496)
@@ -14,7 +14,7 @@
<depend package="teleop_base"/>
<depend package="pr2_etherCAT"/>
<depend package="pr2_power_board"/>
- <depend package="IBPSBatteryInterface"/>
+ <depend package="ocean_battery_driver"/>
<depend package="joy"/>
<depend package="rosrecord"/>
<depend package="hokuyo_node"/>
Modified: pkg/trunk/robot_descriptions/pr2_alpha/pre.launch
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/pre.launch 2008-12-22 18:30:31 UTC (rev 8495)
+++ pkg/trunk/robot_descriptions/pr2_alpha/pre.launch 2008-12-22 18:35:59 UTC (rev 8496)
@@ -19,7 +19,7 @@
<node pkg="pr2_power_board" type="power_node" respawn="true"/>
<!-- Battery Monitor -->
- <node machine="two" pkg="IBPSBatteryInterface" type="monitor" respawn="true"/>
+ <node machine="two" pkg="ocean_battery_driver" type="monitor" respawn="true"/>
<!-- Base Laser -->
<node machine="two" pkg="hokuyo_node" type="hokuyo_node" name="base_hokuyo_node" args="scan:=base_scan">
Modified: pkg/trunk/robot_descriptions/pr2_alpha/prf.launch
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/prf.launch 2008-12-22 18:30:31 UTC (rev 8495)
+++ pkg/trunk/robot_descriptions/pr2_alpha/prf.launch 2008-12-22 18:35:59 UTC (rev 8496)
@@ -19,7 +19,7 @@
<node pkg="pr2_power_board" type="power_node" respawn="true"/>
<!-- Battery Monitor -->
- <node machine="two" pkg="IBPSBatteryInterface" type="monitor" respawn="true"/>
+ <node machine="two" pkg="ocean_battery_driver" type="monitor" respawn="true"/>
<!-- Base Laser -->
<node machine="two" pkg="hokuyo_node" type="hokuyo_node" name="base_hokuyo_node" args="scan:=base_scan">
Modified: pkg/trunk/robot_descriptions/pr2_alpha/prg.launch
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/prg.launch 2008-12-22 18:30:31 UTC (rev 8495)
+++ pkg/trunk/robot_descriptions/pr2_alpha/prg.launch 2008-12-22 18:35:59 UTC (rev 8496)
@@ -19,7 +19,7 @@
<node pkg="pr2_power_board" type="power_node" respawn="true"/>
<!-- Battery Monitor -->
- <node machine="two" pkg="IBPSBatteryInterface" type="monitor" respawn="true"/>
+ <node machine="two" pkg="ocean_battery_driver" type="monitor" respawn="true"/>
<!-- Base Laser -->
<node machine="two" pkg="hokuyo_node" type="hokuyo_node" name="base_hokuyo_node" args="scan:=base_scan">
Modified: pkg/trunk/visualization/pr2_gui/manifest.xml
===================================================================
--- pkg/trunk/visualization/pr2_gui/manifest.xml 2008-12-22 18:30:31 UTC (rev 8495)
+++ pkg/trunk/visualization/pr2_gui/manifest.xml 2008-12-22 18:35:59 UTC (rev 8496)
@@ -16,7 +16,7 @@
<depend package="rospy"/>
<depend package="rostools"/>
<depend package="std_srvs"/>
- <depend package="IBPSBatteryInterface"/>
+ <depend package="ocean_battery_driver"/>
<depend package="pr2_power_board"/>
<sysdepend os="ubuntu" version="7.04-feisty" package="libwxgtk2.8-dev"/>
Modified: pkg/trunk/visualization/pr2_gui/src/pr2_gui/hardware_panel.py
===================================================================
--- pkg/trunk/visualization/pr2_gui/src/pr2_gui/hardware_panel.py 2008-12-22 18:30:31 UTC (rev 8495)
+++ pkg/trunk/visualization/pr2_gui/src/pr2_gui/hardware_panel.py 2008-12-22 18:35:59 UTC (rev 8496)
@@ -37,8 +37,8 @@
import wx.aui
from wx import xrc
import reset
-import IBPSBatteryInterface
-from IBPSBatteryInterface.ibps_panel import *
+import ocean_battery_driver
+from ocean_battery_driver.ibps_panel import *
import pr2_power_board
from pr2_power_board.pr2_power_board_panel import *
@@ -63,4 +63,4 @@
self._notebook.AddPage(self._battery_panel, "Battery")
self._notebook.AddPage(self._powerboard_panel, "Power Board")
-
\ No newline at end of file
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tpr...@us...> - 2008-12-23 23:53:49
|
Revision: 8553
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8553&view=rev
Author: tpratkanis
Date: 2008-12-23 23:53:44 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
Huge commit to change raytracing of static obstacles in the cost map
Modified Paths:
--------------
pkg/trunk/highlevel/highlevel_controllers/src/MoveBase.cpp
pkg/trunk/highlevel/test_highlevel_controllers/test/launch_move_base.xml
pkg/trunk/world_models/costmap_2d/include/costmap_2d/costmap_2d.h
pkg/trunk/world_models/costmap_2d/include/costmap_2d/obstacle_map_accessor.h
pkg/trunk/world_models/costmap_2d/src/costmap_2d.cpp
pkg/trunk/world_models/costmap_2d/src/obstacle_map_accessor.cc
pkg/trunk/world_models/costmap_2d/src/test/module-tests.cc
pkg/trunk/world_models/costmap_2d/testmap_compare.txt
Modified: pkg/trunk/highlevel/highlevel_controllers/src/MoveBase.cpp
===================================================================
--- pkg/trunk/highlevel/highlevel_controllers/src/MoveBase.cpp 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/highlevel/highlevel_controllers/src/MoveBase.cpp 2008-12-23 23:53:44 UTC (rev 8553)
@@ -165,14 +165,18 @@
}
// Now allocate the cost map and its sliding window used by the controller
- double zLB, zUB;
+ double zLB, zUB, raytraceWindow, obstacleRange, rayTraceRange;
param("/costmap_2d/zLB", zLB, 0.15);
param("/costmap_2d/zUB", zUB, 0.25);
+ param("/costmap_2d/raytrace_window", raytraceWindow, 2.5);
+ param("/costmap_2d/raytrace_range", rayTraceRange, 10.0);
+ param("/costmap_2d/obstacle_range", obstacleRange, 10.0);
costMap_ = new CostMap2D((unsigned int)resp.map.width, (unsigned int)resp.map.height,
- inputData , resp.map.resolution,
- lethalObstacleThreshold, maxZ_, zLB, zUB,
- inflationRadius, circumscribedRadius, inscribedRadius, weight);
+ inputData , resp.map.resolution,
+ lethalObstacleThreshold, maxZ_, zLB, zUB,
+ inflationRadius, circumscribedRadius, inscribedRadius, weight,
+ obstacleRange, rayTraceRange, raytraceWindow);
// Allocate Velocity Controller
double mapSize(2.0);
Modified: pkg/trunk/highlevel/test_highlevel_controllers/test/launch_move_base.xml
===================================================================
--- pkg/trunk/highlevel/test_highlevel_controllers/test/launch_move_base.xml 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/highlevel/test_highlevel_controllers/test/launch_move_base.xml 2008-12-23 23:53:44 UTC (rev 8553)
@@ -18,6 +18,7 @@
<param name="/costmap_2d/inflation_radius" value="0.55"/>
<param name="/costmap_2d/circumscribed_radius" value="0.46"/>
<param name="/costmap_2d/inscribed_radius" value="0.325"/>
+ <param name="/costmap_2d/raytrace_window" value="4.0"/>
<param name="/costmap_2d/weight" value="0.1"/>
<!-- Forces a check that we are receiving base scans that are correctly up to date at a rate of at least 2 Hz. This is
Modified: pkg/trunk/world_models/costmap_2d/include/costmap_2d/costmap_2d.h
===================================================================
--- pkg/trunk/world_models/costmap_2d/include/costmap_2d/costmap_2d.h 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/world_models/costmap_2d/include/costmap_2d/costmap_2d.h 2008-12-23 23:53:44 UTC (rev 8553)
@@ -65,6 +65,10 @@
#include <string>
#include <queue>
+namespace std_msgs {
+ class Point2DFloat32;
+};
+
namespace costmap_2d {
typedef unsigned char TICK;
@@ -120,11 +124,13 @@
* @param circumscribedRadius the radius used to indicate objects in the circumscribed circle around the robot
* @param inscribedRadius the radius used to indicate objects in the inscribed circle around the robot
* @param weight the scaling factor in the cost function. Should be <=1. Lower values reduce the effective cost
+ * @param raytraceWindow the size of the window in which raytracing is done.
*/
CostMap2D(unsigned int width, unsigned int height, const std::vector<unsigned char>& data,
double resolution, unsigned char threshold,
double maxZ = 0.5, double zLB = 0.15, double zUB = 0.20,
- double inflationRadius = 0, double circumscribedRadius = 0, double inscribedRadius = 0, double weight = 1, double obstacleRange = 10.0, double raytraceRange = 10.0);
+ double inflationRadius = 0, double circumscribedRadius = 0, double inscribedRadius = 0, double weight = 1, double obstacleRange = 10.0, double raytraceRange = 10.0,
+ double raytraceWindow = 2.5);
/**
* @brief Destructor.
@@ -192,7 +198,6 @@
* @param name The filename to save.
*/
void saveBinary(std::string name);
-
private:
/**
@@ -273,6 +278,7 @@
const unsigned int circumscribedRadius_; /**< The radius for the circumscribed radius, in cells */
const unsigned int inscribedRadius_; /**< The radius for the inscribed radius, in cells */
const double weight_; /**< The weighting to apply to a normalized cost value */
+ const double raytraceWindow_; /**< The window in which statics are raytraced */
//used squared distance because square root computations are expensive
double sq_obstacle_range_; /** The range out to which we will consider laser hitpoints **/
@@ -285,6 +291,8 @@
double** cachedDistances; /**< Cached distances indexed by dx, dy */
const unsigned int kernelWidth_; /**< The width of the kernel matrix, which will be square */
unsigned char* kernelData_; /**< kernel data structure for cost map updates around the robot */
+ const unsigned int raytraceCells_; /**< Raytracing cells */
+ double robotX_, robotY_; /**< The position of the robot */
};
/**
@@ -308,8 +316,6 @@
private:
- static double computeWX(const CostMap2D& costMap, double maxSize, double wx, double wy);
- static double computeWY(const CostMap2D& costMap, double maxSize, double wx, double wy);
static unsigned int computeSize(double maxSize, double resolution);
const CostMap2D& costMap_;
Modified: pkg/trunk/world_models/costmap_2d/include/costmap_2d/obstacle_map_accessor.h
===================================================================
--- pkg/trunk/world_models/costmap_2d/include/costmap_2d/obstacle_map_accessor.h 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/world_models/costmap_2d/include/costmap_2d/obstacle_map_accessor.h 2008-12-23 23:53:44 UTC (rev 8553)
@@ -244,6 +244,10 @@
*/
std::string toString() const;
+
+ static double computeWX(const ObstacleMapAccessor& costMap, double maxSize, double wx, double wy);
+ static double computeWY(const ObstacleMapAccessor& costMap, double maxSize, double wx, double wy);
+
protected:
/**
Modified: pkg/trunk/world_models/costmap_2d/src/costmap_2d.cpp
===================================================================
--- pkg/trunk/world_models/costmap_2d/src/costmap_2d.cpp 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/world_models/costmap_2d/src/costmap_2d.cpp 2008-12-23 23:53:44 UTC (rev 8553)
@@ -72,15 +72,15 @@
CostMap2D::CostMap2D(unsigned int width, unsigned int height, const std::vector<unsigned char>& data,
double resolution, unsigned char threshold, double maxZ, double zLB, double zUB,
double inflationRadius, double circumscribedRadius, double inscribedRadius, double weight,
- double obstacleRange, double raytraceRange)
+ double obstacleRange, double raytraceRange, double raytraceWindow)
: ObstacleMapAccessor(0, 0, width, height, resolution),
- maxZ_(maxZ), zLB_(zLB), zUB_(zUB),
- inflationRadius_(toCellDistance(inflationRadius, (unsigned int) ceil(width * resolution), resolution)),
- circumscribedRadius_(toCellDistance(circumscribedRadius, inflationRadius_, resolution)),
- inscribedRadius_(toCellDistance(inscribedRadius, circumscribedRadius_, resolution)),
- weight_(std::max(0.0, std::min(weight, 1.0))), sq_obstacle_range_(obstacleRange * obstacleRange),
- sq_raytrace_range_((raytraceRange / resolution) * (raytraceRange / resolution)),
- staticData_(NULL), xy_markers_(NULL), kernelWidth_((circumscribedRadius_ * 2) + 1)
+ maxZ_(maxZ), zLB_(zLB), zUB_(zUB),
+ inflationRadius_(toCellDistance(inflationRadius, (unsigned int) ceil(width * resolution), resolution)),
+ circumscribedRadius_(toCellDistance(circumscribedRadius, inflationRadius_, resolution)),
+ inscribedRadius_(toCellDistance(inscribedRadius, circumscribedRadius_, resolution)),
+ weight_(std::max(0.0, std::min(weight, 1.0))), raytraceWindow_(raytraceWindow),
+ sq_obstacle_range_(obstacleRange * obstacleRange), sq_raytrace_range_((raytraceRange / resolution) * (raytraceRange / resolution)),
+ staticData_(NULL), xy_markers_(NULL), kernelWidth_((circumscribedRadius_ * 2) + 1), raytraceCells_ (raytraceWindow_ / resolution)
{
if(weight != weight_){
ROS_INFO("Warning - input weight %f is invalid and has been set to %f\n", weight, weight_);
@@ -96,7 +96,7 @@
for (i=0; i<=inflationRadius_; i++) {
cachedDistances[i] = new double[inflationRadius_+1];
for (j=0; j<=i; j++) {
- cachedDistances[i][j] = sqrt (pow(i, 2) + pow(j, 2));
+ cachedDistances[i][j] = sqrt(pow(i, 2) + pow(j, 2));
cachedDistances[j][i] = cachedDistances[i][j];
}
}
@@ -132,6 +132,12 @@
// Instantiate static data
memcpy(staticData_, costData_, width_ * height_);
+
+ if (raytraceCells_ + inflationRadius_ * 2 >= getWidth() || raytraceCells_ + inflationRadius_ * 2 >= getHeight()) {
+ ROS_ERROR("Raytrace area can't be larger than the costmap.");
+ ROS_ASSERT(false);
+ exit(1);
+ }
}
CostMap2D::~CostMap2D() {
@@ -225,23 +231,8 @@
// Revert to initial state
memset(xy_markers_, 0, width_ * height_ * sizeof(bool));
- // Now propagate free space. We iterate again over observations, process only those from an origin
- // within a specific range, and a point within a certain z-range. We only want to propagate free space
- // in 2D so keep point and its origin within expected range
- for(std::vector<Observation>::const_iterator it = observations.begin(); it!= observations.end(); ++it){
- const Observation& obs = *it;
- if(!in_projection_range(obs.origin_.z))
- continue;
+ robotX_ = wx; robotY_ = wy;
- const std_msgs::PointCloud& cloud = *(obs.cloud_);
- for(size_t i = 0; i < cloud.get_pts_size(); i++) {
- if(!in_projection_range(cloud.pts[i].z))
- continue;
-
- updateFreeSpace(obs.origin_, cloud.pts[i].x, cloud.pts[i].y);
- }
- }
-
// Propagation queue should be empty from completion of last propagation.
ROS_ASSERT(queue_.empty());
@@ -274,9 +265,63 @@
unsigned int mx, my;
IND_MC(ind, mx, my);
enqueue(ind, mx, my);
+
+ if(in_projection_range(cloud.pts[i].z) && in_projection_range(obs.origin_.z))
+ updateFreeSpace(obs.origin_, cloud.pts[i].x, cloud.pts[i].y);
}
}
+
+ // Now propagate free space. We iterate again over observations, process only those from an origin
+ // within a specific range, and a point within a certain z-range. We only want to propagate free space
+ // in 2D so keep point and its origin within expected range
+ /*for(std::vector<Observation>::const_iterator it = observations.begin(); it!= observations.end(); ++it){
+ const Observation& obs = *it;
+ if(!in_projection_range(obs.origin_.z))
+ continue;
+
+ const std_msgs::PointCloud& cloud = *(obs.cloud_);
+ for(size_t i = 0; i < cloud.get_pts_size(); i++) {
+ if(!in_projection_range(cloud.pts[i].z))
+ continue;
+
+ updateFreeSpace(obs.origin_, cloud.pts[i].x, cloud.pts[i].y);
+ }
+ }*/
+
+
+
+ //Clear out the window.
+ unsigned int rayStartX = 0, rayStartY = 0, rayEndX = 0, rayEndY = 0;
+ WC_MC(computeWX(*this, raytraceWindow_ + inflationRadius_ * getResolution() * 2, robotX_, robotY_),
+ computeWY(*this, raytraceWindow_ + inflationRadius_ * getResolution() * 2, robotX_, robotY_), rayStartX, rayStartY);
+ rayEndX = rayStartX + raytraceCells_ + inflationRadius_ * 2;
+ rayEndY = rayStartY + raytraceCells_ + inflationRadius_ * 2;
+
+ unsigned int clearStartX = 0, clearStartY = 0, clearEndX = 0, clearEndY = 0;
+ WC_MC(computeWX(*this, raytraceWindow_, robotX_, robotY_),
+ computeWY(*this, raytraceWindow_, robotX_, robotY_), clearStartX, clearStartY);
+ clearEndX = clearStartX + raytraceCells_;
+ clearEndY = clearStartY + raytraceCells_;
+
+
+
+ for (unsigned int x = rayStartX; x < rayEndX; x++) {
+ for (unsigned int y = rayStartY; y < rayEndY; y++) {
+ unsigned int ind = MC_IND(x, y);
+
+ if (costData_[ind] != 0 && staticData_[ind] == LETHAL_OBSTACLE && !marked(ind)) {
+ enqueue(ind, x, y);
+
+ }
+ if (x > clearStartX && x < clearEndX && y > clearStartY && y < clearEndY) {
+ costData_[ind] = 0;
+ }
+ }
+ }
+
+
+
// Propagate costs
propagateCosts();
}
@@ -310,13 +355,15 @@
void CostMap2D::saveText(std::string file) {
std::ofstream of_text(file.c_str());
+
if (of_text.fail() || !of_text) {
- printf("Failed to open file %s.\n", file.c_str());
+ ROS_INFO("Failed to open file %s.\n", file.c_str());
return;
}
for (unsigned int i = 0; i < getWidth(); i++) {
for (unsigned int j = 0; j < getHeight(); j++) {
+ of_text.width(4);
of_text << (int)(getMap()[i + j * getWidth()]) << ",";
}
of_text << std::endl;
@@ -326,7 +373,7 @@
void CostMap2D::saveBinary(std::string file) {
std::ofstream of(file.c_str(), std::ios::out|std::ios::binary);
if (of.fail() || !of) {
- printf("Failed to open file %s.\n", file.c_str());
+ ROS_INFO("Failed to open file %s.\n", file.c_str());
return;
}
@@ -334,9 +381,6 @@
of.close();
}
-
-
-
/**
* @brief It is arguable if this is the correct update rule. We are trying to avoid
* tracing holes through walls by propagating adjacent cells that are in sensor range through
@@ -435,6 +479,15 @@
numpixels = deltay; // There are more y-values than x-values
}
+
+ //Static Ray trace zone.
+ unsigned int rayStartX = 0, rayStartY = 0, rayEndX = 0, rayEndY = 0;
+ WC_MC(computeWX(*this, raytraceWindow_, robotX_, robotY_),
+ computeWY(*this, raytraceWindow_, robotX_, robotY_), rayStartX, rayStartY);
+ rayEndX = rayStartX + raytraceCells_;
+ rayEndY = rayStartY + raytraceCells_;
+
+
for (unsigned int curpixel = 0; curpixel <= numpixels; curpixel++){
unsigned int index = MC_IND(x, y);
@@ -450,14 +503,20 @@
x += xinc2; // Change the x as appropriate
y += yinc2; // Change the y as appropriate
- if(!marked(index))
+ if(!marked(index) && staticData_[index] == CostMapAccessor::LETHAL_OBSTACLE) {
costData_[index] = 0;
+ }
//we want to break out of the loop if we have raytraced far enough
double sq_cell_dist = (x - startx) * (x - startx) + (y - starty) * (y - starty);
if(sq_cell_dist >= sq_raytrace_range_)
break;
+
+ if (x < rayStartX) { return; }
+ if (x > rayEndX) { return; }
+ if (y < rayStartY) { return; }
+ if (y > rayEndY) { return; }
}
}
@@ -501,38 +560,7 @@
}
}
- double CostMapAccessor::computeWX(const CostMap2D& costMap, double maxSize, double wx, double wy){
- unsigned int mx, my;
- costMap.WC_MC(wx, wy, mx, my);
- unsigned int cellWidth = (unsigned int) (maxSize/costMap.getResolution());
- unsigned int origin_mx(0);
-
- if(mx > cellWidth/2)
- origin_mx = mx - cellWidth/2;
-
- if(origin_mx + cellWidth > costMap.getWidth())
- origin_mx = costMap.getWidth() - cellWidth - 1;
-
- return origin_mx * costMap.getResolution();
- }
-
- double CostMapAccessor::computeWY(const CostMap2D& costMap, double maxSize, double wx, double wy){
- unsigned int mx, my;
- costMap.WC_MC(wx, wy, mx, my);
-
- unsigned int cellWidth = (unsigned int) (maxSize/costMap.getResolution());
- unsigned int origin_my(0);
-
- if(my > cellWidth/2)
- origin_my = my - cellWidth/2;
-
- if(origin_my + cellWidth > costMap.getHeight())
- origin_my = costMap.getHeight() - cellWidth - 1;
-
- return origin_my * costMap.getResolution();
- }
-
unsigned int CostMapAccessor::computeSize(double maxSize, double resolution){
unsigned int cellWidth = (unsigned int) ceil(maxSize/resolution);
ROS_DEBUG("Given a size of %f and a resolution of %f, we have a cell width of %d\n", maxSize, resolution, cellWidth);
Modified: pkg/trunk/world_models/costmap_2d/src/obstacle_map_accessor.cc
===================================================================
--- pkg/trunk/world_models/costmap_2d/src/obstacle_map_accessor.cc 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/world_models/costmap_2d/src/obstacle_map_accessor.cc 2008-12-23 23:53:44 UTC (rev 8553)
@@ -95,4 +95,36 @@
}
return ss.str();
}
+
+ double ObstacleMapAccessor::computeWX(const ObstacleMapAccessor& costMap, double maxSize, double wx, double wy){
+ unsigned int mx, my;
+ costMap.WC_MC(wx, wy, mx, my);
+
+ unsigned int cellWidth = (unsigned int) (maxSize/costMap.getResolution());
+ unsigned int origin_mx(0);
+
+ if(mx > cellWidth/2)
+ origin_mx = mx - cellWidth/2;
+
+ if(origin_mx + cellWidth > costMap.getWidth())
+ origin_mx = costMap.getWidth() - cellWidth - 1;
+
+ return origin_mx * costMap.getResolution();
+ }
+
+ double ObstacleMapAccessor::computeWY(const ObstacleMapAccessor& costMap, double maxSize, double wx, double wy){
+ unsigned int mx, my;
+ costMap.WC_MC(wx, wy, mx, my);
+
+ unsigned int cellWidth = (unsigned int) (maxSize/costMap.getResolution());
+ unsigned int origin_my(0);
+
+ if(my > cellWidth/2)
+ origin_my = my - cellWidth/2;
+
+ if(origin_my + cellWidth > costMap.getHeight())
+ origin_my = costMap.getHeight() - cellWidth - 1;
+
+ return origin_my * costMap.getResolution();
+ }
}
Modified: pkg/trunk/world_models/costmap_2d/src/test/module-tests.cc
===================================================================
--- pkg/trunk/world_models/costmap_2d/src/test/module-tests.cc 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/world_models/costmap_2d/src/test/module-tests.cc 2008-12-23 23:53:44 UTC (rev 8553)
@@ -86,7 +86,7 @@
}
// Allocate the cost map, with a inflation to 3 cells all around
- CostMap2D map(10, 10, staticMap, RESOLUTION, THRESHOLD, MAX_Z, MAX_Z, MAX_Z, 3, 3, 3);
+ CostMap2D map(10, 10, staticMap, RESOLUTION, THRESHOLD, MAX_Z, MAX_Z, MAX_Z, 3, 3, 3, 1, 100.0, 100.0, 3.0);
// Populate the cost map with a wall around the perimeter. Free space should clear out the room.
std_msgs::PointCloud cloud;
@@ -132,33 +132,46 @@
// Update the cost map for this observation
map.updateDynamicObstacles(wx, wy, obsBuf);
- // Verify that we now have only 8 * 4 + 4 cells with lethal cost, thus provong that we have correctly cleared
+
+ // Verify that we now have only 84 cells with lethal cost, thus provong that we have correctly cleared
// free space
unsigned int hitCount = 0;
for(unsigned int i=0; i <100; i++){
if(map.getMap()[i] == CostMap2D::LETHAL_OBSTACLE)
hitCount++;
}
- ASSERT_EQ(hitCount, 36);
+ ASSERT_EQ(hitCount, 84);
- // Veriy that we have 4 free cells
+ // Veriy that we have 16 non-leathal
hitCount = 0;
for(unsigned int i=0; i < 100; i++){
- if(map.getMap()[i] == 0)
+ if(map.getMap()[i] != CostMap2D::LETHAL_OBSTACLE)
hitCount++;
}
- ASSERT_EQ(hitCount, 4);
+ ASSERT_EQ(hitCount, 16);
// Now if we reset the cost map, we shold retain the free space, and also retain values of INSCRIBED circle
// in the region of the circumscribed radius (3 cells)
map.revertToStaticMap(wx, wy);
unsigned int mx, my;
map.WC_MC(wx, wy, mx, my);
- for(unsigned int x = mx - 3; x <= mx+3; x++){
- for(unsigned int y = my -3; y <= my + 3; y++){
- ASSERT_EQ(map.getCost(x, y) < CostMap2D::LETHAL_OBSTACLE, true);
- }
+
+
+ //We should retain
+ hitCount = 0;
+ for(unsigned int i=0; i <100; i++){
+ if(map.getMap()[i] == CostMap2D::LETHAL_OBSTACLE)
+ hitCount++;
}
+ ASSERT_EQ(hitCount, 84);
+
+ // Veriy that we have 16 non-leathal
+ hitCount = 0;
+ for(unsigned int i=0; i < 100; i++){
+ if(map.getMap()[i] != CostMap2D::LETHAL_OBSTACLE)
+ hitCount++;
+ }
+ ASSERT_EQ(hitCount, 16);
}
/**
@@ -337,6 +350,7 @@
std::vector<unsigned int> updates;
map.updateDynamicObstacles(cloud, updates);
+
ASSERT_EQ(updates.size(), 3);
}
@@ -575,6 +589,7 @@
c0.pts[2].z = MAX_Z;
map.updateDynamicObstacles(c0, updates);
+
ASSERT_EQ(map.getCost(3, 2), CostMap2D::INSCRIBED_INFLATED_OBSTACLE);
ASSERT_EQ(map.getCost(3, 3), CostMap2D::INSCRIBED_INFLATED_OBSTACLE);
}
@@ -660,7 +675,7 @@
*/
TEST(costmap, test11){
- CostMap2D map(GRID_WIDTH, GRID_HEIGHT, MAP_10_BY_10, RESOLUTION, THRESHOLD, MAX_Z * 2, MAX_Z, MAX_Z, ROBOT_RADIUS, 0, 0, 1, 100.0, 100.0);
+ CostMap2D map(GRID_WIDTH, GRID_HEIGHT, MAP_10_BY_10, RESOLUTION, THRESHOLD, MAX_Z * 2, MAX_Z, MAX_Z, ROBOT_RADIUS, 0, 0, 1, 100.0, 100.0, 7.0);
// The initial position will be <0,0> by default. So if we add an obstacle at 9,9, we would expect cells
// <0, 0> thru <8, 8> to be free
@@ -676,11 +691,13 @@
// I considered allowing the cost function to over-ride this case but we quickly find that the planner will plan through walls once it gets out of sensor range.
// Note that this will not be the case when we persist the changes to the static map more aggressively since we will retain high cost obstacle data that
// has not been ray tarced thru. If that is the case, this update count would change to 6
- ASSERT_EQ(updates.size(), 4);
+ ASSERT_EQ(updates.size(), 5);
- // all cells will have been switched to free space along the diagonal except for this inflated in the update
- for(unsigned int i=0; i < 8; i++)
- ASSERT_EQ(map.getCost(i, i), 0);
+
+ // many cells will have been switched to free space along the diagonal except for those inflated in the update
+ unsigned char test[9]= {0, 0, 0, 126, 126, 0, 0, 126, 254};
+ for(unsigned int i=0; i < 9; i++)
+ ASSERT_EQ(map.getCost(i, i), test[i]);
}
@@ -691,11 +708,11 @@
test = fopen(a.c_str(), "r");
compare = fopen(b.c_str(), "r");
if (!test) {
- printf("Could not open: %s\n", a.c_str());
+ ROS_INFO("Could not open: %s\n", a.c_str());
return false;
}
if (!compare) {
- printf("Could not open: %s\n", b.c_str());
+ ROS_INFO("Could not open: %s\n", b.c_str());
return false;
}
@@ -735,6 +752,87 @@
ASSERT_EQ(compareFiles("testmap.bin", "testmap_compare.bin"), true);
}
+
+
+
+
+
+/**
+ * Within a certian radius of the robot, the cost map most propagate obstacles. This
+ * is to avoid a case where a hit on a far obstacle clears inscribed radius around a
+ * near one.
+ */
+
+TEST(costmap, test17){
+ const unsigned char MAP_HALL_CHAR[10 * 10] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 254, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 254, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 254, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ };
+ std::vector<unsigned char> MAP_HALL;
+ for (int i = 0; i < 10 * 10; i++) {
+ MAP_HALL.push_back(MAP_HALL_CHAR[i]);
+ }
+
+
+ CostMap2D map(GRID_WIDTH, GRID_HEIGHT, MAP_HALL, RESOLUTION,
+ THRESHOLD, MAX_Z * 2, MAX_Z, MAX_Z, ROBOT_RADIUS, 0, 0, 1, 100.0, 100.0, 7.0);
+
+
+
+ //Add a dynamic obstacle
+ vector<std_msgs::PointCloud*> cv2;
+ std_msgs::PointCloud c2;
+ cv2.push_back(&c2);
+ c2.set_pts_size(2);
+ c2.pts[0].x = 9 - 2;
+ c2.pts[0].y = 9 - 1;
+ c2.pts[0].z = 1.0;
+ c2.pts[1].x = 3.0;
+ c2.pts[1].y = 4.0;
+ c2.pts[1].z = 1.0;
+ map.updateDynamicObstacles(0.0, 0.0, cv2);
+
+
+ const unsigned char MAP_HALL_CHAR_TEST[10 * 10] = {
+ 126, 254, 126, 0, 0, 0, 0, 0, 0, 0,
+ 0, 126, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 126, 0, 0, 0, 0, 0,
+ 0, 0, 0, 126, 254, 126, 0, 0, 0, 0,
+ 0, 0, 0, 0, 126, 0, 0, 126, 0, 0,
+ 0, 0, 0, 0, 0, 0, 126, 254, 126, 0,
+ 0, 0, 0, 0, 0, 0, 0, 126, 126, 0,
+ 0, 0, 0, 0, 0, 0, 0, 126, 254, 126,
+ 0, 0, 0, 0, 0, 0, 0, 0, 126, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ };
+
+
+ for (int i = 0; i < 10 * 10; i++) {
+ ASSERT_EQ(map.getCost(i / 10, i % 10), MAP_HALL_CHAR_TEST[i]);
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
int main(int argc, char** argv){
for(unsigned int i = 0; i< GRID_WIDTH * GRID_HEIGHT; i++){
EMPTY_10_BY_10.push_back(0);
Modified: pkg/trunk/world_models/costmap_2d/testmap_compare.txt
===================================================================
--- pkg/trunk/world_models/costmap_2d/testmap_compare.txt 2008-12-23 23:48:49 UTC (rev 8552)
+++ pkg/trunk/world_models/costmap_2d/testmap_compare.txt 2008-12-23 23:53:44 UTC (rev 8553)
@@ -1,10 +1,10 @@
-0,0,0,0,0,70,0,0,0,0,
-0,0,0,0,0,70,0,0,0,0,
-0,0,0,0,0,0,0,126,0,0,
-0,0,0,126,126,0,126,254,126,0,
-0,0,126,254,254,126,126,254,126,0,
-0,0,0,126,126,0,126,254,126,0,
-0,0,126,126,126,0,0,126,126,126,
-0,126,254,254,254,126,0,126,254,254,
-0,126,254,254,254,126,0,126,254,254,
-0,126,254,254,254,126,0,126,254,254,
+ 0, 0, 0, 0, 0, 70, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 70, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 126, 0, 0,
+ 0, 0, 0, 126, 126, 0, 126, 254, 126, 0,
+ 0, 0, 126, 254, 254, 126, 126, 254, 126, 0,
+ 0, 0, 0, 126, 126, 0, 126, 254, 126, 0,
+ 0, 0, 126, 126, 126, 0, 0, 126, 126, 126,
+ 0, 126, 254, 254, 254, 126, 0, 126, 254, 254,
+ 0, 126, 254, 254, 254, 126, 0, 126, 254, 254,
+ 0, 126, 254, 254, 254, 126, 0, 126, 254, 254,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hsu...@us...> - 2008-12-24 17:55:15
|
Revision: 8571
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8571&view=rev
Author: hsujohnhsu
Date: 2008-12-24 17:55:10 +0000 (Wed, 24 Dec 2008)
Log Message:
-----------
renamed gazebo_plugin files to somewhat ros standards. this affects plugin library names, so robot description <map> tags and some world files are updated as well.
Modified Paths:
--------------
pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_empty.xml
pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_wg.xml
pkg/trunk/demos/examples_gazebo/dual_link_defs/dual_link.xml
pkg/trunk/demos/examples_gazebo/multi_link_defs/multi_link.xml
pkg/trunk/demos/examples_gazebo/single_link_defs/single_link.xml
pkg/trunk/demos/pr2_gazebo/pr2_default_controllers.launch
pkg/trunk/demos/pr2_prototype1_gazebo/pr2_prototype1_empty.launch
pkg/trunk/drivers/simulator/gazebo_plugin/CMakeLists.txt
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_objects/object1.model
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_objects/object_small_box.model
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_worlds/empty.world
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_worlds/obstacle.world
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_worlds/simple.world
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_worlds/tablegrasp.world
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_worlds/tables.world
pkg/trunk/robot_descriptions/gazebo_robot_description/gazebo_worlds/test/test_camera.world
pkg/trunk/robot_descriptions/wg_robot_description/pr2_arm_test/pr2_arm.xacro.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_arm_test/pr2_grav_arm.xacro.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_gripper/pr2_gripper.xacro.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/arm_defs.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/arm_grav_defs.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/base_defs.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/body_defs.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gazebo_defs.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/head_defs.xml
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/ptz_defs.xml
Added Paths:
-----------
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_block_laser.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_bumper.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_camera.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_f3d.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_joint_force.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_laser.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_p3d.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_ptz.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_stereo_camera.h
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/ros_time.h
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_block_laser.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_bumper.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_camera.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_f3d.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_joint_force.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_laser.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_p3d.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_ptz.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_stereo_camera.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/ros_time.cpp
pkg/trunk/drivers/simulator/gazebo_plugin/src/urdf2factory.cpp
Removed Paths:
-------------
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/F3D.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/P3D.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_Block_Laser.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_Bumper.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_Camera.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_JointForce.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_Laser.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_PTZ.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_Stereo_Camera.hh
pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/Ros_Time.hh
pkg/trunk/drivers/simulator/gazebo_plugin/src/F3D.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/P3D.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_Block_Laser.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_Bumper.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_Camera.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_JointForce.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_Laser.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_PTZ.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_Stereo_Camera.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/Ros_Time.cc
pkg/trunk/drivers/simulator/gazebo_plugin/src/urdf2factory.cc
Modified: pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_empty.xml
===================================================================
--- pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_empty.xml 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_empty.xml 2008-12-24 17:55:10 UTC (rev 8571)
@@ -35,15 +35,15 @@
<test test-name="2dnav_gazebo_test_2dnav_empty_ympi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 25.65 -y 23.51 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 50 " time-limit="60" />
<test test-name="2dnav_gazebo_test_2dnav_empty_ym1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 25.65 -y 24.65 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 50 " time-limit="60" />
- <test test-name="2dnav_gazebo_test_2dnav_empty_y1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 25.65 -y 26.65 -t 0 -nav_tol 0.70 -odom_tol 0.06 -timeout 50 " time-limit="60" />
- <test test-name="2dnav_gazebo_test_2dnav_empty_ypi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 25.65 -y 28.79 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 50 " time-limit="60" />
+ <test test-name="2dnav_gazebo_test_2dnav_empty_y1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 25.65 -y 26.65 -t 0 -nav_tol 0.70 -odom_tol 0.06 -timeout 80 " time-limit="90" />
+ <test test-name="2dnav_gazebo_test_2dnav_empty_ypi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 25.65 -y 28.79 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 80 " time-limit="90" />
<test test-name="2dnav_gazebo_test_2dnav_empty_x1y1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 26.65 -y 26.65 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 50 " time-limit="60" />
<test test-name="2dnav_gazebo_test_2dnav_empty_xm1y1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 24.65 -y 26.65 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 50 " time-limit="60" />
<test test-name="2dnav_gazebo_test_2dnav_empty_x1ym1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 26.65 -y 24.65 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 50 " time-limit="60" />
<test test-name="2dnav_gazebo_test_2dnav_empty_xm1ym1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 24.65 -y 24.65 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 50 " time-limit="60" />
- <test test-name="2dnav_gazebo_test_2dnav_empty_xpiypi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 28.79 -y 28.79 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 80 " time-limit="90" />
+ <test test-name="2dnav_gazebo_test_2dnav_empty_xpiypi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 28.79 -y 28.79 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 110 " time-limit="120" />
<test test-name="2dnav_gazebo_test_2dnav_empty_xmpiypi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 23.51 -y 28.79 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 80 " time-limit="90" />
<test test-name="2dnav_gazebo_test_2dnav_empty_xpiympi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 28.79 -y 23.51 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 80 " time-limit="90" />
<test test-name="2dnav_gazebo_test_2dnav_empty_xmpiympi" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 23.51 -y 23.51 -t 0 -nav_tol 0.70 -odom_tol 0.05 -timeout 80 " time-limit="90" />
Modified: pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_wg.xml
===================================================================
--- pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_wg.xml 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/demos/2dnav_gazebo/test/test_2dnav_wg.xml 2008-12-24 17:55:10 UTC (rev 8571)
@@ -28,12 +28,12 @@
-->
<!-- test -->
- <test test-name="2dnav_gazebo_test_2dnav_wg_1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 40.8 -y 42.5 -t 3.083 -nav_tol 0.70 -odom_tol 0.05 -timeout 110 " time-limit="120"/>
- <test test-name="2dnav_gazebo_test_2dnav_wg_2" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 36.0 -y 34.9 -t 2.554 -nav_tol 0.70 -odom_tol 0.03 -timeout 110 " time-limit="120"/>
- <test test-name="2dnav_gazebo_test_2dnav_wg_3" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 31.3 -y 45.8 -t 0.000 -nav_tol 0.70 -odom_tol 0.01 -timeout 110 " time-limit="120"/>
- <test test-name="2dnav_gazebo_test_2dnav_wg_4" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 22.2 -y 20.0 -t 0.000 -nav_tol 0.70 -odom_tol 0.01 -timeout 110 " time-limit="120"/>
- <test test-name="2dnav_gazebo_test_2dnav_wg_5" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 7.5 -y 45.0 -t 1.571 -nav_tol 0.70 -odom_tol 0.05 -timeout 110 " time-limit="120"/>
- <test test-name="2dnav_gazebo_test_2dnav_wg_6" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 9.4 -y 11.2 -t 0.000 -nav_tol 0.70 -odom_tol 0.05 -timeout 110 " time-limit="120"/>
+ <test test-name="2dnav_gazebo_test_2dnav_wg_1" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 40.8 -y 42.5 -t 3.083 -nav_tol 0.70 -odom_tol 0.05 -timeout 290 " time-limit="300"/>
+ <test test-name="2dnav_gazebo_test_2dnav_wg_2" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 36.0 -y 34.9 -t 2.554 -nav_tol 0.70 -odom_tol 0.03 -timeout 290 " time-limit="300"/>
+ <test test-name="2dnav_gazebo_test_2dnav_wg_3" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 31.3 -y 45.8 -t 0.000 -nav_tol 0.70 -odom_tol 0.01 -timeout 290 " time-limit="300"/>
+ <test test-name="2dnav_gazebo_test_2dnav_wg_4" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 22.2 -y 20.0 -t 0.000 -nav_tol 0.70 -odom_tol 0.01 -timeout 290 " time-limit="300"/>
+ <test test-name="2dnav_gazebo_test_2dnav_wg_5" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 7.5 -y 45.0 -t 1.571 -nav_tol 0.70 -odom_tol 0.05 -timeout 290 " time-limit="300"/>
+ <test test-name="2dnav_gazebo_test_2dnav_wg_6" pkg="2dnav_gazebo" type="test_2dnav_translations.py" args=" -x 9.4 -y 11.2 -t 0.000 -nav_tol 0.70 -odom_tol 0.05 -timeout 290 " time-limit="300"/>
<!--
-->
</launch>
Modified: pkg/trunk/demos/examples_gazebo/dual_link_defs/dual_link.xml
===================================================================
--- pkg/trunk/demos/examples_gazebo/dual_link_defs/dual_link.xml 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/demos/examples_gazebo/dual_link_defs/dual_link.xml 2008-12-24 17:55:10 UTC (rev 8571)
@@ -128,7 +128,7 @@
<map name="sensor" flag="gazebo">
<verbatim key="mechanism_control_simulation">
- <controller:ros_time name="ros_time" plugin="libRos_Time.so">
+ <controller:ros_time name="ros_time" plugin="libros_time.so">
<alwaysOn>true</alwaysOn>
<updateRate>100.0</updateRate>
<interface:audio name="dummy_ros_time_iface_should_not_be_here"/>
@@ -142,8 +142,8 @@
<interface:audio name="gazebo_mechanism_control_dummy_iface" />
</controller:gazebo_mechanism_control>
- <!-- P3D for position groundtruth -->
- <controller:P3D name="p3d_link1_controller" plugin="libP3D.so">
+ <!-- ros_p3d for position groundtruth -->
+ <controller:ros_p3d name="p3d_link1_controller" plugin="libros_p3d.so">
<alwaysOn>true</alwaysOn>
<updateRate>1000.0</updateRate>
<bodyName>link1</bodyName>
@@ -152,17 +152,17 @@
<xyzOffsets>0 0 0.0</xyzOffsets>
<rpyOffsets>0 0 0.0</rpyOffsets>
<interface:position name="p3d_link1_position"/>
- </controller:P3D>
+ </controller:ros_p3d>
- <!-- P3D for position groundtruth -->
- <controller:P3D name="p3d_link2_controller" plugin="libP3D.so">
+ <!-- ros_p3d for position groundtruth -->
+ <controller:ros_p3d name="p3d_link2_controller" plugin="libros_p3d.so">
<alwaysOn>true</alwaysOn>
<updateRate>1000.0</updateRate>
<bodyName>link2</bodyName>
<topicName>link2_pose</topicName>
<frameName>map</frameName>
<interface:position name="p3d_link2_position"/>
- </controller:P3D>
+ </controller:ros_p3d>
</verbatim>
</map>
Modified: pkg/trunk/demos/examples_gazebo/multi_link_defs/multi_link.xml
===================================================================
--- pkg/trunk/demos/examples_gazebo/multi_link_defs/multi_link.xml 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/demos/examples_gazebo/multi_link_defs/multi_link.xml 2008-12-24 17:55:10 UTC (rev 8571)
@@ -343,7 +343,7 @@
<map name="sensor" flag="gazebo">
<verbatim key="mechanism_control_simulation">
- <controller:ros_time name="ros_time" plugin="libRos_Time.so">
+ <controller:ros_time name="ros_time" plugin="libros_time.so">
<alwaysOn>true</alwaysOn>
<updateRate>1000.0</updateRate>
<interface:audio name="dummy_ros_time_iface_should_not_be_here"/>
@@ -357,15 +357,15 @@
<interface:audio name="gazebo_mechanism_control_dummy_iface" />
</controller:gazebo_mechanism_control>
- <!-- P3D for position groundtruth -->
- <controller:P3D name="p3d_link3_controller" plugin="libP3D.so">
+ <!-- ros_p3d for position groundtruth -->
+ <controller:ros_p3d name="p3d_link3_controller" plugin="libros_p3d.so">
<alwaysOn>true</alwaysOn>
<updateRate>1000.0</updateRate>
<bodyName>link3</bodyName>
<topicName>link3_pose</topicName>
<frameName>map</frameName>
<interface:position name="p3d_link3_position"/>
- </controller:P3D>
+ </controller:ros_p3d>
</verbatim>
</map>
Modified: pkg/trunk/demos/examples_gazebo/single_link_defs/single_link.xml
===================================================================
--- pkg/trunk/demos/examples_gazebo/single_link_defs/single_link.xml 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/demos/examples_gazebo/single_link_defs/single_link.xml 2008-12-24 17:55:10 UTC (rev 8571)
@@ -82,7 +82,7 @@
<map name="sensor" flag="gazebo">
<verbatim key="mechanism_control_simulation">
- <controller:ros_time name="ros_time" plugin="libRos_Time.so">
+ <controller:ros_time name="ros_time" plugin="libros_time.so">
<alwaysOn>true</alwaysOn>
<updateRate>100.0</updateRate>
<interface:audio name="dummy_ros_time_iface_should_not_be_here"/>
@@ -95,15 +95,15 @@
<interface:audio name="gazebo_mechanism_control_dummy_iface" />
</controller:gazebo_mechanism_control>
- <!-- P3D for position groundtruth -->
- <controller:P3D name="p3d_link1_controller" plugin="libP3D.so">
+ <!-- ros_p3d for position groundtruth -->
+ <controller:ros_p3d name="p3d_link1_controller" plugin="libros_p3d.so">
<alwaysOn>true</alwaysOn>
<updateRate>100.0</updateRate>
<bodyName>link1</bodyName>
<topicName>link1_pose</topicName>
<frameName>map</frameName>
<interface:position name="p3d_link1_position"/>
- </controller:P3D>
+ </controller:ros_p3d>
</verbatim>
</map>
<!-- Define groups of links; a link may be part of multiple groups -->
Modified: pkg/trunk/demos/pr2_gazebo/pr2_default_controllers.launch
===================================================================
--- pkg/trunk/demos/pr2_gazebo/pr2_default_controllers.launch 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/demos/pr2_gazebo/pr2_default_controllers.launch 2008-12-24 17:55:10 UTC (rev 8571)
@@ -18,5 +18,9 @@
<!--node pkg="pr2_mechanism_controllers" type="control_laser.py" args="laser_tilt_controller sine 1 .45 .40" /--> <!-- this one will pick up shoulders at lowest position -->
<node pkg="mechanism_control" type="spawner.py" args="$(find wg_robot_description)/laser_tilt/laser_tilt_controller.xml" />
<node pkg="pr2_mechanism_controllers" type="control_laser.py" args="laser_tilt_controller sine 2 .45 .40" />
+
+ <!-- send arm a command -->
+ <node pkg="robot_mechanism_controllers" type="control.py" args="set l_gripper_controller 0.05" respawn="false" output="screen" /> <!-- open gripper .5 radians -->
+ <node pkg="robot_mechanism_controllers" type="control.py" args="set r_gripper_controller 0.05" respawn="false" output="screen" /> <!-- open gripper .5 radians -->
</launch>
Modified: pkg/trunk/demos/pr2_prototype1_gazebo/pr2_prototype1_empty.launch
===================================================================
--- pkg/trunk/demos/pr2_prototype1_gazebo/pr2_prototype1_empty.launch 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/demos/pr2_prototype1_gazebo/pr2_prototype1_empty.launch 2008-12-24 17:55:10 UTC (rev 8571)
@@ -15,7 +15,7 @@
<env name="MC_RESOURCE_PATH" value="$(find gazebo_robot_description)/world" />
</node>
- <!-- push robotdesc/pr2 to factory and spawn robot in gazebo -->
+ <!-- push robotdesc/pr2 to factory and spawn robot in gazebo, the initial coordinates here is in Gazebo format, in the map frame, add offsets from P3D plugin (25.65,25.65) -->
<node pkg="gazebo_plugin" type="urdf2factory" args="robotdesc/pr2 0 0 0 0 0 0" respawn="false" output="screen" /> <!-- load default arm controller -->
<!-- use mech.py to spawn all controllers listed in controllers.xml -->
Modified: pkg/trunk/drivers/simulator/gazebo_plugin/CMakeLists.txt
===================================================================
--- pkg/trunk/drivers/simulator/gazebo_plugin/CMakeLists.txt 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/drivers/simulator/gazebo_plugin/CMakeLists.txt 2008-12-24 17:55:10 UTC (rev 8571)
@@ -9,22 +9,18 @@
add_definitions(-fPIC)
set(ROS_BUILD_TYPE Release)
-rospack_add_library(Ros_Stereo_Camera src/Ros_Stereo_Camera.cc)
-rospack_add_library(Ros_Camera src/Ros_Camera.cc)
-rospack_add_library(Ros_Laser src/Ros_Laser.cc)
-rospack_add_library(Ros_Block_Laser src/Ros_Block_Laser.cc)
-rospack_add_library(Ros_Time src/Ros_Time.cc)
-rospack_add_library(Ros_PTZ src/Ros_PTZ.cc)
-rospack_add_library(P3D src/P3D.cc)
-rospack_add_library(F3D src/F3D.cc)
+rospack_add_library(ros_stereo_camera src/ros_stereo_camera.cpp)
+rospack_add_library(ros_camera src/ros_camera.cpp)
+rospack_add_library(ros_laser src/ros_laser.cpp)
+rospack_add_library(ros_block_laser src/ros_block_laser.cpp)
+rospack_add_library(ros_time src/ros_time.cpp)
+rospack_add_library(ros_ptz src/ros_ptz.cpp)
+rospack_add_library(ros_p3d src/ros_p3d.cpp)
+rospack_add_library(ros_f3d src/ros_f3d.cpp)
rospack_add_library(gazebo_mechanism_control src/gazebo_mechanism_control.cpp)
rospack_add_library(gazebo_battery src/gazebo_battery.cpp)
-rospack_add_library(Ros_Bumper src/Ros_Bumper.cc)
+rospack_add_library(ros_bumper src/ros_bumper.cpp)
-# This target requires adding player to the manifest.xml.
-#rospack_add_executable(player_pr2 src/player/Pr2_Player.cc)
-#target_link_libraries(player_pr2 playerc++)
-
rospack_add_rostest(test/test_slide.xml)
rospack_add_rostest(test/test_base.xml)
rospack_add_rostest(test/test_arm.xml)
@@ -35,10 +31,8 @@
rospack_add_rostest(test/hztest_rostime.xml)
rospack_add_rostest(test/hztest_pr2_odom.xml)
-# below need xvfb-run
-# test_camera seems to fail a lot
+# below need xvfb-run to test on build machine
rospack_add_rostest_graphical(test/test_camera.xml)
rospack_add_rostest_graphical(test/hztest_pr2_image.xml)
-rospack_add_executable(urdf2factory src/urdf2factory.cc)
-#rospack_add_executable(simiface src/simiface.cc)
+rospack_add_executable(urdf2factory src/urdf2factory.cpp)
Deleted: pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/F3D.hh
===================================================================
--- pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/F3D.hh 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/F3D.hh 2008-12-24 17:55:10 UTC (rev 8571)
@@ -1,120 +0,0 @@
-/*
- * Gazebo - Outdoor Multi-Robot Simulator
- * Copyright (C) 2003
- * Nate Koenig & Andrew Howard
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-/*
- * Desc: 3D Applied Force Feedback Interface
- * Author: John Hsu
- * Date: 24 Sept 2008
- * SVN: $Id$
- */
-#ifndef F3D_HH
-#define F3D_HH
-
-#include <gazebo/Controller.hh>
-#include <gazebo/Entity.hh>
-
-#include <ros/node.h>
-#include <rosthread/mutex.h>
-#include <std_msgs/Vector3Stamped.h>
-
-namespace gazebo
-{
-
-/// @addtogroup gazebo_dynamic_plugins Gazebo ROS Dynamic Plugins
-/// @{
-/** \defgroup F3D Applied Force Feedback Plugin XML Reference and Example
-
- \brief FIXME: Applied Force Feedback controller.
-
- This is a controller that gathers applied force data from a Body and populates a libgazebo interfaace as well as publish a ROS std_msgs::Vector3Stamped message (under topicName). This controller should only be used as a child of a Model. Below is an example of the usage of this plugin.
-
- \verbatim
- <model:physical name="camera_model">
- <controller:F3D name="f3d_finger_tip_l_left_controller" plugin="libF3D.so">
- <alwaysOn>true</alwaysOn>
- <updateRate>100.0</updateRate>
- <bodyName>finger_tip_l_left</bodyName>
- <topicName>finger_tip_l_left_ground_truth</topicName>
- <frameName>map</frameName>
- <interface:position name="f3d_finger_tip_l_left_position" />
- </controller:F3D>
- </model:phyiscal>
- \endverbatim
-
-\{
-*/
-
-/// \brief F3D controller
-/// This is a controller that simulates a 6 dof position sensor
-class F3D : public Controller
-{
- /// \brief Constructor
- /// \param parent The parent entity must be a Model
- public: F3D(Entity *parent);
-
- /// \brief Destructor
- public: virtual ~F3D();
-
- /// \brief Load the controller
- /// \param node XML config node
- protected: virtual void LoadChild(XMLConfigNode *node);
-
- /// \brief Init the controller
- protected: virtual void InitChild();
-
- /// \brief Update the controller
- protected: virtual void UpdateChild();
-
- /// \brief Finalize the controller
- protected: virtual void FiniChild();
-
- /// \brief A link to the parent Model
- private: Model *myParent;
-
- /// \brief A pointer to the Gazebo Body
- private: Body *myBody;
-
-
- /// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
- private: ros::node *rosnode;
-
- /// \brief ROS Vector3Stamped message
- private: std_msgs::Vector3Stamped vector3Msg;
-
- /// \brief ROS Vector3Stamped topic name
- private: std::string topicName;
-
- /// \brief ROS frame transform name to use in the image message header.
- /// This should be simply map since the returned info is in Gazebo Global Frame.
- private: std::string frameName;
-
- /// \brief A mutex to lock access to fields that are used in message callbacks
- private: ros::thread::mutex lock;
-
-};
-
-/** \} */
-/// @}
-
-
-}
-
-#endif
-
Deleted: pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/P3D.hh
===================================================================
--- pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/P3D.hh 2008-12-24 07:51:50 UTC (rev 8570)
+++ pkg/trunk/drivers/simulator/gazebo_plugin/include/gazebo_plugin/P3D.hh 2008-12-24 17:55:10 UTC (rev 8571)
@@ -1,161 +0,0 @@
-/*
- * Gazebo - Outdoor Multi-Robot Simulator
- * Copyright (C) 2003
- * Nate Koenig & Andrew Howard
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-/*
- * Desc: 3D position interface.
- * Author: Sachin Chitta and John Hsu
- * Date: 10 June 2008
- * SVN: $Id$
- */
-#ifndef P3D_HH
-#define P3D_HH
-
-#include <gazebo/Controller.hh>
-#include <gazebo/Entity.hh>
-
-#include <ros/node.h>
-#include <rosthread/mutex.h>
-#include <std_msgs/Pose3DStamped.h>
-#include <std_msgs/PoseWithRatesStamped.h>
-
-namespace gazebo
-{
-/// @addtogroup gazebo_dynamic_plugins Gazebo ROS Dynamic Plugins
-/// @{
- /** \defgroup P3D Groud Truth Position Pose and Rates Interface
-
- \brief P3D controller.
-
- This controller requires to a model as its parent. The plugin broadcasts a body's pose and rates through ROS std_msgs::PoseWithRatesStamped message. In the example below, the plubin broadcasts pose and rate of a body named \b body_name over ROS topic name \b body_pose_groud_truth.
-
- Example Usage:
- \verbatim
- <model:physical name="some_fancy_model">
- <controller:P3D name="p3d_controller" plugin="libP3D.so">
- <alwaysOn>true</alwaysOn>
- <updateRate>1000.0</updateRate>
- <bodyName>body_name</bodyName>
- <topicName>body_pose_ground_truth</topicName>
- <frameName>map</frameName>
- <xyzOffsets>25.65 25.65 0</xyzOffsets> <!-- option to initialize odometry for fake localization-->
- <rpyOffsets>0 0 0</rpyOffsets>
- <interface:position name="p3d_position_iface"/>
- </controller:P3D>
- </model:phyiscal>
- \endverbatim
-
-\{
-*/
-
-/**
-
- \brief P3D controller
- \li Starts a ROS node if none exists.
- \li This controller simulates a 6 dof position and rate sensor, publishes std_msgs::PoseWithRatesStamped.msg ROS topic.
- \li Example Usage:
- \verbatim
- <model:physical name="some_fancy_model">
- <controller:P3D name="p3d_controller" plugin="libP3D.so">
- <alwaysOn>true</alwaysOn>
- <updateRate>1000.0</updateRate>
- <bodyName>body_name</bodyName>
- <topicName>body_pose_ground_truth</topicName>
- <frameName>map</frameName>
- <xyzOffsets>25.65 25.65 0</xyzOffsets> <!-- option to initialize odometry for fake localization-->
- <rpyOffsets>0 0 0</rpyOffsets>
- <interface:position name="p3d_position_iface"/>
- </controller:P3D>
- </model:phyiscal>
- \endverbatim
- .
-*/
-
- class P3D : public Controller
- {
- /// \brief Constructor
- public: P3D(Entity *parent );
-
- /// \brief Destructor
- public: virtual ~P3D();
-
- /// \brief Load the controller
- /// \param node XML config node
- protected: virtual void LoadChild(XMLConfigNode *node);
-
- /// \brief Init the controller
- protected: virtual void InitChild();
-
- /// \brief Update the controller
- protected: virtual void UpdateChild();
-
- /// \brief Finalize the controller
- protected: virtual void FiniChild();
-
- /// \brief The parent Model
- private: Model *myParent;
-
- /// \brief The parent Model
- private: Body *myBody; //Gazebo/ODE body
-
-
-
- /// \brief pointer to ros node
- private: ros::node *rosnode;
-
- /// \brief ros message
- private: std_msgs::PoseWithRatesStamped poseMsg;
-
- /// \brief topic name
- private: std::string topicName;
-
- /// \brief frame transform name, should match link name
- /// FIXME: extract link name directly?
- private: std::string frameName;
-
- /// \brief allow specifying constant xyz and rpy offsets
- private: Vector3 xyzOffsets;
- private: Vector3 rpyOffsets;
-
- /// \b...
[truncated message content] |
|
From: <tf...@us...> - 2008-12-25 13:24:27
|
Revision: 8596
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8596&view=rev
Author: tfoote
Date: 2008-12-25 13:24:23 +0000 (Thu, 25 Dec 2008)
Log Message:
-----------
work from the plane, most of the way to broken wire detection
Modified Paths:
--------------
pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test
Added Paths:
-----------
pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml
pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/__init__.py
pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py
pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch
Added: pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml
===================================================================
--- pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml (rev 0)
+++ pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml 2008-12-25 13:24:23 UTC (rev 8596)
@@ -0,0 +1,16 @@
+wiring_tree: {
+#circuit1: { component: 'pr2_power_board', value: 'breaker_voltage1', tolerance: 10,
+# children: [fr_caster, fl_caster, br_caster, bl_caster]},
+ circuit0: {component: "pr2_power_board", value: "breaker_voltage0", tolerance: 10,
+ children: [l_shoulder_pan]},
+ circuit2: { component: "pr2_power_board", value: "breaker_voltage2", tolerance: 10 ,
+ children: [r_shoulder_pan]},
+ r_shoulder_pan: { component: "ethercat device r_shoulder_pan", value: "voltage", tolerance: 10,
+ children: [r_shoulder_tilt]},
+ l_shoulder_pan: { component: "ethercat device l_shoulder_pan", value: "voltage", tolerance: 10,
+ children: [l_shoulder_tilt]}
+}
+
+root: [ circuit0, circuit2]
+
+
Added: pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py
===================================================================
--- pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py (rev 0)
+++ pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py 2008-12-25 13:24:23 UTC (rev 8596)
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of the Willow Garage nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#import rostools
+#rostools.update_path(PKG)
+
+import sys
+import rospy
+from robot_msgs.msg import *
+
+
+def recurse_tree(element, messages, wiremap):
+ errors = []
+ if element in wiremap:
+ if "children" in wiremap[element]:
+ for child in wiremap[element]["children"]:
+ children_return, errors_return = recurse_tree(child, messages, wiremap)
+ children.extend(children_return)
+ errors.extend(errors_return)
+
+ try:
+ value = messages[ wiremap[element][component]][wiremap[element][value]]
+ child_value = messages[ wiremap[child][component]][wiremap[child][value]]
+ tolerance = wiremap[element][tolerance]
+ if abs(value - child_value) / value > tolerance/100:
+ errors.append("difference between %f (%s) and %f (%s) voltages exceeds tolerance %f\%"
+ %(value, element, child_value, child, tolerance))
+ except KeyError:
+ errors.append("badly formed parameters");
+ return errors
+
+
+def test(latest_status, parameters):
+ #print latest_status
+ results = {}
+
+ if "wiring_tree" in parameters:
+ wiremap = parameters["wiring_tree"]
+ else:
+ results['error'] = ["power_wires: no wiring_tree found"]
+ return results
+
+ if "root" in parameters:
+ for root in parameters["root"]:
+ results.extend( recurse_tree(root, latest_status, parameters))
+
+ else:
+ results['error'] = ["power_wires: no root found"]
+ return results
+
+
+ return results
+
+
Added: pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch
===================================================================
--- pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch (rev 0)
+++ pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch 2008-12-25 13:24:23 UTC (rev 8596)
@@ -0,0 +1,5 @@
+<launch>
+ <node pkg="runtime_monitor" type="runtime_test" args="--test=power_wires --package=pr2_power_board" output="screen" name="wiring_voltage_test">
+ <rosparam command="load" file="pr_wiring.yaml"/>
+ </node>
+</launch>
\ No newline at end of file
Modified: pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test
===================================================================
--- pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test 2008-12-25 02:34:19 UTC (rev 8595)
+++ pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test 2008-12-25 13:24:23 UTC (rev 8596)
@@ -63,11 +63,12 @@
def analyze(package, test_name):
# import the test script
+ exec("rostools.update_path('%s')"%package)
exec('from %s import %s'%(package, test_name))
# get it's parameters
exec("params = rospy.get_param(\"~\")")
-
+
# run the test
exec("results = %s.test(latest_messages, params)"%test_name)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rdi...@us...> - 2008-12-26 04:12:30
|
Revision: 8597
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8597&view=rev
Author: rdiankov
Date: 2008-12-26 04:12:22 +0000 (Fri, 26 Dec 2008)
Log Message:
-----------
added manipulation planning infrastructure with various roslaunch files to simplify execution, fixed several bugs in the openraveros server, added better testing for openrave_robot_description, set nonzero velocity limits on gripper
Modified Paths:
--------------
pkg/trunk/3rdparty/openrave/Makefile
pkg/trunk/openrave_planning/openraveros/msg/RobotInfo.msg
pkg/trunk/openrave_planning/openraveros/octave/openraveros_createsession.m
pkg/trunk/openrave_planning/openraveros/octave/openraveros_getbodyinfo.m
pkg/trunk/openrave_planning/openraveros/octave/openraveros_getrobotinfo.m
pkg/trunk/openrave_planning/openraveros/octave/orEnvCheckCollision.m
pkg/trunk/openrave_planning/openraveros/octave/orEnvCreateRobot.m
pkg/trunk/openrave_planning/openraveros/octave/orEnvGetBodies.m
pkg/trunk/openrave_planning/openraveros/octave/orEnvGetRobots.m
pkg/trunk/openrave_planning/openraveros/octave/orEnvLoadScene.m
pkg/trunk/openrave_planning/openraveros/octave/orEnvRayCollision.m
pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m
pkg/trunk/openrave_planning/openraveros/octave/orProblemSendCommand.m
pkg/trunk/openrave_planning/openraveros/src/rosserver.h
pkg/trunk/openrave_planning/openraveros/src/session.h
pkg/trunk/openrave_planning/openraveros/srv/env_checkcollision.srv
pkg/trunk/openrave_planning/openraveros/srv/env_set.srv
pkg/trunk/openrave_planning/openraveros/test/testsessioncreation.m
pkg/trunk/openrave_planning/ormanipulation/data/pr2table.env.xml
pkg/trunk/openrave_planning/ormanipulation/data/riceboxf.kinbody.xml
pkg/trunk/openrave_planning/ormanipulation/octave/startup.m
pkg/trunk/openrave_planning/ormanipulation/octave/testscene.m
pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml
pkg/trunk/openrave_planning/ormanipulation/startopenrave.ros.xml
pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h
pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
pkg/trunk/openrave_planning/orrosplanning/src/rosarmik.cpp
pkg/trunk/openrave_planning/orrosplanning/src/rosarmik.h
pkg/trunk/openrave_planning/orrosplanning/src/rosplanningproblem.h
pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h
pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
pkg/trunk/robot_descriptions/openrave_robot_description/CMakeLists.txt
pkg/trunk/robot_descriptions/openrave_robot_description/robots/pr2full.robot.xml
pkg/trunk/robot_descriptions/openrave_robot_description/src/urdf2openrave.cpp
pkg/trunk/robot_descriptions/openrave_robot_description/test/test_robots.cpp
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml
Added Paths:
-----------
pkg/trunk/openrave_planning/openraveros/octave/openraveros_makeclone.m
pkg/trunk/openrave_planning/openraveros/octave/openraveros_rotfromaxisangle.m
pkg/trunk/openrave_planning/ormanipulation/data/willow_tablef.kinbody.xml
pkg/trunk/openrave_planning/ormanipulation/maketables.ros.xml
pkg/trunk/openrave_planning/ormanipulation/octave/DeleteObjects.m
pkg/trunk/openrave_planning/ormanipulation/octave/ExecuteOnRealSession.m
pkg/trunk/openrave_planning/ormanipulation/octave/GetObjectToManipulate.m
pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m
pkg/trunk/openrave_planning/ormanipulation/octave/MakePR2GraspTables.m
pkg/trunk/openrave_planning/ormanipulation/octave/ReadValsFromString.m
pkg/trunk/openrave_planning/ormanipulation/octave/RobotCreatePR2Hand.m
pkg/trunk/openrave_planning/ormanipulation/octave/RobotGoInitial.m
pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m
pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m
pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m
pkg/trunk/openrave_planning/ormanipulation/octave/SwitchModels.m
pkg/trunk/openrave_planning/ormanipulation/octave/WaitForRobot.m
pkg/trunk/openrave_planning/ormanipulation/octave/grasp_pr2_ricebox.mat
pkg/trunk/openrave_planning/ormanipulation/octave/rungrasptables.m
pkg/trunk/openrave_planning/ormanipulation/octave/runmaketables.m
pkg/trunk/openrave_planning/ormanipulation/octave/runmanip.m
pkg/trunk/openrave_planning/ormanipulation/octave/runmanip_sim.m
pkg/trunk/openrave_planning/ormanipulation/octave/runperception.m
pkg/trunk/openrave_planning/ormanipulation/octave/setclonesession.m
pkg/trunk/openrave_planning/ormanipulation/octave/setrealsession.m
pkg/trunk/openrave_planning/ormanipulation/startmanip.ros.xml
pkg/trunk/openrave_planning/ormanipulation/startmanip_sim.ros.xml
pkg/trunk/openrave_planning/ormanipulation/viewtables.ros.xml
pkg/trunk/robot_descriptions/openrave_robot_description/robots/pr2gripperfull.robot.xml
Modified: pkg/trunk/3rdparty/openrave/Makefile
===================================================================
--- pkg/trunk/3rdparty/openrave/Makefile 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/3rdparty/openrave/Makefile 2008-12-26 04:12:22 UTC (rev 8597)
@@ -2,7 +2,7 @@
SVN_DIR = openrave_svn
# Should really specify a revision
-SVN_REVISION = -r 574
+SVN_REVISION = -r 587
SVN_URL = https://openrave.svn.sourceforge.net/svnroot/openrave
include $(shell rospack find mk)/svn_checkout.mk
Modified: pkg/trunk/openrave_planning/openraveros/msg/RobotInfo.msg
===================================================================
--- pkg/trunk/openrave_planning/openraveros/msg/RobotInfo.msg 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/msg/RobotInfo.msg 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,4 +1,4 @@
- # robot information
+# robot information
BodyInfo bodyinfo
Manipulator[] manips
Modified: pkg/trunk/openrave_planning/openraveros/octave/openraveros_createsession.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/openraveros_createsession.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/openraveros_createsession.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,4 +1,4 @@
-%% session = openraveros_createsession(sessionserver, cloneuuid)
+%% session = openraveros_createsession(sessionserver, cloneuuid, cloneoptions)
%
%% creates a session and returns its id.
%% clonesession (optional) - if passed in, will clone the new session with this session
Modified: pkg/trunk/openrave_planning/openraveros/octave/openraveros_getbodyinfo.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/openraveros_getbodyinfo.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/openraveros_getbodyinfo.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,6 +1,30 @@
%% body = openraveros_getbodyinfo(bodyinfo)
%%
%% parses the BodyInfo.msg into a simpler form for octave consumption
+
+%% Software License Agreement (BSD License)
+%% Copyright (c) 2006-2009, Rosen Diankov
+%% Redistribution and use in source and binary forms, with or without
+%% modification, are permitted provided that the following conditions are met:
+%% * Redistributions of source code must retain the above copyright notice,
+%% this list of conditions and the following disclaimer.
+%% * Redistributions in binary form must reproduce the above copyright
+%% notice, this list of conditions and the following disclaimer in the
+%% documentation and/or other materials provided with the distribution.
+%% * The name of the author may not be used to endorse or promote products
+%% derived from this software without specific prior written permission.
+%%
+%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+%% POSSIBILITY OF SUCH DAMAGE.
function body = openraveros_getbodyinfo(bodyinfo)
body.id = bodyinfo.bodyid;
Modified: pkg/trunk/openrave_planning/openraveros/octave/openraveros_getrobotinfo.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/openraveros_getrobotinfo.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/openraveros_getrobotinfo.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,6 +1,30 @@
%% robot = openraveros_getrobotinfo(robotinfo)
%%
%% parses the RobotInfo.msg into a simpler form for octave consumption
+
+%% Software License Agreement (BSD License)
+%% Copyright (c) 2006-2009, Rosen Diankov
+%% Redistribution and use in source and binary forms, with or without
+%% modification, are permitted provided that the following conditions are met:
+%% * Redistributions of source code must retain the above copyright notice,
+%% this list of conditions and the following disclaimer.
+%% * Redistributions in binary form must reproduce the above copyright
+%% notice, this list of conditions and the following disclaimer in the
+%% documentation and/or other materials provided with the distribution.
+%% * The name of the author may not be used to endorse or promote products
+%% derived from this software without specific prior written permission.
+%%
+%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+%% POSSIBILITY OF SUCH DAMAGE.
function robot = openraveros_getrobotinfo(robotinfo)
robot = openraveros_getbodyinfo(robotinfo.bodyinfo);
@@ -34,4 +58,3 @@
robot.activelowerlimit = robotinfo.activelowerlimit;
robot.activeupperlimit = robotinfo.activeupperlimit;
-
Added: pkg/trunk/openrave_planning/openraveros/octave/openraveros_makeclone.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/openraveros_makeclone.m (rev 0)
+++ pkg/trunk/openrave_planning/openraveros/octave/openraveros_makeclone.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -0,0 +1,42 @@
+%% clonesession = openraveros_makeclone(cloneoptions)
+%%
+%% Makes a clone of the current global session
+%% Returns an empty session if failed
+
+%% Software License Agreement (BSD License)
+%% Copyright (c) 2008, Willow Garage, Inc.
+%% Redistribution and use in source and binary forms, with or without
+%% modification, are permitted provided that the following conditions are met:
+%% * Redistributions of source code must retain the above copyright notice,
+%% this list of conditions and the following disclaimer.
+%% * Redistributions in binary form must reproduce the above copyright
+%% notice, this list of conditions and the following disclaimer in the
+%% documentation and/or other materials provided with the distribution.
+%% * The name of the author may not be used to endorse or promote products
+%% derived from this software without specific prior written permission.
+%%
+%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+%% POSSIBILITY OF SUCH DAMAGE.
+%%
+%% author: Rosen Diankov
+function clonesession = openraveros_makeclone(cloneoptions)
+
+prevsession = openraveros_getglobalsession();
+if( isempty(prevsession) )
+ return;
+end
+
+if( ~exist('cloneoptions','var') )
+ cloneoptions = 0;
+end
+
+clonesession = openraveros_createsession(prevsession.server, prevsession.uuid, cloneoptions);
Added: pkg/trunk/openrave_planning/openraveros/octave/openraveros_rotfromaxisangle.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/openraveros_rotfromaxisangle.m (rev 0)
+++ pkg/trunk/openrave_planning/openraveros/octave/openraveros_rotfromaxisangle.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -0,0 +1,7 @@
+function R = openraveros_rotfromaxisangle(axis)
+len = norm(axis);
+if( len < 1e-10 )
+ R = eye(3);
+else
+ R = openraveros_rotfromquat([cos(len/2) sin(len/2)*reshape(axis/len,[1 3])]);
+end
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvCheckCollision.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvCheckCollision.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvCheckCollision.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,14 +1,20 @@
-% [collision, colbodyid,contacts,hitbodies,mindist] = orEnvCheckCollision(bodyid,excludeid,req_contacts,req_distance)
+% [collision, colbodyid,contacts,hitbodies,mindist] = orEnvCheckCollision(bodyid,excludeid,...)
%
% Check collision of the robot with the environment. collision is 1 if the robot
% is colliding, colbodyid is the id of the object that body collided with
%% bodyid - the uid of the body, if size > 1, bodyidD(2) narrows collision down to specific body link (one-indexed)
+%% extra options to specify at end
+%% 'distance' - get back distance queries
+%% 'tolerance' - set tolerance for collision error
+%% 'contacts' - get back the contact points
+%% 'selfcollision' - adds a self collision check
+function [collision, colbodyid, contacts, hitbodies, mindist] = orEnvCheckCollision(varargin)
-function [collision, colbodyid, contacts, hitbodies, mindist] = orEnvCheckCollision(bodyid,excludeids,req_contacts,req_distance)
-
session = openraveros_getglobalsession();
req = openraveros_env_checkcollision();
+bodyid = varargin{1};
+
req.bodyid = bodyid(1);
if( length(bodyid)>1)
req.linkid = bodyid(2);
@@ -16,9 +22,28 @@
req.linkid = -1; % all links of the body
end
-if( exist('excludeid', 'var') )
- req.excludeids = excludeids;
+if( nargin > 1 )
+ req.excludeids = varargin{2};
end
+
+req.options = 0;
+index = 3;
+while(index <= nargin)
+ switch(varargin{index})
+ case 'distance'
+ req.options = req.options + req.CO_Distance();
+ case 'tolerance'
+ req.options = req.options + req.CO_UseTolerance();
+ req.tolerance = varargin{i+1};
+ index = index+1;
+ case 'contacts'
+ req.options = req.options + req.CO_Contacts();
+ case 'selfcollision'
+ req.checkselfcollision = 1;
+ end
+ index = index+1;
+end
+
if( exist('req_contacts','var') && req_contacts )
req.options = req.options + req.CO_Contacts();
end
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvCreateRobot.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvCreateRobot.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvCreateRobot.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -6,7 +6,7 @@
session = openraveros_getglobalsession();
req = openraveros_env_createrobot();
-req.robotname = robotname;
+req.name = robotname;
req.file = xmlfile;
if( exist('type','var') )
req.type = type;
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvGetBodies.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvGetBodies.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvGetBodies.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,17 +1,41 @@
-% bodies = orEnvGetBodies(bodyid,options)
+% bodyinfo = orEnvGetBodies(bodyid,options)
%
% Input:
% bodyid (optional) - specific body to get info for, if not specified returns all bodies
% options - mask of BodyInfo.Req_X options (if not specified gets all information)
% Output:
-% bodies is a cell array of all body objects in the scene
-% every cell contains a struct with the following parameters
+%% if bodyid is 0 or wasn't specified, bodyinfo is a cell array of robots.
+%% Otherwise bodyinfo holds the info of just one body
+%% every entry contains a struct with the following parameters
% id - bodyid
% filename - filename used to initialize the body with
% name - human robot name
% type - xml type of body
-function bodies = orEnvGetBodies(bodyid,options)
+%% Software License Agreement (BSD License)
+%% Copyright (c) 2006-2009, Rosen Diankov
+%% Redistribution and use in source and binary forms, with or without
+%% modification, are permitted provided that the following conditions are met:
+%% * Redistributions of source code must retain the above copyright notice,
+%% this list of conditions and the following disclaimer.
+%% * Redistributions in binary form must reproduce the above copyright
+%% notice, this list of conditions and the following disclaimer in the
+%% documentation and/or other materials provided with the distribution.
+%% * The name of the author may not be used to endorse or promote products
+%% derived from this software without specific prior written permission.
+%%
+%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+%% POSSIBILITY OF SUCH DAMAGE.
+function bodyinfo = orEnvGetBodies(bodyid,options)
session = openraveros_getglobalsession();
req = openraveros_env_getbodies();
if( exist('bodyid','var') )
@@ -24,11 +48,15 @@
end
res = rosoct_session_call(session.id,'env_getbodies',req);
-if(~isempty(res))
- bodies = cell(length(res.bodies),1);
- for i = 1:length(res.bodies)
- bodies{i} = openraveros_getbodyinfo(res.bodies{i});
+if(~isempty(res) && ~isempty(res.bodies) )
+ if( exist('bodyid','var') && bodyid ~= 0 )
+ bodyinfo = openraveros_getbodyinfo(res.bodies{1});
+ else
+ bodyinfo = cell(length(res.bodies),1);
+ for i = 1:length(res.bodies)
+ bodyinfo{i} = openraveros_getbodyinfo(res.bodies{i});
+ end
end
else
- bodies = [];
-end
\ No newline at end of file
+ bodyinfo = [];
+end
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvGetRobots.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvGetRobots.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvGetRobots.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,18 +1,42 @@
-% robots = orEnvGetRobots(robotid,options)
+% robotinfo = orEnvGetRobots(robotid,options)
%
%% Input:
-%% robotid - uid of robot
+%% robotid - uid of robot, if 0 gets all robots
%% options - set of options that controls what is sent back (BodyInfo.Req_X and RobotInfo.Req_X).
%% If none specified gets everything.
%% Output:
-% robots is a cell array of robots
-% every cell contains a struct with the following parameters
-% id - robotid
-% filename - filename used to initialize the body with
-% name - human robot name
-% type - type of robot
+%% if robotid is 0 or wasn't specified, robotinfo is a cell array of robots.
+%% Otherwise robotinfo holds the info of just one robot
+%% Every entry contains a struct with the following parameters
+%% id - robotid
+%% filename - filename used to initialize the body with
+%% name - human robot name
+%% type - type of robot
-function robots = orEnvGetRobots(robotid, options)
+%% Software License Agreement (BSD License)
+%% Copyright (c) 2006-2009, Rosen Diankov
+%% Redistribution and use in source and binary forms, with or without
+%% modification, are permitted provided that the following conditions are met:
+%% * Redistributions of source code must retain the above copyright notice,
+%% this list of conditions and the following disclaimer.
+%% * Redistributions in binary form must reproduce the above copyright
+%% notice, this list of conditions and the following disclaimer in the
+%% documentation and/or other materials provided with the distribution.
+%% * The name of the author may not be used to endorse or promote products
+%% derived from this software without specific prior written permission.
+%%
+%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+%% POSSIBILITY OF SUCH DAMAGE.
+function robotinfo = orEnvGetRobots(robotid, options)
session = openraveros_getglobalsession();
req = openraveros_env_getrobots();
if( exist('robotid','var') )
@@ -25,11 +49,15 @@
end
res = rosoct_session_call(session.id,'env_getrobots',req);
-if(~isempty(res))
- robots = cell(length(res.robots),1);
- for i = 1:length(res.robots)
- robots{i} = openraveros_getrobotinfo(res.robots{i});
+if(~isempty(res) && ~isempty(res.robots) )
+ if( exist('robotid','var') && robotid ~= 0 )
+ robotinfo = openraveros_getrobotinfo(res.robots{1});
+ else
+ robotinfo = cell(length(res.robots),1);
+ for i = 1:length(res.robots)
+ robotinfo{i} = openraveros_getrobotinfo(res.robots{i});
+ end
end
else
- robots = {};
+ robotinfo = [];
end
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvLoadScene.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvLoadScene.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvLoadScene.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -15,4 +15,4 @@
req.resetscene = ClearScene;
end
res = rosoct_session_call(session.id,'env_loadscene',req);
-success = ~isempty(res);
\ No newline at end of file
+success = ~isempty(res);
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvRayCollision.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvRayCollision.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvRayCollision.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -1,21 +1,27 @@
-% [collision, colinfo, hitbodies] = orEnvRayCollision(rays,[bodyid],req_contacts,req_bodyinfo)
+% [collision, colinfo, hitbodies] = orEnvRayCollision(rays,[bodyid],...)
%
% performs ray collision checks and returns the position and normals
% where all the rays collide
-% bodyid (optional) - if non zero, will only collide with that ray
-% rays - a 6xN matrix where the first 3
-% rows are the ray position and last 3 are the ray direction
-% collision - N dim vector that is 1 for colliding rays and 0
-% for non-colliding rays colinfo is a 6xN vector that describes
-% where the ray hit and the normal to the surface of the hit point
-% where the first 3 columns are position and last 3 are normals
-% if bodyid is specified, only checks collisions with that body
+%% Input:
+%% bodyid (optional) - if non zero, will only collide with that ray
+%% rays - a 6xN matrix where the first 3
+%% rows are the ray position and last 3 are the ray direction
+%% options -
+%% 'nocontacts' - don't send contacts (by default rays send)
+%% 'bodies' - get back the bodies every ray hit
+%% Output:
+%% collision - N dim vector that is 1 for colliding rays and 0
+%% for non-colliding rays colinfo is a 6xN vector that describes
+%% where the ray hit and the normal to the surface of the hit point
+%% where the first 3 columns are position and last 3 are normals
+%% if bodyid is specified, only checks collisions with that body
-function [collision, colinfo, hitbodies] = orEnvRayCollision(rays,bodyid,req_contacts,req_bodyinfo)
+function [collision, colinfo, hitbodies] = orEnvRayCollision(varargin)
session = openraveros_getglobalsession();
req = openraveros_env_raycollision();
+rays = varargin{1};
numrays = size(rays,2);
req.rays = cell(numrays,1);
for i = 1:numrays
@@ -24,16 +30,21 @@
req.rays{i}.direction(1:3) = rays(4:6,i);
end
-if( exist('bodyid','var') )
- req.bodyid = bodyid;
+if( nargin > 1 )
+ req.bodyid = varargin{2};
end
-if( ~exist('req_contacts','var') )
- req_contacts = 1;
+
+req.request_contacts = 1;
+index = 3;
+while(index <= nargin)
+ switch(varargin{index})
+ case 'nocontacts'
+ req.request_contacts = 0;
+ case 'bodies'
+ req.request_bodies = 1;
+ end
+ index = index+1;
end
-req.request_contacts = req_contacts>0;
-if( exist('req_bodyinfo','var') && req_bodyinfo )
- req.request_bodies = req_bodyinfo;
-end
res = rosoct_session_call(session.id,'env_raycollision',req);
Modified: pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m
===================================================================
--- pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m 2008-12-25 13:24:23 UTC (rev 8596)
+++ pkg/trunk/openrave_planning/openraveros/octave/orEnvSetOptions.m 2008-12-26 04:12:22 UTC (rev 8597)
@@ -7,6 +7,8 @@
% - simulation [start/stop] [time_step] - toggles the internal simulation loop, ie all the calls to SimulationStep. If time_step is specified, will set the simulation time step for all objects. Note that this is not tied to real time at all, how fast the simulation goes in reality depends on complexity of the scene and the physics engine being used.
% - physics engine_name - switches the physics engine to another one with id 'engine_name'
% - collision checker_name - switches the collision checker to a new one with id 'checker_name'
+% - viewer viewer_name - attaches a new viewer to the session
+% - wdims [width height] - resets the size of the current viewer
% - gravity [x y z] - changes to gravity vector
% - publishanytime [1/0] - switch between publishing the body transformations
% to the GUI anytime or only between stepsimulation and server messsages.
@@ -15,8 +17,32 @@
% will only reflect the state of robots after all calls to stepsimulation and
% server send messages have been done. The default is off.
% - debug [debuglevel] - toggles debugging messages by RAVELOG_X. Can be one of
-%% fatal, error, warn, info, debug, verbose
+% fatal, error, warn, info, debug, verbose
% - quit - closes the openrave instance
+
+%% Software License Agreement (BSD License)
+%% Copyright (c) 2006-2009, Rosen Diankov
+%% Redistribution and use in source and binary forms, with or without
+%% modification, are permitted provided that the following conditions are met:
+%% * Redistributions of source code must retain the above copyright notice,
+%% this list of conditions and the following disclaimer.
+%% * Redistributions in binary form must reproduce the above copyright
+%% notice, this list of conditions and the following disclaimer in the
+%% documentation and/or other materials provided with the distribution.
+%% * The name of the author may not be used to endorse or promote products
+%% derived from this software without specific prior written permission.
+%%
+%% THIS SOFTWARE IS PROVIDED BY TH...
[truncated message content] |
|
From: <rdi...@us...> - 2008-12-26 22:22:25
|
Revision: 8598
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8598&view=rev
Author: rdiankov
Date: 2008-12-26 21:50:08 +0000 (Fri, 26 Dec 2008)
Log Message:
-----------
added an accurate gripper transmission model, added an openraveros robot controller interface
Modified Paths:
--------------
pkg/trunk/3rdparty/openrave/Makefile
pkg/trunk/mechanism/mechanism_model/include/mechanism_model/gripper_transmission.h
pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp
pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml
pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m
pkg/trunk/openrave_planning/ormanipulation/octave/runperception.m
pkg/trunk/openrave_planning/orrosplanning/manifest.xml
pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h
pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp
pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h
pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h
pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
pkg/trunk/openrave_planning/setopenrave.sh
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml
Added Paths:
-----------
pkg/trunk/openrave_planning/orrosplanning/src/rosrobotcontroller.h
Modified: pkg/trunk/3rdparty/openrave/Makefile
===================================================================
--- pkg/trunk/3rdparty/openrave/Makefile 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/3rdparty/openrave/Makefile 2008-12-26 21:50:08 UTC (rev 8598)
@@ -2,7 +2,7 @@
SVN_DIR = openrave_svn
# Should really specify a revision
-SVN_REVISION = -r 587
+SVN_REVISION = -r 588
SVN_URL = https://openrave.svn.sourceforge.net/svnroot/openrave
include $(shell rospack find mk)/svn_checkout.mk
Modified: pkg/trunk/mechanism/mechanism_model/include/mechanism_model/gripper_transmission.h
===================================================================
--- pkg/trunk/mechanism/mechanism_model/include/mechanism_model/gripper_transmission.h 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/mechanism/mechanism_model/include/mechanism_model/gripper_transmission.h 2008-12-26 21:50:08 UTC (rev 8598)
@@ -55,7 +55,7 @@
class GripperTransmission : public Transmission
{
public:
- GripperTransmission() {}
+ GripperTransmission() : A_(1), B_(0) {}
virtual ~GripperTransmission() {}
bool initXml(TiXmlElement *config, Robot *robot);
@@ -67,6 +67,9 @@
std::vector<double> reductions_; // Mechanical reduction for each joint
std::vector<control_toolbox::Pid> pids_; // For keeping the joint angles aligned in Gazebo
+
+private:
+ double A_, B_; // gripper angle = reduction*acos(A*motor+B)
};
} // namespace mechanism
Modified: pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp
===================================================================
--- pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp 2008-12-26 21:50:08 UTC (rev 8598)
@@ -44,6 +44,13 @@
const char *name = config->Attribute("name");
name_ = name ? name : "";
+ const char *pA = config->Attribute("A");
+ if( pA != NULL )
+ A_ = atof(pA);
+ const char *pB = config->Attribute("B");
+ if( pB != NULL )
+ B_ = atof(pB);
+
TiXmlElement *ael = config->FirstChildElement("actuator");
const char *actuator_name = ael ? ael->Attribute("name") : NULL;
if (!actuator_name || !robot->getActuator(actuator_name))
@@ -91,10 +98,22 @@
{
assert(as.size() == 1);
assert(js.size() == reductions_.size());
+
+ // cos(pos*reduction) = A*motor+B
+ // -reduction * sin(pos*reduction) * dpos/dt = A * dmotor/dt
+ double cang = as[0]->state_.position_*A_+B_;
+ double ang;
+ if( cang < -1 )
+ ang = M_PI;
+ else if( cang > 1 )
+ ang = 0;
+ else
+ ang = acos(cang);
+
for (unsigned int i = 0; i < js.size(); ++i)
{
- js[i]->position_ = as[0]->state_.position_ / reductions_[i];
- js[i]->velocity_ = as[0]->state_.velocity_ / reductions_[i];
+ js[i]->position_ = ang / reductions_[i];
+ js[i]->velocity_ = - A_*as[0]->state_.velocity_ / (sin(ang)*reductions_[i]);
js[i]->applied_effort_ = as[0]->state_.last_measured_effort_ * reductions_[i];
}
}
@@ -110,8 +129,8 @@
double mean_effort = 0.0;
for (unsigned int i = 0; i < js.size(); ++i)
{
- mean_position += js[i]->position_ * reductions_[i];
- mean_velocity += js[i]->velocity_ * reductions_[i];
+ mean_position += (cos(js[i]->position_ * reductions_[i])-B_)/A_;
+ mean_velocity += - js[i]->velocity_ * reductions_[i] * sin(js[i]->position_*reductions_[i]) / A_;
mean_effort += js[i]->applied_effort_ / (reductions_[i]);
}
as[0]->state_.position_ = mean_position / js.size();
Modified: pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/ormanipulation/data/pr2table_real.env.xml 2008-12-26 21:50:08 UTC (rev 8598)
@@ -1,10 +1,7 @@
<Environment>
- <bkgndcolor>1 1 1</bkgndcolor>
- <camtrans> -0.285786 -4.231486 0.296317</camtrans>
- <camrotaxis>-0.998283 0.046406 0.035754 265</camrotaxis>
-
-<!-- <camtrans>0.792115 1.544696 2.088982</camtrans>
- <camrotaxis>-0.092050 -0.490650 -0.866481 211</camrotaxis> -->
+ <bkgndcol>0.3 0.7 0.8</bkgndcol>
+ <camtrans>0.792115 1.544696 2.088982</camtrans>
+ <camrotaxis>-0.092050 -0.490650 -0.866481 211</camrotaxis>
<Robot file="robots/pr2full.robot.xml">
<translation>-0.708 0.005 0.0</translation>
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m 2008-12-26 21:50:08 UTC (rev 8598)
@@ -56,7 +56,7 @@
orEnvLoadScene('', 1);
%% create rosproblem before everything so resources can init!
-probs.rosplan = orEnvCreateProblem('ROSPlanningProblem');
+probs.rosplan = orEnvCreateProblem('ROSPlanning');
if( isempty(probs.rosplan) )
error('failed to create problem');
end
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/runperception.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/runperception.m 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/runperception.m 2008-12-26 21:50:08 UTC (rev 8598)
@@ -4,9 +4,10 @@
cd(fullfile(rosoct_findpackage('ormanipulation'),'octave'));
startup;
-orEnvSetOptions('debug debug');
+%orEnvSetOptions('debug debug');
robot = SetupTableScene('data/pr2table_real.env.xml');
+orRobotControllerSet(robot.id, 'ROSRobot');
out = orProblemSendCommand('createsystem ObjectTransform /checkerdetector/ObjectDetection 0.1',probs.task);
if( isempty(out) )
Modified: pkg/trunk/openrave_planning/orrosplanning/manifest.xml
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-26 21:50:08 UTC (rev 8598)
@@ -11,4 +11,5 @@
<depend package="libKinematics"/>
<depend package="boost"/>
<depend package="checkerboard_detector"/>
+ <depend package="robot_msgs"/>
</package>
Modified: pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h 2008-12-26 21:50:08 UTC (rev 8598)
@@ -29,8 +29,6 @@
#include "rossensorsystem.h"
#include "checkerboard_detector/ObjectDetection.h"
-using namespace ros;
-
// used to update objects through a mocap system
class ObjectTransformXMLID
{
Modified: pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/orrosplanning/src/orrosplanningmain.cpp 2008-12-26 21:50:08 UTC (rev 8598)
@@ -28,7 +28,7 @@
#include "rosarmik.h"
#include "phasespacesystem.h"
#include "objecttransformsystem.h"
-
+#include "rosrobotcontroller.h"
#include "rosplanningproblem.h"
// declaring variables with stdcall can be a little complex
@@ -53,18 +53,24 @@
InterfaceBase* DECL_STDCALL(ORCreate, (PluginType type, wchar_t* name, EnvironmentBase* penv))
{
switch(type) {
+ case PT_Controller:
+ if( wcsicmp(name, L"ROSRobot") == 0 )
+ return new ROSRobotController(penv);
+ break;
case PT_InverseKinematicsSolver:
if( wcsicmp(name, L"ROSArmIK") == 0 )
return new ROSArmIK(penv);
break;
case PT_ProblemInstance:
- if( wcsicmp(name, L"ROSPlanningProblem") == 0 )
+ if( wcsicmp(name, L"ROSPlanning") == 0 )
return new ROSPlanningProblem(penv);
+ break;
case PT_SensorSystem:
if( wcsicmp(name, L"PhaseSpace") == 0 )
return new PhaseSpaceMocapClient(penv);
if( wcsicmp(name, L"ObjectTransform") == 0 )
return new ObjectTransformSystem(penv);
+ break;
default:
break;
}
@@ -83,7 +89,7 @@
pinfo->iksolvers.push_back(L"ROSArmIK");
pinfo->sensorsystems.push_back(L"PhaseSpace");
pinfo->sensorsystems.push_back(L"ObjectTransform");
- pinfo->problems.push_back(L"ROSPlanningProblem");
+ pinfo->problems.push_back(L"ROSPlanning");
return true;
}
Modified: pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h 2008-12-26 21:50:08 UTC (rev 8598)
@@ -29,8 +29,6 @@
#include "rossensorsystem.h"
#include "phase_space/PhaseSpaceSnapshot.h"
-using namespace ros;
-
// used to update objects through a mocap system
class PhaseSpaceXMLID
{
Modified: pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/orrosplanning/src/plugindefs.h 2008-12-26 21:50:08 UTC (rev 8598)
@@ -143,7 +143,7 @@
#endif
-inline std::wstring _ravembstowcs(const char* pstr)
+inline std::wstring _stdmbstowcs(const char* pstr)
{
size_t len = mbstowcs(NULL, pstr, 0);
std::wstring w; w.resize(len);
@@ -151,6 +151,18 @@
return w;
}
+inline string _stdwcstombs(const wchar_t* pname)
+{
+ string s;
+ size_t len = wcstombs(NULL, pname, 0);
+ if( len != (size_t)-1 ) {
+ s.resize(len);
+ wcstombs(&s[0], pname, len);
+ }
+
+ return s;
+}
+
#include <rave/rave.h>
using namespace OpenRAVE;
@@ -160,6 +172,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
+using namespace ros;
+
inline ros::node* check_roscpp()
{
// start roscpp
Added: pkg/trunk/openrave_planning/orrosplanning/src/rosrobotcontroller.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/rosrobotcontroller.h (rev 0)
+++ pkg/trunk/openrave_planning/orrosplanning/src/rosrobotcontroller.h 2008-12-26 21:50:08 UTC (rev 8598)
@@ -0,0 +1,265 @@
+// Software License Agreement (BSD License)
+// Copyright (c) 2008, Willow Garage, Inc.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * The name of the author may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// author: Rosen Diankov
+#ifndef RAVE_ROS_ROBOT_CONTROLLER
+#define RAVE_ROS_ROBOT_CONTROLLER
+
+#include <robot_msgs/MechanismState.h>
+
+// controller for the SSC-32 board
+class ROSRobotController : public ControllerBase
+{
+ enum ControllerState{
+ None = 0,
+ Servo, // done when servoed to position and the position is held
+ Traj, // done when reaches last point
+ Velocity // done when joints stop moving
+ };
+
+public:
+ ROSRobotController(EnvironmentBase* penv) : ControllerBase(penv), _topic("mechanism_state"), _fTimeCommandStarted(0),
+ _ptraj(NULL), _bIsDone(false), _bSendTimestamps(false), _bSubscribed(false), _bCalibrated(false) {
+ }
+
+ virtual ~ROSRobotController() {
+ Destroy();
+ }
+
+ /// args format: host port [proxytype index]
+ /// where proxytype is actarray, pos2d, or ...
+ /// the order specified is the order the degrees of freedom will be arranged
+ virtual bool Init(RobotBase* robot, const char* args)
+ {
+ Destroy();
+ _probot = robot;
+ if( _probot == NULL )
+ return false;
+
+ startsubscriptions();
+
+ return _bSubscribed;
+ }
+
+ virtual void Destroy()
+ {
+ stopsubscriptions();
+ _bCalibrated = false;
+ _probot = NULL;
+ _bIsDone = false;
+ }
+
+ virtual void Reset(int options)
+ {
+ }
+
+ virtual bool SetDesired(const dReal* pValues)
+ {
+ return true;
+ }
+
+ virtual bool SetPath(const Trajectory* ptraj)
+ {
+ return true;
+ }
+
+ virtual bool SetPath(const Trajectory* ptraj, int nTrajectoryId, float fDivergenceTime)
+ {
+ RAVELOG_ERRORA("ros controller does not support path with divergence");
+ return false;
+ }
+
+ virtual int GetDOF() { return _probot != NULL ? _probot->GetDOF() : 0; }
+
+ virtual bool SimulationStep(float fTimeElapsed)
+ {
+ if( !_bSubscribed )
+ return false;
+
+ {
+ boost::mutex::scoped_lock lock(_mutexstate);
+ if( _bCalibrated ) {
+ vector<dReal> values;
+ values.reserve(_mstate.get_joint_states_size());
+ FOREACHC(itj, _vjointmap)
+ values.push_back(_mstate.joint_states[*itj].position);
+
+ ROS_ASSERT( (int)values.size() == _probot->GetDOF() );
+ _probot->SetJointValues(NULL, NULL, &values[0], true);
+ }
+ }
+
+ return IsDone();
+ }
+
+ virtual bool SendCmd(const char* pcmd)
+ {
+ return false;
+ }
+
+ virtual bool SupportsCmd(const char* pcmd)
+ {
+ return false;
+ }
+
+ virtual bool IsDone() { return _bIsDone; }
+
+ virtual ActuatorState GetActuatorState(int index)
+ {
+ return AS_Idle;
+ }
+
+ virtual float GetTime() const
+ {
+ boost::mutex::scoped_lock lock(_mutexstate);
+ return _mstate.time - _fTimeCommandStarted;
+ }
+ virtual RobotBase* GetRobot() const { return _probot; }
+
+ virtual void GetVelocity(std::vector<dReal>& vel) const
+ {
+ vel.resize(0);
+ if( !_bCalibrated )
+ return;
+
+ boost::mutex::scoped_lock lock(_mutexstate);
+ assert( (int)_vjointmap.size() == _probot->GetDOF() );
+
+ vel.reserve(_mstate.get_joint_states_size());
+ FOREACHC(itj, _vjointmap)
+ vel.push_back(_mstate.joint_states[*itj].velocity);
+ }
+
+ virtual void GetTorque(std::vector<dReal>& torque) const
+ {
+ torque.resize(0);
+ if( !_bCalibrated )
+ return;
+
+ boost::mutex::scoped_lock lock(_mutexstate);
+ assert( (int)_vjointmap.size() == _probot->GetDOF() );
+
+ torque.reserve(_mstate.get_joint_states_size());
+ FOREACHC(itj, _vjointmap)
+ torque.push_back(_mstate.joint_states[*itj].applied_effort); // commanded_effort?
+ }
+
+private:
+
+ virtual void startsubscriptions()
+ {
+ // check if thread launched
+ _bSubscribed = false;
+ ros::node* pnode = check_roscpp();
+ if( pnode != NULL ) {
+ _bSubscribed = pnode->subscribe(_topic, _mstate_cb, &ROSRobotController::mechanismstatecb, this, 10);
+ if( _bSubscribed )
+ RAVELOG_DEBUGA("subscribed to %s\n", _topic.c_str());
+ else
+ RAVELOG_ERRORA("failed to subscribe to %s\n", _topic.c_str());
+ }
+ }
+
+ virtual void stopsubscriptions()
+ {
+ if( _bSubscribed ) {
+ ros::node* pnode = check_roscpp_nocreate();
+ if( pnode != NULL ) {
+ pnode->unsubscribe(_topic.c_str());
+ RAVELOG_DEBUGA("unsubscribe from %s\n", _topic.c_str());
+ }
+ _bSubscribed = false;
+ }
+ }
+
+ virtual void mechanismstatecb()
+ {
+ if( !_bCalibrated ) {
+ // check the robot joint/link names
+ GetEnv()->LockPhysics(true);
+
+ do {
+ _vjointmap.resize(0);
+ for(int i = 0; i < _probot->GetDOF(); ++i) {
+ for(size_t j = 0; j < _mstate_cb.get_joint_states_size(); ++j) {
+ if( _stdwcstombs(_probot->GetJoints()[i]->GetName()) == _mstate_cb.joint_states[j].name ) {
+ _vjointmap.push_back(j);
+ break;
+ }
+ }
+
+ if( i+1 != (int)_vjointmap.size()) {
+ RAVELOG_WARNA("could not find robot joint %S in mechanism state\n", _probot->GetJoints()[i]->GetName());
+ break;
+ }
+ }
+
+ if( _probot->GetDOF() != (int)_vjointmap.size() ) {
+ _vjointmap.resize(0);
+ break;
+ }
+
+ _bCalibrated = true;
+ } while(0);
+
+ GetEnv()->LockPhysics(false);
+ }
+ else {
+ if( _probot->GetDOF() != (int)_mstate_cb.get_joint_states_size() )
+ _bCalibrated = false;
+ }
+
+ if( !_bCalibrated )
+ return;
+
+ {
+ boost::mutex::scoped_lock lock(_mutexstate);
+ _mstate = _mstate_cb;
+ }
+
+ // do some monitoring of the joint state (try to look for stalls)
+ }
+
+ RobotBase* _probot; ///< robot owning this controller
+
+ string _topic;
+ robot_msgs::MechanismState _mstate_cb, _mstate;
+ vector<dReal> _vecdesired;
+ mutable boost::mutex _mutexstate;
+
+ ofstream flog;
+ int logid;
+
+ vector<int> _vjointmap; ///< maps mechanism state joints to robot joints
+
+ double _fTimeCommandStarted;
+ const Trajectory* _ptraj;
+
+ bool _bIsDone;
+ bool _bSendTimestamps; ///< if true, will send timestamps along with traj
+ bool _bSubscribed; ///< if true, succesfully subscribed to the mechanism state msgs
+ bool _bCalibrated; ///< if true, mechanism state matches robot
+};
+
+#endif
Modified: pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h 2008-12-26 21:50:08 UTC (rev 8598)
@@ -28,8 +28,6 @@
#include "simplesensorsystem.h"
-using namespace ros;
-
// used to update objects through a mocap system
template <typename T, typename XMLID>
class ROSSensorSystem : public SimpleSensorSystem<XMLID>
Modified: pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h 2008-12-26 21:50:08 UTC (rev 8598)
@@ -94,7 +94,7 @@
if( stricmp((const char*)name, "offsetlink") == 0 ) {
string linkname;
ss >> linkname;
- _pMocap->strOffsetLink = _ravembstowcs(linkname.c_str());
+ _pMocap->strOffsetLink = _stdmbstowcs(linkname.c_str());
}
else if( stricmp((const char*)name, "id") == 0 )
ss >> _pMocap->id;
Modified: pkg/trunk/openrave_planning/setopenrave.sh
===================================================================
--- pkg/trunk/openrave_planning/setopenrave.sh 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/openrave_planning/setopenrave.sh 2008-12-26 21:50:08 UTC (rev 8598)
@@ -2,5 +2,5 @@
# highly recommend to put these commands in the local ~..bashrc file
# otherwise, use source setopenrave.sh
export PATH=`rospack find openrave`/bin:$PATH
-export OPENRAVE_DATA=`rospack find openrave_robot_description`:`openrave-config --prefix`/share/openrave/:$OPENRAVE_DATA
+export OPENRAVE_DATA=`rospack find openrave_robot_description`:`rospack find ormanipulation`:`openrave-config --prefix`/share/openrave/:$OPENRAVE_DATA
export OPENRAVE_PLUGINS=`rospack find orplugins`:`openrave-config --prefix`/share/openrave/plugins:$OPENRAVE_PLUGINS
Modified: pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml
===================================================================
--- pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml 2008-12-26 04:12:22 UTC (rev 8597)
+++ pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml 2008-12-26 21:50:08 UTC (rev 8598)
@@ -423,20 +423,20 @@
<pr2_finger prefix="${side}_gripper" parent="${side}_gripper_palm" />
- <!--transmission type="GripperTransmission" name="${side}_gripper_trans">
+ <!-- cos(angle*reduction) = motor_encoder * A + B -->
+ <transmission type="GripperTransmission" name="${side}_gripper_trans" A="0.0004268" B="0.72730">
<actuator name="${side}_gripper_motor" />
- <joint name="${side}_gripper_r_finger_joint" reduction="-1000.0" />
- <joint name="${side}_gripper_r_finger_tip_joint" reduction="1000.0" />
- <joint name="${side}_gripper_l_finger_joint" reduction="1000.0" />
- <joint name="${side}_gripper_l_finger_tip_joint" reduction="-1000.0" />
+ <joint name="${side}_gripper_r_finger_joint" reduction="-1.0" />
+ <joint name="${side}_gripper_r_finger_tip_joint" reduction="1.0" />
+ <joint name="${side}_gripper_l_finger_joint" reduction="1.0" />
+ <joint name="${side}_gripper_l_finger_tip_joint" reduction="-1.0" />
<pid p="0.01" i="0.001" d="0.005" iClamp="0.005" />
- </transmission-->
- <transmission type="SimpleTransmission" name="${side}_gripper_trans">
+ </transmission>
+<!-- <transmission type="SimpleTransmission" name="${side}_gripper_trans">
<actuator name="${side}_gripper_motor" />
<joint name="${side}_gripper_l_finger_joint" />
<mechanicalReduction>6.0</mechanicalReduction>
- </transmission>
-
+ </transmission> -->
</macro>
<!-- Calibration -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rdi...@us...> - 2008-12-27 02:14:23
|
Revision: 8603
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8603&view=rev
Author: rdiankov
Date: 2008-12-27 01:45:36 +0000 (Sat, 27 Dec 2008)
Log Message:
-----------
correct pr2 gripper transmissions now working
Modified Paths:
--------------
pkg/trunk/estimation/robot_pose_ekf/src/odom_estimation_node.h
pkg/trunk/hardware_test/life_test/arm_life_test/controllers_twist.xml
pkg/trunk/hardware_test/life_test/arm_life_test/teleop_arm.launch
pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp
pkg/trunk/robot_descriptions/pr2_alpha/prf.launch
pkg/trunk/robot_descriptions/pr2_alpha/teleop_joystick_new.launch
pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml
Modified: pkg/trunk/estimation/robot_pose_ekf/src/odom_estimation_node.h
===================================================================
--- pkg/trunk/estimation/robot_pose_ekf/src/odom_estimation_node.h 2008-12-27 01:44:57 UTC (rev 8602)
+++ pkg/trunk/estimation/robot_pose_ekf/src/odom_estimation_node.h 2008-12-27 01:45:36 UTC (rev 8603)
@@ -50,6 +50,8 @@
#include "robot_msgs/VOPose.h"
#include "robot_msgs/PoseWithCovariance.h"
+#include <rosthread/mutex.h>
+
// log files
#include <fstream>
Modified: pkg/trunk/hardware_test/life_test/arm_life_test/controllers_twist.xml
===================================================================
--- pkg/trunk/hardware_test/life_test/arm_life_test/controllers_twist.xml 2008-12-27 01:44:57 UTC (rev 8602)
+++ pkg/trunk/hardware_test/life_test/arm_life_test/controllers_twist.xml 2008-12-27 01:45:36 UTC (rev 8603)
@@ -2,6 +2,6 @@
<controller type="EndeffectorTwistControllerNode" name="arm_twist" topic="arm_twist">
<pid_trans p="20.0" d="0.0" i="0.5" iClamp="1.0" />
<pid_rot p="0.5" d="0.0" i="0.1" iClamp="0.2" />
- <chain root="torso_link" tip="r_wrist_roll_link" offset="0.3 0 0" />
+ <chain root="torso_lift_link" tip="r_wrist_roll_link" offset="0.3 0 0" />
</controller>
</controllers>
Modified: pkg/trunk/hardware_test/life_test/arm_life_test/teleop_arm.launch
===================================================================
--- pkg/trunk/hardware_test/life_test/arm_life_test/teleop_arm.launch 2008-12-27 01:44:57 UTC (rev 8602)
+++ pkg/trunk/hardware_test/life_test/arm_life_test/teleop_arm.launch 2008-12-27 01:45:36 UTC (rev 8603)
@@ -3,7 +3,7 @@
<!-- Arm twist controller -->
<param name="arm_twist/joystick_max_trans" value="3.0" />
<param name="arm_twist/joystick_max_rot" value="4.0" />
- <node pkg="mechanism_control" type="spawner.py" args="controllers_twist.xml" />
+ <node pkg="mechanism_control" type="spawner.py" args="$(find arm_life_test)/controllers_twist.xml" />
<!-- Gripper controller -->
Modified: pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp
===================================================================
--- pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp 2008-12-27 01:44:57 UTC (rev 8602)
+++ pkg/trunk/mechanism/mechanism_model/src/gripper_transmission.cpp 2008-12-27 01:45:36 UTC (rev 8603)
@@ -107,25 +107,22 @@
ROS_ASSERT(as.size() == 1);
ROS_ASSERT(js.size() == preductions_.size());
- // cos(pos*reduction) = A*motor+B
- // -reduction * sin(pos*reduction) * dpos/dt = A * dmotor/dt
- double cang = as[0]->state_.position_*A_+B_;
+ // sin(pos*reduction) = A*motor+B
+ // reduction * cos(pos*reduction) * dpos/dt = A * dmotor/dt
+ double sang = as[0]->state_.position_*A_+B_;
double ang;
- if( cang < -1 )
- ang = M_PI;
- else if( cang > 1 )
- ang = 0;
+ if( sang <= -1 )
+ ang = -M_PI/2;
+ else if( sang >= 1 )
+ ang = M_PI/2;
else
- ang = acos(cang);
+ ang = asin(sang);
for (unsigned int i = 0; i < js.size(); ++i)
{
js[i]->position_ = ang / preductions_[i];
- js[i]->velocity_ = - A_*as[0]->state_.velocity_ / (sin(ang)*preductions_[i]);
+ js[i]->velocity_ = A_*as[0]->state_.velocity_ / (cos(ang)*preductions_[i]);
js[i]->applied_effort_ = as[0]->state_.last_measured_effort_ * ereductions_[i];
- ROS_INFO("gripper pos %d: %f from %f (%f,%f)\n", i, js[i]->position_, as[0]->state_.position_, (float)A_, (float)B_);
- js[i]->position_ = as[0]->state_.position_;
- js[i]->velocity_ = as[0]->state_.velocity_;
}
}
@@ -140,14 +137,13 @@
double mean_effort = 0.0;
for (unsigned int i = 0; i < js.size(); ++i)
{
- mean_position += (cos(js[i]->position_ * preductions_[i])-B_)/A_;
- mean_velocity += - js[i]->velocity_ * preductions_[i] * sin(js[i]->position_*preductions_[i]) / A_;
+ mean_position += (sin(js[i]->position_ * preductions_[i])-B_)/A_;
+ mean_velocity += js[i]->velocity_ * preductions_[i] * cos(js[i]->position_*preductions_[i]) / A_;
mean_effort += js[i]->applied_effort_ / (ereductions_[i]);
}
- ROS_INFO("gripper motor pos: %f\n", (float)mean_position / js.size());
- as[0]->state_.position_ = js[0]->position_;//mean_position / js.size();
- as[0]->state_.velocity_ = js[0]->velocity_;//mean_velocity / js.size();
+ as[0]->state_.position_ = mean_position / js.size();
+ as[0]->state_.velocity_ = mean_velocity / js.size();
as[0]->state_.last_measured_effort_ = mean_effort / js.size();
}
@@ -164,7 +160,6 @@
strongest = js[i]->commanded_effort_ / ereductions_[i];
}
- //ROS_INFO("gripper motor eff: %f\n", (float)strongest);
as[0]->command_.effort_ = strongest;
}
@@ -177,7 +172,7 @@
std::vector<double> scaled_positions(js.size());
for (unsigned int i = 0; i < js.size(); ++i)
- scaled_positions[i] = (cos(js[i]->position_ * preductions_[i])-B_)/A_;
+ scaled_positions[i] = (sin(js[i]->position_ * preductions_[i])-B_)/A_;
double mean = std::accumulate(scaled_positions.begin(), scaled_positions.end(), 0.0)
/ scaled_positions.size();
@@ -187,7 +182,6 @@
double err = scaled_positions[i] - mean;
double pid_effort = pids_[i].updatePid(err, 0.001);
- ROS_INFO("gripper commanded eff: %f\n", (float)as[0]->command_.effort_ * ereductions_[i]);
js[i]->commanded_effort_ =
/*pid_effort / ereductions_[i] + */as[0]->command_.effort_ * ereductions_[i];
}
Modified: pkg/trunk/robot_descriptions/pr2_alpha/prf.launch
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/prf.launch 2008-12-27 01:44:57 UTC (rev 8602)
+++ pkg/trunk/robot_descriptions/pr2_alpha/prf.launch 2008-12-27 01:45:36 UTC (rev 8603)
@@ -63,12 +63,12 @@
-->
<!-- DCAM-->
- <node machine="three" name="dcam" pkg="dcam_node" type="dcam_node" respawn="false">
+<!-- <node machine="three" name="dcam" pkg="dcam_node" type="dcam_node" respawn="false">
<param name="video_mode" type="str" value="640x480_videre_none"/>
<param name="do_rectify" type="bool" value="True"/>
<param name="do_stereo" type="bool" value="True"/>
<param name="do_calc_points" type="bool" value="False"/>
- </node>
+ </node> -->
<!-- Runtime Diagnostics Logging -->
Modified: pkg/trunk/robot_descriptions/pr2_alpha/teleop_joystick_new.launch
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/teleop_joystick_new.launch 2008-12-27 01:44:57 UTC (rev 8602)
+++ pkg/trunk/robot_descriptions/pr2_alpha/teleop_joystick_new.launch 2008-12-27 01:45:36 UTC (rev 8603)
@@ -1,6 +1,6 @@
<launch>
<param name="base_controller/odom_publish_rate" value="30.0"/>
-<node pkg="mechanism_control" type="spawner.py" args="controllers_base_new.xml" output="screen"/>
+<node pkg="mechanism_control" type="spawner.py" args="$(find pr2_alpha)/controllers_base_new.xml" output="screen"/>
<group name="wg">
<param name="axis_vx" value="3" type="int"/>
Modified: pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml
===================================================================
--- pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml 2008-12-27 01:44:57 UTC (rev 8602)
+++ pkg/trunk/robot_descriptions/wg_robot_description/pr2_robot_defs/gripper_defs.xml 2008-12-27 01:45:36 UTC (rev 8603)
@@ -5,7 +5,7 @@
<property name="M_PI" value="3.1415926535897931" />
- <property name="gripper_max_angle" value="0.5236" />
+ <property name="gripper_max_angle" value="0.548" />
<property name="gripper_min_angle" value="0.05" />
<macro name="pr2_finger" params="prefix parent">
@@ -423,20 +423,20 @@
<pr2_finger prefix="${side}_gripper" parent="${side}_gripper_palm" />
- <!-- cos(angle*reduction) = motor_encoder * A + B -->
-<!-- <transmission type="GripperTransmission" name="${side}_gripper_trans" A="0.00042803" B="0.97567">
+ <!-- sin(angle*reduction) = motor_encoder * A + B -->
+ <transmission type="GripperTransmission" name="${side}_gripper_trans" A="0.0002193927" B="0.530981135">
<actuator name="${side}_gripper_motor" />
- <joint name="${side}_gripper_r_finger_joint" preduction="1.0" ereduction="6.0" />
- <joint name="${side}_gripper_r_finger_tip_joint" preduction="-1.0" ereduction="-6.0" />
- <joint name="${side}_gripper_l_finger_joint" preduction="-1.0" ereduction="-6.0"/>
- <joint name="${side}_gripper_l_finger_tip_joint" preduction="1.0" ereduction="6.0" />
+ <joint name="${side}_gripper_r_finger_joint" preduction="-1.0" ereduction="-6.0" />
+ <joint name="${side}_gripper_r_finger_tip_joint" preduction="1.0" ereduction="6.0" />
+ <joint name="${side}_gripper_l_finger_joint" preduction="1.0" ereduction="6.0"/>
+ <joint name="${side}_gripper_l_finger_tip_joint" preduction="-1.0" ereduction="-6.0" />
<pid p="0.01" i="0.001" d="0.005" iClamp="0.005" />
- </transmission> -->
- <transmission type="SimpleTransmission" name="${side}_gripper_trans">
+ </transmission>
+<!-- <transmission type="SimpleTransmission" name="${side}_gripper_trans">
<actuator name="${side}_gripper_motor" />
<joint name="${side}_gripper_l_finger_joint" />
<mechanicalReduction>6.0</mechanicalReduction>
- </transmission>
+ </transmission> -->
</macro>
<!-- Calibration -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hsu...@us...> - 2008-12-27 02:22:11
|
Revision: 8602
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8602&view=rev
Author: hsujohnhsu
Date: 2008-12-27 01:44:57 +0000 (Sat, 27 Dec 2008)
Log Message:
-----------
create [mesh]_convex.stl using convex decomposition package.
Modified Paths:
--------------
pkg/trunk/3rdparty/convex_decomposition/manifest.xml
pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt
pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml
Modified: pkg/trunk/3rdparty/convex_decomposition/manifest.xml
===================================================================
--- pkg/trunk/3rdparty/convex_decomposition/manifest.xml 2008-12-27 01:22:01 UTC (rev 8601)
+++ pkg/trunk/3rdparty/convex_decomposition/manifest.xml 2008-12-27 01:44:57 UTC (rev 8602)
@@ -9,6 +9,6 @@
<review status="3rdparty" notes=""/>
<url>http://www.amillionpixels.us/ConvexDecomposition.zip</url>
<export>
- <cpp lflags="-L${prefix}/ConvexDecomposition/lib -lconvex_decomposition" cflags="-I${prefix}/ConvexDecomposition/include"/>
+ <cpp lflags="-L${prefix}/ConvexDecomposition/lib " cflags="-I${prefix}/ConvexDecomposition/include"/>
</export>
</package>
Modified: pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt
===================================================================
--- pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt 2008-12-27 01:22:01 UTC (rev 8601)
+++ pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt 2008-12-27 01:44:57 UTC (rev 8602)
@@ -11,6 +11,7 @@
# xacro file generation
find_ros_package(xacro)
+find_ros_package(convex_decomposition)
set(pr2robot "${CMAKE_CURRENT_SOURCE_DIR}/pr2/pr2")
add_custom_command(
@@ -65,6 +66,34 @@
set(pr2_gen_files ${pr2_gen_files} ${basepath}/${basename}.iv)
+#obj files
+add_custom_command(
+ OUTPUT ${basepath}/${basename}.obj
+ COMMAND ivcon
+ ARGS ${it} ${basepath}/${basename}.obj
+ DEPENDS ${it} ivcon)
+
+set(pr2_gen_files ${pr2_gen_files} ${basepath}/${basename}.obj)
+
+#convex decomposition obj files
+add_custom_command(
+ OUTPUT ${basepath}/${basename}_convex.obj
+ COMMAND ${convex_decomposition_PACKAGE_PATH}/convex_decomposition/bin/convex_decomposition
+ ARGS ${basepath}/${basename}.obj
+ DEPENDS ${basepath}/${basename}.obj)
+
+set(pr2_gen_files ${pr2_gen_files} ${basepath}/${basename}_convex.obj)
+
+#convert obj files back to stl
+add_custom_command(
+ OUTPUT ${basepath}/${basename}_convex.stl
+ COMMAND ivcon
+ ARGS ${basepath}/${basename}_convex.obj ${basepath}/${basename}_convex.stl
+ DEPENDS ${it} ivcon)
+
+set(pr2_gen_files ${pr2_gen_files} ${basepath}/${basename}_convex.stl)
+
+
endforeach(it)
add_custom_target(media_files ALL DEPENDS ${pr2robot}.xml ${pr2prototype1}.xml ${pr2arm}.xml ${pr2gripper}.xml ${pr2_gen_files})
Modified: pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml
===================================================================
--- pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml 2008-12-27 01:22:01 UTC (rev 8601)
+++ pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml 2008-12-27 01:44:57 UTC (rev 8602)
@@ -12,6 +12,7 @@
<depend package="wg_robot_description_parser" />
<depend package="xacro"/>
+ <depend package="convex_decomposition"/>
<url>http://pr.willowgarage.com/wiki/RobotDescriptionFormat</url>
</package>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hsu...@us...> - 2008-12-27 04:08:50
|
Revision: 8608
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8608&view=rev
Author: hsujohnhsu
Date: 2008-12-27 04:08:47 +0000 (Sat, 27 Dec 2008)
Log Message:
-----------
* update convex decomposition generated stl mesh to .stlb extension.
* added numpy dependency to gazebo_plugin for unit tests.
* update gazebo_robot_description to generate ogre mesh from .stl and .stlb
Modified Paths:
--------------
pkg/trunk/drivers/simulator/gazebo_plugin/manifest.xml
pkg/trunk/robot_descriptions/gazebo_robot_description/CMakeLists.txt
pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt
Modified: pkg/trunk/drivers/simulator/gazebo_plugin/manifest.xml
===================================================================
--- pkg/trunk/drivers/simulator/gazebo_plugin/manifest.xml 2008-12-27 03:55:06 UTC (rev 8607)
+++ pkg/trunk/drivers/simulator/gazebo_plugin/manifest.xml 2008-12-27 04:08:47 UTC (rev 8608)
@@ -30,4 +30,6 @@
<export>
<cpp cflags="-I${prefix}/include" lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib" />
</export>
+ <sysdepend os="ubuntu" version="8.04-hardy" package="python-numpy"/>
+ <sysdepend os="ubuntu" version="7.10-gutsy" package="python-numpy"/>
</package>
Modified: pkg/trunk/robot_descriptions/gazebo_robot_description/CMakeLists.txt
===================================================================
--- pkg/trunk/robot_descriptions/gazebo_robot_description/CMakeLists.txt 2008-12-27 03:55:06 UTC (rev 8607)
+++ pkg/trunk/robot_descriptions/gazebo_robot_description/CMakeLists.txt 2008-12-27 04:08:47 UTC (rev 8608)
@@ -8,8 +8,8 @@
find_ros_package(gazebo_robot_description)
get_target_property(urdf2gazebo_exe urdf2gazebo LOCATION)
-# build the ogre mesh files
-file(GLOB pr2_stl_files ${wg_robot_description_PACKAGE_PATH}/models/pr2/*.stl)
+# build the ogre mesh files from *.stl (and *.stlb from convex decomposition)
+file(GLOB pr2_stl_files ${wg_robot_description_PACKAGE_PATH}/models/pr2/*.stl ${wg_robot_description_PACKAGE_PATH}/models/pr2/convex/*.stlb)
set(pr2_gen_files "")
set(pr2_out_path ${CMAKE_CURRENT_SOURCE_DIR}/world/Media/models/pr2)
Modified: pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt
===================================================================
--- pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt 2008-12-27 03:55:06 UTC (rev 8607)
+++ pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt 2008-12-27 04:08:47 UTC (rev 8608)
@@ -89,14 +89,14 @@
set(pr2_gen_files ${pr2_gen_files} ${basepath}/convex/${basename}_convex.obj)
-#convert obj files back to stl, put in directory name convex
+#convert obj files back to stlb, put in directory named convex
add_custom_command(
- OUTPUT ${basepath}/convex/${basename}_convex.stl
+ OUTPUT ${basepath}/convex/${basename}_convex.stlb
COMMAND ivcon
- ARGS ${basepath}/convex/${basename}_convex.obj ${basepath}/convex/${basename}_convex.stl
+ ARGS ${basepath}/convex/${basename}_convex.obj ${basepath}/convex/${basename}_convex.stlb
DEPENDS ${it} ivcon)
-set(pr2_gen_files ${pr2_gen_files} ${basepath}/convex/${basename}_convex.stl)
+set(pr2_gen_files ${pr2_gen_files} ${basepath}/convex/${basename}_convex.stlb)
endforeach(it)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rdi...@us...> - 2008-12-27 05:27:00
|
Revision: 8610
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8610&view=rev
Author: rdiankov
Date: 2008-12-27 05:26:57 +0000 (Sat, 27 Dec 2008)
Log Message:
-----------
connected tf to object tracking in openrave
Modified Paths:
--------------
pkg/trunk/3rdparty/openrave/Makefile
pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml
pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml
pkg/trunk/openrave_planning/orrosplanning/manifest.xml
pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h
pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h
pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
pkg/trunk/robot_descriptions/openrave_robot_description/src/urdf2openrave.cpp
pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp
pkg/trunk/vision/checkerboard_detector/msg/Object6DPose.msg
Modified: pkg/trunk/3rdparty/openrave/Makefile
===================================================================
--- pkg/trunk/3rdparty/openrave/Makefile 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/3rdparty/openrave/Makefile 2008-12-27 05:26:57 UTC (rev 8610)
@@ -2,7 +2,7 @@
SVN_DIR = openrave_svn
# Should really specify a revision
-SVN_REVISION = -r 588
+SVN_REVISION = -r 589
SVN_URL = https://openrave.svn.sourceforge.net/svnroot/openrave
include $(shell rospack find mk)/svn_checkout.mk
Modified: pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/openrave_planning/ormanipulation/openrave_sensing.ros.xml 2008-12-27 05:26:57 UTC (rev 8610)
@@ -8,5 +8,5 @@
<node pkg="phase_space" type="phase_space_node"/>
<!-- launch octave scripts to start the openrave client -->
- <node pkg="ormanipulation" type="runperception.m" output="screen"/>
+<!-- <node pkg="ormanipulation" type="runperception.m" output="screen"/> -->
</launch>
Modified: pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml 2008-12-27 05:26:57 UTC (rev 8610)
@@ -1,22 +1,12 @@
<launch>
- <machine name="cameras" address="ahc" default="false" user="rdiankov"/>
+ <machine name="localhost_cameras" address="localhost" default="false"/>
- <node machine="cameras" name="dcam" pkg="dcam" type="dcam" respawn="false">
- <!-- video_mode should be one of the following:
- 640x480_videre_rectified: Provides rectified images from the hw
- Provides: left mono image
- 640x480_videre_disparity: Disparity and rectification done on chip.
- Provides: Disparity and left mono image
- 640x480_videre_disparity_raw: Disparity done on chip (debayer and rectification in software).
- Provides: disparity and left color image.
- 640x480_videre_none: No stereo on chip (all processing done in software).
- Provides: all 3 images available
- -->
+<!-- <node machine="cameras" name="dcam" pkg="dcam" type="dcam" respawn="false">
<param name="video_mode" type="str" value="640x480_videre_rectified"/>
<param name="do_rectify" type="bool" value="False"/>
<param name="do_stereo" type="bool" value="False"/>
<param name="do_calc_points" type="bool" value="False"/>
- </node>
+ </node> -->
<group ns="checkerdetector" clear_params="true">
<param name="display" type="int" value="1"/>
<param name="rect0_size_x" type="double" value="0.02133"/>
@@ -24,10 +14,10 @@
<param name="grid0_size_x" type="int" value="4"/>
<param name="grid0_size_y" type="int" value="3"/>
<param name="type0" type="string" value="data/ricebox.kinbody.xml"/>
- <node machine="cameras" pkg="checkerboard_detector" type="checkerboard_detector" respawn="true" output="screen">
+ <node pkg="checkerboard_detector" type="checkerboard_detector" respawn="true" output="screen">
<remap from="CamInfo" to="/dcam/left/cam_info"/>
<remap from="Image" to="/dcam/left/image_rect"/>
- <env name="DISPLAY" value=":0.0"/>
+<!-- <env name="DISPLAY" value=":0.0"/> -->
</node>
</group>
</launch>
Modified: pkg/trunk/openrave_planning/orrosplanning/manifest.xml
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/openrave_planning/orrosplanning/manifest.xml 2008-12-27 05:26:57 UTC (rev 8610)
@@ -12,4 +12,5 @@
<depend package="boost"/>
<depend package="checkerboard_detector"/>
<depend package="robot_msgs"/>
+ <depend package="tf"/>
</package>
Modified: pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/openrave_planning/orrosplanning/src/objecttransformsystem.h 2008-12-27 05:26:57 UTC (rev 8610)
@@ -26,8 +26,10 @@
#ifndef OBJECTTRANSFORM_SENSOR_SYSTEM
#define OBJECTTRANSFORM_SENSOR_SYSTEM
+#include <tf/transform_listener.h>
+#include <checkerboard_detector/ObjectDetection.h>
+
#include "rossensorsystem.h"
-#include "checkerboard_detector/ObjectDetection.h"
// used to update objects through a mocap system
class ObjectTransformXMLID
@@ -40,22 +42,84 @@
{
public:
ObjectTransformSystem(EnvironmentBase* penv)
- : ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>(penv), nNextId(1)
+ : ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>(penv), _probot(NULL), nNextId(1)
{
}
virtual bool Init(istream& sinput)
{
+ _probot = NULL;
_topic = "ObjectDetection";
- bool bSuccess = ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>::Init(sinput);
- if( !bSuccess )
- return false;
_fThreshSqr = 0.05*0.05f;
- sinput >> _fThreshSqr;
- return true;
+
+ string cmd;
+ while(!sinput.eof()) {
+ sinput >> cmd;
+ if( !sinput )
+ break;
+
+ if( stricmp(cmd.c_str(), "topic") == 0 )
+ sinput >> _topic;
+ else if( stricmp(cmd.c_str(), "thresh") == 0 )
+ sinput >> _fThreshSqr;
+ else if( stricmp(cmd.c_str(), "robot") == 0 ) {
+ int id;
+ sinput >> id;
+ KinBody* pbody = GetEnv()->GetBodyFromNetworkId(id);
+ if( pbody->IsRobot() )
+ _probot = (RobotBase*)pbody;
+
+ if( _probot == NULL )
+ RAVELOG_WARNA("failed to find robot with id %d\n", id);
+ }
+ else break;
+
+ if( !sinput ) {
+ RAVELOG_ERRORA("failed\n");
+ return false;
+ }
+ }
+
+ startsubscriptions();
+ return _bSubscribed;
}
private:
+ virtual void startsubscriptions()
+ {
+ ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>::startsubscriptions();
+
+ if( _bSubscribed ) {
+ ros::node* pnode = check_roscpp_nocreate();
+ if( pnode != NULL ) {
+ double tf_cache_time_secs;
+ pnode->param("~tf_cache_time_secs", tf_cache_time_secs, 10.0);
+ if (tf_cache_time_secs < 0)
+ RAVELOG_ERRORA("ROSSensorSystem: Parameter tf_cache_time_secs<0 (%f)", tf_cache_time_secs);
+ unsigned long long tf_cache_time = tf_cache_time_secs*1000000000ULL;
+ _tf.reset(new tf::TransformListener(*pnode, true, tf_cache_time));
+ RAVELOG_INFOA("ROSSensorSystem: TF Cache Time: %f Seconds", tf_cache_time_secs);
+
+ // **** Set TF Extrapolation Limit ****
+ double tf_extrap_limit_secs ;
+ pnode->param("~tf_extrap_limit", tf_extrap_limit_secs, 0.00);
+ if (tf_extrap_limit_secs < 0.0)
+ RAVELOG_ERRORA("ROSSensorSystem: parameter tf_extrap_limit<0 (%f)", tf_extrap_limit_secs);
+
+ ros::Duration extrap_limit;
+ extrap_limit.fromSec(tf_extrap_limit_secs);
+ _tf->setExtrapolationLimit(extrap_limit);
+ RAVELOG_INFOA("ROSSensorSystem: tf extrapolation Limit: %f Seconds", tf_extrap_limit_secs);
+ }
+ }
+ }
+
+ virtual void stopsubscriptions()
+ {
+ ROSSensorSystem<checkerboard_detector::ObjectDetection, ObjectTransformXMLID>::stopsubscriptions();
+ _tf.reset();
+ }
+
void newdatacb()
{
list< SNAPSHOT > listbodies;
@@ -64,13 +128,39 @@
{
boost::mutex::scoped_lock lock(_mutex);
TYPEOF(_mapbodies) mapbodies = _mapbodies;
+ std_msgs::PoseStamped posestamped, poseout;
+ Transform trobot;
+ if( _probot != NULL && _topicmsg.objects.size() > 0 ) {
+ GetEnv()->LockPhysics(true);
+ trobot = _probot->GetTransform();
+ GetEnv()->LockPhysics(false);
+ }
+
FOREACHC(itobj, _topicmsg.objects) {
boost::shared_ptr<BODY> b;
- Transform tnew = GetTransform(itobj->pose);
+
+ Transform tnew;
+ // if on robot, have to find the global transformation
+ if( _probot != NULL ) {
+ posestamped.pose = itobj->pose;
+ posestamped.header = _topicmsg.header;
+
+ try {
+ _tf->transformPose(_stdwcstombs(_probot->GetLinks().front()->GetName()), posestamped, poseout);
+ tnew = trobot * _probot->GetTransform() * GetTransform(poseout.pose);
+ }
+ catch(tf::TransformException& ex) {
+ RAVELOG_WARNA("failed to get tf frames %S for object %s\n",posestamped.header.frame_id.c_str(), _probot->GetLinks().front()->GetName(), b->_initdata->sid.c_str());
+ tnew = GetTransform(itobj->pose);
+ }
+ }
+ else
+ tnew = GetTransform(itobj->pose);
+
FOREACH(it, mapbodies) {
- if( it->second->_initdata.sid == itobj->type ) {
+ if( it->second->_initdata->sid == itobj->type ) {
// same type matched, need to check proximity
Transform tbody = it->second->GetOffsetLink()->GetParent()->GetTransform();
@@ -132,11 +222,19 @@
}
}
- Transform GetTransform(const std_msgs::Transform& pose)
+ Transform GetTransform(const std_msgs::Pose& pose)
{
- return Transform(Vector(pose.rotation.w, pose.rotation.x, pose.rotation.y, pose.rotation.z), Vector(pose.translation.x, pose.translation.y, pose.translation.z));
+ return Transform(Vector(pose.orientation.w, pose.orientation.x, pose.orientation.y, pose.orientation.z), Vector(pose.position.x, pose.position.y, pose.position.z));
}
+ Transform GetTransform(const btTransform& bt)
+ {
+ btQuaternion q = bt.getRotation();
+ btVector3 o = bt.getOrigin();
+ return Transform(Vector(q.w(),q.x(),q.y(),q.z()),Vector(o.x(),o.y(),o.z()));
+ }
+ boost::shared_ptr<tf::TransformListener> _tf;
+ RobotBase* _probot; ///< system is attached to this robot
dReal _fThreshSqr;
int nNextId;
};
Modified: pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/openrave_planning/orrosplanning/src/phasespacesystem.h 2008-12-27 05:26:57 UTC (rev 8610)
@@ -66,7 +66,7 @@
Transform tnew = GetTransform(psbody.pose);
FOREACH(it, _mapbodies) {
- if( it->second->_initdata.id == psbody.id ) {
+ if( it->second->_initdata->id == psbody.id ) {
b = it->second;
break;
}
Modified: pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/openrave_planning/orrosplanning/src/rossensorsystem.h 2008-12-27 05:26:57 UTC (rev 8610)
@@ -43,10 +43,22 @@
virtual bool Init(istream& sinput)
{
- if( !SimpleSensorSystem<XMLID>::Init(sinput) )
- return false;
+ string cmd;
+ while(!sinput.eof()) {
+ sinput >> cmd;
+ if( !sinput )
+ break;
- sinput >> _topic;
+ if( stricmp(cmd.c_str(), "topic") == 0 )
+ sinput >> _topic;
+ else break;
+
+ if( !sinput ) {
+ RAVELOG_ERRORA("failed\n");
+ return false;
+ }
+ }
+
startsubscriptions();
return _bSubscribed;
}
Modified: pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h
===================================================================
--- pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/openrave_planning/orrosplanning/src/simplesensorsystem.h 2008-12-27 05:26:57 UTC (rev 8610)
@@ -32,16 +32,20 @@
template <typename XMLID>
class SimpleSensorSystem : public SensorSystemBase
{
- public:
+public:
class MocapData : public XMLReadable
{
public:
MocapData() {}
virtual const char* GetXMLId() { return XMLID::GetXMLId(); }
-
+
+ virtual void copy(const MocapData* pdata) {
+ assert( pdata != NULL );
+ *this = *pdata;
+ }
+
string sid; ///< global id for the system id
int id;
- string tfframe; ///< if not empty, the tf frame this object is in
std::wstring strOffsetLink; ///< the link where the markers are attached (if any)
Transform transOffset,transPreOffset; // final offset = transOffset * transReturnedFromVision * transPreOffset
};
@@ -49,11 +53,10 @@
class BODY : public BODYBASE
{
public:
- BODY(KinBody* pbody, const MocapData& initdata) : BODYBASE()
+ BODY(KinBody* pbody) : BODYBASE()
{
assert( pbody != NULL );
- _initdata = initdata;
- pOffsetLink = pbody->GetLink(_initdata.strOffsetLink.c_str());
+ pOffsetLink = pbody->GetLink(_initdata->strOffsetLink.c_str());
if( pOffsetLink == NULL )
pOffsetLink = pbody->GetLinks().front();
@@ -67,21 +70,21 @@
virtual void* GetInitData(int* psize) { if( psize ) *psize = sizeof(_initdata); return &_initdata; }
ros::Time lastupdated;
- MocapData _initdata;
+ boost::shared_ptr<MocapData> _initdata;
private:
friend class SimpleSensorSystem<XMLID>;
};
- class MocapXMLReader : public BaseXMLReader
+ class SimpleXMLReader : public BaseXMLReader
{
public:
- MocapXMLReader(MocapData* pMocap, const char **atts) {
+ SimpleXMLReader(MocapData* pMocap, const char **atts) {
_pMocap = pMocap;
if( _pMocap == NULL )
_pMocap = new MocapData();
}
- virtual ~MocapXMLReader() { delete _pMocap; }
+ virtual ~SimpleXMLReader() { delete _pMocap; }
void* Release() { MocapData* temp = _pMocap; _pMocap = NULL; return temp; }
@@ -100,8 +103,6 @@
ss >> _pMocap->id;
else if( stricmp((const char*)name, "sid") == 0 )
ss >> _pMocap->sid;
- else if( stricmp((const char*)name, "tfframe") == 0 )
- ss >> _pMocap->tfframe;
else if( stricmp((const char*)name, "translation") == 0 )
ss >> _pMocap->transOffset.trans.x >> _pMocap->transOffset.trans.y >> _pMocap->transOffset.trans.z;
else if( stricmp((const char*)name, "rotationmat") == 0 ) {
@@ -134,7 +135,7 @@
RAVELOG_ERRORA("unknown field %s\n", name);
if( !ss )
- RAVELOG_ERRORA("MocapXMLReader error parsing %s\n", name);
+ RAVELOG_ERRORA("SimpleXMLReader error parsing %s\n", name);
return false;
}
@@ -162,7 +163,7 @@
static BaseXMLReader* CreateMocapReader(KinBody* parent, const char **atts)
{
- return new MocapXMLReader(NULL, atts);
+ return new SimpleXMLReader(NULL, atts);
}
SimpleSensorSystem(EnvironmentBase* penv) : SensorSystemBase(penv), _expirationtime(2,0)
@@ -221,7 +222,8 @@
return NULL;
}
- BODY* b = new BODY(pbody, *pdata);
+ BODY* b = CreateBODY(pbody);
+ b->_initdata->copy((const MocapData*)pdata);
_mapbodies[pbody->GetNetworkId()].reset(b);
RAVELOG_DEBUGA("system adding body %S, total: %d\n", pbody->GetName(), _mapbodies.size());
return b;
@@ -309,6 +311,12 @@
}
protected:
+ virtual BODY* CreateBODY(KinBody* pbody)
+ {
+ BODY* b = new BODY(pbody);
+ b->_initdata.reset(new MocapData());
+ return b;
+ }
typedef pair<boost::shared_ptr<BODY>, Transform > SNAPSHOT;
virtual void UpdateBodies(list<SNAPSHOT>& listbodies)
@@ -326,8 +334,8 @@
// transform with respect to offset link
TransformMatrix tlink = it->first->GetOffsetLink()->GetTransform();
TransformMatrix tbase = it->first->GetOffsetLink()->GetParent()->GetTransform();
- TransformMatrix toffset = tbase * tlink.inverse() * it->first->_initdata.transOffset;
- TransformMatrix tfinal = toffset * it->second*it->first->_initdata.transPreOffset;
+ TransformMatrix toffset = tbase * tlink.inverse() * it->first->_initdata->transOffset;
+ TransformMatrix tfinal = toffset * it->second*it->first->_initdata->transPreOffset;
it->first->GetOffsetLink()->GetParent()->SetTransform(tfinal);
it->first->lastupdated = curtime;
@@ -371,7 +379,7 @@
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE(SimpleSensorSystem::MocapData, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(SimpleSensorSystem::BODY, 1)
-BOOST_TYPEOF_REGISTER_TEMPLATE(SimpleSensorSystem::MocapXMLReader, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(SimpleSensorSystem::SimpleXMLReader, 1)
#endif
#endif
Modified: pkg/trunk/robot_descriptions/openrave_robot_description/src/urdf2openrave.cpp
===================================================================
--- pkg/trunk/robot_descriptions/openrave_robot_description/src/urdf2openrave.cpp 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/robot_descriptions/openrave_robot_description/src/urdf2openrave.cpp 2008-12-27 05:26:57 UTC (rev 8610)
@@ -166,7 +166,7 @@
stringstream ss;
s_listResourceNames.push_back(mesh->filename + "_hi.iv");
- s_listResourceNames.push_back(mesh->filename + "_low.iv");
+ //s_listResourceNames.push_back(mesh->filename + "_low.iv");
ss << mesh->filename << "_hi.iv " << mesh->scale[0];
addKeyValue(geom, "render", ss.str());
Modified: pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp
===================================================================
--- pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp 2008-12-27 05:26:57 UTC (rev 8610)
@@ -260,8 +260,8 @@
CHECKERBOARD& cb = vcheckers[itype];
CvSize& s = cb.griddims;
Transform tlocal;
- tlocal.trans = Vector(vobjects[i].pose.translation.x,vobjects[i].pose.translation.y,vobjects[i].pose.translation.z);
- tlocal.rot = Vector(vobjects[i].pose.rotation.w,vobjects[i].pose.rotation.x,vobjects[i].pose.rotation.y, vobjects[i].pose.rotation.z);
+ tlocal.trans = Vector(vobjects[i].pose.position.x,vobjects[i].pose.position.y,vobjects[i].pose.position.z);
+ tlocal.rot = Vector(vobjects[i].pose.orientation.w,vobjects[i].pose.orientation.x,vobjects[i].pose.orientation.y, vobjects[i].pose.orientation.z);
CvPoint X[4];
@@ -302,7 +302,7 @@
}
}
- std_msgs::Transform FindTransformation(const vector<CvPoint2D32f> &imgpts, const vector<Vector> &objpts)
+ std_msgs::Pose FindTransformation(const vector<CvPoint2D32f> &imgpts, const vector<Vector> &objpts)
{
CvMat *objpoints = cvCreateMat(3,objpts.size(),CV_32FC1);
for(size_t i=0; i<objpts.size(); ++i) {
@@ -311,11 +311,12 @@
cvSetReal2D(objpoints, 2,i, objpts[i].z);
}
- std_msgs::Transform pose;
+ std_msgs::Pose pose;
float fR3[3];
CvMat R3, T3;
+ assert(sizeof(pose.position.x) == sizeof(double));
cvInitMatHeader(&R3, 3, 1, CV_32FC1, fR3);
- cvInitMatHeader(&T3, 3, 1, CV_64FC1, &pose.translation.x);
+ cvInitMatHeader(&T3, 3, 1, CV_64FC1, &pose.position.x);
// for some reason distortion coeffs are needed
float kc[4] = {0};
@@ -330,17 +331,17 @@
double fang = sqrt(fR3[0]*fR3[0] + fR3[1]*fR3[1] + fR3[2]*fR3[2]);
if( fang < 1e-6 ) {
- pose.rotation.w = 1;
- pose.rotation.x = 0;
- pose.rotation.y = 0;
- pose.rotation.z = 0;
+ pose.orientation.w = 1;
+ pose.orientation.x = 0;
+ pose.orientation.y = 0;
+ pose.orientation.z = 0;
}
else {
double fmult = sin(fang/2)/fang;
- pose.rotation.w = cos(fang/2);
- pose.rotation.x = fR3[0]*fmult;
- pose.rotation.y = fR3[1]*fmult;
- pose.rotation.z = fR3[2]*fmult;
+ pose.orientation.w = cos(fang/2);
+ pose.orientation.x = fR3[0]*fmult;
+ pose.orientation.y = fR3[1]*fmult;
+ pose.orientation.z = fR3[2]*fmult;
}
return pose;
Modified: pkg/trunk/vision/checkerboard_detector/msg/Object6DPose.msg
===================================================================
--- pkg/trunk/vision/checkerboard_detector/msg/Object6DPose.msg 2008-12-27 04:15:32 UTC (rev 8609)
+++ pkg/trunk/vision/checkerboard_detector/msg/Object6DPose.msg 2008-12-27 05:26:57 UTC (rev 8610)
@@ -1,3 +1,3 @@
-std_msgs/Transform pose # 6D pose of object
+std_msgs/Pose pose # 6D pose of object
string type # type of object
int32 uid # unique id of the object
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rdi...@us...> - 2008-12-27 09:40:43
|
Revision: 8612
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8612&view=rev
Author: rdiankov
Date: 2008-12-27 09:40:39 +0000 (Sat, 27 Dec 2008)
Log Message:
-----------
added missing dependencies to pr2_alpha, fixed rosthread issue in robot_pose_ekf, checkerboard detector takes in tf frames
Modified Paths:
--------------
pkg/trunk/estimation/robot_pose_ekf/manifest.xml
pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml
pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml
pkg/trunk/robot_descriptions/pr2_alpha/prf.launch
pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp
Modified: pkg/trunk/estimation/robot_pose_ekf/manifest.xml
===================================================================
--- pkg/trunk/estimation/robot_pose_ekf/manifest.xml 2008-12-27 06:36:24 UTC (rev 8611)
+++ pkg/trunk/estimation/robot_pose_ekf/manifest.xml 2008-12-27 09:40:39 UTC (rev 8612)
@@ -7,4 +7,5 @@
<depend package="std_msgs" />
<depend package="robot_msgs" />
<depend package="tf" />
+<depend package="rosthread"/>
</package>
Modified: pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml 2008-12-27 06:36:24 UTC (rev 8611)
+++ pkg/trunk/openrave_planning/ormanipulation/startchecker.ros.xml 2008-12-27 09:40:39 UTC (rev 8612)
@@ -9,12 +9,13 @@
</node> -->
<group ns="checkerdetector" clear_params="true">
<param name="display" type="int" value="1"/>
+ <param name="frame_id" type="string" value="head_tilt_link"/>
<param name="rect0_size_x" type="double" value="0.02133"/>
<param name="rect0_size_y" type="double" value="0.021"/>
<param name="grid0_size_x" type="int" value="4"/>
<param name="grid0_size_y" type="int" value="3"/>
<param name="type0" type="string" value="data/ricebox.kinbody.xml"/>
- <node pkg="checkerboard_detector" type="checkerboard_detector" respawn="true" output="screen">
+ <node machine="localhost_cameras" pkg="checkerboard_detector" type="checkerboard_detector" respawn="true" output="screen">
<remap from="CamInfo" to="/dcam/left/cam_info"/>
<remap from="Image" to="/dcam/left/image_rect"/>
<!-- <env name="DISPLAY" value=":0.0"/> -->
Modified: pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml 2008-12-27 06:36:24 UTC (rev 8611)
+++ pkg/trunk/robot_descriptions/pr2_alpha/manifest.xml 2008-12-27 09:40:39 UTC (rev 8612)
@@ -19,6 +19,6 @@
<depend package="rosrecord"/>
<depend package="hokuyo_node"/>
<depend package="imu_node"/>
-
-
+ <depend package="dcam"/>
+ <depend package="robot_pose_ekf"/>
</package>
Modified: pkg/trunk/robot_descriptions/pr2_alpha/prf.launch
===================================================================
--- pkg/trunk/robot_descriptions/pr2_alpha/prf.launch 2008-12-27 06:36:24 UTC (rev 8611)
+++ pkg/trunk/robot_descriptions/pr2_alpha/prf.launch 2008-12-27 09:40:39 UTC (rev 8612)
@@ -63,14 +63,23 @@
-->
<!-- DCAM-->
-<!-- <node machine="three" name="dcam" pkg="dcam_node" type="dcam_node" respawn="false">
- <param name="video_mode" type="str" value="640x480_videre_none"/>
- <param name="do_rectify" type="bool" value="True"/>
- <param name="do_stereo" type="bool" value="True"/>
- <param name="do_calc_points" type="bool" value="False"/>
- </node> -->
+<node machine="three" name="dcam" pkg="dcam" type="dcam" respawn="false">
+ <!-- video_mode should be one of the following:
+ 640x480_videre_rectified: Provides rectified images from the hw
+ Provides: left mono image
+ 640x480_videre_disparity: Disparity and rectification done on chip.
+ Provides: Disparity and left mono image
+ 640x480_videre_disparity_raw: Disparity done on chip (debayer and rectification in software).
+ Provides: disparity and left color image.
+ 640x480_videre_none: No stereo on chip (all processing done in software).
+ Provides: all 3 images available
+ -->
+ <param name="video_mode" type="str" value="640x480_videre_rectified"/>
+ <param name="do_rectify" type="bool" value="False"/>
+ <param name="do_stereo" type="bool" value="False"/>
+ <param name="do_calc_points" type="bool" value="False"/>
+</node>
-
<!-- Runtime Diagnostics Logging -->
<node pkg="rosrecord" type="rosrecord" args="-f /hwlog/prf_runtime_automatic /diagnostics" />
Modified: pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp
===================================================================
--- pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp 2008-12-27 06:36:24 UTC (rev 8611)
+++ pkg/trunk/vision/checkerboard_detector/checkerboard_detector.cpp 2008-12-27 09:40:39 UTC (rev 8612)
@@ -58,6 +58,7 @@
image_msgs::Image _imagemsg;
checkerboard_detector::ObjectDetection _objdetmsg;
image_msgs::CvBridge _cvbridge;
+ string frame_id; // tf frame id
int display, uidnext;
vector<CHECKERBOARD> vcheckers; // grid points for every checkerboard
@@ -117,6 +118,8 @@
index++;
}
+ param("frame_id",frame_id,string(""));
+
if( maptypes.size() == 0 ) {
ROS_ERROR("no checkerboards to detect");
return;
@@ -245,6 +248,7 @@
}
_objdetmsg.set_objects_vec(vobjects);
+ _objdetmsg.header.frame_id = frame_id;
publish("ObjectDetection", _objdetmsg);
ROS_INFO("checkerboard: image: %dx%d (size=%d), num: %d, total: %.3fs",_caminfomsg.width,_caminfomsg.height,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hsu...@us...> - 2008-12-29 19:15:43
|
Revision: 8636
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8636&view=rev
Author: hsujohnhsu
Date: 2008-12-29 19:15:38 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
removing _hi suffixes from stl files now that we are using convex decomposition to create coarser mesh.
Modified Paths:
--------------
pkg/trunk/drivers/simulator/gazebo_plugin/src/urdf2factory.cpp
pkg/trunk/robot_descriptions/gazebo_robot_description/src/urdf2gazebo.cpp
Added Paths:
-----------
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/base.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/caster.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/elbow_flex.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_l.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_r.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/forearm_roll.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_pan.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_tilt.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/hok_tilt.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_l.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_r.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_l.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_r.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_top.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_lift.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_yaw.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/torso.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_l.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_r.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upperarm_roll.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wheel.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_flex.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_roll.stl
Removed Paths:
-------------
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/base_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/caster_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/elbow_flex_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_l_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_r_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/forearm_roll_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_pan_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_tilt_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/hok_tilt_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_l_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_r_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_l_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_r_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_top_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_lift_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_yaw_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/torso_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_l_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_r_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upperarm_roll_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wheel_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_flex_hi.stl
pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_roll_hi.stl
Modified: pkg/trunk/drivers/simulator/gazebo_plugin/src/urdf2factory.cpp
===================================================================
--- pkg/trunk/drivers/simulator/gazebo_plugin/src/urdf2factory.cpp 2008-12-29 19:02:58 UTC (rev 8635)
+++ pkg/trunk/drivers/simulator/gazebo_plugin/src/urdf2factory.cpp 2008-12-29 19:15:38 UTC (rev 8636)
@@ -248,7 +248,7 @@
if (mesh->filename.empty())
addKeyValue(visual, "mesh", "unit_" + type);
else
- addKeyValue(visual, "mesh", "models/pr2/" + mesh->filename + "_hi.mesh");
+ addKeyValue(visual, "mesh", "models/pr2/" + mesh->filename + ".mesh");
}
else
Modified: pkg/trunk/robot_descriptions/gazebo_robot_description/src/urdf2gazebo.cpp
===================================================================
--- pkg/trunk/robot_descriptions/gazebo_robot_description/src/urdf2gazebo.cpp 2008-12-29 19:02:58 UTC (rev 8635)
+++ pkg/trunk/robot_descriptions/gazebo_robot_description/src/urdf2gazebo.cpp 2008-12-29 19:15:38 UTC (rev 8636)
@@ -242,7 +242,7 @@
if (mesh->filename.empty())
addKeyValue(visual, "mesh", "unit_" + type);
else
- addKeyValue(visual, "mesh", "models/pr2/" + mesh->filename + "_hi.mesh");
+ addKeyValue(visual, "mesh", "models/pr2/" + mesh->filename + ".mesh");
}
else
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/base.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/base_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/base_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/caster.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/caster_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/caster_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/elbow_flex.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/elbow_flex_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/elbow_flex_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_l.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_l_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_l_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_r.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_r_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/finger_tip_r_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/forearm_roll.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/forearm_roll_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/forearm_roll_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_pan.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_pan_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_pan_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_tilt.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_tilt_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/head_tilt_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/hok_tilt.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/hok_tilt_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/hok_tilt_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_l.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_l_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_l_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_r.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_r_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_base_r_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_l.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_l_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_l_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_r.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_r_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_r_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_top.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_top_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/ptz_top_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_lift.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_lift_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_lift_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_yaw.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_yaw_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/shoulder_yaw_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/torso.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/torso_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/torso_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_l.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_l_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_l_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_r.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_r_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upper_finger_r_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upperarm_roll.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upperarm_roll_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/upperarm_roll_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wheel.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wheel_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wheel_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_flex.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_flex_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_flex_hi.stl
===================================================================
(Binary files differ)
Copied: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_roll.stl (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_roll_hi.stl)
===================================================================
(Binary files differ)
Deleted: pkg/trunk/robot_descriptions/wg_robot_description/models/pr2/wrist_roll_hi.stl
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hsu...@us...> - 2008-12-29 20:55:23
|
Revision: 8642
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8642&view=rev
Author: hsujohnhsu
Date: 2008-12-29 20:55:18 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
move ivcon to it's own separate package in 3rdparty.
Modified Paths:
--------------
pkg/trunk/robot_descriptions/wg_robot_description/CMakeLists.txt
pkg/trunk/robot_descriptions/wg_robot_description/manifest.xml
Added Paths:
-----------
pkg/trunk/3rdparty/ivcon/
pkg/trunk/3rdparty/ivcon/CMakeLists.txt
pkg/trunk/3rdparty/ivcon/Makefile
pkg/trunk/3rdparty/ivcon/manifest.xml
pkg/trunk/3rdparty/ivcon/src/
pkg/trunk/3rdparty/ivcon/src/ivcon.c
Removed Paths:
-------------
pkg/trunk/robot_descriptions/wg_robot_description/src/ivcon.c
Added: pkg/trunk/3rdparty/ivcon/CMakeLists.txt
===================================================================
--- pkg/trunk/3rdparty/ivcon/CMakeLists.txt (rev 0)
+++ pkg/trunk/3rdparty/ivcon/CMakeLists.txt 2008-12-29 20:55:18 UTC (rev 8642)
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 2.6)
+include(rosbuild)
+rospack(ivcon)
+
+#uncomment for profiling
+set(ROS_LINK_FLAGS "-lm" ${ROS_LINK_FLAGS})
+
+rospack_add_executable(bin/ivcon src/ivcon.c)
+
Added: pkg/trunk/3rdparty/ivcon/Makefile
===================================================================
--- pkg/trunk/3rdparty/ivcon/Makefile (rev 0)
+++ pkg/trunk/3rdparty/ivcon/Makefile 2008-12-29 20:55:18 UTC (rev 8642)
@@ -0,0 +1 @@
+include $(shell rospack find mk)/cmake.mk
Added: pkg/trunk/3rdparty/ivcon/manifest.xml
===================================================================
--- pkg/trunk/3rdparty/ivcon/manifest.xml (rev 0)
+++ pkg/trunk/3rdparty/ivcon/manifest.xml 2008-12-29 20:55:18 UTC (rev 8642)
@@ -0,0 +1,14 @@
+<package>
+<description brief="Mesh Conversion Utility">
+
+Mesh Conversion Utility
+
+</description>
+<author>John Burkardt</author>
+<license>GPL</license>
+<review status="3rdparty" notes=""/>
+<url>https://sourceforge.net/projects/ivcon/</url>
+<export>
+ <cpp lflags="" cflags=""/>
+</export>
+</package>
Copied: pkg/trunk/3rdparty/ivcon/src/ivcon.c (from rev 8634, pkg/trunk/robot_descriptions/wg_robot_description/src/ivcon.c)
===================================================================
--- pkg/trunk/3rdparty/ivcon/src/ivcon.c (rev 0)
+++ pkg/trunk/3rdparty/ivcon/src/ivcon.c 2008-12-29 20:55:18 UTC (rev 8642)
@@ -0,0 +1,16707 @@
+/* ivcon.c 24 May 2001 */
+
+/*
+ Purpose:
+
+ IVCON converts various 3D graphics files.
+
+ Acknowledgements:
+
+ Coding, comments, and advice were supplied by a number of collaborators.
+
+ John F Flanagan made some corrections to the 3D Studio Max routines.
+
+ Zik Saleeba (zi...@zi...) enhanced the DXF routines, and added the
+ Golgotha GMOD routines.
+
+ Thanks to Susan M. Fisher, University of North Carolina,
+ Department of Computer Science, for pointing out a coding error
+ in FACE_NULL_DELETE that was overwriting all the data!
+
+ Modified:
+
+ 04 July 2000
+
+ Author:
+
+ John Burkardt
+*/
+
+#include <ctype.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define FALSE 0
+#define TRUE 1
+
+#define ERROR 1
+#define G1_SECTION_MODEL_QUADS 18
+#define G1_SECTION_MODEL_TEXTURE_NAMES 19
+#define G1_SECTION_MODEL_VERT_ANIMATION 20
+#define GMOD_MAX_SECTIONS 32
+#define GMOD_UNUSED_VERTEX 65535
+#define PI 3.141592653589793238462643
+#define SUCCESS 0
+
+#define DEG_TO_RAD ( PI / 180.0 )
+#define RAD_TO_DEG ( 180.0 / PI )
+
+/******************************************************************************/
+
+/* GLOBAL DATA */
+
+/******************************************************************************/
+
+/*
+ BACKGROUND_RGB[3], the background color.
+
+ BYTE_SWAP, byte swapping option.
+
+ COR3[3][COR3_MAX], the coordinates of nodes.
+
+ COR3_MATERIAL[COR3_MAX], the index of the material of each node.
+
+ COR3_MAX, the maximum number of points.
+
+ COR3_NORMAL[3][COR3_MAX], normal vectors associated with nodes.
+
+ COR3_NUM, the number of points.
+
+ COR3_RGB[3][COR3_MAX], RGB colors associated with nodes.
+
+ COR3_TEX_UV[2][COR3_MAX], texture coordinates associated with nodes.
+
+ FACE[ORDER_MAX][FACE_MAX] contains the index of the I-th node making up face J.
+
+ FACE_AREA(FACE_MAX), the area of each face.
+
+ FACE_MATERIAL[FACE_MAX]; the material of each face.
+
+ FACE_MAX, the maximum number of faces.
+
+ FACE_NORMAL[3][FACE_MAX], the face normal vectors.
+
+ FACE_NUM, the number of faces.
+
+ FACE_ORDER[FACE_MAX], the number of vertices per face.
+
+ FACE_TEX_UV[2][FACE_MAX], texture coordinates associated with faces.
+
+ LINE_DEX[LINES_MAX], node indices, denoting polylines, each terminated by -1.
+
+ LINE_MATERIAL[LINES_MAX], index into RGBCOLOR for line color.
+
+ LINES_MAX, the maximum number of line definition items.
+
+ LINE_NUM, the number of line definition items.
+
+ LINE_PRUNE, pruning option ( 0 = no pruning, nonzero = pruning).
+
+ MATERIAL_MAX, the maximum number of materials.
+
+ MATERIAL_NUM, the number of materials.
+
+ ORDER_MAX, the maximum number of vertices per face.
+
+ TEXTURE_MAX, the maximum number of textures.
+
+ TEXTURE_NAME[TEXTURE_MAX][LINE_MAX_LEN], ...
+
+ TEXTURE_NUM, the number of textures.
+
+ TRANSFORM_MATRIX[4][4], the current transformation matrix.
+
+ VERTEX_MATERIAL[ORDER_MAX][FACE_MAX]; the material of vertices of faces.
+
+ VERTEX_NORMAL[3][ORDER_MAX][FACE_MAX], normals at vertices of faces.
+
+ VERTEX_RGB[3][ORDER_MAX][FACE_MAX], colors of vertices of faces.
+
+ VERTEX_TEX_UV[2][ORDER_MAX][FACE_MAX], texture coordinates of vertices of faces.
+*/
+
+#define COLOR_MAX 1000
+#define COR3_MAX 200000
+#define FACE_MAX 200000
+#define LINE_MAX_LEN 256
+#define LEVEL_MAX 10
+#define LINES_MAX 100000
+#define MATERIAL_MAX 100
+#define ORDER_MAX 10
+#define TEXTURE_MAX 100
+
+char anim_name[LINE_MAX_LEN];
+float background_rgb[3];
+int bad_num;
+int byte_swap;
+int bytes_num;
+int color_num;
+int comment_num;
+
+float cor3[3][COR3_MAX];
+int cor3_material[COR3_MAX];
+float cor3_normal[3][COR3_MAX];
+int cor3_num;
+float cor3_tex_uv[3][COR3_MAX];
+
+int debug;
+
+int dup_num;
+
+int face[ORDER_MAX][FACE_MAX];
+float face_area[FACE_MAX];
+int face_flags[FACE_MAX];
+int face_material[FACE_MAX];
+float face_normal[3][FACE_MAX];
+int face_num;
+int face_object[FACE_MAX];
+int face_order[FACE_MAX];
+int face_smooth[FACE_MAX];
+float face_tex_uv[2][FACE_MAX];
+
+char filein_name[1024];
+char fileout_name[1024];
+
+int group_num;
+
+int i;
+char input[LINE_MAX_LEN];
+int k;
+char level_name[LEVEL_MAX][LINE_MAX_LEN];
+
+int line_dex[LINES_MAX];
+int line_material[LINES_MAX];
+int line_num;
+int line_prune;
+
+int list[COR3_MAX];
+
+char material_binding[80];
+char material_name[MATERIAL_MAX][LINE_MAX_LEN];
+int material_num;
+float material_rgba[4][MATERIAL_MAX];
+
+char mat_name[81];
+int max_order2;
+
+char normal_binding[80];
+float normal_temp[3][ORDER_MAX*FACE_MAX];
+
+char object_name[81];
+int object_num;
+
+float origin[3];
+float pivot[3];
+float rgbcolor[3][COLOR_MAX];
+char temp_name[81];
+
+int text_num;
+
+char texture_binding[80];
+char texture_name[TEXTURE_MAX][LINE_MAX_LEN];
+int texture_num;
+float texture_temp[2][ORDER_MAX*FACE_MAX];
+
+float transform_matrix[4][4];
+
+int vertex_material[ORDER_MAX][FACE_MAX];
+float vertex_normal[3][ORDER_MAX][FACE_MAX];
+float vertex_rgb[3][ORDER_MAX][FACE_MAX];
+float vertex_tex_uv[2][ORDER_MAX][FACE_MAX];
+
+/******************************************************************************/
+
+/* FUNCTION PROTOTYPES */
+
+/******************************************************************************/
+
+int main ( int argc, char **argv );
+int ase_read ( FILE *filein );
+int ase_write ( FILE *fileout );
+int byu_read ( FILE *filein );
+int byu_write ( FILE *fileout );
+int char_index_last ( char* string, char c );
+int char_pad ( int *char_index, int *null_index, char *string,
+ int STRING_MAX );
+char char_read ( FILE *filein );
+int char_write ( FILE *fileout, char c );
+int command_line ( char **argv );
+void cor3_normal_set ( void );
+void cor3_range ( void );
+void data_check ( void );
+void data_init ( void );
+int data_read ( void );
+void data_report ( void );
+int data_write ( void );
+int dxf_read ( FILE *filein );
+int dxf_write ( FILE *fileout );
+void edge_null_delete ( void );
+void face_area_set ( void );
+void face_normal_ave ( void );
+void face_null_delete ( void );
+int face_print ( int iface );
+void face_reverse_order ( void );
+int face_subset ( void );
+void face_to_line ( void );
+void face_to_vertex_material ( void );
+char *file_ext ( char *file_name );
+float float_read ( FILE *filein );
+float float_reverse_bytes ( float x );
+int float_write ( FILE *fileout, float float_val );
+int gmod_arch_check ( void );
+int gmod_read ( FILE *filein );
+float gmod_read_float ( FILE *filein );
+unsigned short gmod_read_w16 ( FILE *filein );
+unsigned long gmod_read_w32 ( FILE *filein );
+int gmod_write ( FILE *fileout );
+void gmod_write_float ( float Val, FILE *fileout );
+void gmod_write_w16 ( unsigned short Val, FILE *fileout );
+void gmod_write_w32 ( unsigned long Val, FILE *fileout );
+void hello ( void );
+void help ( void );
+int hrc_read ( FILE *filein );
+int hrc_write ( FILE *fileout );
+void init_program_data ( void );
+int interact ( void );
+int iv_read ( FILE *filein );
+int iv_write ( FILE *fileout );
+int ivec_max ( int n, int *a );
+int leqi ( char* string1, char* string2 );
+long int long_int_read ( FILE *filein );
+int long_int_write ( FILE *fileout, long int int_val );
+void news ( void );
+void node_to_vertex_material ( void );
+int obj_read ( FILE *filein );
+int obj_write ( FILE *fileout );
+int pov_write ( FILE *fileout );
+int rcol_find ( float a[][COR3_MAX], int m, int n, float r[] );
+float rgb_to_hue ( float r, float g, float b );
+short int short_int_read ( FILE *filein );
+int short_int_write ( FILE *fileout, short int int_val );
+int smf_read ( FILE *filein );
+int smf_write ( FILE *fileout );
+int stla_read ( FILE *filein );
+int stla_write ( FILE *fileout );
+int stlb_read ( FILE *filein );
+int stlb_write ( FILE *fileout );
+void tds_pre_process ( void );
+int tds_read ( FILE *filein );
+unsigned long int tds_read_ambient_section ( FILE *filein );
+unsigned long int tds_read_background_section ( FILE *filein );
+unsigned long int tds_read_boolean ( unsigned char *boolean, FILE *filein );
+unsigned long int tds_read_camera_section ( FILE *filein );
+unsigned long int tds_read_edit_section ( FILE *filein, int *views_read );
+unsigned long int tds_read_keyframe_section ( FILE *filein, int *views_read );
+unsigned long int tds_read_keyframe_objdes_section ( FILE *filein );
+unsigned long int tds_read_light_section ( FILE *filein );
+unsigned long int tds_read_u_long_int ( FILE *filein );
+int tds_read_long_name ( FILE *filein );
+unsigned long int tds_read_matdef_section ( FILE *filein );
+unsigned long int tds_read_material_section ( FILE *filein );
+int tds_read_name ( FILE *filein );
+unsigned long int tds_read_obj_section ( FILE *filein );
+unsigned long int tds_read_object_section ( FILE *filein );
+unsigned long int tds_read_tex_verts_section ( FILE *filein );
+unsigned long int tds_read_texmap_section ( FILE *filein );
+unsigned short int tds_read_u_short_int ( FILE *filein );
+unsigned long int tds_read_spot_section ( FILE *filein );
+unsigned long int tds_read_unknown_section ( FILE *filein );
+unsigned long int tds_read_view_section ( FILE *filein, int *views_read );
+unsigned long int tds_read_vp_section ( FILE *filein, int *views_read );
+int tds_write ( FILE *fileout );
+int tds_write_string ( FILE *fileout, char *string );
+int tds_write_u_short_int ( FILE *fileout,
+ unsigned short int int_val );
+int tec_write ( FILE *fileout );
+void tmat_init ( float a[4][4] );
+void tmat_mxm ( float a[4][4], float b[4][4], float c[4][4] );
+void tmat_mxp ( float a[4][4], float x[4], float y[4] );
+void tmat_mxp2 ( float a[4][4], float x[][3], float y[][3], int n );
+void tmat_mxv ( float a[4][4], float x[4], float y[4] );
+void tmat_rot_axis ( float a[4][4], float b[4][4], float angle,
+ char axis );
+void tmat_rot_vector ( float a[4][4], float b[4][4], float angle,
+ float v1, float v2, float v3 );
+void tmat_scale ( float a[4][4], float b[4][4], float sx, float sy,
+ float sz );
+void tmat_shear ( float a[4][4], float b[4][4], char *axis,
+ float s );
+void tmat_trans ( float a[4][4], float b[4][4], float x, float y,
+ float z );
+int tria_read ( FILE *filein );
+int tria_write ( FILE *fileout );
+int trib_read ( FILE *filein );
+int trib_write ( FILE *fileout );
+int txt_write ( FILE *fileout );
+int ucd_write ( FILE *fileout );
+void vertex_normal_set ( void );
+void vertex_to_face_material ( void );
+void vertex_to_node_material ( void );
+int vla_read ( FILE *filein );
+int vla_write ( FILE *fileout );
+int wrl_write ( FILE *filout );
+int xgl_write ( FILE *fileout );
+
+/******************************************************************************/
+
+int main ( int argc, char **argv )
+
+/******************************************************************************/
+
+/*
+ Purpose:
+
+ MAIN is the main program for converting graphics files.
+
+ Modified:
+
+ 26 May 1999
+
+ Author:
+
+ John Burkardt
+*/
+{
+ int result;
+/*
+ Initialize the program data.
+*/
+ init_program_data ( );
+/*
+ If there are at least two command line arguments, call COMMAND_LINE.
+ Otherwise call INTERACT and get information from the user.
+*/
+ if ( argc >= 2 ) {
+ result = command_line ( argv );
+ }
+ else {
+ result = interact ( );
+ }
+
+ return result;
+}
+/******************************************************************************/
+
+int ase_read ( FILE *filein )
+
+/******************************************************************************/
+
+/*
+ Purpose:
+
+ ASE_READ reads an AutoCAD ASE file.
+
+ Modified:
+
+ 22 May 1999
+
+ Author:
+
+ John Burkardt
+*/
+{
+ float bval;
+ int count;
+ float gval;
+ int i;
+ int iface;
+ int ivert;
+ int iword;
+ int level;
+ char *next;
+ int nlbrack;
+ int nrbrack;
+ int cor3_num_old;
+ int face_num_old;
+ float rval;
+ float temp;
+ int width;
+ char word[LINE_MAX_LEN];
+ char word1[LINE_MAX_LEN];
+ char word2[LINE_MAX_LEN];
+ char wordm1[LINE_MAX_LEN];
+ float x;
+ float y;
+ float z;
+
+ level = 0;
+ strcpy ( level_name[0], "Top" );
+ cor3_num_old = cor3_num;
+ face_num_old = face_num;
+ nlbrack = 0;
+ nrbrack = 0;
+
+ strcpy ( word, " " );
+ strcpy ( wordm1, " " );
+/*
+ Read a line of text from the file.
+*/
+
+ for ( ;; ) {
+
+ if ( fgets ( input, LINE_MAX_LEN, filein ) == NULL ) {
+ break;
+ }
+
+ text_num = text_num + 1;
+ next = input;
+ iword = 0;
+/*
+ Read the next word from the line.
+*/
+ for ( ;; ) {
+
+ strcpy ( wordm1, word );
+ strcpy ( word, " " );
+
+ count = sscanf ( next, "%s%n", word, &width );
+ next = next + width;
+
+ if ( count <= 0 ) {
+ break;
+ }
+
+ iword = iword + 1;
+
+ if ( iword == 1 ) {
+ strcpy ( word1, word );
+ }
+/*
+ In case the new word is a bracket, update the bracket count.
+*/
+ if ( strcmp ( word, "{" ) == 0 ) {
+
+ nlbrack = nlbrack + 1;
+ level = nlbrack - nrbrack;
+ strcpy ( level_name[level], wordm1 );
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+
+ nrbrack = nrbrack + 1;
+
+ if ( nlbrack < nrbrack ) {
+
+ printf ( "\n" );
+ printf ( "ASE_READ - Fatal error!\n" );
+ printf ( " Extraneous right bracket on line %d\n", text_num );
+ printf ( " Currently processing field:\n" );
+ printf ( "%s\n", level_name[level] );
+ return ERROR;
+ }
+
+ }
+/*
+ *3DSMAX_ASCIIEXPORT 200
+*/
+ if ( strcmp ( word1, "*3DSMAX_ASCIIEXPORT" ) == 0 ) {
+ break;
+ }
+/*
+ *COMMENT
+*/
+ else if ( strcmp ( word1, "*COMMENT" ) == 0 ) {
+ break;
+ }
+/*
+ *GEOMOBJECT
+*/
+ else if ( strcmp ( level_name[level], "*GEOMOBJECT" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+/*
+ Why don't you read and save this name?
+*/
+ else if ( strcmp ( word, "*NODE_NAME" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*NODE_TM" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*PROP_CASTSHADOW" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*PROP_MOTIONBLUR" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*PROP_RECVSHADOW" ) == 0 ) {
+ break;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in GEOMOBJECT, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *MESH
+*/
+ else if ( strcmp ( level_name[level], "*MESH" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_CFACELIST" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_CVERTLIST" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_FACE_LIST" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_NORMALS" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_NUMCVERTEX" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*MESH_NUMCVFACES" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*MESH_NUMFACES" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*MESH_NUMTVERTEX" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*MESH_NUMTVFACES" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*MESH_NUMVERTEX" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*MESH_TFACELIST" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_TVERTLIST" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_VERTEX_LIST" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "*TIMEVALUE" ) == 0 ) {
+ break;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in MESH, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *MESH_CFACELIST
+*/
+ else if ( strcmp ( level_name[level], "*MESH_CFACELIST" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_CFACE" ) == 0 ) {
+ break;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in MESH_CFACE, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *MESH_CVERTLIST
+
+ Mesh vertex indices must be incremented by COR3_NUM_OLD before being stored
+ in the internal array.
+*/
+ else if ( strcmp ( level_name[level], "*MESH_CVERTLIST" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_VERTCOL" ) == 0 ) {
+
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+
+ i = i + cor3_num_old;
+
+ count = sscanf ( next, "%f%n", &rval, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &gval, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &bval, &width );
+ next = next + width;
+
+ if ( material_num < MATERIAL_MAX ) {
+ material_rgba[0][material_num] = rval;
+ material_rgba[1][material_num] = gval;
+ material_rgba[2][material_num] = bval;
+ material_rgba[3][material_num] = 1.0;
+ }
+
+ material_num = material_num + 1;
+ cor3_material[i] = material_num;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "\n" );
+ printf ( "ASE_READ - Warning!\n" );
+ printf ( " Bad data in MESH_CVERTLIST, line %d\n", text_num );
+ break;
+ }
+
+ }
+/*
+ *MESH_FACE_LIST
+ This coding assumes a face is always triangular or quadrilateral.
+*/
+ else if ( strcmp ( level_name[level], "*MESH_FACE_LIST" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_FACE" ) == 0 ) {
+
+ if ( face_num < FACE_MAX ) {
+
+ face_material[face_num] = 0;
+ face_order[face_num] = 0;
+
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%s%n", word2, &width );
+ next = next + width;
+ count = sscanf ( next, "%s%n", word2, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+ face[0][face_num] = i + cor3_num_old;
+ face_order[face_num] = face_order[face_num] + 1;
+
+ count = sscanf ( next, "%s%n", word2, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+ face[1][face_num] = i + cor3_num_old;
+ face_order[face_num] = face_order[face_num] + 1;
+
+ count = sscanf ( next, "%s%n", word2, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+ face[2][face_num] = i + cor3_num_old;
+ face_order[face_num] = face_order[face_num] + 1;
+
+ count = sscanf ( next, "%s%n", word2, &width );
+ next = next + width;
+
+ if ( strcmp ( word2, "D:" ) == 0 ) {
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+ face[3][face_num] = i + cor3_num_old;
+ face_order[face_num] = face_order[face_num] + 1;
+ }
+ }
+
+ face_num = face_num + 1;
+
+ break;
+
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in MESH_FACE_LIST, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *MESH_NORMALS
+*/
+ else if ( strcmp ( level_name[level], "*MESH_NORMALS" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word, "*MESH_FACENORMAL" ) == 0 ) {
+
+ count = sscanf ( next, "%d%n", &iface, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &x, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &y, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &z, &width );
+ next = next + width;
+
+ iface = iface + face_num_old;
+ ivert = 0;
+
+ face_normal[0][iface] = x;
+ face_normal[1][iface] = y;
+ face_normal[2][iface] = z;
+
+ break;
+
+ }
+ else if ( strcmp ( word, "*MESH_VERTEXNORMAL" ) == 0 ) {
+
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &x, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &y, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &z, &width );
+ next = next + width;
+
+ vertex_normal[0][ivert][iface] = x;
+ vertex_normal[1][ivert][iface] = y;
+ vertex_normal[2][ivert][iface] = z;
+ ivert = ivert + 1;
+
+ break;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in MESH_NORMALS, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *MESH_TFACELIST
+*/
+ else if ( strcmp ( level_name[level], "*MESH_TFACELIST" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word1, "*MESH_TFACE" ) == 0 ) {
+ break;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in MESH_TFACE_LIST, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *MESH_TVERTLIST
+*/
+ else if ( strcmp ( level_name[level], "*MESH_TVERTLIST" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word1, "*MESH_TVERT" ) == 0 ) {
+ break;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in MESH_TVERTLIST, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *MESH_VERTEX_LIST
+*/
+ else if ( strcmp ( level_name[level], "*MESH_VERTEX_LIST" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+ cor3_num_old = cor3_num;
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word1, "*MESH_VERTEX" ) == 0 ) {
+
+ count = sscanf ( next, "%d%n", &i, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &x, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &y, &width );
+ next = next + width;
+
+ count = sscanf ( next, "%f%n", &z, &width );
+ next = next + width;
+
+ i = i + cor3_num_old;
+ if ( cor3_num < i + 1 ) {
+ cor3_num = i + 1;
+ }
+
+ if ( i < COR3_MAX ) {
+
+ cor3[0][i] =
+ transform_matrix[0][0] * x
+ + transform_matrix[0][1] * y
+ + transform_matrix[0][2] * z
+ + transform_matrix[0][3];
+
+ cor3[1][i] =
+ transform_matrix[1][0] * x
+ + transform_matrix[1][1] * y
+ + transform_matrix[1][2] * z
+ + transform_matrix[1][3];
+
+ cor3[2][i] =
+ transform_matrix[2][0] * x
+ + transform_matrix[2][1] * y
+ + transform_matrix[2][2] * z
+ + transform_matrix[2][3];
+ }
+
+ break;
+ }
+ else {
+ bad_num = bad_num + 1;
+ printf ( "Bad data in MESH_VERTEX_LIST, line %d\n", text_num );
+ break;
+ }
+ }
+/*
+ *NODE_TM
+
+ Each node should start out with a default transformation matrix.
+*/
+ else if ( strcmp ( level_name[level], "*NODE_TM" ) == 0 ) {
+
+ if ( strcmp ( word, "{" ) == 0 ) {
+
+ tmat_init ( transform_matrix );
+
+ continue;
+ }
+ else if ( strcmp ( word, "}" ) == 0 ) {
+ level = nlbrack - nrbrack;
+ continue;
+ }
+ else if ( strcmp ( word, "*INHERIT_POS" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*INHERIT_ROT" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*INHERIT_SCL" ) == 0 ) {
+ break;
+ }
+ else if ( strcmp ( word, "*NODE_NAME" ) == 0 ) {
+ break;
+ }
+ e...
[truncated message content] |
|
From: <vij...@us...> - 2008-12-30 22:15:30
|
Revision: 8707
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8707&view=rev
Author: vijaypradeep
Date: 2008-12-30 22:15:21 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
Refactored and added tests for point_cloud_assembler package. Still need to add diagnostics
Small bugfixes
Modified Paths:
--------------
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/manifest.xml
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/grab_cloud_data.cpp
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_assembler_srv.cpp
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/point_cloud_snapshotter.cpp
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/srv/BuildCloud.srv
pkg/trunk/robot_descriptions/wg_robot_description/tilt_laser_deprecated/build_snapshots.launch
Added Paths:
-----------
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/include/
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/include/point_cloud_assembler/
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/include/point_cloud_assembler/base_assembler_srv.h
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/mainpage.dox
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/test/
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/test/test_assembler.bag
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/test/test_assembler.cpp
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/test/test_cloud_assembler.launch
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/test/test_laser_assembler.launch
Removed Paths:
-------------
pkg/trunk/drivers/robot/pr2/point_cloud_assembler/launch_assembler.xml
Modified: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt 2008-12-30 22:10:46 UTC (rev 8706)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/CMakeLists.txt 2008-12-30 22:15:21 UTC (rev 8707)
@@ -8,3 +8,10 @@
rospack_add_executable(grab_cloud_data src/grab_cloud_data.cpp)
rospack_add_executable(point_cloud_snapshotter src/point_cloud_snapshotter.cpp)
+rospack_add_executable(../test/bin/test_assembler
+ test/test_assembler.cpp)
+
+rospack_add_rostest(${CMAKE_CURRENT_SOURCE_DIR}/test/test_laser_assembler.launch)
+rospack_add_rostest(${CMAKE_CURRENT_SOURCE_DIR}/test/test_cloud_assembler.launch)
+
+set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
\ No newline at end of file
Added: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/include/point_cloud_assembler/base_assembler_srv.h
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/include/point_cloud_assembler/base_assembler_srv.h (rev 0)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/include/point_cloud_assembler/base_assembler_srv.h 2008-12-30 22:15:21 UTC (rev 8707)
@@ -0,0 +1,265 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+* Copyright (c) 2008, Willow Garage, Inc.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of the Willow Garage nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+
+#include "ros/node.h"
+#include "tf/transform_listener.h"
+#include "tf/message_notifier.h"
+#include "std_msgs/PointCloud.h"
+
+#include <deque>
+
+// Service
+#include "point_cloud_assembler/BuildCloud.h"
+
+#include "rosthread/mutex.h"
+#include "math.h"
+
+namespace point_cloud_assembler
+{
+
+/**
+ * \brief Maintains a history of point clouds and generates an aggregate point cloud upon request
+ * \todo Clean up the doxygen part of this header
+ *
+ * @section parameters ROS Parameters
+ *
+ * Reads the following parameters from the parameter server
+ * - \b "~tf_cache_time_secs" (double) - The cache time (in seconds) to holds past transforms
+ * - \b "~max_scans" (unsigned int) - The number of scans to store in the assembler's history, until they're thrown away
+ * - \b "~fixed_frame" (string) - The frame to which received data should immeadiately be transformed to
+ *
+ * @section services ROS Service Calls
+ * - \b "~build_cloud" (BuildCloud.srv) - Accumulates scans between begin time and
+ * end time and returns the aggregated data as a point cloud
+ */
+template<class T>
+class BaseAssemblerSrv : public ros::node
+{
+public:
+ BaseAssemblerSrv(const std::string& node_name) ;
+ ~BaseAssemblerSrv() ;
+
+ /** \brief Returns the number of points in the current scan
+ * \param scan The scan for for which we want to know the number of points
+ * \return the number of points in scan
+ */
+ virtual unsigned int GetPointsInScan(const T& scan) = 0 ;
+
+ /** \brief Converts the current scan into a cloud in the specified fixed frame
+ *
+ * Note: Once implemented, ConvertToCloud should NOT catch TF exceptions. These exceptions are caught by
+ * BaseAssemblerSrv, and will be counted for diagnostic information
+ * \param fixed_frame_id The name of the frame in which we want cloud_out to be in
+ * \param scan_in The scan that we want to convert
+ * \param cloud_out The result of transforming scan_in into a cloud in frame fixed_frame_id
+ */
+ virtual void ConvertToCloud(const std::string& fixed_frame_id, const T& scan_in, std_msgs::PointCloud& cloud_out) = 0 ;
+
+protected:
+ tf::TransformListener* tf_ ;
+
+private:
+ //! \brief Callback function for every time we receive a new scan
+ //void scansCallback(const tf::MessageNotifier<T>::MessagePtr& scan_ptr, const T& testA)
+ void scansCallback(const boost::shared_ptr<T>& scan_ptr) ;
+
+ //! \brief Service Callback function called whenever we need to build a cloud
+ bool buildCloud(BuildCloud::request& req, BuildCloud::response& resp) ;
+
+ tf::MessageNotifier<T>* scan_notifier_ ;
+
+ //! \brief Stores history of scans
+ std::deque<std_msgs::PointCloud> scan_hist_ ;
+ ros::thread::mutex scan_hist_mutex_ ;
+
+ //! \brief The number points currently in the scan history
+ unsigned int total_pts_ ;
+
+ //! \brief The max number of scans to store in the scan history
+ unsigned int max_scans_ ;
+
+ //! \brief The frame to transform data into upon receipt
+ std::string fixed_frame_ ;
+
+} ;
+
+template <class T>
+BaseAssemblerSrv<T>::BaseAssemblerSrv(const std::string& node_name) : ros::node(node_name)
+{
+ // **** Initialize TransformListener ****
+ double tf_cache_time_secs ;
+ param("~tf_cache_time_secs", tf_cache_time_secs, 10.0) ;
+ if (tf_cache_time_secs < 0)
+ ROS_ERROR("Parameter tf_cache_time_secs<0 (%f)", tf_cache_time_secs) ;
+ unsigned long long tf_cache_time = tf_cache_time_secs*1000000000ULL ;
+ tf_ = new tf::TransformListener(*this, true, tf_cache_time) ;
+ ROS_INFO("TF Cache Time: %f Seconds", tf_cache_time_secs) ;
+
+ // ***** Set max_scans *****
+ const int default_max_scans = 400 ;
+ int tmp_max_scans ;
+ param("~max_scans", tmp_max_scans, default_max_scans) ;
+ if (tmp_max_scans < 0)
+ {
+ ROS_ERROR("Parameter max_scans<0 (%i)", tmp_max_scans) ;
+ tmp_max_scans = default_max_scans ;
+ }
+ max_scans_ = tmp_max_scans ;
+ ROS_INFO("Max Scans in History: %u", max_scans_) ;
+ total_pts_ = 0 ; // We're always going to start with no points in our history
+
+ // ***** Set fixed_frame *****
+ param("~fixed_frame", fixed_frame_, std::string("ERROR_NO_NAME")) ;
+ ROS_INFO("Fixed Frame: %s", fixed_frame_.c_str()) ;
+ if (fixed_frame_ == "ERROR_NO_NAME")
+ ROS_ERROR("Need to set parameter fixed_frame") ;
+
+ // ***** Start Services *****
+ advertise_service(get_name()+"/build_cloud", &BaseAssemblerSrv<T>::buildCloud, this, 0) ;
+
+ // ***** Start Listening to Data *****
+ scan_notifier_ = new tf::MessageNotifier<T>(tf_, this, boost::bind(&BaseAssemblerSrv<T>::scansCallback, this, _1), "scan_in", fixed_frame_, 10) ;
+}
+
+template <class T>
+BaseAssemblerSrv<T>::~BaseAssemblerSrv()
+{
+ delete scan_notifier_ ;
+ unadvertise_service(get_name()+"/build_cloud") ;
+ delete tf_ ;
+}
+
+template <class T>
+void BaseAssemblerSrv<T>::scansCallback(const boost::shared_ptr<T>& scan_ptr)
+{
+ const T scan = *scan_ptr ;
+
+ std_msgs::PointCloud cur_cloud ;
+
+ // Convert the scan data into a universally known datatype: PointCloud
+ try
+ {
+ ConvertToCloud(fixed_frame_, scan, cur_cloud) ; // Convert scan into a point cloud
+ }
+ catch(tf::TransformException& ex)
+ {
+ ROS_WARN("Transform Exception %s", ex.what()) ;
+ return ;
+ }
+
+ // Add the current scan (now of type PointCloud) into our history of scans
+ scan_hist_mutex_.lock() ;
+ if (scan_hist_.size() == max_scans_) // Is our deque full?
+ {
+ total_pts_ -= scan_hist_.front().get_pts_size() ; // We're removing an elem, so this reduces our total point count
+ scan_hist_.pop_front() ; // The front of the deque has the oldest elem, so we can get rid of it
+ }
+ scan_hist_.push_back(cur_cloud) ; // Add the newest scan to the back of the deque
+ total_pts_ += cur_cloud.get_pts_size() ; // Add the new scan to the running total of points
+
+ //printf("Scans: %4u Points: %10u\n", scan_hist_.size(), total_pts_) ;
+
+ scan_hist_mutex_.unlock() ;
+}
+
+template <class T>
+bool BaseAssemblerSrv<T>::buildCloud(BuildCloud::request& req, BuildCloud::response& resp)
+{
+ //printf("Starting Service Request\n") ;
+
+ scan_hist_mutex_.lock() ;
+ // Determine where in our history we actually are
+ unsigned int i = 0 ;
+
+ // Find the beginning of the request. Probably should be a search
+ while ( i < scan_hist_.size() && // Don't go past end of deque
+ scan_hist_[i].header.stamp < req.begin ) // Keep stepping until we've exceeded the start time
+ {
+ i++ ;
+ }
+ unsigned int start_index = i ;
+
+ unsigned int req_pts = 0 ; // Keep a total of the points in the current request
+ // Find the end of the request
+ while ( i < scan_hist_.size() && // Don't go past end of deque
+ scan_hist_[i].header.stamp < req.end ) // Don't go past the end-time of the request
+ {
+ req_pts += scan_hist_[i].get_pts_size() ;
+ i++ ;
+ }
+ unsigned int past_end_index = i ;
+
+ if (start_index == past_end_index)
+ {
+ resp.cloud.header.frame_id = fixed_frame_ ;
+ resp.cloud.header.stamp = req.end ;
+ resp.cloud.set_pts_size(0) ;
+ resp.cloud.set_chan_size(0) ;
+ }
+ else
+ {
+ // Note: We are assuming that channel information is consistent across multiple scans. If not, then bad things (segfaulting) will happen
+ // Allocate space for the cloud
+ resp.cloud.set_pts_size( req_pts ) ;
+ const unsigned int num_channels = scan_hist_[start_index].get_chan_size() ;
+ resp.cloud.set_chan_size(num_channels) ;
+ for (i = 0; i<num_channels; i++)
+ {
+ resp.cloud.chan[i].name = scan_hist_[start_index].chan[i].name ;
+ resp.cloud.chan[i].set_vals_size(req_pts) ;
+ }
+ resp.cloud.header.stamp = req.end ;
+ resp.cloud.header.frame_id = fixed_frame_ ;
+ unsigned int cloud_count = 0 ;
+ for (i=start_index; i<past_end_index; i++)
+ {
+ for(unsigned int j=0; j<scan_hist_[i].get_pts_size(); j++)
+ {
+ resp.cloud.pts[cloud_count].x = scan_hist_[i].pts[j].x ;
+ resp.cloud.pts[cloud_count].y = scan_hist_[i].pts[j].y ;
+ resp.cloud.pts[cloud_count].z = scan_hist_[i].pts[j].z ;
+ for (unsigned int k=0; k<num_channels; k++)
+ resp.cloud.chan[k].vals[cloud_count] = scan_hist_[i].chan[k].vals[j] ;
+
+ cloud_count++ ;
+ }
+ }
+ }
+ scan_hist_mutex_.unlock() ;
+
+ ROS_INFO("Point Cloud Results: Aggregated from index %u->%u. BufferSize: %u", start_index, past_end_index, scan_hist_.size()) ;
+ return true ;
+}
+
+}
Deleted: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/launch_assembler.xml
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/launch_assembler.xml 2008-12-30 22:10:46 UTC (rev 8706)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/launch_assembler.xml 2008-12-30 22:15:21 UTC (rev 8707)
@@ -1,6 +0,0 @@
-<launch>
- <node pkg="point_cloud_assembler" type="point_cloud_assembler" output="screen" name="assembler">
- <remap from="scan" to="tilt_scan"/>
- <remap from="laser_scanner_signal" to="laser_controller/laser_scanner_signal"/>
- </node>
-</launch>
Added: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/mainpage.dox
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/mainpage.dox (rev 0)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/mainpage.dox 2008-12-30 22:15:21 UTC (rev 8707)
@@ -0,0 +1,58 @@
+/**
+
+\mainpage
+
+\htmlinclude manifest.html
+
+@section summary Summary
+The point_cloud_assembler package is used to accumulate a time-series of sensor readings into a single, aggregate point cloud.
+Each sensor reading is converted into a point cloud upon receipt and then pushed onto a ring buffer. When a \b"~build_cloud"
+service request is made, the readings that lie between the start-time and end-time of the request are aggregated into a point
+cloud.
+
+
+@section usage Common Usage
+
+@subsection assemblers Assemblers
+point_cloud_assembler::BaseAssemblerSrv is an abstract class, so it cannot be used directly. Instead, a user should run one
+of the derived nodes (point_cloud_assembler::LaserScanAssemblerSrv or point_cloud_assembler::PointCloudAssemblerSrv),
+depending on what datatype they want to accumulate.
+
+@subsection snapshotter Snapshotter
+The point_cloud_assembler::PointCloudSnapshotter listens to the laser_scanner_signal messages and generates a cloud whenever
+the sensor reaches the top or bottom of it's profile. This is extremely useful when a single, consistent laser scan of the
+environment is needed.
+
+@subsection launch Example Launch File
+This launch file is performing two separate tasks
+ -# Launch a LaserScanAssemblerSrv node
+ - Listen for laser scans on topic "tilt_scan". Transform each scan (ignoring laser skew) into the torso_lift_link frame, and
+ then push the data onto a queue that is a maximum 400 elements long.
+ -# Launch the Snapshotter
+ - Listen to topic "laser_tilt_controller/laser_scanner_signal". Whenever a message is received, make a service call to
+ "laser_scan_assembler/build_cloud" to accumulate laser scans between the last two laser_scanner_signal messages. Once the
+ service call is complete, publish the data aggregate point cloud on the topic "snapshot_cloud"
+
+\verbatim
+<launch>
+
+ <node pkg="point_cloud_assembler" type="laser_scan_assembler_srv" output="screen" name="laser_scan_assembler">
+ <remap from="scan_in" to="tilt_scan"/>
+ <param name="tf_cache_time_secs" type="double" value="10.0" />
+ <param name="max_scans" type="int" value="400" />
+ <param name="ignore_laser_skew" type="bool" value="true" />
+ <param name="fixed_frame" type="string" value="torso_lift_link" />
+ </node>
+
+ <node pkg="point_cloud_assembler" type="point_cloud_snapshotter" output="screen" name="snapshotter">
+ <remap from="laser_scanner_signal" to="laser_tilt_controller/laser_scanner_signal"/>
+ <remap from="build_cloud" to="laser_scan_assembler/build_cloud" />
+ <remap from="full_cloud" to="snapshot_cloud" />
+ </node>
+
+</launch>
+
+\endverbatim
+
+
+*/
\ No newline at end of file
Modified: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/manifest.xml
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/manifest.xml 2008-12-30 22:10:46 UTC (rev 8706)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/manifest.xml 2008-12-30 22:15:21 UTC (rev 8707)
@@ -11,5 +11,10 @@
<depend package="laser_scan"/>
<depend package="tf"/>
<depend package="pr2_mechanism_controllers"/>
+
+ # For Testing
+ <depend package="rostest"/>
+ <depend package="gtest"/>
+ <depend package="scan_shadows_filter"/>
</package>
Modified: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/grab_cloud_data.cpp
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/grab_cloud_data.cpp 2008-12-30 22:10:46 UTC (rev 8706)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/grab_cloud_data.cpp 2008-12-30 22:15:21 UTC (rev 8707)
@@ -1,13 +1,13 @@
/*********************************************************************
* Software License Agreement (BSD License)
-*
+*
* Copyright (c) 2008, Willow Garage, Inc.
* All rights reserved.
-*
+*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
-*
+*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -17,7 +17,7 @@
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
-*
+*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -54,23 +54,23 @@
class GrabCloudData : public ros::node
{
-
+
public:
GrabCloudData() : ros::node("grab_cloud_data")
{
advertise<PointCloud> ("full_cloud", 1) ;
}
-
+
~GrabCloudData()
{
unadvertise("full_cloud") ;
}
-
+
bool spin()
{
ros::Duration period(4,0) ; // Repeat Every 4 seconds
-
+
ros::Time next_time = ros::Time::now() ;
while ( ok() )
@@ -79,18 +79,17 @@
if (ros::Time::now() >= next_time)
{
next_time.from_double(next_time.to_double() + period.to_double()) ;
-
+
BuildCloud::request req ;
BuildCloud::response resp ;
-
+
req.begin.from_double(next_time.to_double() - period.to_double() ) ;
req.end = next_time ;
- req.target_frame_id = "base" ;
-
+
printf("Making Service Call...\n") ;
ros::service::call("build_cloud", req, resp) ;
printf("Done with service call\n") ;
-
+
publish("full_cloud", resp.cloud) ;
printf("Published Cloud size=%u\n", resp.cloud.get_pts_size()) ;
}
Modified: pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp
===================================================================
--- pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp 2008-12-30 22:10:46 UTC (rev 8706)
+++ pkg/trunk/drivers/robot/pr2/point_cloud_assembler/src/laser_scan_assembler_srv.cpp 2008-12-30 22:15:21 UTC (rev 8707)
@@ -33,54 +33,13 @@
*********************************************************************/
-/**
+#include "laser_scan/laser_scan.h"
-@mainpage
-
-@htmlinclude manifest.html
-
-@b LaserScanAssemblerSrv accumulates scan lines from a laser range finder mounted on a tilting stage and generates 3D point clouds.
-
-<hr>
-
-@section usage Usage
-
-To use this node, the tilting stage and laser have to be started. A convenient method for starting them is on the way, perhaps as a script.
-
-@par Example
-
-<hr>
-
-@section topic ROS topics
-
-Subscribes to (name/type):
-- @b "scan"/<a href="../../std_msgs/html/classstd__msgs_1_1LaserScan.html">LaserScan</a> : laser scan data
-
-<hr>
-
-@section parameters ROS parameters
-
- **/
-
-
-#include "ros/node.h"
-#include "tf/transform_listener.h"
#include "std_msgs/LaserScan.h"
-#include "std_msgs/PointCloud.h"
+#include "point_cloud_assembler/base_assembler_srv.h"
-#include <deque>
-
-// Service
-#include "point_cloud_assembler/BuildCloud.h"
-
-// Laser projection
-#include "laser_scan/laser_scan.h"
-
-#include "math.h"
-
using namespace std_msgs;
-
using namespace std ;
namespace point_cloud_assembler
@@ -88,170 +47,51 @@
/**
* \brief Maintains a history of laser scans and generates a point cloud upon request
- * \todo Clean up the doxygen part of this header
- * params
- * * "~tf_cache_time_secs" (double) - The cache time (in seconds) to holds past transforms
- * * "~tf_extrap_limit" (double) - The extrapolation limit for TF (in seconds)
- * * "~max_scans" (unsigned int) - The number of scans to store in the assembler's history, until they're thrown away
- * * "~ignore_laser_skew" (bool) - Specifies the method to project laser data
- * * true -> Account for laser skew, and compute the transform for each laser point (This is currently really slow!)
- * * false-> Don't account for laser skew, and use 1 transform per scanline. (This might have a little error when moving fast)
+ * \section params ROS Parameters
+ * - (Several params are inherited from point_cloud_assembler::BaseAssemblerSrv)
+ * - \b "~ignore_laser_skew" (bool) - Specifies the method to project laser data
+ * - true -> Account for laser skew, and compute the transform for each laser point (This is currently really slow!)
+ * - false-> Don't account for laser skew, and use 1 transform per scanline. (This might have a little error when moving fast)
+ * \section services ROS Services
+ * - "~build_cloud" - Inhertited from point_cloud_assembler::BaseAssemblerSrv
*/
-class LaserScanAssemblerSrv : public ros::node
+class LaserScanAssemblerSrv : public BaseAssemblerSrv<std_msgs::LaserScan>
{
public:
-
- tf::TransformListener* tf_;
- laser_scan::LaserProjection projector_;
-
- LaserScan scan_;
-
- unsigned int max_scans_ ;
- bool ignore_laser_skew_ ;
-
- deque<LaserScan> scan_hist_ ; //!< Stores history of scans. We want them in time-ordered, which is (in most situations) the same as time-of-receipt-ordered
- unsigned int total_pts_ ; //!< Stores the total number of range points in the entire stored history of scans. Useful for estimating points/scan
-
-
- LaserScanAssemblerSrv() : ros::node("point_cloud_assembler")
+ LaserScanAssemblerSrv() : BaseAssemblerSrv<std_msgs::LaserScan>("laser_scan_assembler")
{
- // **** Initialize TransformListener ****
- double tf_cache_time_secs ;
- param("~tf_cache_time_secs", tf_cache_time_secs, 10.0) ;
- if (tf_cache_time_secs < 0)
- ROS_ERROR("Parameter tf_cache_time_secs<0 (%f)", tf_cache_time_secs) ;
- unsigned long long tf_cache_time = tf_cache_time_secs*1000000000ULL ;
- tf_ = new tf::TransformListener(*this, true, tf_cache_time) ;
- ROS_INFO("TF Cache Time: %f Seconds", tf_cache_time_secs) ;
-
- // **** Set TF Extrapolation Limit ****
- double tf_extrap_limit_secs ;
- param("~tf_extrap_limit", tf_extrap_limit_secs, 0.00) ;
- if (tf_extrap_limit_secs < 0.0)
- ROS_ERROR("Parameter tf_extrap_limit<0 (%f)", tf_extrap_limit_secs) ;
-
- ros::Duration extrap_limit ;
- extrap_limit.fromSec(tf_extrap_limit_secs) ;
- tf_->setExtrapolationLimit(extrap_limit) ;
- ROS_INFO("TF Extrapolation Limit: %f Seconds", tf_extrap_limit_secs) ;
-
- // ***** Set max_scans *****
- const int default_max_scans = 400 ;
- int tmp_max_scans;
- param("~max_scans", tmp_max_scans, default_max_scans) ;
- if (tmp_max_scans < 0)
- {
- ROS_ERROR("Parameter max_scans<0 (%i)", tmp_max_scans) ;
- tmp_max_scans = default_max_scans ;
- }
- max_scans_ = tmp_max_scans;
- ROS_INFO("Max Scans in History: %u", max_scans_) ;
- total_pts_ = 0 ; // We're always going to start with no points in our history
-
// ***** Set Laser Projection Method *****
param("~ignore_laser_skew", ignore_laser_skew_, true) ;
-
- // ***** Start Services *****
- advertise_service(get_name()+"/build_cloud", &LaserScanAssemblerSrv::buildCloud, this, 0) ; // Don't spawn threads so that we can avoid dealing with mutexing [for now]
- subscribe("scan", scan_, &LaserScanAssemblerSrv::scans_callback, 40) ; // Choose something reasonably large, so data doesn't get dropped
}
~LaserScanAssemblerSrv()
{
- unadvertise_service(get_name()+"/build_cloud") ;
- unsubscribe("scan") ;
- delete tf_ ;
+
}
- void scans_callback()
+ unsigned int GetPointsInScan(const LaserScan& scan)
{
- if (scan_hist_.size() == max_scans_) // Is our deque full?
- {
- total_pts_ -= scan_hist_.front().get_ranges_size() ; // We're removing an elem, so this reduces our total point count
- scan_hist_.pop_front() ; // The front of the deque has the oldest elem, so we can get rid of it
- }
-
- scan_hist_.push_back(scan_) ; // Add the newest scan to the back of the deque
- total_pts_ += scan_.get_ranges_size() ; // Add the new scan to the running total of points
-
- //printf("LaserScanAssemblerSrv:: Got Scan: TotalPoints=%u", total_pts_) ;
+ return scan.get_ranges_size() ;
}
- bool buildCloud(BuildCloud::request& req, BuildCloud::response& resp)
+ void ConvertToCloud(const string& fixed_frame_id, const LaserScan& scan_in, PointCloud& cloud_out)
{
- // Allocate space for the cloud
- resp.cloud.set_pts_size( total_pts_ ) ; // There's no way to have a point cloud bigger than our entire history of scans.
- resp.cloud.set_chan_size(1) ;
- resp.cloud.chan[0].name = "intensities" ;
- resp.cloud.chan[0].set_vals_size( total_pts_ ) ;
-
- unsigned int cloud_count = 0 ; // Store the number of points in the current cloud
-
- PointCloud projector_cloud ; // Stores the current scan after being projected into the laser frame
- PointCloud target_frame_cloud ; // Stores the current scan in the target frame
-
- unsigned int i = 0 ;
-
- // Find the beginning of the request. Probably should be a search
- while ( i < scan_hist_.size() && // Don't go past end of deque
- scan_hist_[i].header.stamp < req.begin ) // Keep stepping until we've exceeded the start time
+ if (ignore_laser_skew_) // Do it the fast (approximate) way
{
- i++ ;
+ projector_.projectLaser(scan_in, cloud_out) ;
+ if (cloud_out.header.frame_id != fixed_frame_id)
+ tf_->transformPointCloud(fixed_frame_id, cloud_out, cloud_out) ;
}
-
- unsigned int start_index = i ;
-
- unsigned int tf_ex_count = 0 ; // Keep a count of how many TF exceptions we got (for diagnostics)
- unsigned int scan_lines_count = 0 ; // Keep a count of how many scan lines we agregated (for diagnostics)
-
- // Populate the cloud
- while ( i < scan_hist_.size() && // Don't go past end of deque
- scan_hist_[i].header.stamp < req.end ) // Don't go past the end-time of the request
+ else // Do it the slower (more accurate) way
{
- const LaserScan& cur_scan = scan_hist_[i] ;
-
- try
- {
- if (ignore_laser_skew_) // Do it the fast (approximate) way
- {
- projector_.projectLaser(cur_scan, projector_cloud) ;
- tf_->transformPointCloud(req.target_frame_id, projector_cloud, target_frame_cloud) ;
- }
- else // Do it the slower (more accurate) way
- {
- projector_.transformLaserScanToPointCloud(req.target_frame_id, target_frame_cloud, cur_scan, *tf_) ;
- }
-
- for(unsigned int j = 0; j < target_frame_cloud.get_pts_size(); j++) // Populate full_cloud from the cloud
- {
- resp.cloud.pts[cloud_count].x = target_frame_cloud.pts[j].x ;
- resp.cloud.pts[cloud...
[truncated message content] |
|
From: <vij...@us...> - 2008-12-30 23:27:28
|
Revision: 8721
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8721&view=rev
Author: vijaypradeep
Date: 2008-12-30 23:27:19 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
Adding filter to laser_traj controller. Works in gazebo. Need to test on robot.
Modified Paths:
--------------
pkg/trunk/controllers/pr2_mechanism_controllers/include/pr2_mechanism_controllers/laser_scanner_traj_controller.h
pkg/trunk/controllers/pr2_mechanism_controllers/manifest.xml
pkg/trunk/controllers/pr2_mechanism_controllers/src/laser_scanner_traj_controller.cpp
pkg/trunk/robot_descriptions/pr2/pr2_experimental_controllers/laser_tilt/laser_tilt_controller.xml
Modified: pkg/trunk/controllers/pr2_mechanism_controllers/include/pr2_mechanism_controllers/laser_scanner_traj_controller.h
===================================================================
--- pkg/trunk/controllers/pr2_mechanism_controllers/include/pr2_mechanism_controllers/laser_scanner_traj_controller.h 2008-12-30 23:27:14 UTC (rev 8720)
+++ pkg/trunk/controllers/pr2_mechanism_controllers/include/pr2_mechanism_controllers/laser_scanner_traj_controller.h 2008-12-30 23:27:19 UTC (rev 8721)
@@ -41,6 +41,9 @@
#include <misc_utils/realtime_publisher.h>
+
+#include "filters/transfer_function.h"
+
// Messages
#include <pr2_mechanism_controllers/LaserScannerSignal.h>
#include <pr2_mechanism_controllers/PeriodicCmd.h>
@@ -80,6 +83,9 @@
inline double getProfileDuration() ;
private:
+
+ void initDErrorFilter(double f) ; // Initializes d_error_filter using a smoothing factor
+
mechanism::RobotState *robot_ ;
mechanism::JointState *joint_state_ ; // Need this to check the calibrated flag on the joint
@@ -94,13 +100,22 @@
JointPositionSmoothController joint_position_controller_ ; // The PID position controller that is doing all the under-the-hood controls stuff
+ std::string name_ ; // The controller name. Used for ROS_INFO Messages
+
double traj_start_time_ ; // The time that the trajectory was started (in seconds)
double traj_duration_ ; // The length of the current profile (in seconds)
- double tracking_offset_ ; // Offset generated by the track_link code
double max_rate_ ; // Max allowable rate/velocity
double max_acc_ ; // Max allowable acceleration
+
+ // Control loop state
+ control_toolbox::Pid pid_controller_ ; // Position PID Controller
+ filters::TransferFunctionFilter<double >* d_error_filter ; // Filter on derivative term of error
+ double last_time_ ; // The previous time at which the control loop was run
+ double last_error_ ; // Error for the previous time at which the control loop was run
+ double tracking_offset_ ; // Position cmd generated by the track_link code
+ double traj_command_ ; // Position cmd generated by the trajectory code
};
class LaserScannerTrajControllerNode : public Controller
@@ -120,6 +135,7 @@
private:
ros::node *node_ ;
LaserScannerTrajController c_ ;
+ mechanism::RobotState *robot_ ;
std::string service_prefix_ ;
double prev_profile_time_ ; //!< The time in the current profile when update() was last called
Modified: pkg/trunk/controllers/pr2_mechanism_controllers/manifest.xml
===================================================================
--- pkg/trunk/controllers/pr2_mechanism_controllers/manifest.xml 2008-12-30 23:27:14 UTC (rev 8720)
+++ pkg/trunk/controllers/pr2_mechanism_controllers/manifest.xml 2008-12-30 23:27:19 UTC (rev 8721)
@@ -21,6 +21,7 @@
<depend package="rosthread" />
<depend package="angles" />
<depend package="control_toolbox" />
+ <depend package="filters" />
<url>http://pr.willowgarage.com</url>
<repository>http://pr.willowgarage.com/repos</repository>
<export>
Modified: pkg/trunk/controllers/pr2_mechanism_controllers/src/laser_scanner_traj_controller.cpp
===================================================================
--- pkg/trunk/controllers/pr2_mechanism_controllers/src/laser_scanner_traj_controller.cpp 2008-12-30 23:27:14 UTC (rev 8720)
+++ pkg/trunk/controllers/pr2_mechanism_controllers/src/laser_scanner_traj_controller.cpp 2008-12-30 23:27:19 UTC (rev 8721)
@@ -37,8 +37,9 @@
#include <math.h>
-using namespace std;
-using namespace controller;
+using namespace std ;
+using namespace controller ;
+using namespace filters ;
ROS_REGISTER_CONTROLLER(LaserScannerTrajController)
@@ -46,11 +47,13 @@
{
tracking_offset_ = 0 ;
track_link_enabled_ = false ;
+ d_error_filter = NULL ;
}
LaserScannerTrajController::~LaserScannerTrajController()
{
-
+ if (d_error_filter != NULL)
+ delete d_error_filter ;
}
bool LaserScannerTrajController::initXml(mechanism::RobotState *robot, TiXmlElement *config)
@@ -59,21 +62,70 @@
return false ;
robot_ = robot ;
- // Look through XML to grab the joint name
+ // ***** Name element *****
+ const char* name = config->Attribute("name") ;
+ if (!name)
+ {
+ ROS_ERROR("LaserScannerTrajController:: Name attribute not defined in controller tag") ;
+ return false ;
+ }
+ name_ = name ;
+
+ // ***** Joint Element *****
TiXmlElement *j = config->FirstChildElement("joint") ;
if (!j)
+ {
+ ROS_ERROR("%s:: joint element not defined inside controller", name_.c_str()) ;
return false ;
-
+ }
const char *jn = j->Attribute("name") ;
if (!jn)
+ {
+ ROS_ERROR("%s:: name attribute not defined insidejoint element", name_.c_str()) ;
return false ;
- std::string joint_name = jn ;
+ }
+ joint_state_ = robot_->getJointState(string(jn)) ; // Need joint state to check calibrated flag
+ if (!joint_state_)
+ {
+ ROS_ERROR("%s:: Could not find joint \"%s\" in robot model", name_.c_str(), jn) ;
+ return false ;
+ }
- joint_state_ = robot_->getJointState(joint_name) ; // Need joint state to check calibrated flag
+ TiXmlElement *pid_elem = j->FirstChildElement("pid") ;
+ if (!pid_elem)
+ {
+ ROS_ERROR("%s:: Could not find element \"pid\" in joint", name_.c_str()) ;
+ return false ;
+ }
- joint_position_controller_.initXml(robot, config) ; //Pass down XML snippet to encapsulated joint_position_controller_
+ bool result ;
+ result = pid_controller_.initXml(pid_elem) ;
+ if (!result)
+ {
+ ROS_ERROR("%s:: Error initializing pid element", name_.c_str()) ;
+ return false ;
+ }
+ last_time_ = robot->hw_->current_time_ ;
+ last_error_ = 0.0 ;
+ // ***** Derivate Error Filter Element *****
+ TiXmlElement *filter_elem = config->FirstChildElement("d_error_filter");
+ if(!filter_elem)
+ {
+ ROS_ERROR("%s:: d_error_filter element not defined inside controller", name_.c_str()) ;
+ return false ;
+ }
+
+ double smoothing_factor ;
+ if(filter_elem->QueryDoubleAttribute("smoothing_factor", & smoothing_factor)!=TIXML_SUCCESS)
+ {
+ ROS_ERROR("%s:: Error reading \"smoothing_factor\" element in d_error_filter element", name_.c_str()) ;
+ return false ;
+ }
+ initDErrorFilter(smoothing_factor) ;
+
+ // ***** Max Rate and Acceleration Elements *****
TiXmlElement *max_rate_elem = config->FirstChildElement("max_rate") ;
if (!max_rate_elem)
return false ;
@@ -89,12 +141,26 @@
return true ;
}
+void LaserScannerTrajController::initDErrorFilter(double f)
+{
+ vector<double> a ;
+ vector<double> b ;
+ a.resize(2) ;
+ b.resize(1) ;
+ a[0] = 1.0 ;
+ a[1] = - (1.0 - f) ;
+ b[0] = 1.0 ;
+
+ if(d_error_filter == NULL)
+ delete d_error_filter ;
+ d_error_filter = new TransferFunctionFilter<double>(b,a,1) ;
+}
+
void LaserScannerTrajController::update()
{
- //if (!joint_state_->calibrated_)
- // return;
+ if (!joint_state_->calibrated_)
+ return;
-
// ***** Compute the offset from tracking a link *****
//! \todo replace this link tracker with a KDL inverse kinematics solver
if(track_link_lock_.trylock())
@@ -133,13 +199,34 @@
result = traj_.sample(sampled_point, profile_time) ;
if (result > 0)
- {
- joint_position_controller_.setCommand(sampled_point.q_[0] + tracking_offset_) ;
- joint_position_controller_.update() ;
- }
+ traj_command_ = sampled_point.q_[0] ;
}
traj_lock_.unlock() ;
}
+
+ // ***** Run the position control loop *****
+ double cmd = traj_command_ + tracking_offset_ ;
+
+ double time = robot_->hw_->current_time_ ;
+ double error(0.0) ;
+ angles::shortest_angular_distance_with_limits(cmd, joint_state_->position_,
+ joint_state_->joint_->joint_limit_min_,
+ joint_state_->joint_->joint_limit_max_,
+ error) ;
+ double dt = time - last_time_ ;
+ double d_error = (error-last_error_)/dt ;
+ vector<double> filtered_d_error ;
+ filtered_d_error.resize(1) ;
+
+ vector<double> d_error_vec(1,d_error) ;
+
+ d_error_filter->update(&d_error_vec, &filtered_d_error) ;
+
+ // Add filtering step
+ // Update pid with d_error added
+ joint_state_->commanded_effort_ = pid_controller_.updatePid(error, filtered_d_error[0], dt) ;
+ last_time_ = time ;
+ last_error_ = error ;
}
double LaserScannerTrajController::getCurProfileTime()
@@ -277,11 +364,17 @@
prev_profile_time_ < c_.getProfileDuration()/2.0)
{
// Should we be populating header.stamp here? Or, we can simply let ros take care of the timestamp
+ ros::Time cur_time ;
+ cur_time.fromSec(robot_->hw_->current_time_) ;
+ m_scanner_signal_.header.stamp = cur_time ;
m_scanner_signal_.signal = 0 ;
need_to_send_msg_ = true ;
}
else if (cur_profile_time < prev_profile_time_) // Check if we wrapped around
{
+ ros::Time cur_time ;
+ cur_time.fromSec(robot_->hw_->current_time_) ;
+ m_scanner_signal_.header.stamp = cur_time ;
m_scanner_signal_.signal = 1 ;
need_to_send_msg_ = true ;
}
@@ -305,6 +398,8 @@
bool LaserScannerTrajControllerNode::initXml(mechanism::RobotState *robot, TiXmlElement *config)
{
+ robot_ = robot ; // Need robot in order to grab hardware time
+
service_prefix_ = config->Attribute("name") ;
if (!c_.initXml(robot, config))
Modified: pkg/trunk/robot_descriptions/pr2/pr2_experimental_controllers/laser_tilt/laser_tilt_controller.xml
===================================================================
--- pkg/trunk/robot_descriptions/pr2/pr2_experimental_controllers/laser_tilt/laser_tilt_controller.xml 2008-12-30 23:27:14 UTC (rev 8720)
+++ pkg/trunk/robot_descriptions/pr2/pr2_experimental_controllers/laser_tilt/laser_tilt_controller.xml 2008-12-30 23:27:19 UTC (rev 8721)
@@ -1,8 +1,8 @@
<controllers>
- <controller name="laser_controller" topic="laser_controller" type="LaserScannerTrajControllerNode">
+ <controller name="laser_tilt_controller" topic="laser_controller" type="LaserScannerTrajControllerNode">
<max_acc value="1.0" />
<max_rate value="100.0" />
- <filter smoothing_factor=".1" />
+ <d_error_filter smoothing_factor=".1" />
<joint name="laser_tilt_mount_joint">
<pid p="2" i=".1" d="0.25" iClamp="0.5" />
</joint>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jl...@us...> - 2008-12-31 03:45:04
|
Revision: 8763
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8763&view=rev
Author: jleibs
Date: 2008-12-31 03:45:00 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Adding ability to set/check camera parameters.
Modified Paths:
--------------
pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp
pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp
pkg/trunk/image_msgs/msg/StereoInfo.msg
pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h
pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp
Modified: pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp
===================================================================
--- pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp 2008-12-31 03:45:00 UTC (rev 8763)
@@ -337,16 +337,16 @@
stereo_info_.width = stcam->stIm->imWidth;
stereo_info_.dpp = stcam->stIm->dpp;
- stereo_info_.numDisp = stcam->stIm->numDisp;
- stereo_info_.imDtop = stcam->stIm->imDtop;
- stereo_info_.imDleft = stcam->stIm->imDleft;
- stereo_info_.imDwidth = stcam->stIm->imDwidth;
- stereo_info_.imDheight = stcam->stIm->imDheight;
- stereo_info_.corrSize = stcam->stIm->corrSize;
- stereo_info_.filterSize = stcam->stIm->filterSize;
- stereo_info_.horOffset = stcam->stIm->horOffset;
- stereo_info_.textureThresh = stcam->stIm->textureThresh;
- stereo_info_.uniqueThresh = stcam->stIm->uniqueThresh;
+ stereo_info_.num_disp = stcam->stIm->numDisp;
+ stereo_info_.im_Dtop = stcam->stIm->imDtop;
+ stereo_info_.im_Dleft = stcam->stIm->imDleft;
+ stereo_info_.im_Dwidth = stcam->stIm->imDwidth;
+ stereo_info_.im_Dheight = stcam->stIm->imDheight;
+ stereo_info_.corr_size = stcam->stIm->corrSize;
+ stereo_info_.filter_size = stcam->stIm->filterSize;
+ stereo_info_.hor_offset = stcam->stIm->horOffset;
+ stereo_info_.texture_thresh = stcam->stIm->textureThresh;
+ stereo_info_.unique_thresh = stcam->stIm->uniqueThresh;
memcpy((char*)(&stereo_info_.T[0]), (char*)(stcam->stIm->T), 3*sizeof(double));
memcpy((char*)(&stereo_info_.Om[0]), (char*)(stcam->stIm->Om), 3*sizeof(double));
Modified: pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp
===================================================================
--- pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp 2008-12-31 03:45:00 UTC (rev 8763)
@@ -32,6 +32,35 @@
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
+/**
+
+@mainpage
+
+@htmlinclude manifest.html
+
+stereodcam node uses the parameters:
+
+- @b ~exposure (int)
+- @b ~gain (int)
+- @b ~brightness (int)
+- @b ~exposure_auto (bool)
+- @b ~gain_auto (bool)
+- @b ~brightness_auto (bool)
+- @b ~companding (bool)
+- @b ~hdr (bool)
+- @b ~unique_check (bool)
+- @b ~texture_thresh (int)
+- @b ~unique_thresh (int)
+- @b ~smoothness_thresh (int)
+- @b ~horopter (int)
+- @b ~speckle_size (int)
+- @b ~speckle_diff (int)
+- @b ~corr_size (int)
+- @b ~num_disp (int)
+
+**/
+
+
#include <cstdio>
#include "dcam/dcam.h"
@@ -156,14 +185,14 @@
// Fetch the camera string and send it to the parameter server if people want it (they shouldn't)
std::string params(stcam_->getParameters());
- set_param("~/params", params);
+ set_param("~params", params);
- set_param("~/exposure_max", (int)stcam_->expMax);
- set_param("~/exposure_min", (int)stcam_->expMin);
- set_param("~/gain_max", (int)stcam_->gainMax);
- set_param("~/gain_min", (int)stcam_->gainMin);
- set_param("~/brightness_max", (int)stcam_->brightMax);
- set_param("~/brightness_min", (int)stcam_->brightMin);
+ set_param("~exposure_max", (int)stcam_->expMax);
+ set_param("~exposure_min", (int)stcam_->expMin);
+ set_param("~gain_max", (int)stcam_->gainMax);
+ set_param("~gain_min", (int)stcam_->gainMin);
+ set_param("~brightness_max", (int)stcam_->brightMax);
+ set_param("~brightness_min", (int)stcam_->brightMin);
// Configure camera
stcam_->setFormat(mode, fps, speed);
@@ -198,23 +227,32 @@
void checkAndSetAll()
{
- checkAndSetIntBool("exposure", boost::bind(&dcam::Dcam::setExposure, stcam_, _1, _2));
- checkAndSetIntBool("gain", boost::bind(&dcam::Dcam::setGain, stcam_, _1, _2));
- checkAndSetIntBool("brightness", boost::bind(&dcam::Dcam::setBrightness, stcam_, _1, _2));
- checkAndSetBool("companding", boost::bind(&dcam::Dcam::setCompanding, stcam_, _1));
- checkAndSetBool("hdr", boost::bind(&dcam::Dcam::setHDR, stcam_, _1));
+ checkAndSetIntBool("exposure", boost::bind(&dcam::Dcam::setExposure, stcam_, _1, _2));
+ checkAndSetIntBool("gain", boost::bind(&dcam::Dcam::setGain, stcam_, _1, _2));
+ checkAndSetIntBool("brightness", boost::bind(&dcam::Dcam::setBrightness, stcam_, _1, _2));
+ checkAndSetBool("companding", boost::bind(&dcam::Dcam::setCompanding, stcam_, _1));
+ checkAndSetBool("hdr", boost::bind(&dcam::Dcam::setHDR, stcam_, _1));
+ checkAndSetBool("unique_check", boost::bind(&dcam::StereoDcam::setUniqueCheck, stcam_, _1));
+ checkAndSetInt("texture_thresh", boost::bind(&dcam::StereoDcam::setTextureThresh, stcam_, _1));
+ checkAndSetInt("unique_thresh", boost::bind(&dcam::StereoDcam::setUniqueThresh, stcam_, _1));
+ checkAndSetInt("smoothness_thresh", boost::bind(&dcam::StereoDcam::setSmoothnessThresh, stcam_, _1));
+ checkAndSetInt("horopter", boost::bind(&dcam::StereoDcam::setHoropter, stcam_, _1));
+ checkAndSetInt("speckle_size", boost::bind(&dcam::StereoDcam::setSpeckleSize, stcam_, _1));
+ checkAndSetInt("speckle_diff", boost::bind(&dcam::StereoDcam::setSpeckleDiff, stcam_, _1));
+ checkAndSetInt("corr_size", boost::bind(&dcam::StereoDcam::setCorrsize, stcam_, _1));
+ checkAndSetInt("num_disp", boost::bind(&dcam::StereoDcam::setNumDisp, stcam_, _1));
}
void checkAndSetIntBool(std::string param_name, boost::function<void(int, bool)> setfunc)
{
- if (has_param(std::string("~/") + param_name) || has_param(std::string("~/") + param_name + std::string("_auto")))
+ if (has_param(std::string("~") + param_name) || has_param(std::string("~") + param_name + std::string("_auto")))
{
int val = 0;
bool isauto = false;
- param( std::string("~/") + param_name, val, 0);
- param( std::string("~/") + param_name + std::string("_auto"), isauto, false);
+ param( std::string("~") + param_name, val, 0);
+ param( std::string("~") + param_name + std::string("_auto"), isauto, false);
int testval = (val * (!isauto));
@@ -230,11 +268,11 @@
void checkAndSetBool(std::string param_name, boost::function<bool(bool)> setfunc)
{
- if (has_param(std::string("~/") + param_name))
+ if (has_param(std::string("~") + param_name))
{
bool on = false;
- param(std::string("~/") + param_name, on, false);
+ param(std::string("~") + param_name, on, false);
std::map<std::string, int>::iterator cacheval = paramcache_.find(param_name);
@@ -249,12 +287,12 @@
void checkAndSetInt(std::string param_name, boost::function<bool(int)> setfunc)
{
- if (has_param(std::string("~/") + param_name))
+ if (has_param(std::string("~") + param_name))
{
int val = 0;
- param(std::string("~/") + param_name, val, 0);
+ param(std::string("~") + param_name, val, 0);
std::map<std::string, int>::iterator cacheval = paramcache_.find(param_name);
Modified: pkg/trunk/image_msgs/msg/StereoInfo.msg
===================================================================
--- pkg/trunk/image_msgs/msg/StereoInfo.msg 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/image_msgs/msg/StereoInfo.msg 2008-12-31 03:45:00 UTC (rev 8763)
@@ -14,16 +14,20 @@
float64[16] RP # Reprojection Matrix
int32 dpp
-int32 numDisp
-int32 imDtop
-int32 imDleft
-int32 imDwidth
-int32 imDheight
-int32 corrSize
-int32 filterSize
-int32 horOffset
-int32 textureThresh
-int32 uniqueThresh
+int32 num_disp
+int32 im_Dtop
+int32 im_Dleft
+int32 im_Dwidth
+int32 im_Dheight
+int32 corr_size
+int32 filter_size
+int32 hor_offset
+int32 texture_thresh
+int32 unique_thresh
+int32 smooth_thresh
+int32 speckle_diff
+int32 speckle_region_size
+byte unique_check
byte has_disparity
Modified: pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h
===================================================================
--- pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h 2008-12-31 03:45:00 UTC (rev 8763)
@@ -129,16 +129,20 @@
raw_stereo.stereo_info.height = stIm->imHeight;
raw_stereo.stereo_info.width = stIm->imWidth;
raw_stereo.stereo_info.dpp = stIm->dpp;
- raw_stereo.stereo_info.numDisp = stIm->numDisp;
- raw_stereo.stereo_info.imDtop = stIm->imDtop;
- raw_stereo.stereo_info.imDleft = stIm->imDleft;
- raw_stereo.stereo_info.imDwidth = stIm->imDwidth;
- raw_stereo.stereo_info.imDheight = stIm->imDheight;
- raw_stereo.stereo_info.corrSize = stIm->corrSize;
- raw_stereo.stereo_info.filterSize = stIm->filterSize;
- raw_stereo.stereo_info.horOffset = stIm->horOffset;
- raw_stereo.stereo_info.textureThresh = stIm->textureThresh;
- raw_stereo.stereo_info.uniqueThresh = stIm->uniqueThresh;
+ raw_stereo.stereo_info.num_disp = stIm->numDisp;
+ raw_stereo.stereo_info.im_Dtop = stIm->imDtop;
+ raw_stereo.stereo_info.im_Dleft = stIm->imDleft;
+ raw_stereo.stereo_info.im_Dwidth = stIm->imDwidth;
+ raw_stereo.stereo_info.im_Dheight = stIm->imDheight;
+ raw_stereo.stereo_info.corr_size = stIm->corrSize;
+ raw_stereo.stereo_info.filter_size = stIm->filterSize;
+ raw_stereo.stereo_info.hor_offset = stIm->horOffset;
+ raw_stereo.stereo_info.texture_thresh = stIm->textureThresh;
+ raw_stereo.stereo_info.unique_thresh = stIm->uniqueThresh;
+ raw_stereo.stereo_info.smooth_thresh = stIm->smoothThresh;
+ raw_stereo.stereo_info.speckle_diff = stIm->speckleDiff;
+ raw_stereo.stereo_info.speckle_region_size = stIm->speckleRegionSize;
+ raw_stereo.stereo_info.unique_check = stIm->unique_check;
memcpy((char*)(&raw_stereo.stereo_info.T[0]), (char*)(stIm->T), 3*sizeof(double));
memcpy((char*)(&raw_stereo.stereo_info.Om[0]), (char*)(stIm->Om), 3*sizeof(double));
memcpy((char*)(&raw_stereo.stereo_info.RP[0]), (char*)(stIm->RP), 16*sizeof(double));
@@ -243,17 +247,22 @@
stIm->hasDisparity = true;
}
- stIm->dpp = raw_stereo.stereo_info.dpp;
- stIm->numDisp = raw_stereo.stereo_info.numDisp;
- stIm->imDtop = raw_stereo.stereo_info.imDtop;
- stIm->imDleft = raw_stereo.stereo_info.imDleft;
- stIm->imDwidth = raw_stereo.stereo_info.imDwidth;
- stIm->imDheight = raw_stereo.stereo_info.imDheight;
- stIm->corrSize = raw_stereo.stereo_info.corrSize;
- stIm->filterSize = raw_stereo.stereo_info.filterSize;
- stIm->horOffset = raw_stereo.stereo_info.horOffset;
- stIm->textureThresh = raw_stereo.stereo_info.textureThresh;
- stIm->uniqueThresh = raw_stereo.stereo_info.uniqueThresh;
+
+ stIm->dpp = raw_stereo.stereo_info.dpp;
+ stIm->numDisp = raw_stereo.stereo_info.num_disp;
+ stIm->imDtop = raw_stereo.stereo_info.im_Dtop;
+ stIm->imDleft = raw_stereo.stereo_info.im_Dleft;
+ stIm->imDwidth = raw_stereo.stereo_info.im_Dwidth;
+ stIm->imDheight = raw_stereo.stereo_info.im_Dheight;
+ stIm->corrSize = raw_stereo.stereo_info.corr_size;
+ stIm->filterSize = raw_stereo.stereo_info.filter_size;
+ stIm->horOffset = raw_stereo.stereo_info.hor_offset;
+ stIm->textureThresh = raw_stereo.stereo_info.texture_thresh;
+ stIm->uniqueThresh = raw_stereo.stereo_info.unique_thresh;
+ stIm->smoothThresh = raw_stereo.stereo_info.smooth_thresh;
+ stIm->speckleDiff = raw_stereo.stereo_info.speckle_diff;
+ stIm->speckleRegionSize = raw_stereo.stereo_info.speckle_region_size;
+ stIm->unique_check = raw_stereo.stereo_info.unique_check;
memcpy((char*)(stIm->T), (char*)(&raw_stereo.stereo_info.T[0]), 3*sizeof(double));
memcpy((char*)(stIm->Om), (char*)(&raw_stereo.stereo_info.Om[0]), 3*sizeof(double));
memcpy((char*)(stIm->RP), (char*)(&raw_stereo.stereo_info.RP[0]), 16*sizeof(double));
Modified: pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp
===================================================================
--- pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp 2008-12-31 03:45:00 UTC (rev 8763)
@@ -191,17 +191,22 @@
stereo_info_.width = stdata_->imWidth;
stereo_info_.dpp = stdata_->dpp;
- stereo_info_.numDisp = stdata_->numDisp;
- stereo_info_.imDtop = stdata_->imDtop;
- stereo_info_.imDleft = stdata_->imDleft;
- stereo_info_.imDwidth = stdata_->imDwidth;
- stereo_info_.imDheight = stdata_->imDheight;
- stereo_info_.corrSize = stdata_->corrSize;
- stereo_info_.filterSize = stdata_->filterSize;
- stereo_info_.horOffset = stdata_->horOffset;
- stereo_info_.textureThresh = stdata_->textureThresh;
- stereo_info_.uniqueThresh = stdata_->uniqueThresh;
+ stereo_info_.num_disp = stdata_->numDisp;
+ stereo_info_.im_Dtop = stdata_->imDtop;
+ stereo_info_.im_Dleft = stdata_->imDleft;
+ stereo_info_.im_Dwidth = stdata_->imDwidth;
+ stereo_info_.im_Dheight = stdata_->imDheight;
+ stereo_info_.corr_size = stdata_->corrSize;
+ stereo_info_.filter_size = stdata_->filterSize;
+ stereo_info_.hor_offset = stdata_->horOffset;
+ stereo_info_.texture_thresh = stdata_->textureThresh;
+ stereo_info_.unique_thresh = stdata_->uniqueThresh;
+ stereo_info_.smooth_thresh = stdata_->smoothThresh;
+ stereo_info_.speckle_diff = stdata_->speckleDiff;
+ stereo_info_.speckle_region_size = stdata_->speckleRegionSize;
+ stereo_info_.unique_check = stdata_->unique_check;
+
memcpy((char*)(&stereo_info_.T[0]), (char*)(stdata_->T), 3*sizeof(double));
memcpy((char*)(&stereo_info_.Om[0]), (char*)(stdata_->Om), 3*sizeof(double));
memcpy((char*)(&stereo_info_.RP[0]), (char*)(stdata_->RP), 16*sizeof(double));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tf...@us...> - 2008-12-31 19:21:02
|
Revision: 8777
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8777&view=rev
Author: tfoote
Date: 2008-12-31 19:20:58 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
reverting from boost mutices since they crash in realtime
Modified Paths:
--------------
pkg/trunk/mechanism/mechanism_control/include/mechanism_control/mechanism_control.h
pkg/trunk/mechanism/mechanism_control/manifest.xml
pkg/trunk/mechanism/mechanism_control/src/mechanism_control.cpp
Added Paths:
-----------
pkg/trunk/util/misc_utils/include/misc_utils/mutex_guard.h
Modified: pkg/trunk/mechanism/mechanism_control/include/mechanism_control/mechanism_control.h
===================================================================
--- pkg/trunk/mechanism/mechanism_control/include/mechanism_control/mechanism_control.h 2008-12-31 19:05:53 UTC (rev 8776)
+++ pkg/trunk/mechanism/mechanism_control/include/mechanism_control/mechanism_control.h 2008-12-31 19:20:58 UTC (rev 8777)
@@ -41,7 +41,7 @@
#include <tinyxml/tinyxml.h>
#include <hardware_interface/hardware_interface.h>
#include <mechanism_model/robot.h>
-#include "boost/thread/mutex.hpp"
+#include <rosthread/mutex.h>
#include <mechanism_model/controller.h>
#include <misc_utils/realtime_publisher.h>
#include <misc_utils/advertised_service_guard.h>
@@ -80,7 +80,7 @@
bool initialized_;
const static int MAX_NUM_CONTROLLERS = 100;
- boost::mutex controllers_lock_;
+ ros::thread::mutex controllers_lock_;
controller::Controller* controllers_[MAX_NUM_CONTROLLERS];
std::string controller_names_[MAX_NUM_CONTROLLERS];
Modified: pkg/trunk/mechanism/mechanism_control/manifest.xml
===================================================================
--- pkg/trunk/mechanism/mechanism_control/manifest.xml 2008-12-31 19:05:53 UTC (rev 8776)
+++ pkg/trunk/mechanism/mechanism_control/manifest.xml 2008-12-31 19:20:58 UTC (rev 8777)
@@ -5,7 +5,7 @@
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>http://pr.willowgarage.com</url>
-<depend package="boost"/>
+<depend package="rosthread"/>
<depend package="roscpp" />
<depend package="hardware_interface"/>
<depend package="tinyxml"/>
Modified: pkg/trunk/mechanism/mechanism_control/src/mechanism_control.cpp
===================================================================
--- pkg/trunk/mechanism/mechanism_control/src/mechanism_control.cpp 2008-12-31 19:05:53 UTC (rev 8776)
+++ pkg/trunk/mechanism/mechanism_control/src/mechanism_control.cpp 2008-12-31 19:20:58 UTC (rev 8777)
@@ -29,6 +29,8 @@
*/
#include "mechanism_control/mechanism_control.h"
+#include "rosthread/member_thread.h"
+#include "misc_utils/mutex_guard.h"
#include "rosconsole/rosconsole.h"
using namespace mechanism;
@@ -112,7 +114,7 @@
bool MechanismControl::addController(controller::Controller *c, const std::string &name)
{
- boost::mutex::scoped_lock guard(controllers_lock_);
+ misc_utils::MutexGuard guard(&controllers_lock_);
if (getControllerByName(name))
return false;
Copied: pkg/trunk/util/misc_utils/include/misc_utils/mutex_guard.h (from rev 8726, pkg/trunk/util/misc_utils/include/misc_utils/mutex_guard.h)
===================================================================
--- pkg/trunk/util/misc_utils/include/misc_utils/mutex_guard.h (rev 0)
+++ pkg/trunk/util/misc_utils/include/misc_utils/mutex_guard.h 2008-12-31 19:20:58 UTC (rev 8777)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2008, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Willow Garage, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Author: Stuart Glaser
+ */
+#ifndef MUTEX_GUARD_H
+#define MUTEX_GUARD_H
+
+#include "rosthread/mutex.h"
+
+namespace misc_utils {
+
+class MutexGuard
+{
+public:
+ MutexGuard(ros::thread::mutex *mutex)
+ {
+ assert(mutex);
+ m = mutex;
+ m->lock();
+ }
+
+ ~MutexGuard()
+ {
+ m->unlock();
+ }
+
+private:
+ ros::thread::mutex *m;
+};
+
+}
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rdi...@us...> - 2009-01-05 13:39:17
|
Revision: 8828
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8828&view=rev
Author: rdiankov
Date: 2009-01-05 13:39:12 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
much more robust openrave grasping and manipulation planning scripts, environment cloning works
Modified Paths:
--------------
pkg/trunk/3rdparty/openrave/Makefile
pkg/trunk/openrave_planning/openraveros/src/openraveros.h
pkg/trunk/openrave_planning/openraveros/src/rosserver.h
pkg/trunk/openrave_planning/openraveros/src/session.h
pkg/trunk/openrave_planning/ormanipulation/octave/GetObjectToManipulate.m
pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m
pkg/trunk/openrave_planning/ormanipulation/octave/RobotGoInitial.m
pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m
pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m
pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m
pkg/trunk/openrave_planning/ormanipulation/octave/setclonesession.m
pkg/trunk/openrave_planning/ormanipulation/octave/setrealsession.m
pkg/trunk/openrave_planning/ormanipulation/octave/startup.m
Modified: pkg/trunk/3rdparty/openrave/Makefile
===================================================================
--- pkg/trunk/3rdparty/openrave/Makefile 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/3rdparty/openrave/Makefile 2009-01-05 13:39:12 UTC (rev 8828)
@@ -2,7 +2,7 @@
SVN_DIR = openrave_svn
# Should really specify a revision
-SVN_REVISION = -r 590
+SVN_REVISION = -r 597
SVN_URL = https://openrave.svn.sourceforge.net/svnroot/openrave
include $(shell rospack find mk)/svn_checkout.mk
Modified: pkg/trunk/openrave_planning/openraveros/src/openraveros.h
===================================================================
--- pkg/trunk/openrave_planning/openraveros/src/openraveros.h 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/openraveros/src/openraveros.h 2009-01-05 13:39:12 UTC (rev 8828)
@@ -148,7 +148,7 @@
class SetViewerFunc
{
public:
- virtual bool SetViewer(EnvironmentBase* penv, const string& viewername) = 0;
+ virtual bool SetViewer(EnvironmentBase* penv, const string& viewername, const string& title) = 0;
};
#endif
Modified: pkg/trunk/openrave_planning/openraveros/src/rosserver.h
===================================================================
--- pkg/trunk/openrave_planning/openraveros/src/rosserver.h 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/openraveros/src/rosserver.h 2009-01-05 13:39:12 UTC (rev 8828)
@@ -160,8 +160,8 @@
};
public:
- ROSServer(SetViewerFunc* psetviewer, EnvironmentBase* penv, const string& physicsengine, const string& collisionchecker, const string& viewer)
- : RaveServerBase(penv), _nNextFigureId(1), _nNextPlannerId(1), _nNextProblemId(1) {
+ ROSServer(int nSessionId, SetViewerFunc* psetviewer, EnvironmentBase* penv, const string& physicsengine, const string& collisionchecker, const string& viewer)
+ : RaveServerBase(penv), _nSessionId(nSessionId), _nNextFigureId(1), _nNextPlannerId(1), _nNextProblemId(1) {
_psetviewer.reset(psetviewer);
_bThreadDestroyed = false;
_bCloseClient = false;
@@ -295,8 +295,11 @@
if( viewer.size() == 0 )
return true;
- if( !!_psetviewer )
- return _psetviewer->SetViewer(GetEnv(),viewer);
+ if( !!_psetviewer ) {
+ stringstream ss;
+ ss << "OpenRAVE - session " << _nSessionId;
+ return _psetviewer->SetViewer(GetEnv(),viewer,ss.str());
+ }
_threadviewer.join(); // wait for the viewer
@@ -1551,6 +1554,7 @@
map<int, boost::shared_ptr<PlannerBase> > _mapplanners;
map<int, boost::shared_ptr<ProblemInstance> > _mapproblems;
map<int, boost::shared_ptr<FIGURE> > _mapFigureIds;
+ int _nSessionId;
int _nNextFigureId, _nNextPlannerId, _nNextProblemId;
float _fSimulationTimestep;
Vector _vgravity;
Modified: pkg/trunk/openrave_planning/openraveros/src/session.h
===================================================================
--- pkg/trunk/openrave_planning/openraveros/src/session.h 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/openraveros/src/session.h 2009-01-05 13:39:12 UTC (rev 8828)
@@ -60,8 +60,8 @@
{
public:
SessionSetViewerFunc(SessionServer* pserv) : _pserv(pserv) {}
- virtual bool SetViewer(EnvironmentBase* penv, const string& viewername) {
- return _pserv->SetViewer(penv,viewername);
+ virtual bool SetViewer(EnvironmentBase* penv, const string& viewername, const string& title) {
+ return _pserv->SetViewer(penv,viewername,title);
}
private:
@@ -228,7 +228,7 @@
_penvViewer->AttachViewer(NULL);
}
- bool SetViewer(EnvironmentBase* penv, const string& viewer)
+ bool SetViewer(EnvironmentBase* penv, const string& viewer, const string& title)
{
boost::mutex::scoped_lock lock(_mutexViewer);
@@ -241,6 +241,7 @@
ROS_ASSERT(!_penvViewer);
+ _strviewertitle = title;
_strviewer = viewer;
if( viewer.size() == 0 || !penv )
return false;
@@ -263,7 +264,7 @@
boost::mutex _mutexViewer;
boost::condition _conditionViewer;
EnvironmentBase* _penvViewer;
- string _strviewer;
+ string _strviewer, _strviewertitle;
bool _ok;
@@ -293,6 +294,9 @@
continue;
}
+ if( _strviewertitle.size() > 0 )
+ _pviewer->ViewerSetTitle(_strviewertitle.c_str());
+
_pviewer->main(); // spin until quitfrommainloop is called
boost::mutex::scoped_lock lockcreate(_mutexViewer);
@@ -364,7 +368,7 @@
state._penv.reset(_pParentEnvironment->CloneSelf(0));
}
- state._pserver.reset(new ROSServer(new SessionSetViewerFunc(this), state._penv.get(), req.physicsengine, req.collisionchecker, req.viewer));
+ state._pserver.reset(new ROSServer(id, new SessionSetViewerFunc(this), state._penv.get(), req.physicsengine, req.collisionchecker, req.viewer));
state._penv->AttachServer(state._pserver.get());
_mapsessions[id] = state;
res.sessionid = id;
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/GetObjectToManipulate.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/GetObjectToManipulate.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/GetObjectToManipulate.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -94,5 +94,13 @@
curobj.dests(:,i) = [Rnew(:);pos];
end
+%% scroll through the destinations
+% Tbody = orBodyGetTransform(curobj.id);
+% for i = 1:size(curobj.dests,2)
+% orBodySetTransform(curobj.id,curobj.dests(:,i));
+% pause(0.02);
+% end
+% orBodySetTransform(curobj.id,Tbody);
+
%% for now
outmemory.ignorelist(end+1) = curobj.id;
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -82,7 +82,8 @@
offset = 0.02;
- cmd = ['testallgrasps combinepreshapetraj execute 0 outputtraj palmdir ' sprintf('%f ', handrobot.palmdir) ...
+ cmd = ['testallgrasps execute 0 outputtraj palmdir ' sprintf('%f ', handrobot.palmdir) ...
+ ' seedik 1 seedgrasps 10 seeddests 8 randomdests 1 randomgrasps 1 ' ...
' target ' curobj.info.name ' robothand ' handrobot.name ...
' robothandjoints ' sprintf('%d ', length(handjoints), handjoints) ...
' handjoints ' sprintf('%d ', length(handrobot.handjoints), handrobot.handjoints) ...
@@ -124,7 +125,7 @@
end
% start the trajectory
- success = StartTrajectory(robotid,probs.manip,trajdata);
+ success = StartTrajectory(robotid,trajdata);
if( ~success )
warning('failed to start initial traj');
return;
@@ -136,7 +137,7 @@
if( ~success )
error('failed to movehandstraight');
end
- success = StartTrajectory(robotid,probs.manip,trajdata);
+ success = StartTrajectory(robotid,trajdata);
if( ~success )
warning('failed to move hand straight');
return;
@@ -178,7 +179,7 @@
if( ~success )
error('failed to movehandstraight');
end
- success = StartTrajectory(robotid,probs.manip,trajdata);
+ success = StartTrajectory(robotid,trajdata);
if( ~success )
warning('failed to close fingers');
return;
@@ -199,7 +200,7 @@
%% not going to work well
%ExecuteOnRealSession(@() orProblemSendCommand(['grabbody name ' curobj.info.name], probs.manip));
- success = StartTrajectory(robotid,probs.manip,trajdata);
+ success = StartTrajectory(robotid,trajdata);
if( ~success )
warning('failed to move hand straight');
return;
@@ -224,9 +225,9 @@
if( squeezesuccess > 0 )
display('planning to destination');
- [trajdata,success] = orProblemSendCommand(['MoveToHandPosition execute 0 outputtraj matrices ' sprintf('%d ', size(goaldests,2)) ' sprintf('%f ', goaldests)], probs.manip);
+ [trajdata,success] = orProblemSendCommand(['MoveToHandPosition maxiter 1000 maxtries 1 seedik 4 execute 0 outputtraj matrices ' sprintf('%d ', size(destgoals,2)) sprintf('%f ', destgoals)], probs.manip);
if( success )
- success = StartTrajectory(robotid,probs.manip,trajdata);
+ success = StartTrajectory(robotid,trajdata);
if( ~success )
warning('failed to start trajectory');
return;
@@ -277,7 +278,7 @@
if( ~success )
error('failed to movehandstraight');
end
- success = StartTrajectory(robotid,probs.manip,trajdata);
+ success = StartTrajectory(robotid,trajdata);
if( ~success )
warning('failed to move hand straight');
return;
@@ -297,7 +298,7 @@
error('failed to release fingers');
end
- success = StartTrajectory(robotid,probs.manip,trajdata,4);
+ success = StartTrajectory(robotid,trajdata,4);
if( ~success )
warning('trajectory failed to release fingers');
return;
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/RobotGoInitial.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/RobotGoInitial.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/RobotGoInitial.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -21,7 +21,7 @@
return;
end
-success = StartTrajectory(robotid, probs.manip, trajdata)
+success = StartTrajectory(robotid, trajdata)
if( ~success )
return;
end
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -55,8 +55,11 @@
continue;
end
- %% if found, create a clone
- %setclonesession(openraveros_makeclone(openraveros_openrave_session().CloneBodies()));
+ %% if not simulation, create a clone
+ if( ~simulation )
+ setclonesession(openraveros_makeclone(openraveros_openrave_session().CloneBodies()));
+ scenedata.SetupCloneFn();
+ end
%% try to find the new object
curobj.info = orEnvGetBodies(curobj.id);
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -94,6 +94,7 @@
scenedata.TargetObjPattern = TargetObjPattern;
scenedata.SwitchModelPatterns = SwitchModelPatterns;
scenedata.GetDestsFn = @() GetDests('^willow_table$');
+scenedata.SetupCloneFn = @() SetupClone(robot.name);
updir = [0;0;1];
@@ -156,8 +157,8 @@
X = [];
Y = [];
for x = 0:(Nx-1)
- X = [X 0.5*ones(1,Ny)/(Nx+1) + (x+0.5)/(Nx+1)];
- Y = [Y 0.5*ones(1,Ny)/(Ny+1) + ([0:(Ny-1)]+0.5)/(Ny+1)];
+ X = [X 0.5*rand(1,Ny)/(Nx+1) + (x+1)/(Nx+1)];
+ Y = [Y 0.5*rand(1,Ny)/(Ny+1) + ([0:(Ny-1)]+0.5)/(Ny+1)];
end
offset = [ab(1,1)-ab(1,2);ab(2,1); ab(3,1)+ab(3,2)];
@@ -177,3 +178,17 @@
orEnvClose();
orEnvPlot(dests(10:12,:)','size',10);
+
+function SetupClone(robotname)
+
+global probs
+
+probs.task = orEnvCreateProblem('TaskManipulation',robotname);
+if( isempty(probs.task) )
+ error('failed to create TaskManipulation problem');
+end
+
+probs.manip = orEnvCreateProblem('BaseManipulation',robotname);
+if( isempty(probs.manip) )
+ error('failed to create BaseManipulation problem');
+end
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -1,8 +1,9 @@
-%% success = StartTrajectory(robotid, probid, trajdata)
+%% success = StartTrajectory(robotid, trajdata)
%%
%% Starts a trajectory on the real robot and waits for it, in the end sets the new robot values
%% in the cloned (current) world.
-function success = StartTrajectory(robotid, probid, trajdata,timelimit)
+function success = StartTrajectory(robotid,trajdata,timelimit)
+global probs
if( isempty(trajdata) )
success = 1;
@@ -14,8 +15,15 @@
end
prevsession = openraveros_getglobalsession();
+prevprobs = probs;
setrealsession();
-orProblemSendCommand(['traj stream ' trajdata],probid);
+[out,trajsuc] = orProblemSendCommand(['traj stream ' trajdata],probs.manip);
+if( ~trajsuc )
+ success = 0;
+ setclonesession(prevsession);
+ probs = prevprobs;
+ return;
+end
display('waiting for robot');
success = 1;
@@ -40,4 +48,5 @@
newjointconfig = orBodyGetJointValues(robotid);
setclonesession(prevsession);
+probs = prevprobs;
orBodySetJointValues(robotid,newjointconfig);
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/setclonesession.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/setclonesession.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/setclonesession.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -1,6 +1,6 @@
%% setclonesession(session)
function setclonesession(session)
-global realsession
+global realsession realprobs probs
if( isempty(session) )
error('setting an empty clone');
@@ -9,6 +9,8 @@
if( isempty(realsession) )
%% revert back to the real session
realsession = openraveros_getglobalsession();
+ realprobs = probs;
end
openraveros_setglobalsession(session);
+probs = [];
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/setrealsession.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/setrealsession.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/setrealsession.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -1,9 +1,14 @@
%% setrealsession()
function setrealsession()
-global realsession
+global realsession realprobs probs
if( ~isempty(realsession) )
%% revert back to the real session
openraveros_setglobalsession(realsession);
+
+ if( ~isempty(realprobs) )
+ probs = realprobs;
+ end
+
realsession = [];
end
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/startup.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/startup.m 2009-01-05 05:55:50 UTC (rev 8827)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/startup.m 2009-01-05 13:39:12 UTC (rev 8828)
@@ -15,4 +15,4 @@
openraveros_restart();
orEnvSetOptions('wdims 800 600');
%orEnvSetOptions('collision bullet');
-orEnvSetOptions('debug debug');
+%orEnvSetOptions('debug debug');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jl...@us...> - 2009-01-06 09:05:50
|
Revision: 8875
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8875&view=rev
Author: jleibs
Date: 2009-01-06 09:05:46 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
Overhaul of assorted stereo relating functions due to move of stereoinfo into disparity info and change from byte to uint8.
Modified Paths:
--------------
pkg/trunk/drivers/cam/dcam/src/nodes/check_params.cpp
pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp
pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp
pkg/trunk/image_msgs/include/image_msgs/CvBridge.h
pkg/trunk/image_msgs/include/image_msgs/FillImage.h
pkg/trunk/image_msgs/msg/CamInfo.msg
pkg/trunk/image_msgs/msg/Image.msg
pkg/trunk/image_msgs/msg/RawStereo.msg
pkg/trunk/image_msgs/msg/StereoInfo.msg
pkg/trunk/vision/people/src/face_detection.cpp
pkg/trunk/vision/people/src/stereo_face_color_tracker.cpp
pkg/trunk/vision/people/src/track_starter_gui.cpp
pkg/trunk/vision/stereo_capture/capture.launch
pkg/trunk/vision/stereo_capture/src/stereo_capture.cpp
pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h
pkg/trunk/vision/stereo_image_proc/src/image.cpp
pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp
pkg/trunk/vision/stereo_view/stereo_view.cpp
pkg/trunk/vision/stereo_view/stereo_view_pixel_info.cpp
Added Paths:
-----------
pkg/trunk/drivers/cam/dcam/videre.launch
pkg/trunk/image_msgs/msg/DisparityInfo.msg
Modified: pkg/trunk/drivers/cam/dcam/src/nodes/check_params.cpp
===================================================================
--- pkg/trunk/drivers/cam/dcam/src/nodes/check_params.cpp 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/drivers/cam/dcam/src/nodes/check_params.cpp 2009-01-06 09:05:46 UTC (rev 8875)
@@ -33,7 +33,7 @@
*********************************************************************/
#include "ros/node.h"
-#include "std_srvs/Empty.h"
+#include "std_msgs/Empty.h"
#include <string>
@@ -42,9 +42,15 @@
public:
CheckParams() : ros::node("param_checker")
{
- std_srvs::Empty::request req;
- std_srvs::Empty::response res;
- ros::service::call("stereodcam/check_params", req, res);
+ advertise<std_msgs::Empty>("stereodcam/check_params");
+
+ usleep(100000);
+
+ std_msgs::Empty e;
+
+ publish("stereodcam/check_params", e);
+
+ usleep(100000);
}
};
Modified: pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp
===================================================================
--- pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp 2009-01-06 09:05:46 UTC (rev 8875)
@@ -198,80 +198,62 @@
{
fillImage(img_, "image_raw",
img_data->imHeight, img_data->imWidth, 1,
- "mono", "byte",
+ "mono", "uint8",
img_data->imRaw );
img_.header.stamp = ros::Time().fromNSec(cam_->camIm->im_time * 1000);
publish(base_name + std::string("image_raw"), img_);
- cam_info_.has_image = true;
- } else {
- cam_info_.has_image = false;
}
if (img_data->imType != COLOR_CODING_NONE)
{
fillImage(img_, "image",
img_data->imHeight, img_data->imWidth, 1,
- "mono", "byte",
+ "mono", "uint8",
img_data->im );
img_.header.stamp = ros::Time().fromNSec(cam_->camIm->im_time * 1000);
publish(base_name + std::string("image"), img_);
- cam_info_.has_image = true;
- } else {
- cam_info_.has_image = false;
}
if (img_data->imColorType != COLOR_CODING_NONE && img_data->imColorType == COLOR_CODING_RGB8)
{
fillImage(img_, "image_color",
img_data->imHeight, img_data->imWidth, 3,
- "rgba", "byte",
+ "rgba", "uint8",
img_data->imColor );
img_.header.stamp = ros::Time().fromNSec(cam_->camIm->im_time * 1000);
publish(base_name + std::string("image_color"), img_);
- cam_info_.has_image_color = true;
- } else {
- cam_info_.has_image_color = false;
}
if (img_data->imRectType != COLOR_CODING_NONE)
{
fillImage(img_, "image_rect",
img_data->imHeight, img_data->imWidth, 1,
- "mono", "byte",
+ "mono", "uint8",
img_data->imRect );
img_.header.stamp = ros::Time().fromNSec(cam_->camIm->im_time * 1000);
publish(base_name + std::string("image_rect"), img_);
- cam_info_.has_image_rect = true;
- } else {
- cam_info_.has_image_rect = false;
}
if (img_data->imRectColorType != COLOR_CODING_NONE && img_data->imRectColorType == COLOR_CODING_RGB8)
{
fillImage(img_, "image_rect_color",
img_data->imHeight, img_data->imWidth, 3,
- "rgb", "byte",
+ "rgb", "uint8",
img_data->imRectColor );
img_.header.stamp = ros::Time().fromNSec(cam_->camIm->im_time * 1000);
publish(base_name + std::string("image_rect_color"), img_);
- cam_info_.has_image_rect_color = true;
- } else {
- cam_info_.has_image_rect_color = false;
}
if (img_data->imRectColorType != COLOR_CODING_NONE && img_data->imRectColorType == COLOR_CODING_RGBA8)
{
fillImage(img_, "image_rect_color",
img_data->imHeight, img_data->imWidth, 4,
- "rgba", "byte",
+ "rgba", "uint8",
img_data->imRectColor );
img_.header.stamp = ros::Time().fromNSec(cam_->camIm->im_time * 1000);
publish(base_name + std::string("image_rect_color"), img_);
- cam_info_.has_image_rect_color = true;
- } else {
- cam_info_.has_image_rect_color = false;
}
cam_info_.header.stamp = ros::Time().fromNSec(cam_->camIm->im_time * 1000);
Modified: pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp
===================================================================
--- pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp 2009-01-06 09:05:46 UTC (rev 8875)
@@ -38,26 +38,91 @@
@htmlinclude manifest.html
-stereodcam node uses the parameters:
+Stereodcam is a driver primarily for communicating with the Videre stereocameras.
-- @b ~exposure (int)
-- @b ~gain (int)
-- @b ~brightness (int)
-- @b ~exposure_auto (bool)
-- @b ~gain_auto (bool)
-- @b ~brightness_auto (bool)
-- @b ~companding (bool)
-- @b ~hdr (bool)
-- @b ~unique_check (bool)
-- @b ~texture_thresh (int)
-- @b ~unique_thresh (int)
-- @b ~smoothness_thresh (int)
-- @b ~horopter (int)
-- @b ~speckle_size (int)
-- @b ~speckle_diff (int)
-- @b ~corr_size (int)
-- @b ~num_disp (int)
+<hr>
+@section behavior Behavior
+
+The Stereodcam node outputs a "raw_stereo" message, defined in the
+"image_msgs" package. This message may either contain a left and
+right image, or, in the event of STOC processing, will contain a left
+image and disparity image. It additionally contains the relevant
+intrinsic and extrinsic parameters for computing stereo.
+
+<hr>
+
+@section names Names
+
+The default name for the node is "stereodcam", however, this private
+namespace is not actually used internally to the node. This node
+primarily makes use of the "stereo" namespace, which it shares with
+the "stereoproc" node. This namespace is both where it looks for
+parameters and publishes topics.
+
+The "stereo" name can be remapped through standard topic remapping in
+the event that two cameras are sharing the same ROS system.
+
+<hr>
+
+@par Example
+
+Running in the stereo namespace:
+@verbatim
+$ rosrun dcam stereodcam
+@endverbatim
+
+Running in a different namespace
+@verbatim
+$ rosrun dcam stereodcam stereo:=head_cam
+@endverbatim
+
+<hr>
+
+@section topics Topics
+
+Subscribes to (name/type):
+- @b "stereo/check_params" : std_msgs/Empty : signal to recheck all of the parameters
+
+Publishes to (name : type : description):
+- @b "stereo/raw_stereo" : image_msgs/RawStereo : raw stereo information from camera
+
+<hr>
+
+@section parameters Parameters
+
+The camera will set the following parameters after running:
+- @b stereo/exposure_max (int) : maximum value for exposure
+- @b stereo/exposure_min (int) : maximum value for exposure
+- @b stereo/brightness_max (int) : maximum value for brightness
+- @b stereo/brightness_min (int) : maximum value for brightness
+- @b stereo/gain_max (int) : maximum value for gain
+- @b stereo/gain_min (int) : maximum value for gain
+
+The camera will read from the following parameters:
+- @b stereo/videre_mode (string) : The processing type that a Videre
+ STOC will use. Value can be "none", "rectified", "disparity" or
+ "disparity_raw"
+- @b stereo/fps (double) : Target fps of the camera
+- @b stereo/speed (string) : Firewire isospeed: S100, S200, or S400
+- @b stereo/exposure (int)
+- @b stereo/gain (int)
+- @b stereo/brightness (int)
+- @b stereo/exposure_auto (bool)
+- @b stereo/gain_auto (bool)
+- @b stereo/brightness_auto (bool)
+- @b stereo/companding (bool)
+- @b stereo/hdr (bool)
+- @b stereo/unique_check (bool)
+- @b stereo/texture_thresh (int)
+- @b stereo/unique_thresh (int)
+- @b stereo/smoothness_thresh (int)
+- @b stereo/horopter (int)
+- @b stereo/speckle_size (int)
+- @b stereo/speckle_diff (int)
+- @b stereo/corr_size (int)
+- @b stereo/num_disp (int)
+
**/
@@ -76,7 +141,7 @@
#include <boost/function.hpp>
#include <boost/bind.hpp>
-#include "std_srvs/Empty.h"
+#include "std_msgs/Empty.h"
using namespace std;
@@ -94,6 +159,10 @@
std::map<std::string, int> paramcache_;
+ std_msgs::Empty check_params_msg_;
+
+ std::string stereo_name_;
+
public:
dcam::StereoDcam* stcam_;
@@ -112,28 +181,30 @@
// Register a frequency status updater
diagnostic_.addUpdater( &StereoDcamNode::freqStatus );
+ stereo_name_ = map_name("stereo") + std::string("/");
+
// If there is a camera...
if (num_cams > 0)
{
// Check our gui parameter, or else use first camera
uint64_t guid;
- if (has_param("~guid"))
+ if (has_param(stereo_name_+ std::string("guid")))
{
string guid_str;
- get_param("~guid", guid_str);
+ get_param(stereo_name_ + std::string("guid"), guid_str);
guid = strtoll(guid_str.c_str(), NULL, 16);
} else {
guid = dcam::getGuid(0);
}
- param("~frame_id", frame_id_, string("stereo"));
+ param(stereo_name_ + std::string("frame_id"), frame_id_, string("stereo"));
// Get the ISO speed parameter if available
string str_speed;
dc1394speed_t speed;
- param("~speed", str_speed, string("S400"));
+ param(stereo_name_ + std::string("speed"), str_speed, string("S400"));
if (str_speed == string("S100"))
speed = DC1394_ISO_SPEED_100;
else if (str_speed == string("S200"))
@@ -144,7 +215,7 @@
// Get the FPS parameter if available;
double dbl_fps;
dc1394framerate_t fps;
- param("~fps", dbl_fps, 30.0);
+ param(stereo_name_ + std::string("fps"), dbl_fps, 30.0);
desired_freq_ = dbl_fps;
if (dbl_fps >= 240.0)
fps = DC1394_FRAMERATE_240;
@@ -169,7 +240,7 @@
// Get the videre processing mode if available:
string str_videre_mode;
videre_proc_mode_t videre_mode = PROC_MODE_NONE;
- param("~videre_mode", str_videre_mode, string("none"));
+ param(stereo_name_ + std::string("videre_mode"), str_videre_mode, string("none"));
if (str_videre_mode == string("rectified"))
videre_mode = PROC_MODE_RECTIFIED;
else if (str_videre_mode == string("disparity"))
@@ -185,14 +256,14 @@
// Fetch the camera string and send it to the parameter server if people want it (they shouldn't)
std::string params(stcam_->getParameters());
- set_param("~params", params);
+ set_param(stereo_name_ + std::string("params"), params);
- set_param("~exposure_max", (int)stcam_->expMax);
- set_param("~exposure_min", (int)stcam_->expMin);
- set_param("~gain_max", (int)stcam_->gainMax);
- set_param("~gain_min", (int)stcam_->gainMin);
- set_param("~brightness_max", (int)stcam_->brightMax);
- set_param("~brightness_min", (int)stcam_->brightMin);
+ set_param(stereo_name_ + std::string("exposure_max"), (int)stcam_->expMax);
+ set_param(stereo_name_ + std::string("exposure_min"), (int)stcam_->expMin);
+ set_param(stereo_name_ + std::string("gain_max"), (int)stcam_->gainMax);
+ set_param(stereo_name_ + std::string("gain_min"), (int)stcam_->gainMin);
+ set_param(stereo_name_ + std::string("brightness_max"), (int)stcam_->brightMax);
+ set_param(stereo_name_ + std::string("brightness_min"), (int)stcam_->brightMin);
// Configure camera
stcam_->setFormat(mode, fps, speed);
@@ -203,9 +274,10 @@
stcam_->setSpeckleDiff(10);
stcam_->setCompanding(true);
- advertise<image_msgs::RawStereo>("~raw_stereo", 1);
- advertise_service("~check_params", &StereoDcamNode::checkFeatureService);
+ advertise<image_msgs::RawStereo>(stereo_name_ + std::string("raw_stereo"), 1);
+ subscribe(stereo_name_ + std::string("check_params"), check_params_msg_, &StereoDcamNode::checkParams, 1);
+
// Start the camera
stcam_->start();
@@ -220,11 +292,9 @@
}
- bool checkFeatureService(std_srvs::Empty::request &req,
- std_srvs::Empty::response &res)
+ void checkParams()
{
checkAndSetAll();
- return true;
}
void checkAndSetAll()
@@ -247,14 +317,14 @@
void checkAndSetIntBool(std::string param_name, boost::function<void(int, bool)> setfunc)
{
- if (has_param(std::string("~") + param_name) || has_param(std::string("~") + param_name + std::string("_auto")))
+ if (has_param(stereo_name_ + param_name) || has_param(stereo_name_ + param_name + std::string("_auto")))
{
int val = 0;
bool isauto = false;
- param( std::string("~") + param_name, val, 0);
- param( std::string("~") + param_name + std::string("_auto"), isauto, false);
+ param( stereo_name_ + param_name, val, 0);
+ param( stereo_name_ + param_name + std::string("_auto"), isauto, false);
int testval = (val * (!isauto));
@@ -270,11 +340,11 @@
void checkAndSetBool(std::string param_name, boost::function<bool(bool)> setfunc)
{
- if (has_param(std::string("~") + param_name))
+ if (has_param(stereo_name_ + param_name))
{
bool on = false;
- param(std::string("~") + param_name, on, false);
+ param(stereo_name_ + param_name, on, false);
std::map<std::string, int>::iterator cacheval = paramcache_.find(param_name);
@@ -289,12 +359,12 @@
void checkAndSetInt(std::string param_name, boost::function<bool(int)> setfunc)
{
- if (has_param(std::string("~") + param_name))
+ if (has_param(stereo_name_ + param_name))
{
int val = 0;
- param(std::string("~") + param_name, val, 0);
+ param(stereo_name_ + param_name, val, 0);
std::map<std::string, int>::iterator cacheval = paramcache_.find(param_name);
@@ -331,7 +401,7 @@
}
cam_bridge::StereoDataToRawStereo(stcam_->stIm, raw_stereo_);
- publish("~raw_stereo", raw_stereo_);
+ publish(stereo_name_ + std::string("raw_stereo"), raw_stereo_);
count_++;
return true;
Added: pkg/trunk/drivers/cam/dcam/videre.launch
===================================================================
--- pkg/trunk/drivers/cam/dcam/videre.launch (rev 0)
+++ pkg/trunk/drivers/cam/dcam/videre.launch 2009-01-06 09:05:46 UTC (rev 8875)
@@ -0,0 +1,18 @@
+<launch>
+ <group ns="stereo">
+ <param name="videre_mode" type="str" value="none"/>
+ <param name="exposure" type="int" value="450"/>
+ <param name="exposure_auto" type="bool" value="false"/>
+ <param name="brightness" type="int" value="50"/>
+ <param name="brightness_auto" type="bool" value="false"/>
+ <param name="gain" type="int" value="10"/>
+ <param name="gain_auto" type="bool" value="false"/>
+ <param name="do_colorize" type="bool" value="True"/>
+ <param name="do_rectify" type="bool" value="True"/>
+ <param name="do_stereo" type="bool" value="True"/>
+ <param name="do_calc_points" type="bool" value="True"/>
+ </group>
+ <node pkg="dcam" type="stereodcam" respawn="false"/>
+ <node pkg="stereo_image_proc" type="stereoproc" respawn="false"/>
+</launch>
+
Modified: pkg/trunk/image_msgs/include/image_msgs/CvBridge.h
===================================================================
--- pkg/trunk/image_msgs/include/image_msgs/CvBridge.h 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/image_msgs/include/image_msgs/CvBridge.h 2009-01-06 09:05:46 UTC (rev 8875)
@@ -90,11 +90,11 @@
bool fromImage(Image& rosimg, std::string encoding = "")
{
- if (rosimg.depth == "byte")
+ if (rosimg.depth == "uint8")
{
- cvInitImageHeader(rosimg_, cvSize(rosimg.byte_data.layout.dim[1].size, rosimg.byte_data.layout.dim[0].size),
- IPL_DEPTH_8U, rosimg.byte_data.layout.dim[2].size);
- cvSetData(rosimg_, &(rosimg.byte_data.data[0]), rosimg.byte_data.layout.dim[1].stride);
+ cvInitImageHeader(rosimg_, cvSize(rosimg.uint8_data.layout.dim[1].size, rosimg.uint8_data.layout.dim[0].size),
+ IPL_DEPTH_8U, rosimg.uint8_data.layout.dim[2].size);
+ cvSetData(rosimg_, &(rosimg.uint8_data.data[0]), rosimg.uint8_data.layout.dim[1].stride);
img_ = rosimg_;
} else if (rosimg.depth == "uint16") {
cvInitImageHeader(rosimg_, cvSize(rosimg.uint16_data.layout.dim[1].size, rosimg.uint16_data.layout.dim[0].size),
Modified: pkg/trunk/image_msgs/include/image_msgs/FillImage.h
===================================================================
--- pkg/trunk/image_msgs/include/image_msgs/FillImage.h 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/image_msgs/include/image_msgs/FillImage.h 2009-01-06 09:05:46 UTC (rev 8875)
@@ -88,8 +88,8 @@
if (height_step == 0)
height_step = height_arg * width_step;
- if (image.depth == "byte")
- fillImageHelper(image.byte_data,
+ if (image.depth == "uint8")
+ fillImageHelper(image.uint8_data,
height_arg, height_step,
width_arg, width_step,
channel_arg, channel_step,
@@ -108,16 +108,20 @@
width_arg, width_step,
channel_arg, channel_step,
data_arg);
+ else
+ {
+ return false;
+ }
return true;
}
- bool clearImage(Image& image)
+ void clearImage(Image& image)
{
image.label = "none";
image.encoding = "other";
- if (image.depth == "byte")
- clearImageHelper(image.byte_data);
+ if (image.depth == "uint8")
+ clearImageHelper(image.uint8_data);
else if (image.depth == "uint16")
clearImageHelper(image.uint16_data);
else if (image.depth == "int16")
Modified: pkg/trunk/image_msgs/msg/CamInfo.msg
===================================================================
--- pkg/trunk/image_msgs/msg/CamInfo.msg 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/image_msgs/msg/CamInfo.msg 2009-01-06 09:05:46 UTC (rev 8875)
@@ -2,9 +2,6 @@
# camera namespace and accompanied by up to 5 image topics named:
#
# image_raw, image, image_color, image_rect, and image_rect_color
-#
-# Whether these other topics are being published is defined by
-# the has_* variables within this message.
Header header
@@ -16,10 +13,4 @@
float64[9] R # rectification matrix
float64[12] P # projection/camera matrix
-byte has_image_raw
-byte has_image
-byte has_image_color
-byte has_image_rect
-byte has_image_rect_color
-
-# Should put exposure, gain, etc. information here as well
\ No newline at end of file
+# Should put exposure, gain, etc. information here as well
Added: pkg/trunk/image_msgs/msg/DisparityInfo.msg
===================================================================
--- pkg/trunk/image_msgs/msg/DisparityInfo.msg (rev 0)
+++ pkg/trunk/image_msgs/msg/DisparityInfo.msg 2009-01-06 09:05:46 UTC (rev 8875)
@@ -0,0 +1,22 @@
+# This message defines meta information for a computed disparity image
+
+Header header
+
+uint32 height
+uint32 width
+
+int32 dpp
+int32 num_disp
+int32 im_Dtop
+int32 im_Dleft
+int32 im_Dwidth
+int32 im_Dheight
+int32 corr_size
+int32 filter_size
+int32 hor_offset
+int32 texture_thresh
+int32 unique_thresh
+int32 smooth_thresh
+int32 speckle_diff
+int32 speckle_region_size
+byte unique_check
Modified: pkg/trunk/image_msgs/msg/Image.msg
===================================================================
--- pkg/trunk/image_msgs/msg/Image.msg 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/image_msgs/msg/Image.msg 2009-01-06 09:05:46 UTC (rev 8875)
@@ -14,7 +14,7 @@
# other
string depth # Specifies the depth of the data:
# Acceptable values:
- # byte, uint16, int16, uint32, int32, uint64, int64, float32, float64
+ # uint8, int8, uint16, int16, uint32, int32, uint64, int64, float32, float64
# Based on depth ONE of the following MultiArrays may contain data.
# The multi-array MUST have 3 dimensions, labeled as "height",
@@ -26,7 +26,8 @@
# Height, width, and number of channels are specified in the dimension
# sizes within the appropriate MultiArray
-std_msgs/ByteMultiArray byte_data
+std_msgs/UInt8MultiArray uint8_data
+std_msgs/Int8MultiArray int8_data
std_msgs/UInt16MultiArray uint16_data
std_msgs/Int16MultiArray int16_data
std_msgs/UInt32MultiArray uint32_data
Modified: pkg/trunk/image_msgs/msg/RawStereo.msg
===================================================================
--- pkg/trunk/image_msgs/msg/RawStereo.msg 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/image_msgs/msg/RawStereo.msg 2009-01-06 09:05:46 UTC (rev 8875)
@@ -5,19 +5,21 @@
# used. This is the preferred message to log when generating log
# files, as it is the minimal representation of the information.
-byte NONE=0
-byte IMAGE_RAW=1
-byte IMAGE=2
-byte IMAGE_COLOR=3
-byte IMAGE_RECT=4
-byte IMAGE_RECT_COLOR=5
+uint8 NONE=0
+uint8 IMAGE_RAW=1
+uint8 IMAGE=2
+uint8 IMAGE_COLOR=3
+uint8 IMAGE_RECT=4
+uint8 IMAGE_RECT_COLOR=5
-Header header
-StereoInfo stereo_info
-CamInfo left_info
-byte left_type
-Image left_image
-CamInfo right_info
-byte right_type
-Image right_image
-Image disparity_image
+Header header
+StereoInfo stereo_info
+CamInfo left_info
+uint8 left_type
+Image left_image
+CamInfo right_info
+uint8 right_type
+Image right_image
+uint8 has_disparity
+DisparityInfo disparity_info
+Image disparity_image
Modified: pkg/trunk/image_msgs/msg/StereoInfo.msg
===================================================================
--- pkg/trunk/image_msgs/msg/StereoInfo.msg 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/image_msgs/msg/StereoInfo.msg 2009-01-06 09:05:46 UTC (rev 8875)
@@ -12,23 +12,3 @@
float64[3] T # Pose of right camera in left camera coords
float64[3] Om # rotation vector
float64[16] RP # Reprojection Matrix
-
-int32 dpp
-int32 num_disp
-int32 im_Dtop
-int32 im_Dleft
-int32 im_Dwidth
-int32 im_Dheight
-int32 corr_size
-int32 filter_size
-int32 hor_offset
-int32 texture_thresh
-int32 unique_thresh
-int32 smooth_thresh
-int32 speckle_diff
-int32 speckle_region_size
-byte unique_check
-
-byte has_disparity
-
-# Should put exposure, gain, etc. information here as well
\ No newline at end of file
Modified: pkg/trunk/vision/people/src/face_detection.cpp
===================================================================
--- pkg/trunk/vision/people/src/face_detection.cpp 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/vision/people/src/face_detection.cpp 2009-01-06 09:05:46 UTC (rev 8875)
@@ -43,6 +43,7 @@
#include "CvStereoCamModel.h"
#include <robot_msgs/PositionMeasurement.h>
#include "image_msgs/StereoInfo.h"
+#include "image_msgs/DisparityInfo.h"
#include "image_msgs/CamInfo.h"
#include "image_msgs/Image.h"
#include "image_msgs/CvBridge.h"
@@ -73,6 +74,7 @@
image_msgs::Image limage_; /**< Left image msg. */
image_msgs::Image dimage_; /**< Disparity image msg. */
image_msgs::StereoInfo stinfo_; /**< Stereo info msg. */
+ image_msgs::DisparityInfo dispinfo_; /**< Disparity info msg. */
image_msgs::CamInfo rcinfo_; /**< Right camera info msg. */
image_msgs::CvBridge lbridge_; /**< ROS->OpenCV bridge for the left image. */
image_msgs::CvBridge dbridge_; /**< ROS->OpenCV bridge for the disparity image. */
@@ -131,12 +133,13 @@
// Subscribe to the images and parameters
std::list<std::string> left_list;
- //left_list.push_back(std::string("stereodcam/left/image_rect"));
- left_list.push_back(std::string("stereodcam/left/image_rect_color"));
+ //left_list.push_back(std::string("stereo/left/image_rect"));
+ left_list.push_back(std::string("stereo/left/image_rect_color"));
sync_.subscribe(left_list,limage_,1);
- sync_.subscribe("stereodcam/disparity",dimage_,1);
- sync_.subscribe("stereodcam/stereo_info",stinfo_,1);
- sync_.subscribe("stereodcam/right/cam_info",rcinfo_,1);
+ sync_.subscribe("stereo/disparity",dimage_,1);
+ sync_.subscribe("stereo/stereo_info",stinfo_,1);
+ sync_.subscribe("stereo/disparity_info",dispinfo_,1);
+ sync_.subscribe("stereo/right/cam_info",rcinfo_,1);
sync_.ready();
// Advertise a position measure message.
@@ -260,7 +263,7 @@
double Crx = Clx;
double Cy = rcinfo_.P[6];
double Tx = -rcinfo_.P[3]/Fx;
- cam_model_ = new CvStereoCamModel(Fx,Fy,Tx,Clx,Crx,Cy,1.0/(double)stinfo_.dpp);
+ cam_model_ = new CvStereoCamModel(Fx,Fy,Tx,Clx,Crx,Cy,1.0/(double)dispinfo_.dpp);
if ( cv_image_left_ ) {
im_size = cvGetSize(cv_image_left_);
@@ -338,7 +341,7 @@
if (!cv_image_disp_out_) {
cv_image_disp_out_ = cvCreateImage(im_size,IPL_DEPTH_8U,1);
}
- cvCvtScale(cv_image_disp_,cv_image_disp_out_,4.0/stinfo_.dpp);
+ cvCvtScale(cv_image_disp_,cv_image_disp_out_,4.0/dispinfo_.dpp);
cvShowImage("Face detector: Face Detection",cv_image_left_);
cvShowImage("Face detector: Disparity",cv_image_disp_out_);
Modified: pkg/trunk/vision/people/src/stereo_face_color_tracker.cpp
===================================================================
--- pkg/trunk/vision/people/src/stereo_face_color_tracker.cpp 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/vision/people/src/stereo_face_color_tracker.cpp 2009-01-06 09:05:46 UTC (rev 8875)
@@ -44,6 +44,7 @@
#include "color_calib.h"
#include <robot_msgs/PositionMeasurement.h>
#include "image_msgs/StereoInfo.h"
+#include "image_msgs/DisparityInfo.h"
#include "image_msgs/CamInfo.h"
#include "image_msgs/Image.h"
#include "image_msgs/CvBridge.h"
@@ -70,6 +71,7 @@
image_msgs::Image limage_;
image_msgs::Image dimage_;
image_msgs::StereoInfo stinfo_;
+ image_msgs::DisparityInfo dispinfo_;
image_msgs::CamInfo rcinfo_;
image_msgs::CvBridge lbridge_;
image_msgs::CvBridge dbridge_;
@@ -137,10 +139,11 @@
people_ = new People();
// Subscribe to the images and parameters
- sync_.subscribe("stereodcam/left/image_rect_color",limage_,1);
- sync_.subscribe("stereodcam/disparity",dimage_,1);
- sync_.subscribe("stereodcam/stereo_info",stinfo_,1);
- sync_.subscribe("stereodcam/right/cam_info",rcinfo_,1);
+ sync_.subscribe("stereo/left/image_rect_color",limage_,1);
+ sync_.subscribe("stereo/disparity",dimage_,1);
+ sync_.subscribe("stereo/stereo_info",stinfo_,1);
+ sync_.subscribe("stereo/disparity_info",dispinfo_,1);
+ sync_.subscribe("stereo/right/cam_info",rcinfo_,1);
sync_.ready();
// Advertise a 3d position measurement for each head.
@@ -282,7 +285,7 @@
cv_image_left_ = lbridge_.toIpl();
}
}
- else if (calib_color_ && lcolor_cal_.getFromParam("stereodcam/left/image_rect_color")) {
+ else if (calib_color_ && lcolor_cal_.getFromParam("stereo/left/image_rect_color")) {
// Exit if color calibration hasn't been performed.
do_calib = true;
if (lbridge_.fromImage(limage_,"bgr")) {
@@ -310,7 +313,7 @@
double Crx = Clx;
double Cy = rcinfo_.P[6];
double Tx = -rcinfo_.P[3]/Fx;
- cam_model_ = new CvStereoCamModel(Fx,Fy,Tx,Clx,Crx,Cy,1.0/stinfo_.dpp);
+ cam_model_ = new CvStereoCamModel(Fx,Fy,Tx,Clx,Crx,Cy,1.0/dispinfo_.dpp);
im_size = cvGetSize(cv_image_left_);
@@ -489,7 +492,7 @@
if (!cv_image_disp_out_) {
cv_image_disp_out_ = cvCreateImage(im_size,IPL_DEPTH_8U,1);
}
- cvCvtScale(cv_image_disp_,cv_image_disp_out_,4.0/stinfo_.dpp);
+ cvCvtScale(cv_image_disp_,cv_image_disp_out_,4.0/dispinfo_.dpp);
cvShowImage("Face color tracker: Face Detection", cv_image_left_);
cvShowImage("Face color tracker: Disparity", cv_image_disp_out_);
#endif
Modified: pkg/trunk/vision/people/src/track_starter_gui.cpp
===================================================================
--- pkg/trunk/vision/people/src/track_starter_gui.cpp 2009-01-06 07:08:25 UTC (rev 8874)
+++ pkg/trunk/vision/people/src/track_starter_gui.cpp 2009-01-06 09:05:46 UTC (rev 8875)
@@ -42,6 +42,7 @@
#include "ros/node.h"
#include "image_msgs/StereoInfo.h"
+#include "image_msgs/DisparityInfo.h"
#include "image_msgs/CamInfo.h"
#include "image_msgs/Image.h"
#include "image_msgs/CvBridge.h"
@@ -101,6 +102,7 @@
image_msgs::Image limage_;
image_msgs::Image dimage_;
image_msgs::StereoInfo stinfo_;
+ image_msgs::DisparityInfo dispinfo_;
image_msgs::CamInfo rcinfo_;
image_msgs::CvBridge lbridge_;
image_msgs::CvBridge dbridge_;
@@ -141,12 +143,13 @@
advertise<robot_msgs::PositionMeasurement>("people_tracke...
[truncated message content] |
|
From: <rdi...@us...> - 2009-01-06 10:53:51
|
Revision: 8877
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8877&view=rev
Author: rdiankov
Date: 2009-01-06 10:53:48 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
tweaking of manipulation scripts and data gathering script for laser/camera calibration
Modified Paths:
--------------
pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m
pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m
pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m
pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m
Added Paths:
-----------
pkg/trunk/calibration/laser_camera_calibration/
pkg/trunk/calibration/laser_camera_calibration/gatherdata.py
pkg/trunk/calibration/laser_camera_calibration/manifest.xml
Added: pkg/trunk/calibration/laser_camera_calibration/gatherdata.py
===================================================================
--- pkg/trunk/calibration/laser_camera_calibration/gatherdata.py (rev 0)
+++ pkg/trunk/calibration/laser_camera_calibration/gatherdata.py 2009-01-06 10:53:48 UTC (rev 8877)
@@ -0,0 +1,197 @@
+#!/usr/bin/env python
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of the Willow Garage nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Revision $Id: listener_with_userdata 3059 2008-12-10 00:39:00Z sfkwc $
+
+## Gathers camera, laser, and mechanism state data into chunks
+
+PKG = 'laser_camera_calibration' # this package name
+NAME = 'lasercamera_gatherer'
+
+import rostools; rostools.update_path(PKG)
+
+import sys
+import thread
+from numpy import *
+
+import rospy
+from rostools import rostime
+from std_msgs.msg import LaserScan
+from robot_msgs.msg import MechanismState
+from checkerboard_detector.msg import ObjectDetection
+import copy
+
+class GatherData:
+ objectthresh = 0.005 # meters + scale * quaternion dist
+ publishinterval = rostime.Duration(secs = 0.5)
+
+ def __init__(self, *args):
+ self.laserqueue = []
+ self.robotqueue = []
+ self.objdetqueue = []
+ self.lastpublished = rostime.Time().now()
+ self.mutex = thread.allocate_lock()
+ self.numpublished = 0
+
+ self.pub_objdet = rospy.Publisher("new_ObjectDetection", ObjectDetection)
+ self.pub_laser = rospy.Publisher("new_tile_scan", LaserScan)
+ self.pub_robot = rospy.Publisher("new_mechanism_state", MechanismState)
+ rospy.Subscriber("ObjectDetection", ObjectDetection, self.callback_objdet, 1)
+ rospy.Subscriber("tilt_scan", LaserScan, self.callback_laser, 1)
+ rospy.Subscriber("mechanism_state", MechanismState, self.callback_robot, 1)
+ rospy.init_node(NAME, anonymous=True)
+
+ def pose_dist(self, pose1, pose2):
+ t1 = array([pose1.position.x, pose1.position.y, pose1.position.z])
+ q1 = array([pose1.orientation.x, pose1.orientation.y, pose1.orientation.z, pose1.orientation.w])
+ t2 = array([pose2.position.x, pose2.position.y, pose2.position.z])
+ q2 = array([pose2.orientation.x, pose2.orientation.y, pose2.orientation.z, pose2.orientation.w])
+ return sqrt(sum(t1-t2)**2) + 0.3 * sqrt(sum(q1-q2)**2)
+
+ def get_neighbors(self, msglist, stamp):
+ indices = filter(lambda i: stamp > msglist[i].header.stamp and stamp <= msglist[i+1].header.stamp,range(0,len(msglist)-1))
+ if len(indices) == 0:
+ return None, None
+
+ return msglist[indices[-1]], msglist[indices[-1]+1]
+
+ def insert_msg(self, msglist, msg, dumpinterval):
+ while len(msglist) > 0:
+ # try to reject
+ if msg.header.stamp - msglist[0].header.stamp < dumpinterval:
+ break
+ msglist.pop(0)
+ msglist.append(msg)
+
+ def callback_laser(self, lasermsg, arg):
+ self.mutex.acquire()
+ try:
+ self.insert_msg(self.laserqueue,lasermsg, rostime.Duration(secs = 1))
+ finally:
+ self.mutex.release()
+
+ def callback_robot(self, robotmsg, arg):
+ self.mutex.acquire()
+ try:
+ self.insert_msg(self.robotqueue,robotmsg, rostime.Duration(secs = 0.5))
+ finally:
+ self.mutex.release()
+
+ def callback_objdet(self, objdetmsg, arg):
+ self.mutex.acquire()
+ try:
+ self.insert_msg(self.objdetqueue, objdetmsg, rostime.Duration(secs = 4))
+
+ # test all lists for publishing
+ if rostime.Time().now()-self.lastpublished < self.publishinterval:
+ return
+
+ # return if anything other than one object was detected
+ if not all([len(x.objects)==1 for x in self.objdetqueue ]):
+ return
+
+ # make sure the object type is the same and transformation is close
+ obj = self.objdetqueue[-1].objects[0]
+ if not all([x.objects[0].type==obj.type for x in self.objdetqueue ]):
+ return
+ if not all([self.pose_dist(x.objects[0].pose,obj.pose)<=self.objectthresh for x in self.objdetqueue]):
+ return
+
+ if len(self.laserqueue) < 2 or len(self.robotqueue) < 2:
+ return
+
+ stamp = min(self.objdetqueue[-1].header.stamp, self.laserqueue[-1].header.stamp, self.robotqueue[-1].header.stamp)
+
+ # interpolate scanlines, find two scanlines that are between stamp
+ laserprev, lasernext = self.get_neighbors(self.laserqueue, stamp)
+ objdetprev, objdetnext = self.get_neighbors(self.objdetqueue, stamp)
+ robotprev, robotnext = self.get_neighbors(self.robotqueue, stamp)
+
+ if laserprev is None or objdetprev is None or robotprev is None:
+ return
+
+ # validate robot values
+ jointsprev = array([x.position for x in robotprev.joint_states])
+ jointsnext = array([x.position for x in robotnext.joint_states])
+ robotdtime = (robotnext.header.stamp-stamp).to_seconds()/(robotnext.header.stamp-robotprev.header.stamp).to_seconds()
+ if not len(jointsprev) == len(jointsnext):
+ print "joint lengths different"
+ return
+
+ # validate laser values
+ if not laserprev.angle_min == lasernext.angle_min or not laserprev.angle_max == lasernext.angle_max or not laserprev.angle_increment == lasernext.angle_increment or not laserprev.time_increment == lasernext.time_increment or not laserprev.scan_time == lasernext.scan_time or not laserprev.range_min == lasernext.range_min or not laserprev.range_max == lasernext.range_max:
+ return
+
+ rangesprev = array(laserprev.ranges)
+ rangesnext = array(lasernext.ranges)
+ laserdtime = (lasernext.header.stamp-stamp).to_seconds()/(lasernext.header.stamp-laserprev.header.stamp).to_seconds()
+ if not len(rangesprev) == len(rangesnext):
+ print "ranges different"
+ return
+
+ # validate obj values
+ poseprev = objdetprev.objects[0].pose
+ posenext = objdetnext.objects[0].pose
+ objdetdtime = (objdetnext.header.stamp-stamp).to_seconds()/(objdetnext.header.stamp-objdetprev.header.stamp).to_seconds()
+
+ if robotdtime < 0 or laserdtime < 0 or objdetdtime < 0:
+ print "times are negative, skipping"
+ return
+
+ joints = jointsprev*robotdtime+jointsnext*(1-robotdtime)
+ ranges = rangesprev*laserdtime+rangesnext*(1-laserdtime)
+ pose = posenext # pose changes slow so just pick one
+
+ objdetmsg = copy.copy(self.objdetqueue[-1])
+ objdetmsg.header.stamp = stamp; objdetmsg.objects[0].pose = pose;
+ lasermsg = copy.copy(self.laserqueue[-1]); lasermsg.header.stamp = stamp; lasermsg.ranges = ranges;
+ robotmsg = copy.copy(self.robotqueue[-1]); robotmsg.header.stamp = stamp;
+ for i in range(len(robotmsg.joint_states)):
+ robotmsg.joint_states[i].position = joints[i]
+
+ self.pub_objdet.publish(objdetmsg)
+ self.pub_laser.publish(lasermsg)
+ self.pub_robot.publish(robotmsg)
+
+ self.numpublished = self.numpublished+1
+ print "published ",self.numpublished
+ finally:
+ self.mutex.release()
+
+if __name__ == '__main__':
+ try:
+ gatherer = GatherData()
+ rospy.spin()
+ except KeyboardInterrupt, e:
+ pass
+ print "exiting"
Property changes on: pkg/trunk/calibration/laser_camera_calibration/gatherdata.py
___________________________________________________________________
Added: svn:executable
+ *
Added: pkg/trunk/calibration/laser_camera_calibration/manifest.xml
===================================================================
--- pkg/trunk/calibration/laser_camera_calibration/manifest.xml (rev 0)
+++ pkg/trunk/calibration/laser_camera_calibration/manifest.xml 2009-01-06 10:53:48 UTC (rev 8877)
@@ -0,0 +1,10 @@
+<package>
+ <description>Simultaneous 6D Laser and Camera Calibration</description>
+ <author>Rosen Diankov</author>
+ <license>BSD</license>
+ <review status="unreviewed" notes=""/>
+ <depend package="robot_msgs" />
+ <depend package="std_msgs" />
+ <depend package="rospy"/>
+ <depend package="checkerboard_detector"/>
+</package>
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m 2009-01-06 09:09:20 UTC (rev 8876)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/GraspAndPlaceObject.m 2009-01-06 10:53:48 UTC (rev 8877)
@@ -81,9 +81,9 @@
g = transpose(grasps(curgrasp:end,:));
offset = 0.02;
-
+ basetime = toc;
cmd = ['testallgrasps execute 0 outputtraj palmdir ' sprintf('%f ', handrobot.palmdir) ...
- ' seedik 1 seedgrasps 10 seeddests 8 randomdests 1 randomgrasps 1 ' ...
+ ' seedik 1 seedgrasps 5 seeddests 8 randomdests 1 randomgrasps 1 ' ...
' target ' curobj.info.name ' robothand ' handrobot.name ...
' robothandjoints ' sprintf('%d ', length(handjoints), handjoints) ...
' handjoints ' sprintf('%d ', length(handrobot.handjoints), handrobot.handjoints) ...
@@ -114,7 +114,7 @@
putsuccess=1;
grasp = grasps(curgrasp,:);
- display(['grasp: ' sprintf('%d ', [curgrasp order(curgrasp)]) ]);
+ display(['grasp: ' sprintf('%d ', [curgrasp order(curgrasp)]) ' time: ' sprintf('%fs', toc-basetime)]);
open_config = transpose(grasp(handrobot.grasp.joints));
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m 2009-01-06 09:09:20 UTC (rev 8876)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/RunDynamicGrasping.m 2009-01-06 10:53:48 UTC (rev 8877)
@@ -39,6 +39,7 @@
memory = [];
memory.ignorelist = [];
+tic;
while(1)
orProblemSendCommand('releaseall',probs.manip);
@@ -72,12 +73,13 @@
display(['Grasping ' curobj.info.name ' numdests: ' num2str(size(curobj.dests,2))]);
%% pick up and place one object
+ basetime = toc;
[success, full_solution_index] = GraspAndPlaceObject(robot, curobj, squeeze, MySwitchModels, scenedata.SwitchModelPatterns);
if( success )
- display(sprintf('sucessfully manipulated obj %s', curobj.info.name));
+ display(sprintf('sucessfully manipulated obj %s, total time: %f', curobj.info.name, toc-basetime));
else
- display(sprintf('%s failed', curobj.info.name));
+ display(sprintf('%s failed, total time: %f', curobj.info.name, toc-basetime));
end
% switch back to real
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m 2009-01-06 09:09:20 UTC (rev 8876)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/SetupTableScene.m 2009-01-06 10:53:48 UTC (rev 8877)
@@ -76,7 +76,7 @@
robot.CreateHandFn = @RobotCreatePR2Hand;
robot.testhandname = 'testhand';
-robothome = [0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.582704 1.081165 0.000000 2.299995 -0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.979114 -0.400000 0.000000 1.535151 0.000000 0.000000 0.000000 0.000000 0.000000];
+robothome = orBodyGetJointValues(robot.id);
probs.task = orEnvCreateProblem('TaskManipulation',robot.name);
if( isempty(probs.task) )
Modified: pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m
===================================================================
--- pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m 2009-01-06 09:09:20 UTC (rev 8876)
+++ pkg/trunk/openrave_planning/ormanipulation/octave/StartTrajectory.m 2009-01-06 10:53:48 UTC (rev 8877)
@@ -29,10 +29,10 @@
success = 1;
dowait = 1;
pause(0.3); % pause a little to give a chance for controller to start
-tic;
+basetime = toc;
while(dowait == 1 & (orEnvWait(robotid, 0.05) == 0) )
- if( timelimit > 0 && toc > timelimit )
+ if( timelimit > 0 && toc-basetime > timelimit )
success = 0;
break;
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|