远程看摄像头图像很卡
wifi网速问题,可以使用压缩后的图像,效果很不错
rospy开启节点
如果是在子函数内部开启node,子函数退出之后node就没了,如果加上,那么节点就不会退出,主程序还可以继续往下运行
add_thread = threading.Thread(target = thread_job)
add_thread.setDaemon(True)
add_thread.start()
def thread_job():
rospy.spin()
时间戳问题
tf2.ExtrapolationException
tf2.TransformException: Lookup would require extrapolation into the past. Requested time 1576844226.026989698 but the earliest data is at time 1576844226.064086676, when looking u
尝试解决方案:
时间戳的问题,需要将时间戳放到while大循环里面。保持rospy不关闭
没解决
自己摸索发现时时间的问题,注意rospy.Time(0),和rospy.Time.now()的细微区别
参考这里最下面
而且我发现,使用now的时候,虽然我们加了等待时间rospy.Duration(3),这个时间不要设的太小,否则在这个时间内没有建立好转换关系还是会报错,但是在等待的过程中tf似乎并没有干活,因为报的错仍然是第一个data比请求时间晚了零点几秒,而零点几秒显然是小于3秒的。
而且根据这篇文章,还需要注意,循环里外都要加这个wait函数,他们作用不同
注意!!!! 循环外面的wait要用Time,不要用Time.now(),循环里面的可以用now
data时间晚于请求时间报错我能理解,早于还报错我就不能理解了!
我发现同样涉及坐标转换
(a, bb) = trans.lookupTransform('/map', '/base_link', rospy.Time(0))
# goal=trans.transformPose("map",goal)
第一行代码没问题,第二行代码就会报这个错。
我好想知道原因了
goal = PoseStamped()
goal.pose = Pose(Point(22.7, 9.88, 0.000),Quaternion(0.000, 0.000, -0.309, 0.951))
goal.header.frame_id = 'base_link'
goal.header.stamp = rospy.Time(0)
goal = trans.transformPose("/map", goal)
我把这块改成Time(0)就没问题了,难道是因为使用now的时候,必须时间严格相等,小数点后差一点点都不行?但如果使用time(0)会涉及到缓存器里面消息序列的丢弃问题,因为计算机运算以及小车的运动要耗时间,且时间不确定。
发现上面这几行goal的代码其实也可以用now
只是必须加上
goal.header.stamp = rospy.Time.now()
trans.waitForTransform('/map', '/base_link', rospy.Time.now(), rospy.Duration(10))
而且这两行顺序不能反过来,实际上最好写成
goal.header.stamp = rospy.Time.now()
trans.waitForTransform('/map', '/base_link', goal.header.stamp, rospy.Duration(10))
这块写的有点乱,凑活看吧,懒得改了
tf 包里面的listener.py文件,调用的时候最好调用最下面那个reansforListener类,它继承了上面所有方法,最主要的是,父类的一些方法需要用到self.setUsingDedicatedThread(True),但是却没写
“map” passed to lookupTransform argument target_frame does not exist.
使用goal=trans.transformPose("map",goal)
时出现此问题
注意:
A.由于tf的会把监听的内容存放到一个缓存中,然后再读取相关的内容,而这个过程可能会有几毫秒的延迟,也就是,tf的监听器并不能监听到“现在”的变换,所以如果不使用try,catch函数会导致报错:
并且会导致程序挂掉,使用try,catch之后就OK了。
关于pykdl
引入这个包的时候说什么动态链接库的错误,估计和之前一样,需要自己下载源码用3,6编译一下,但是源码没有提供melodic的版本,所以没走这条路,后来下了indigo的版本,发现一样能用3.6编译,melodic一样可以用。所以版本不对也不一定不能用。另外运行的时候查了transformations 的路径,并不是py文件,而是pyc文件,所以自己直接把源码中的某个函数复制过来运行是有问题的。
关于rviz
尽量不要主从机同时开rviz,有些内容似乎会冲突
Display添加的时候尽量从topic下面添加,从by display type 下面添加的内容有时候会出现奇怪的问题
后source的似乎会覆盖先source的空间?
运行cartographer时候报错
ERROR: cannot launch node of type [cartographer_ros/cartographer_node]: can't locate node [cartographer_node] in package [cartographer_ros]
ERROR: cannot launch node of type [cartographer_ros/cartographer_occupancy_grid_node]: can't locate node [cartographer_occupancy_grid_node] in package [cartographer_ros]
process[rviz-4]: started with pid [1729]
process[playbag-5]: started with pid [1740]
[FATAL] [1576053693.421505084]: Error opening file: /home/ubuntu/cartographer_paper_deutsches_museum.bag
[playbag-5] process has died [pid 1740, exit code 1, cmd /opt/ros/kinetic/lib/rosbag/play --clock /home/ubuntu/cartographer_paper_deutsches_museum.bag __name:=playbag __log:=/home/ubuntu/.ros/log/e16aa31c-1bf1-11ea-aeb1-00e04c680194/playbag-5.log].
log file: /home/ubuntu/.ros/log/e16aa31c-1bf1-11ea-aeb1-00e04c680194/playbag-5*.log
[ERROR] [1576053694.199733288]: PluginlibFactory: The plugin for class 'Submaps' failed to load. Error: Could not find library corresponding to plugin Submaps. Make sure the plugin description XML file has the correct name of the library and that the library actually exists.
我手动在终端:
source ~/catkin_ws3/install_isolated/setup.bash
source ~/catkin_ws3/devel_isolated/setup.sh
解决了错误
我在bashrc文件里面明明已经:
source ~/catkin_ws3/install_isolated/setup.bash
source ~/catkin_ws3/devel_isolated/setup.sh
但是可能因为下面我在bashrc中又:
source ~/turbot_ws/devel/setup.bash
source了另一个工作空间,所以原先的空间被覆盖了?
总之尽量一个工程用一个空间,只source需要的空间就不会有问题
安装ros_qtc_plugin,PPA源的问题
教程中需要添加的ppa源明明可以用浏览器打开,但就是ping不同,apt-get update也说什么 404或者 no releas