Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wp-statistics domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/robotattractor/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the jetpack domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/robotattractor/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the updraftplus domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/robotattractor/wp-includes/functions.php on line 6114
ROS常见错误和问题汇总 – 机器人家园

1 topic名不一致

  如果你的topic名中包含空格,例如将

ros::Subscriber odom_sub = nh.subscribe("/odometry", 10, odomCallback);

  写成了下面的样子(/odometry后面多了个空格)。

ros::Subscriber odom_sub = nh.subscribe("/odometry ", 10, odomCallback);

  那么编译会成功,但是运行会崩溃,报以下错误。

terminate called after throwing an instance of 'ros::InvalidNameException'
  what():  Character [ ] at element [9] is not valid in Graph Resource Name [/odometry ].  Valid characters are a-z, A-Z, 0-9, / and _.

2 节点名包含空格

  如果节点名中包含空格,例如下面的例子,"Model Predict Control"中有空格,那么编译也会通过但是运行时会报错。所以,不要带空格,可以用下划线替代。

ros::init(argc, argv, "Model Predict Control");

3 四元数不初始化

  如果你仅仅定义了四元数但是忘了初始化或者赋值,那么后面在使用的时候如果用tf::getYaw函数获取角度显然会报错。此时tf::getYaw函数会返回一个nan值,如果你不作判断可能会引发一系列错误。

4 不要把advertise写在循环里

  在调试 hbanzhaf / steering_functions 包时,错误的把类的实例化放在循环里了,但是类里有个advertise,所以效果相当于以下代码:

 while (ros::ok())
  {
    pub_path_ = nh.advertise("/path", 10);
    ros::spinOnce();
    loop_rate.sleep();
  }

  表现就是输出非常奇怪,一会有一会没有,什么时候有也没准。所以使用advertise的只能声明一次,不要声明多次。

5 package路径有中文

  如果工作空间或者子文件夹包含中文,直接用rosrun运行节点不会报错,但是用roslaunch启动会报错Value error: 'ascii' codec can't decode byte 0xe5 in position 8: ordinal not in range(128),如下图所示。

6 rviz坐标系

  Rviz中的固定坐标系(Fixed Frame)顾名思义,就是显示在屏幕上不会动的那个坐标系。固定坐标系一般设置为地图map坐标系,因为地图跟地球固定,它显然不会动,因此在map坐标系中表示的地图点云数据等等也不会动。如果你这样设置了但是点云地图还是有晃动那可能是因为你把右边栏中的Target Frame设置成一个移动的坐标系了(例如base_link),把它改成map以后地图点云就不会动了。
  

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注