geturin / OAFD_Monocular

Master Thesis
MIT License
46 stars 7 forks source link

rosrun oafd path_following.py error #13

Open DigitalDungeon01 opened 3 months ago

DigitalDungeon01 commented 3 months ago

i got a problem with pat_following.py

Traceback (most recent call last): File "/home/arief/FYPworkspaces/catkin_ws_OAFD/src/OAFD_Monocular/src/simple_tf.py", line 29, in get_transformation self.transformation = self.tf_buffer.lookup_transform(self.target_frame, File "/opt/ros/noetic/lib/python3/dist-packages/tf2_ros/buffer.py", line 90, in lookup_transform return self.lookup_transform_core(target_frame, source_frame, time) tf2.LookupException: "tello" passed to lookupTransform argument target_frame does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/arief/FYPworkspaces/catkin_ws_OAFD/src/OAFD_Monocular/src/path_following.py", line 78, in tello_origin = tf_linster.transform_pose(origin) File "/home/arief/FYPworkspaces/catkin_ws_OAFD/src/OAFD_Monocular/src/simple_tf.py", line 47, in transform_pose self.get_transformation()
File "/home/arief/FYPworkspaces/catkin_ws_OAFD/src/OAFD_Monocular/src/simple_tf.py", line 33, in get_transformation rospy.logerr('Unable to find the transformation from %s to %s' TypeError: not enough arguments for format string

my steps that i produce this error :

  1. Record bag files
  2. Launch Tello_node.py
  3. Stop bag files 4.Disconnect Tello
  4. Start roslaunch oafd slam.launch
  5. Play bag file
  6. Ctrl+c (stop) after doing orb slam
  7. Connect to tello back.
  8. run rosrun oafd path_following.py
  9. Error
DigitalDungeon01 commented 3 months ago

image image

DigitalDungeon01 commented 3 months ago

IMG_20240527_164739 And what topic did you select in order to generate like costmap like you did?. Because when i click on select. There is no map option that showed on my selection

geturin commented 3 months ago

The error in path_following.py is due to the lack of a transformation relationship between the map and Tello coordinate. The Tello coordinate system is transformed from the camera coordinate . https://github.com/geturin/OAFD_Monocular/blob/41f98f3fb53c3250187efc55c2893373dc32cfbc/launch/slam.launch#L31

so the problem should be that ORB_SLAM3 is not properly publishing the coordinate system. You should check the output of ORB_SLAM3

The global map in the video screenshots is generated using the ROS package octomap_server. However, I soon realized that the octomap constructed from sparse feature points was not very useful, so I abandoned it and did not include it in this project. If you still want to achieve a similar effect, you can install octomap_server and use it with this pointcloud filter code https://github.com/geturin/kitti/blob/master/src/pclfilter.py

DigitalDungeon01 commented 3 months ago

In order to i get more accurate results. I already do calibration on my drone. But do i need to change on the config file for orb_slam _wrapper and also oafd _monocular package ?

I mean for the camera calibration

https://github.com/geturin/OAFD_Monocular/blob/41f98f3fb53c3250187efc55c2893373dc32cfbc/config/tello.yaml#L4

https://github.com/geturin/orb_slam3_ros_wrapper/blob/4f1aaffa1c4eae9ad9680047bd867650f673989e/config/TUM1.yaml#L4

geturin commented 3 months ago

You need to modify the parameters in tello.yaml. Additionally, since I hardcoded the parameters into the depth2pcd.py file those parameters also need to be modified: https://github.com/geturin/OAFD_Monocular/blob/master/src/depth2pcd.py

DigitalDungeon01 commented 3 months ago

The error in path_following.py is due to the lack of a transformation relationship between the map and Tello coordinate. The Tello coordinate system is transformed from the camera coordinate .

https://github.com/geturin/OAFD_Monocular/blob/41f98f3fb53c3250187efc55c2893373dc32cfbc/launch/slam.launch#L31

so the problem should be that ORB_SLAM3 is not properly publishing the coordinate system. You should check the output of ORB_SLAM3

The global map in the video screenshots is generated using the ROS package octomap_server. However, I soon realized that the octomap constructed from sparse feature points was not very useful, so I abandoned it and did not include it in this project. If you still want to achieve a similar effect, you can install octomap_server and use it with this pointcloud filter code https://github.com/geturin/kitti/blob/master/src/pclfilter.py

i still got problem when doing path_following.py, i dont know what wrong with it. so i include a video so make it easy for you to understand the problem https://youtu.be/vPnhw5vZAx0

DigitalDungeon01 commented 3 months ago

And also for the octomap , it says no module named 'pcl'

Is that because any other libraries dependencies that i need to downlad?

geturin commented 3 months ago

"As I mentioned before, the error is due to ORB_SLAM3 not working. In the video, after you stopped the rosbag playback and connected Tello, it was obvious that ORB_SLAM3 did not compute new coordinates. You can try the following:

1.Adjust the timestamps. Rosbag playback uses the timestamps of the original data, which might differ significantly from the timestamps of the drone data, causing ORB_SLAM3 to fail in computation. You can try removing the timestamp assignment in https://github.com/geturin/OAFD_Monocular/blob/41f98f3fb53c3250187efc55c2893373dc32cfbc/src/Tello_node.py#L61

and change the publish topic to something else, such as '/camera/img_nostamp'. Then write a subscriber to receive data from '/camera/img_nostamp', add the current timestamp, and publish it back to '/camera/img_raw'. This way, both rosbag and the actual drone will publish the current timestamp.

2.At the end of the rosbag recording, cover Tello's camera with your finger, just like I did in the video. This will cause ORB_SLAM3 to enter tracking loss mode, and when new images come in, it will prioritize loop closure detection.

Finally, yes, you need to install PCL if you want to run octomap.py. However, this doesn't seem to be my code; is it kitti/src/pclfilter.py? In ROS, if you want to use octomap, you need octomap_server. Also, there are many solutions for the global map; you can search for other options

DigitalDungeon01 commented 3 months ago

I finally archive my autonomous dji tello drone, thanks to you for you help!. Thank you so much geturin

But i think my drone need to make better calibration because got some problem with the path that i created because originally the path is more longer and far. But the orb slam kinda translate the path shorter than the original world.

I think need to do some more calibration on the camera.

Anyways , thank you geturin

Test flight : https://youtube.com/shorts/hSWts8rk7o8?si=Q9HHfSRk6wgCWtsi

DigitalDungeon01 commented 3 months ago

arief@DigitalDungeon01:~/FYPworkspaces/catkin_ws_OAFD$ rosrun octomap_server octomap_server_node

[ INFO] [1717559399.607871918]: Publishing latched (single publish will take longer, all topics are prepared) [ WARN] [1717559399.657465149]: Nothing to publish, octree is empty

got problem when running pclfilter and octomap server, the node already published the topic but the problem is the terminal from octomap_server_node says "Nothing to publish, octree is empty"

does my command for running the octomap_server is incorrect ?

geturin commented 3 months ago

I think you didn't set the parameters in the launch file, or you missed some parameters. You can refer to the following: https://github.com/OctoMap/octomap_mapping/blob/kinetic-devel/octomap_server/launch/octomap_mapping.launch

DigitalDungeon01 commented 3 months ago

Do i need to change the topic names? I mean for this part from the launch file for octomap_server :

    <remap from="cloud_in" to="/narrow_stereo/points_filtered2" />

from filter pcl script: rospy.Publisher('/filterpcl', PointCloud2, queue_size=1).publish(pcldata)

DigitalDungeon01 commented 3 months ago

this is my settings

DigitalDungeon01 commented 3 months ago

but it still shows the some problem [ WARN] [1717899693.013559003]: Nothing to publish, octree is empty

geturin commented 3 months ago

I can't see any obvious errors from the configuration information. You can try checking the following:

Ensure that pointcloud2 data is being published on /filterpcl. Check the tf tree to ensure there is a proper tf2 relationship between map, world, camera, and tello.