Slam navigation based on obstacle avoidance

#1

hello everyone,
The px4 obstacle avoidance package gives some camera models and the cameras can send message to ROS topics. I am trying to do some simulation use PX4 SITL. I used a ROS package “orb_slam2_ros” to read the image information for obtaining the position of the camera in a simulated world. I used the ‘local_planner_depth-camera.launch’ to launch a copter with a depth-camera. The orb_slam2_ros can connect to the topic. But the slam didn’t publish any information. I want to ask if it’s possible to use slam based on the ‘obstacle avoidance’.

#2

Hi @guoxianzhen,

Could you explain a bit more what you are trying to do?

IMO if you get your SLAM algorithm to run with this SITL setup, I think you could use its output for the state estimation in the local planner. The local planner subscribes to state topics coming from the PX4 firmware, but you could change those to use the ones generated by your SLAM algorithm.

But if you want to use the map generated by your SLAM for the obstacle avoidance, this would be a bigger thing. You would basically have to write a new planner which is compatible with your SLAM map and can plan based on that. The local planner cannot do that as it is now.

#4

Simply, I want to implement vision fusion using px4. Then I can get the position estimation from px4 without GPS.

#5

hi,
Thank you for your reply. I want to implement navigation without GPS and I only need to navigate the copter fly from A to B without considering obstacle avoidance. So I use slam for position estimation. Firstly, I launch ‘local_planner_depth-camera.launch’ to create a simulated environment. Then I downloaded ‘orb_slam2_ros’ package which subscribed to the image topic from the depth-camera. The slam package is expected to estimate position. Next, I want to publish the position to /mavros/vision_pose/pose for vision fusion using EKF2. Finally, I think i can navigate the copter without GPS. Specifically, if I give a mission through QGC, the copter could finish it without GPS.
But now, the slam package does not work. So I want to ask the method I mentioned before is executable? If I can use slam directly or I need to something before make the slam subscribe to the depth-camera.
I am new in ROS and PX4 development.
Thank you very much.
[/quote]

#6

From a concept point of view i think your approach sounds fine. But I’m not an expert on SLAM and I do not know the package you are trying to use. Did you check what kind of input this package requires? I’m just wondering if the depth camera is the right kind of sensor for your SLAM algorithm as it produces a pointcloud.

#8

The SLAM need image input or RGB Image. I find that the depth camera produces image and depth image through “rgb/image_raw” and “depth/image_raw”. So I think it may works.

#9

Ok, that sounds fine. So I think you mainly need to find out why your SLAM algorithm is not working. Maybe ask for support from their developers.

#10

OK, thank you for your kind and patient reply!

#11

There are some errors when i try to build realsense_gazebo_plugin. I use ros-kinetic and gezebo 7. There are a note saying the branch do not fit kinetic and gazebo 7. Do you know where i can find the kinetic-devel branch?

#12

you need to checkout the kinetic-devel branch of the realsense_gazebo_plugin repo: https://github.com/PX4/avoidance#local-planner

#14

Sorry, I can understand your method. can you explain it more clearly?

#15

Uhmm you just clone the repo: git clone git@github.com:SyrianSpock/realsense_gazebo_plugin.git
then you go into the folder: cd realsense_gazebo_plugin
then you checkout the branch: git checkout -b kinetic-devel origin/kinetic-devel
then you build: catkin build

#17

Hello,
Sorry to ask you again. I met some problems when i tried the ‘avoidance’ package. I succeeded before, but now the copter model didn’t show in rviz and the terminal gave some information:
Segmentation Fault
INFO [log] Backtrace: 9
INFO [log] /home/guoxianzhen/catkin_ws/Firmware/build/px4_sitl_default/bin/px4(px4_backtrace+0x25) [0x588245]
INFO [log] /home/guoxianzhen/catkin_ws/Firmware/build/px4_sitl_default/bin/px4() [0x41e8e1]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f457423d390]
INFO [log] /home/guoxianzhen/catkin_ws/Firmware/build/px4_sitl_default/bin/px4() [0x42d1ce]
INFO [log] /home/guoxianzhen/catkin_ws/Firmware/build/px4_sitl_default/bin/px4(camera_trigger_main+0x169) [0x42d6a9]
INFO [log] /home/guoxianzhen/catkin_ws/Firmware/build/px4_sitl_default/bin/px4() [0x5e3a5f]
INFO [log] /home/guoxianzhen/catkin_ws/Firmware/build/px4_sitl_default/bin/px4() [0x5e4ee9]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f45742336ba]
INFO [log] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f45734d241d]

