arlk / Crazyflie.jl

A julia package that can fly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crazyflie.jl

Build Status codecov

This package provides a Julia interface for crazyflie-lib-python to communicate with a crazyflie.

Installation

Follow directions from crazyflie-lib-python to (system-wide) install the python library and any necessary dependencies. Then from the REPL

julia> ] add Crazyflie

Usage

Scan for crazyflies

julia> scan()
Found 2 crazyflies:
        radio://0/60/2M
        radio://0/80/2M

Run an algorithm

The play function takes the crazyflie uri and the anonymous function in the do...end block as inputs:

play(uri) do cf
  # send commands
end

It constructs the SyncCrazyflie python object, connects to the crazyflie, runs the provided algorithm, and disconnects from the crazyflie.

A motor ramp test example: This is already included in the examples and can be invoked directly.

function motor_ramp_test(uri)
    play(uri) do cf
        cf.commander.send_setpoint(0, 0, 0, 0)
        thrust = 20000
        for i = 1:20
            cf.commander.send_setpoint(0, 0, 0, thrust)
            thrust += i > 10 ? -500 : 500
            sleep(0.1)
        end
        cf.commander.send_setpoint(0, 0, 0, 0)
        sleep(0.1)
    end
end

About

A julia package that can fly

License:MIT License


Languages

Language:Julia 100.0%