control with the simulator using crazyflie-lib-python

Firmware/software/electronics/mechanics
Post Reply
t.yoneda
Beginner
Posts: 27
Joined: Mon May 17, 2021 3:03 am

control with the simulator using crazyflie-lib-python

Post by t.yoneda »

Hello,

I want to control simulated crazyflies using crazyflie-lib-python.
I am currently able to use sim_cf simulator to make the connection, but I am having problems unpacking the data. (I created this issue)

currently I am using sim_cf simulator, are there any other simulators that can be controlled from crazyflie-lib-python? I have yet to find that information.
If I can control some simulator from crazyflie-lib-python, I will try to document it.

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

Re: control with the simulator using crazyflie-lib-python

Post by kimberly »

Currently we haven not heard of a way to control a simulated crazyflie from sim_cf. It is a simulator in gazebo and it would be possible to write a [gazebo plugin](http://gazebosim.org/tutorials?tut=plug ... eboPlugins) that can perhaps take an input of a regular python script?

We haven't worked on this ourselves though, but perhaps if you are thinking of doing something with that let us know! This would be really interesting for many people probably so we can definitely guide you in that.
t.yoneda
Beginner
Posts: 27
Joined: Mon May 17, 2021 3:03 am

Re: control with the simulator using crazyflie-lib-python

Post by t.yoneda »

Hello,

the problem unpacking the data is closed. (https://github.com/bitcraze/crazyflie-l ... issues/240)
thanks to jonasdn's PR!

now I have a problem with communication between simulator and cflib.
sim_cf can communicate via udp, and we can already create sockets in python.
but the data from the simulator seems to be different from the crtp packet.

based on this script in the simulator and the data dump received by udpdriver.py, I expected the data from the simulator to be a crtp packet with
simulated crazyflie's id (1 byte) at the beginning.

Code: Select all

[cf_id] + [crtp packet]
I tried remove a byte the beginning of the data received by receive_packet() in udpdriver.py and setting the cf_id a byte at the beginning of the packet sent by socket.sendto(), but it didn't work.
jonasdn
Expert
Posts: 132
Joined: Mon Mar 01, 2021 3:13 pm

Re: control with the simulator using crazyflie-lib-python

Post by jonasdn »

Hi t.yoneda!

There is probably more to do, it seems that the simulated CF starts sending logging data without you needing to create/start a log block? That will probably confuse the python library somewhat. Perhaps you need to account for that. Reading the sim_cf sources might be the way forward here.

Good luck!
Jonas
Post Reply