route_point_inline.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2016, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
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 Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from 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 <COPYRIGHT HOLDER> BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //
00028 // *****************************************************************************
00029 #ifndef SWRI_ROUTE_UTIL_ROUTE_POINT_INLINE_H_
00030 #define SWRI_ROUTE_UTIL_ROUTE_POINT_INLINE_H_
00031 
00032 #include <boost/lexical_cast.hpp>
00033 
00034 namespace swri_route_util
00035 {
00036 inline
00037 void RoutePoint::setPosition(const tf::Vector3 &position)
00038 {
00039   position_ = position;
00040 }
00041 
00042 inline
00043 const tf::Vector3& RoutePoint::position() const
00044 {
00045   return position_;
00046 }
00047 
00048 inline
00049 tf::Vector3& RoutePoint::position()
00050 {
00051   return position_;
00052 }
00053 
00054 inline
00055 void RoutePoint::setPosition(const geometry_msgs::Point &position)
00056 {
00057   tf::pointMsgToTF(position, position_);
00058 }
00059 
00060 inline
00061 const geometry_msgs::Point RoutePoint::positionMsg() const
00062 {
00063   geometry_msgs::Point p;
00064   tf::pointTFToMsg(position_, p);
00065   return p;
00066 }
00067 
00068 inline
00069 void RoutePoint::setOrientation(const tf::Quaternion &orientation)
00070 {
00071   orientation_ = orientation;
00072 }
00073 
00074 inline
00075 const tf::Quaternion& RoutePoint::orientation() const
00076 {
00077   return orientation_;
00078 }
00079 
00080 inline
00081 tf::Quaternion& RoutePoint::orientation()
00082 {
00083   return orientation_;
00084 }
00085 
00086 inline
00087 void RoutePoint::setOrientation(const geometry_msgs::Quaternion &orientation)
00088 {
00089   tf::quaternionMsgToTF(orientation, orientation_);
00090 }
00091 
00092 inline
00093 const geometry_msgs::Quaternion RoutePoint::orientationMsg() const
00094 {
00095   geometry_msgs::Quaternion q;
00096   tf::quaternionTFToMsg(orientation_, q);
00097   return q;
00098 }
00099 
00100 inline
00101 void RoutePoint::setPose(const tf::Pose &pose)
00102 {
00103   setPosition(pose.getOrigin());
00104   setOrientation(pose.getRotation());
00105 }
00106 
00107 inline
00108 tf::Pose RoutePoint::pose() const
00109 {
00110   tf::Pose pose;
00111   pose.setOrigin(position_);
00112   pose.setRotation(orientation_);
00113   return pose;
00114 }
00115 
00116 inline
00117 void RoutePoint::setPose(const geometry_msgs::Pose &pose)
00118 {
00119   setPosition(pose.position);
00120   setOrientation(pose.orientation);
00121 }
00122 
00123 inline
00124 geometry_msgs::Pose RoutePoint::poseMsg() const
00125 {
00126   geometry_msgs::Pose pose;
00127   pose.position = positionMsg();
00128   pose.orientation = orientationMsg();
00129   return pose;
00130 }
00131   
00132 inline
00133 const std::string& RoutePoint::id() const
00134 {
00135   return id_;
00136 }
00137 
00138 inline
00139 void RoutePoint::setId(const std::string &id)
00140 {
00141   id_ = id;
00142 }
00143 
00144 inline
00145 marti_nav_msgs::RoutePosition RoutePoint::routePosition() const
00146 {
00147   marti_nav_msgs::RoutePosition position;
00148   position.id = id();
00149   position.distance = 0.0;
00150   return position;
00151 }
00152 
00153 inline
00154 bool RoutePoint::stopPoint() const
00155 {
00156   return stop_point_;
00157 }
00158 
00159 inline
00160 void RoutePoint::setStopPoint(bool value)
00161 {
00162   stop_point_ = value;
00163 }
00164 
00165 inline
00166 double RoutePoint::stopPointDelay() const
00167 {
00168   return stop_point_delay_;
00169 }
00170 
00171 inline
00172 void RoutePoint::setStopPointDelay(double delay)
00173 {
00174   stop_point_delay_ = delay;
00175 }
00176 
00177 template <typename T>
00178 inline
00179 T RoutePoint::getTypedProperty(const std::string &name) const
00180 {
00181   return boost::lexical_cast<T>(getProperty(name));
00182 }
00183 } // namespace swri_route_util
00184 #endif  // SWRI_ROUTE_UTIL_ROUTE_POINT_INLINE_H_


swri_route_util
Author(s):
autogenerated on Thu Jun 6 2019 20:35:04