moveit / moveit_ros

THIS REPO HAS MOVED TO https://github.com/ros-planning/moveit
70 stars 118 forks source link

Rviz crashes with RobotState Display #415

Open danielmaier opened 10 years ago

danielmaier commented 10 years ago

I recently experienced more crashes than usual of Rviz and I think they are related to the moveit_ros_visualization/RobotState display. 3-5 months ago, I have not observed this problem but I also have not used Moveit since a few days ago.

Even tough the problem occured with my own robot/moveit config, it can be reproduced with the PR2 moveit configs/tutorials. To do so:

roslaunch pr2_moveit_config demo.launch

add a new RobotState display or use the one inside the MotionPlanning Display and set the topic to /tutorial_robot_state

 roslaunch pr2_moveit_tutorials state_display_tutorial.launch

--> Rviz will crash with the error message

   rviz: /build/buildd/ogre-1.7.4/OgreMain/include/OgreAxisAlignedBox.h:252: void Ogre::AxisAlignedBox::setExtents(const Ogre::Vector3&, const Ogre::Vector3&): Assertion `(min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"' failed.

If it does not crash, uncheck and re-check the Display and call the state_display_tutorial.launch again. Repeat multiple times and at some point, Rviz will crash.

My system is up to date with ROS hydro and ubuntu 12.04 64 bit. I also checked that the capability move_group/MoveGroupGetPlanningSceneService is present in the move_group.launch file.

Especially unchecking und re-checking the RobotState Display seems to cause problems (i.e. rivz crashes). With my robot config, I often observe a crash and this error message:

 rviz: /build/buildd/ogre-1.7.4/OgreMain/src/OgreNode.cpp:413: virtual void Ogre::Node::setPosition(const Ogre::Vector3&): Assertion `!pos.isNaN() && "Invalid vector supplied as parameter"' failed.
kivrakh commented 9 years ago

Have you fixed the problem? I have the same problem right now.

kivrakh commented 9 years ago

Finally i fixed this problem.

The solution is the virtual_joint Joint Type which we create in moveit setup assistant should be set to fixed or you should set the robot initial positions for grid in RVIZ. As far as i understand initially it sets a robot position in the grid and when the robot position is outside of the grid RVIZ crashes.

davetcoleman commented 9 years ago

Do you have an idea of what needs to be changed in the code to prevent this problem in the future?

hersh commented 9 years ago

Ogre tends to use assertions to enforce valid numeric values. This may be what you want in games, which is what Ogre is written for.

In RViz, we receive data from many unknown sources, and we run 3rd-party plugins. We really don't want it to crash like this whenever someone forgot to initialize something or when their math has a singularity.

The proper solution, in my mind, is to go through all of RViz source and replace every instance of scene_node->setPosition(pos) with some wrapper function like safeSetPosition(scene_node, pos), where "safeSetPosition()" looks like:

if(isfinite(pos.x) && isfinite(pos.y) && isfinite(pos.z))
{
  scene_node->setPosition(pos);
}

And of course also setOrientation() needs to be wrapped as well, and possibly other functions.

Unfortunately, RViz exposes the Ogre APIs to plugin writers, so there is no way to prevent plugin writers from causing this.

Huh, just read this thread: http://www.ogre3d.org/forums/viewtopic.php?t=40634

They argue both ways for and against the assertions, mostly "for". The other thing to notice is that they say the assertions only happen when ogre is compiled in debug mode. Maybe we can change rviz to use a release version of Ogre?