Skip to content

Commit

Permalink
add more verbose warnings
Browse files Browse the repository at this point in the history
... as suggested in ros-visualization#1182
  • Loading branch information
rhaschke committed Jan 3, 2018
1 parent 76e3a52 commit 99d4096
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/rviz/default_plugin/covariance_visual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,10 @@ void CovarianceVisual::setCovariance( const geometry_msgs::PoseWithCovariance& p

// store orientation in Ogre structure
Ogre::Quaternion ori;
if (!normalizeQuaternion(pose.pose.orientation, ori))
ROS_WARN("Invalid quaternion (zero length)");
if (!normalizeQuaternion(pose.pose.orientation, ori)) {
ROS_WARN_ONCE_NAMED("quaternions", "Covariance contains invalid quaternion (zero length)");
ROS_DEBUG_NAMED("quaternions", "Covariance contains invalid quaternion (zero length)");
}

// Set the orientation of the fixed node. Since this node is attached to the root node, it's orientation will be the
// inverse of pose's orientation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ bool InteractiveMarker::processMessage( const visualization_msgs::InteractiveMar
message.pose.position.y,
message.pose.position.z );

if (!normalizeQuaternion(message.pose.orientation, orientation_))
ROS_WARN("Invalid quaternion (zero length)");
if (!normalizeQuaternion(message.pose.orientation, orientation_)) {
ROS_WARN_ONCE_NAMED("quaternions", "Interactive marker '%s' contains invalid quaternion (zero length)", name_.c_str());
ROS_DEBUG_NAMED("quaternions", "Interactive marker '%s' contains invalid quaternion (zero length)", name_.c_str());
}

pose_changed_ =false;
time_since_last_feedback_ = 0;
Expand Down
11 changes: 7 additions & 4 deletions src/rviz/default_plugin/pose_array_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ namespace
return Ogre::Vector3( point.x, point.y, point.z );
}

Ogre::Quaternion quaternionRosToOgre( geometry_msgs::Quaternion const & quaternion )
Ogre::Quaternion quaternionRosToOgre( geometry_msgs::Quaternion const & quaternion, const char* topic )
{
Ogre::Quaternion q;
if (!normalizeQuaternion(quaternion, q))
ROS_WARN("Invalid quaternion (zero length)");
if (!normalizeQuaternion(quaternion, q)) {
ROS_WARN_ONCE_NAMED("quaternions", "Invalid quaternion (zero length) in PoseArray msg received on topic: %s", topic);
ROS_DEBUG_NAMED("quaternions", "Invalid quaternion (zero length) in PoseArray msg received on topic: %s", topic);
}
return q;
}
}
Expand Down Expand Up @@ -151,11 +153,12 @@ void PoseArrayDisplay::processMessage( const geometry_msgs::PoseArray::ConstPtr&
return;
}

const char* topic = topic_property_->getTopicStd().c_str();
poses_.resize( msg->poses.size() );
for (std::size_t i = 0; i < msg->poses.size(); ++i)
{
poses_[i].position = vectorRosToOgre( msg->poses[i].position );
poses_[i].orientation = quaternionRosToOgre( msg->poses[i].orientation );
poses_[i].orientation = quaternionRosToOgre( msg->poses[i].orientation, topic );
}

updateDisplay();
Expand Down

0 comments on commit 99d4096

Please sign in to comment.