当前位置:网站首页>The problem and possible causes of the robot's instantaneous return to the origin of the world coordinate during rviz simulation

The problem and possible causes of the robot's instantaneous return to the origin of the world coordinate during rviz simulation

2022-07-06 08:35:00 Will_ Ye

1. Problem

During the simulation , Originally, the robot was normally controlled to move , But suddenly the robot instantly returned to the origin of the world coordinates , Break through all restrictions .
At this time, some variables in the algorithm should be calculated nan, Then the equation for calculating the velocity uses this band nan The numerical , And get nan Value , adopt /cmd_vel This topic Send it to the robot , Cause the robot to return to the origin in an instant

2. Solution

At this time, you can only reverse check in the code , from cmd_vel Step by step, check the data of , Set a judgment nan The sentence of , Slowly check which variable is wrong , as follows :

if(isnan(inter_the[2]))
cout <<"nan appear!"<<endl;

Cause these variables to become nan There are so many reasons , Many are basic computational logic problems , It's easy to do as long as you locate it , Sometimes, for example, give a function input The variable of has a 0, And this 0 Used as denominator , That's the problem .

This is just right Rviz A possible analysis of an abnormal phenomenon during simulation , I have encountered this problem several times , It's all because of nan As a result of speed , So just find out nan Where you can quickly fix This bug.

原网站

版权声明
本文为[Will_ Ye]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060822255402.html