Do you know why does this happen and how to fix it?
Thank you.
[/quote]

#18

Can you give a bit more context? Which Firmware version are you running? How did you build it?
If you have the Firmware in the catkin workspace try to clean the build and build it again not with catkin but from the Firmware directory run make px4_sitl gazebo

#20

I just cloned it from px4/Firmware github. I am not clear about the specific version. I build it in Firmware directory using make px4_sitl gazebo.

#21

Go into the Firmware directory and run make clean. In your catkin workspace run catkin clean.
Then build only the packages you need e.g. catkin build local_planner.
Build the Firmware with make px4_sitl gazebo .
Run again roslaunch local_planner local_planner_depth-camera.launch

If you have the same error please post the commit hash of the Firmware you’re using and the complete output of the console.

#23

[quote=“guoxianzhen, post:22, topic:10765”]
hello,
I have tried this but it didn’t work. What’s more, I put Firmware into /home/ folder. I tried to use “roslaunch px4 posix_sitl.launch”. Then the same error happened. The information is:
Segmentation Fault
INFO [log] Backtrace: 9
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(px4_backtrace+0x25) [0x588315]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x41e8d1]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2aa75cf390]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x42d29e]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(camera_trigger_main+0x169) [0x42d779]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e3b2f]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e4fb9]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f2aa75c56ba]
INFO [log] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2aa686441d]
INFO [log] Backtrace: 9
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(px4_backtrace+0x25) [0x588315]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x41e8d1]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2aa75cf390]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x42d29e]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(camera_trigger_main+0x169) [0x42d779]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e3b2f]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e4fb9]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f2aa75c56ba]
INFO [log] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2aa686441d]
INFO [log] Backtrace: 9
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(px4_backtrace+0x25) [0x588315]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x41e8d1]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2aa75cf390]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x42d29e]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(camera_trigger_main+0x169) [0x42d779]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e3b2f]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e4fb9]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f2aa75c56ba]
INFO [log] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2aa686441d]
INFO [log] Backtrace: 9
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(px4_backtrace+0x25) [0x588315]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x41e8d1]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2aa75cf390]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x42d29e]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(camera_trigger_main+0x169) [0x42d779]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e3b2f]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e4fb9]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f2aa75c56ba]
INFO [log] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2aa686441d]
INFO [log] Backtrace: 9
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(px4_backtrace+0x25) [0x588315]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_d
Segmentation Fault
efault/bin/px4() [0x41e8d1]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2aa75cf390]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x42d29e]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(camera_trigger_main+0x169) [0x42d779]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e3b2f]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e4fb9]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f2aa75c56ba]
INFO [log] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2aa686441d]
INFO [log] Backtrace: 9
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(px4_backtrace+0x25) [0x588315]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x41e8d1]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2aa75cf390]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x42d29e]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4(camera_trigger_main+0x169) [0x42d779]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e3b2f]
INFO [log] /home/guoxianzhen/Firmware/build/px4_sitl_default/bin/px4() [0x5e4fb9]
INFO [log] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f2aa75c56ba]
INFO [log] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2aa686441d]

#24

What OS are you running on? Which compiler and which version are you using?

#26

hello,
I am running on ubuntu 16.06 , ROS Kinetic. I cloned the “Firmware” file from https://github.com/PX4/Firmware. I believe its version is v1.8.2. In addition, I have succeeded before but from yesterday, this error came. I can build FIrmware using make px4_sitl gazebo successfully but when i tried to use “roslaunch px4 posix_sitl.launch”, this error came.

#27

When does the seg fault happen? As soon as the simulation starts? Or can you fly around? Can you copy the entire output of the console from roslaunch px4 posix_sitl.launch on?

Did you change the parameter TRIG_MODE from QGC or mavlink shell? Are you running any custom code/vehicle model?