User Tools

Site Tools

Translations of this page:

howto:og_service_comm_tool

OGs Service Tool for Dji products

By mefisto and the OG's, Github here: https://github.com/o-gs/dji-firmware-tools/blob/master/comm_og_service_tool.py

The script allows to trigger a few service functions of Dji drones. It talks to the drone like comm_serialtalk.py, but provides easier interface for some important functions.

File Download: https://github.com/o-gs/dji-firmware-tools/raw/master/comm_og_service_tool.py

Example functions:

Example of listing Flight Controller Parameters 200-300 on Ph3 Pro to CSV format:

./comm_og_service_tool.py /dev/ttyUSB0 P3X FlycParam list --start=200 --count=100 --fmt=csv

Example of getting value of Flight Controller Parameters on Spark:

./comm_og_service_tool.py /dev/ttyUSB0 -vv SPARK FlycParam get g_config.flying_limit.max_height_0 --fmt=2line

Example of setting value of Flight Controller Parameters on Spark:

./comm_og_service_tool.py /dev/ttyUSB0 -vv SPARK FlycParam set g_config.flying_limit.max_height_0 500

Example of performing service “joint coarse” calibration of Spark gimbal:

./comm_og_service_tool.py /dev/ttyUSB0 -vv SPARK GimbalCalib JointCoarse

Example of performing service “linear hall” calibration of Spark gimbal, using Windows host:

python3 comm_og_service_tool.py COM23 -vv SPARK GimbalCalib LinearHall

Supported Aircraft

  • A2 = 0 # Released 2013-09-04 A2 Flight Controller
  • P330 = 1 # Released 2013-01-07 Phantom 1
  • P330V = 2 # Released 2013-10-28 Phantom 2 Vision
  • P330Z = 3 # Released 2013-12-15 Phantom 2 w/ Zenmuse H3-2D
  • P330VP = 4 # Released 2014-04-07 Phantom 2 Vision+
  • WM610 = 5 # Released 2014-11-13 Inspire 1
  • P3X = 6 # Released 2015-03-09 Phantom 3 Professional
  • P3S = 7 # Released 2015-03-09 Phantom 3 Advanced
  • MAT100 = 8 # Released 2015-06-08 Matrice 100
  • P3C = 9 # Released 2015-08-04 Phantom 3 Standard
  • MG1 = 10 # Released 2015-11-27 Agras MG-1
  • WM325 = 11 # Released 2016-01-05 Phantom 3 4K
  • WM330 = 12 # Released 2016-03-02 Phantom 4 (now referenced as Phantom 4 Standard)
  • MAT600 = 13 # Released 2016-04-17 Matrice 600
  • WM220 = 14 # Released 2016-09-28 Mavic Pro (also includes Released 2017-08-24 Mavic Pro Platinum)
  • WM620 = 15 # Released 2016-11-16 Inspire 2
  • WM331 = 16 # Released 2016-11-16 Phantom 4 Pro
  • MAT200 = 17 # Released 2017-02-26 Matrice 200
  • MG1S = 18 # Released 2017-03-28 Agras MG-1S
  • WM332 = 19 # Released 2017-04-13 Phantom 4 Advanced
  • WM100 = 20 # Released 2017-05-24 Spark
  • WM230 = 21 # Released 2018-01-23 Mavic Air
  • WM335 = 22 # Released 2018-05-08 Phantom 4 Pro V2
  • WM240 = 23 # Released 2018-08-23 Mavic 2 Pro/Zoom
  • WM245 = 24 # Released 2018-10-29 Mavic 2 Enterprise
  • WM246 = 25 # Released 2018-12-20 Mavic 2 Enterprise Dual
  • WM160 = 26 # Released 2019-10-30 Mavic Mini

Types of commands

THis section is a WIP

SERVICE_CMD

  FlycParam = 0
  GimbalCalib = 1
  CameraCalib = 2

FLYC_PARAM_CMD

  LIST = 0
  GET = 1
  SET = 2

GIMBAL_CALIB_CMD

  JOINTCOARSE = 0
  LINEARHALL = 1

CAMERA_CALIB_CMD

  ENCRYPTCHECK = 0
  ENCRYPTPAIR = 1

CAMERA_ENCRYPT_PAIR_TARGET

  ALL = 0
  CAMERA = 1
  GIMBAL = 4
  LB_DM3XX_SKY = 8

Command line

usage: comm_og_Service_Tool.py [-h] [-b BAUDRATE] [-w TIMEOUT] [–dry-test]

                             [-v] [--version]
                             port product command ...

Needs cleaning up from code

    Its task is to parse command line options and call a function which performs serial communication.
  """
  parser = argparse.ArgumentParser(description=__doc__)
  parser.add_argument('port', type=str,
          help="the serial port to write to and read from")
  parser.add_argument('product', metavar='product', choices=[i.name for i in PRODUCT_CODE], type=parse_product_code,
          help="target product code name; one of: {:s}".format(','.join(i.name for i in PRODUCT_CODE)))
  parser.add_argument('-b', '--baudrate', default=9600, type=int,
          help="the baudrate to use for the serial port (default is %(default)s)")
  parser.add_argument('-w', '--timeout', default=500, type=int,
          help="how long to wait for answer, in miliseconds (default is %(default)s)")
  parser.add_argument('--dry-test', action='store_true',
          help="internal testing mode; do not use real serial interface and use template answers from the drone.")
  parser.add_argument('-v', '--verbose', action='count', default=0,
          help="increases verbosity level; max level is set by -vvv")
  parser.add_argument('--version', action='version', version="%(prog)s {version} by {author}"
            .format(version=__version__,author=__author__),
          help="display version information and exit")
howto/og_service_comm_tool.txt · Last modified: 2020/01/18 21:18 by digdat0