1 #include <OgreSceneNode.h> 
    2 #include <OgreSceneManager.h> 
   12 #include <boost/foreach.hpp> 
   17 template <
class MessageType>
 
   22 template <
class MessageType>
 
   29 constexpr 
const char* linear<geometry_msgs::WrenchStamped>()
 
   34 constexpr 
const char* angular<geometry_msgs::WrenchStamped>()
 
   41 template <
class MessageType>
 
   44   auto lin = linear<MessageType>();
 
   45   auto ang = angular<MessageType>();
 
   46   linear_color_property_ =
 
   47       new ColorProperty(QString(
"%1 Color").arg(lin), QColor(204, 51, 51),
 
   48                         QString(
"Color to draw the %1 arrows.").arg(QString(lin).toLower()), 
this);
 
   52   angular_color_property_ =
 
   53       new ColorProperty(QString(
"%1 Color").arg(ang), QColor(204, 204, 51),
 
   54                         QString(
"Color to draw the %1 arrows.").arg(QString(ang).toLower()), 
this);
 
   59       new FloatProperty(
"Alpha", 1.0, 
"0 is fully transparent, 1.0 is fully opaque.", 
this);
 
   63   linear_scale_property_ = 
new FloatProperty(QString(
"%1 Arrow Scale").arg(lin), 2.0,
 
   64                                              QString(
"%1 arrow scale").arg(lin), 
this);
 
   68   angular_scale_property_ = 
new FloatProperty(QString(
"%1 Arrow Scale").arg(ang), 2.0,
 
   69                                               QString(
"%1 arrow scale").arg(ang), 
this);
 
   73   width_property_ = 
new FloatProperty(
"Arrow Width", 0.5, 
"arrow width", 
this);
 
   77   history_length_property_ =
 
   78       new IntProperty(
"History Length", 1, 
"Number of prior measurements to display.", 
this);
 
   82   hide_small_values_property_ = 
new BoolProperty(
"Hide Small Values", 
true, 
"Hide small values", 
this);
 
   86   history_length_property_->setMin(1);
 
   87   history_length_property_->setMax(100000);
 
   91 template <
class MessageType>
 
   95   updateHistoryLength();
 
   99 template <
class MessageType>
 
  106 template <
class MessageType>
 
  109   float alpha = alpha_property_->getFloat();
 
  110   float linear_scale = linear_scale_property_->getFloat();
 
  111   float angular_scale = angular_scale_property_->getFloat();
 
  112   float width = width_property_->getFloat();
 
  113   bool hide_small_values = hide_small_values_property_->getBool();
 
  114   Ogre::ColourValue linear_color = linear_color_property_->getOgreColor();
 
  115   Ogre::ColourValue angular_color = angular_color_property_->getOgreColor();
 
  117   for (
size_t i = 0; i < visuals_.size(); i++)
 
  119     visuals_[i]->setLinearColor(linear_color.r, linear_color.g, linear_color.b, alpha);
 
  120     visuals_[i]->setAngularColor(angular_color.r, angular_color.g, angular_color.b, alpha);
 
  121     visuals_[i]->setLinearScale(linear_scale);
 
  122     visuals_[i]->setAngularScale(angular_scale);
 
  123     visuals_[i]->setWidth(width);
 
  124     visuals_[i]->setHideSmallValues(hide_small_values);
 
  129 template <
class MessageType>
 
  132   visuals_.rset_capacity(history_length_property_->getInt());
 
  136 template <
class MessageType>
 
  138                                                       const geometry_msgs::Vector3& 
linear,
 
  139                                                       const geometry_msgs::Vector3& 
angular)
 
  144                        "Message contained invalid floating point values (nans or infs)");
 
  151   Ogre::Quaternion orientation;
 
  152   Ogre::Vector3 position;
 
  156     ROS_DEBUG(
"Error transforming from frame '%s' to frame '%s'", 
header.frame_id.c_str(),
 
  166     visual = visuals_.front();
 
  175   visual->setFramePosition(position);
 
  176   visual->setFrameOrientation(orientation);
 
  177   float alpha = alpha_property_->getFloat();
 
  178   Ogre::ColourValue linear_color = linear_color_property_->getOgreColor();
 
  179   Ogre::ColourValue angular_color = angular_color_property_->getOgreColor();
 
  180   visual->setLinearColor(linear_color.r, linear_color.g, linear_color.b, alpha);
 
  181   visual->setAngularColor(angular_color.r, angular_color.g, angular_color.b, alpha);
 
  182   visual->setLinearScale(linear_scale_property_->getFloat());
 
  183   visual->setAngularScale(angular_scale_property_->getFloat());
 
  184   visual->setWidth(width_property_->getFloat());
 
  185   visual->setHideSmallValues(hide_small_values_property_->getBool());
 
  188   visuals_.push_back(visual);