在ROS中使用ros::Time和ros::Duration时出现了如下错误:
terminate called after throwing an instance of 'ros::TimeNotInitializedException'
what(): Cannot use ros::Time::now() before the first NodeHandle has been created or ros::start() has been called. If this is a standalone app or test that just uses ros::Time and does not communicate over ROS, you may also call ros::Time::init()
已放弃 (核心已转储)
解决方案:
在建立ros::Time和ros::Duration对象之前,采用ros::Time::init();语句进行初始化。
欢迎关注我的公众号:
编程技术与生活(ID:hw_cchang)