Combining Motion Commander with Swarm

Discussions about autonomous flight in general, regardless of positioning method
Post Reply
youngbin1130
Member
Posts: 42
Joined: Thu Dec 12, 2019 4:28 am

Combining Motion Commander with Swarm

Post by youngbin1130 »

I was just wondering if it is possible for me to use MotionCommander within a swarm system. I would like to continuously use the Velocity setpoints for my drones instead of positioning.

Also, I see that there is a SetPointThread in Motion_Commander.py which (from my understanding) is so continuously send the actions to the drone. However, there isn't any example for me to understand how I am able to use it. I have a CSV file (which I'm able to read) as an input but I'm unsure how to use this class in a bigger scale.

Cheers.

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

Re: Combining Motion Commander with Swarm

Post by kristoffer »

Yes it is possible, a good starting point is maybe examples/swarm/swarmSequence.py
In run_sequence(), use the MotionCommander instead of sending setpoints directly.

Code: Select all

def run_sequence(scf, sequence):
    # We take off when the commander is created
    with MotionCommander(scf) as mc:
        ...
You are right, the thread is sending the setpoints for you.
run_sequence() will be called for each Crazyflie, and this will create one instance of the MotionCommander (and one setpoint thread) for each Crazyflie.

Post Reply