billboard.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * \file
00003  *
00004  * $Id: Billboard.h 676 2012-04-19 18:32:07Z xlokaj03 $
00005  *
00006  * Copyright (C) Brno University of Technology
00007  *
00008  * This file is part of software developed by Robo@FIT group.
00009  *
00010  * Author: Tomas Lokaj (xlokaj03@stud.fit.vutbr.cz)
00011  * Supervised by: Michal Spanel (spanel@fit.vutbr.cz)
00012  * Date: 27.11.2011
00013  * 
00014  * This file is free software: you can redistribute it and/or modify
00015  * it under the terms of the GNU Lesser General Public License as published by
00016  * the Free Software Foundation, either version 3 of the License, or
00017  * (at your option) any later version.
00018  * 
00019  * This file is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU Lesser General Public License for more details.
00023  * 
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this file.  If not, see <http://www.gnu.org/licenses/>.
00026  */
00027 
00028 #pragma once
00029 #ifndef BILLBOARD_H_
00030 #define BILLBOARD_H_
00031 
00032 #include "primitive.h"
00033 #include <srs_interaction_primitives/BillboardType.h>
00034 #include <OGRE/OgreVector3.h>
00035 #include <OGRE/OgreMatrix3.h>
00036 #include <OGRE/OgreQuaternion.h>
00037 
00038 #define PREDICTIONS_COUNT 3
00039 #define PREDICTION_SPHERE_SIZE 0.1
00040 
00041 namespace srs_interaction_primitives
00042 {
00053 class Billboard : public Primitive
00054 {
00055 public:
00062   Billboard(InteractiveMarkerServerPtr server, std::string frame_id, std::string name);
00063 
00068   void setType(int type);
00069 
00074   int getType();
00075 
00079   void insert();
00080 
00085   double getVelocity()
00086   {
00087     if (primitive_type_ != srs_interaction_primitives::PrimitiveType::BILLBOARD)
00088       ROS_WARN("This is object is not a billboard, you cannot get velocity!");
00089     return velocity_;
00090   }
00091 
00096   void setDirection(geometry_msgs::Quaternion direction)
00097   {
00098     if (primitive_type_ != srs_interaction_primitives::PrimitiveType::BILLBOARD)
00099     {
00100       ROS_WARN("This is object is not a billboard, you cannot set direction!");
00101       return;
00102     }
00103 
00104     geometry_msgs::Quaternion direction_change;
00105     direction_change.x = direction.w - direction_.x;
00106     direction_change.y = direction.y - direction_.y;
00107     direction_change.z = direction.z - direction_.z;
00108     direction_change.w = direction.w - direction_.w;
00109 
00110     updatePublisher_->publishMovementChanged(direction, direction_change, velocity_, 0.0f);
00111 
00112     direction_ = direction;
00113   }
00114 
00119   geometry_msgs::Quaternion getDirection()
00120   {
00121     if (primitive_type_ != srs_interaction_primitives::PrimitiveType::BILLBOARD)
00122       ROS_WARN("This is object is not a billboard, you cannot get direction!");
00123     return direction_;
00124   }
00125 
00130   void setVelocity(double velocity)
00131   {
00132     if (primitive_type_ != srs_interaction_primitives::PrimitiveType::BILLBOARD)
00133     {
00134       ROS_WARN("This is object is not a billboard, you cannot set velocity!");
00135       return;
00136     }
00137     updatePublisher_->publishMovementChanged(direction_, geometry_msgs::Quaternion(), velocity, velocity - velocity_);
00138     velocity_ = velocity;
00139   }
00140 
00144   void addTrajectoryControls();
00145 
00149   void removeTrajectoryControls();
00150 
00154   void updateControls();
00155 
00159   void menuCallback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &);
00160 
00161 private:
00162   // Billboard's attributes
00163   double velocity_;
00164   geometry_msgs::Quaternion direction_;
00165   int billboard_type_;
00166   visualization_msgs::Marker mesh_;
00167 
00168   void create();
00169   void createMenu();
00170   void createMesh();
00171   void addTrajectoryPredictionMarkers();
00172   void removeTrajectoryPredictionMarkers();
00173 };
00174 }
00175 #endif /* BILLBOARD_H_ */


srs_interaction_primitives
Author(s): Tomas Lokaj, Michal Spanel (spanel@fit.vutbr.cz)
autogenerated on Mon Oct 6 2014 07:55:11