2D Mapping using Crazyflie Stem Range Bundle

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
JMaktabi15
Beginner
Posts: 3
Joined: Thu Jan 30, 2020 9:40 pm

2D Mapping using Crazyflie Stem Range Bundle

Post by JMaktabi15 » Thu Jan 30, 2020 9:50 pm

I am currently using the CrazyFlie stem ranging bundle for a final year engineering project. The title of our project is Machine learning assisted SLAM.

Could you please share with me the code used for the 2-Dimensional mapping used in the demo video for the stem ranging plus. I have accessed your library but couldn't find it. I found a 3D Mapping code.

The code I used is: https://github.com/bitcraze/crazyflie-l ... ntcloud.py
The video in question is the following: https://youtu.be/pIBM6RPggcs

I have made several runs using the 3d code using a similar set up as yours. However, the output mapping was no where near the result you got. The output is messy and unclear. I am running the drone in a high ceiling warehouse but I am still getting z-axis interference. How can I get rid of the unnecessary noise and get a clearer mapping?
WhatsApp Image 2020-01-30 at 3.15.00 PM.jpeg
I would really appreciate it if you could provide me with the code as it would help me immensely in my presentation.



kristoffer
Bitcraze
Posts: 257
Joined: Tue Jun 30, 2015 7:47 am

Re: 2D Mapping using Crazyflie Stem Range Bundle

Post by kristoffer » Fri Jan 31, 2020 9:04 am

Hi!

I'm fairly sure the code we used in the demo was the one you pointed out (https://github.com/bitcraze/crazyflie-l ... ntcloud.py) and that it actually is a 3D mapping viewed from the top.

If you want to remove the top sensor, you could remove these lines from the code https://github.com/bitcraze/crazyflie-l ... #L320-L322

If you want to put all points in the XY-plane, change this line https://github.com/bitcraze/crazyflie-l ... ud.py#L311 to

Code: Select all

        tmp3 = np.add(tmp2, origin)
        tmp3[2] = 0.0
        return tmp3
, it will force z=0.

If you also want to move the Crazyflie position to the XY-plane, add

Code: Select all

        o[2] = 0.0
after https://github.com/bitcraze/crazyflie-l ... ud.py#L351

This would give you a 2D mapping, still visualized in 3D though.

JMaktabi15
Beginner
Posts: 3
Joined: Thu Jan 30, 2020 9:40 pm

Re: 2D Mapping using Crazyflie Stem Range Bundle

Post by JMaktabi15 » Fri Jan 31, 2020 1:51 pm

Thank you. Should I also lower the sensor threshhold for more stability?

What does the sensor_threshold do?

kristoffer
Bitcraze
Posts: 257
Joined: Tue Jun 30, 2015 7:47 am

Re: 2D Mapping using Crazyflie Stem Range Bundle

Post by kristoffer » Fri Jan 31, 2020 2:09 pm

SENSOR_TH = 2000
Sensor readings larger than SENSOR_TH (2 meters in this case) will be discarded. I think it is intended to cut out readings that are in "open space". Feel free to play with it and see what happens.

What kind of stability problems do you see?

JMaktabi15
Beginner
Posts: 3
Joined: Thu Jan 30, 2020 9:40 pm

Re: 2D Mapping using Crazyflie Stem Range Bundle

Post by JMaktabi15 » Fri Jan 31, 2020 3:07 pm

When the drone goes into relatively tight or closed spaces it starts to drift and shake heavily.

kimberly
Bitcraze
Posts: 330
Joined: Fri Jul 06, 2018 11:13 am

Re: 2D Mapping using Crazyflie Stem Range Bundle

Post by kimberly » Mon Feb 03, 2020 11:15 am

That is to be expected. The controller is not fast enough to deal with the windgusts created by the motors itself.

Check out this forum thread: viewtopic.php?f=2&t=3556&p=16955&hilit=indi#p16955. They are talking about the same issue

Post Reply