cart_state_estimator.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  *
00029  */
00030 
00031 /*
00032  * cart_state_estimator.h
00033  *
00034  *  Created on: Aug 6, 2010
00035  *      Author: jscholz
00036  */
00037 
00038 #ifndef CART_STATE_ESTIMATOR_H_
00039 #define CART_STATE_ESTIMATOR_H_
00040 
00041 #include <manipulation_transforms/manipulation_transforms_ros.h>
00042 #include <tf/transform_broadcaster.h>
00043 #include <tf/transform_listener.h>
00044 #include <tf/exceptions.h>
00045 #include <geometry_msgs/PolygonStamped.h>
00046 #include <ros/ros.h>
00047 #include <ros/time.h>
00048 #include <string>
00049 #include <boost/optional.hpp>
00050 #include <boost/thread.hpp>
00051 #include <boost/format.hpp>
00052 
00053 namespace cart_state_estimator {
00054 
00055 namespace gm=geometry_msgs;
00056 using std::string;
00057 using ros::WallDuration;
00058 using ros::Duration;
00059 using ros::WallTimerEvent;
00060 using tf::StampedTransform;
00061 using boost::optional;
00062 using ros::Time;
00063 using boost::format;
00064 
00065 typedef tf::Stamped<tf::Pose> StampedPose;
00066 typedef boost::mutex::scoped_lock Lock;
00067 
00068 class CartStateEstimator {
00069 public:
00070 
00071         CartStateEstimator();
00072 
00073 private:
00074 
00075         void publishState(const ros::WallTimerEvent& e);
00076         StampedTransform computeCartFrame(const StampedPose& left,
00077                         const StampedPose& right) const;
00078         void broadcastCartPose(const string& frame, const btTransform& trans);
00079         btTransform cartPoseFromCheckerboard(const btTransform& cb_pose) const;
00080         gm::PolygonStamped getProjectedFootprint() const;
00081 
00082         const double cart_width_;
00083         const double cart_length_;
00084         const string l_gripper_frame_, r_gripper_frame_;
00085         const bool publish_fake_transforms_;
00086         const geometry_msgs::PolygonStamped footprint_;
00087         const double footprint_x_offset_, footprint_y_offset_;
00088         const double publication_interval_;
00089         const double transform_recency_threshold_;
00090 
00091         const btTransform cart_to_board_;
00092 
00093         boost::mutex mutex_;
00094         ros::NodeHandle nh_;
00095         tf::TransformListener tf_listener_;
00096         tf::TransformBroadcaster tf_broadcaster_;
00097         ros::WallTimer pub_timer_;
00098         ros::Publisher footprint_pub_;
00099         ros::ServiceClient effector_to_cart_client_;
00100         ros::ServiceClient set_solver_transforms_client_;
00101 };
00102 } // namespace cart_state_estimator
00103 
00104 #endif /* CART_STATE_ESTIMATOR_H_ */


cart_state_estimator
Author(s): Bhaskara Marthi
autogenerated on Tue Jan 7 2014 11:12:52