Getting Started


Prerequisites for DroneForce

Setting up

To build and run DroneForce, you'll need:

  • A compatible drone platform
  • A supported embedded system (e.g., Raspberry Pi, Arduino, STM32)
  • C++ compiler with C++17 support
  • CMake version 3.10 or higher
  • Basic knowledge of drone control systems and embedded programming

What it does

  • Control individual motor PWM outputs
  • Give body torque as input and automatically resolve to PWM

How it works

  • DroneForce is initalized
    • Frame data
      • Type, class
      • Mass
      • Inertia
    • Motors (currently hard-coded)
      • kx (thrust co-efficient)
      • lx (x-distance to CG)
      • ly (y-distance to CG)
    • Actuator Effectiveness Matrix (currently hard-coded)
      • Rows - r, p, y, T allocation for each motor
      • Cols - repeat Row for each motor
    • Control Allocation Matrix
      • Pseudo-inverse of EA Matrix
  • Motor is pre-set to be controlled over PWM
    • commander.set_motor_mode(i, 1)
    • Above command sets the parameter SERVOn_FUNCTION to 1 (RCPassThru)
    • SERVO1_FUNCTION is usually set to Motor1 (and so on...), an identifier for the selected n-th motor. It can be set to another value for changing the config.
    • SERVOn_FUNCTION value RCPassThru lets us take a single RC channel as PWM value output for motor (i.e. Direct RC override without the usual RC mapping for channels[roll, pitch, yaw, th] etc)
  • Controller gives input for torque(p,q,r) and thrust (T)
    • For e.g, in tests/
      • torq_cmd takes Torque values (numpy array of 3 floats)
      • th_cmd takes Thrust value (float)
  • Scale torque/thrust output to PWM range
    • linearly
      • torque_to_PWM() maps input Torque range to output PWM range
    • non-linearly (by modelling motor characterstics)
      • (To-Do)
  • Send motor PWM output command via MAVLink
    • commander.set_servo(i, PWM) sets the PWM value for the i-th motor
    • Above function uses MAVLink`s MAV_CMD_DO_SET_SERVO packet through command_long_encode function
    • MAVLink packet is sent using message_factory.command_long_encode() function from the DroneKit API
      • Can be replaced with MAVLink alternative directly (To-Do)\
      • (To-Do) Will reduce 1 connection to ArduPilot; might improve response time
Edit this page on GitHub
Built at the Robotics Research Centre, IIIT-H