Page 1 of 1

Combining Motion Commander with Swarm

Posted: Tue May 19, 2020 7:30 am
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.

Re: Combining Motion Commander with Swarm

Posted: Tue May 19, 2020 8:10 am
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.