Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to record the ros bag file to use EVO ? #660

Closed
sahilsaqi opened this issue Apr 30, 2024 · 7 comments
Closed

How to record the ros bag file to use EVO ? #660

sahilsaqi opened this issue Apr 30, 2024 · 7 comments

Comments

@sahilsaqi
Copy link

sahilsaqi commented Apr 30, 2024

i am using Ubuntu 20.04 LTS

RplidarA1 , IMU (mpu6050), in raspi -4
ROS Noetic

i have recorded my ros bag file last time and when i tried to ./record_tf_as_posestamped_bag.py --lookup_frequency 15 --output_topic run_1_pose --bagfile run_1.bag map base_link

it is just recording with irregular data inside not providing right data,
i think the problem could be with my ros bag file

my ros bag file includes topics like /scan, /tf, imu , i don't know which topics are required for converting into geometry_msgs/PoseStamped, geometry_msgs/TransformStamped, geometry_msgs/PoseWithCovarianceStamped and nav_msgs/Odometry topics

i am trying to achieve the absolute error, and visualize the trajectory and RMSE values

@MichaelGrupp
Copy link
Owner

my ros bag file includes topics like /scan, /tf, imu

The only topic that would make sense here is /tf, if it contains what you want. Maybe you could try to load the trajectory of the frames that you are interested in? evo can load trajectories from the /tf topic, as explained in the Wiki: https://github.com/MichaelGrupp/evo/wiki/Formats#bag--bag2---ros1ros2-bagfile

For example: evo_traj bag my_data.bag /tf:map.base_link /tf:odom.base_link

@sahilsaqi
Copy link
Author

sahilsaqi commented May 13, 2024

Owner

Thank you for your reply! I changed my file to another one.
I tried a lot! it throws an error, it looks like my ros bag file is not in the correct format I guess, in this file I have topics like /clock, /imu, /scan, /tracked_pose (when I plot this topic only using evo_traj bag evo_traj.bag /tracked_pose --plot command i can see the trajectory path on 3d but i need to compare with ground truth which i don't know how to get), /trajectory_node_list

also can you please tell me do I need to change the format of the file to TUM? when we need to use a TUM format file.

here is my ros bag file
https://drive.google.com/file/d/1WhDmBRDLBp96GJEo8OXpDzRy5QwUeNAW/view?usp=drive_link

and the error is:
` PS C:\Users\AIoTLab-PC04\evo> evo_traj bag cartographer_new_001.bag /tf:map.base_link /tf:odom.base_link
[ERROR] Unhandled error in evo.main_traj
Traceback (most recent call last):
File "C:\Users\AIoTLab-PC04\evo\evo\entry_points.py", line 95, in launch
main_module.run(args)
File "C:\Users\AIoTLab-PC04\evo\evo\main_traj.py", line 194, in run
trajectories, ref_traj = load_trajectories(args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AIoTLab-PC04\evo\evo\main_traj.py", line 105, in load_trajectories
trajectories[topic] = file_interface.read_bag_trajectory(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AIoTLab-PC04\evo\evo\tools\file_interface.py", line 283, in read_bag_trajectory
from evo.tools import tf_cache
File "C:\Users\AIoTLab-PC04\evo\evo\tools\tf_cache.py", line 28, in
import rospy
ModuleNotFoundError: No module named 'rospy'

[ERROR] evo module evo.main_traj crashed - no logfile written (disabled) `

@MichaelGrupp
Copy link
Owner

MichaelGrupp commented May 14, 2024

You wrote that you're using Ubuntu with ROS noetic, but the traceback shows Windows paths...

You'll need a ROS1 installation with ROS noetic to be able to import rospy / tf2, as these modules are needed to load TF messages from bags. Normal topics should also work on Windows without a ROS installation.

@sahilsaqi sahilsaqi changed the title How to record the ros bag file to use EVO How to record the ros bag file to use EVO ? May 17, 2024
@sahilsaqi
Copy link
Author

sahilsaqi commented May 17, 2024

You wrote that you're using Ubuntu with ROS noetic, but the traceback shows Windows paths...

You'll need a ROS1 installation with ROS noetic to be able to import rospy / tf2, as these modules are needed to load TF messages from bags. Normal topics should also work on Windows without a ROS installation.

This Still does not work in Ubuntu environment, always showing this error
I have used another ros file which contains the /tf !
` aiot@ubuntu:~/myproject$ evo_traj bag my_bagfile002.bag /tf:map.base_link /tf:odom.base_link
[ERROR] Unhandled error in evo.main_traj
Traceback (most recent call last):
File "/home/aiot/ros_slam/src/evo/evo/entry_points.py", line 95, in launch
main_module.run(args)
File "/home/aiot/ros_slam/src/evo/evo/main_traj.py", line 194, in run
trajectories, ref_traj = load_trajectories(args)
File "/home/aiot/ros_slam/src/evo/evo/main_traj.py", line 105, in load_trajectories
trajectories[topic] = file_interface.read_bag_trajectory(
File "/home/aiot/ros_slam/src/evo/evo/tools/file_interface.py", line 286, in read_bag_trajectory
return tf_tree_cache.get_trajectory(reader, identifier=topic)
File "/home/aiot/ros_slam/src/evo/evo/tools/tf_cache.py", line 164, in get_trajectory
self.from_bag(reader, topic, static_topic)
File "/home/aiot/ros_slam/src/evo/evo/tools/tf_cache.py", line 102, in from_bag
msg = typestore.deserialize_ros1(rawdata, connection.msgtype)
File "/home/aiot/.local/lib/python3.8/site-packages/rosbags/typesys/store.py", line 192, in deserialize_ros1
msgdef = self.get_msgdef(typename)
File "/home/aiot/.local/lib/python3.8/site-packages/rosbags/typesys/store.py", line 325, in get_msgdef
entries = self.FIELDDEFS[typename][1]
KeyError: 'tf2_msgs/msg/TFMessage'

[ERROR] evo module evo.main_traj crashed - no logfile written (disabled)
aiot@ubuntu:~/myproject$ `

@MichaelGrupp
Copy link
Owner

Can you try to update evo to the latest version in your Ubuntu environment? (either pip install --upgrade evo or git pull etc if you installed from source). After that, evo pkg --version should print v1.28.0.

There was a patch needed recently because of a change in the rosbags interface, this should fix your installation: ee3b7b8

@sahilsaqi
Copy link
Author

sahilsaqi commented May 20, 2024

I tried to Upgrade the Pkg and now its version is v1.28.0, and the command works fine,

But I have another question
I need to compare the ground truth to the estimated one. what topics are required for that?

I don't have a Ground truth topic nor have I generated it.
what i need to do for that ?

@MichaelGrupp
Copy link
Owner

MichaelGrupp commented May 22, 2024

I don't have a Ground truth topic nor have I generated it.
what i need to do for that ?

A ground truth trajectory is a reference trajectory against which you compare your other trajectories. For example, a motion capture system can be used for ground truth. Or some precise GPS for outdoors. But all of this is highly dependent on your setup and your goals, plus you anyway have to do this yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants