rosrun tf view_frames时报错TypeError: cannot use a string pattern on a bytes-likeobject

Foreword: I am still learning the ROS+ drone framework,,,
For more updated articles, please see my personal blog homepage[ Go to]

Wrong process

root@laohanba-NUC11TNKi7:~/Doc# rosrun tf view_frames 
Listening to /tf for 5.0 seconds
Done Listening
b'dot - graphviz version 2.43.0 (0)\n'
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/tf/view_frames", line 119, in <module>
    generate(dot_graph)
  File "/opt/ros/noetic/lib/tf/view_frames", line 89, in generate
    m = r.search(vstr)
TypeError: cannot use a string pattern on a bytes-like object

Solution

Modify/opt/ros/noetic/lib/tf/view_framescode in file

The file path may be different,noeticdepend on your ownROSVersion to be modified

sudo vim /opt/ros/noetic/lib/tf/view_frames

Add the following line at about line 89

Insert image description here

vstr = str(vstr)

Run it again and the coordinate system file will be generated normally.

root@laohanba-NUC11TNKi7:~/Doc# rosrun tf view_frames 
Listening to /tf for 5.0 seconds
Done Listening
b'dot - graphviz version 2.43.0 (0)\n'
Detected dot version 2.43
frames.pdf generated

Guess you like

Origin blog.csdn.net/qq_45516773/article/details/131896738