ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Time is out of dual 32-bit range vrep_ros_bridge simulation

asked 2018-10-29 10:12:27 -0500

sjoshi13 gravatar image

updated 2021-10-26 14:17:09 -0500

lucasw gravatar image

I followed this link to implement vrep_ros_bridge. I followed all the steps and successfully loaded the quadrotor scene from scenes in vrep_ros_bridge folder in my catkin workspace. However on running the simulation on vrep, it crashes with message

terminate called after throwing an instance of 'std::runtime_error'
  what():  Time is out of dual 32-bit range
./vrep.sh: line 33: 11486 Aborted                 (core dumped) "$dirname/$appname" "${PARAMETERS[@]}"

I'm using ros kinetic and vrep 3.5.

Please help me solve this error. thanks!

edit retag flag offensive close merge delete

Comments

I'm facing the exact same problem. Did you find a solution?

wiktor gravatar image wiktor  ( 2019-03-16 09:34:14 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-10-26 14:09:31 -0500

lucasw gravatar image

updated 2021-10-26 14:15:34 -0500

The the source of the exception is almost certainly right here (which dates from 2014): https://github.com/lagadic/vrep_ros_b...

_lastPrintedMsg = ros::Time(-1.0);

(and possibly there are other instances of bad time initialization in the same package, and there's also an issue where initializing a ros::Duration with an uninitialized double will sometimes result in a Duration is out of dual 32-bit rangedepending on if the uninitialized memory happens to be an acceptable Duration or not https://github.com/ros-controls/ros_c...):

Here's a simple example https://github.com/lucasw/timer_test/...

#include <iostream>
#include <ros/ros.h>

int main()
{
  const auto cur = ros::Time(-1);
/**
 * this will be the result of the above
terminate called after throwing an instance of 'std::runtime_error'
  what():  Time is out of dual 32-bit range
Aborted (core dumped)
*/
  std::cout << cur << std::endl;
  const double sec = cur.toSec();
  std::cout << sec << std::endl;
}

For reference the exception is thrown from here (though for some cases there are some similarly phrased exceptions so it isn't always clear):

https://github.com/ros/roscpp_core/bl...

Maybe a few years and ros versions ago ros::Time(-1) was an unofficial sentinel value? Then it started throwing exceptions but the people encountering the exceptions and the rosccp_core maintainers were too many degrees separated to realize any of this. Or it was cleaned up in major packages that were being actively maintained, but little time bombs are lying around elsewhere.

Ideally something could be done to make it a compiler error (or we should all move to rust...).

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-10-29 10:11:30 -0500

Seen: 269 times

Last updated: Oct 26 '21