-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Problem
As I was following the procedure, I arrived to the point where we should clone another package responsible for plotting the trajectory. I followed the described steps and when running the ros2 launch bme_gazebo_basics spawn_robot.launch.py
command on one terminal, and the ros2 run teleop_twist_keyboard teleop_twist_keyboard
in another terminal, RViz was NOT plotting the trajectory as the robot moved. Moreover, when opening the rqt tool, the "/mogi_trajectory_server" node was not present.
Search for issue
I attempted to open the "trajectory_topic_based.py" and "trajectory.py", and PyLance via VS Code signaled an "unknown module" error for line 7 in "trajectory.py": from bitbots_tf_buffer import Buffer
. I also realized that line 6 in that file was commented out: #from tf2_ros import TransformListener, Buffer
.
Solution
Digging into this issue, I found that line 7 in "trajectory.py" should be commented out and line 6 should actually be used. This is because in line 20, the comment reports: # TF2 Listener
while line 21 reports: self.tf_buffer = Buffer(self)
. This is not a listener implementation. The alternative is that we'd need to import the Duration module from rclpy.duration via the following line of code: from rclpy.duration import Duration
. And then replace line 22 (previously 21 before adding the import mentioned previously) with the following: self.tf_buffer = Buffer(cache_time=Duration(seconds=10))
(where 10 seconds is just a random value that I chose). Then in line 23 we must add the following to have a listener: self.tf_listener = TransformListener(self.tf_buffer, self)
.