Control RPY angles through UART api (like RC)
  • Hi, I'd like to control the RPY angles using the UART api
    just like when feeding a pwm on RC_PITCH .. channels.
    I'm currently using
    CMD_CONTROL message, check http://pastebin.com/z6RnvrG7
    Am i doing anything wrong ?
  • update, here's the right pastebin
  • "Am i doing anything wrong ?" It is a bit difficult to say without knowing if there is a problem and what the problem is. What FW, what Serial API are you using?
  • fw 2.56b9, board v3, serial 2.5
    I'm trying to communicate with the board (ultimately set an angle) but right now, it doesn't respond to anything. So i've tried using the GUI "debug" tab , send a "52" command (eg) then read the console output, I can see the board receives the message and answers back, but i cant get this behavior without using GUI.
    Also I tried to use the GUI to set an angle :
    command : 67 data(hex) : 01 55 00 00 00 00 00
    which is supposed to set the control mode to speed , and put 0x55 speed on roll axis, but nothing happens
    So the real question is :
    Is my protocol wrong or not ?
  • It is too complicated question to verify if your code is correct or not, I would propose to see the examples and start from there. Also have you ensured the connection is ok, how have you connected the serial interface to the board? Debug tab, I do not know, I have connected Arduino Tx to Rx and Rx to Tx and GND and it works.

  • Well, when using the GUI debug tab, I send command 52 (CMD_BOARD_INFO) the board answers.
    But when sending 67 (CMD_CONTROL), with 01 55 00 00 00 00 00 (control = speed, speed_roll = 0x55) it doesn't do anything.
  • CMD_CONTROL – control gimbal movement
    • CONTROL_MODE – 1u
    • SPEED_ROLL – 2s
    • ANGLE_ROLL – 2s
    • SPEED_PITCH – 2s
    • ANGLE_PITCH – 2s
    • SPEED_YAW – 2s
    • ANGLE_YAW – 2s

    I do not know how that works with GUI, but you need to send correct amount of bytes.

    1u – 1 byte unsigned
    2s – 2 byte signed (little-endian order)
  • There is LCDRemote example where CMD_CONTROL is used, you can check it and compare with your code: https://github.com/alexmos/sbgc-api-examples

    From GUI Debug, correct command will look:
    67 [01 55 00 00 00 00 00 00 00 00 00 00 00]
  • Thanks, you were right, i was not sending the right amounts of data...
  • When using a logic analyzer, this is the frame i get when sending
    67 [01 55 00 00 00 00 00 00 00 00 00 00 00]
    Gimbal connected, it turns.
    This works, but doesnt make sense, 0x43 should be sent, not 0x42. checksum doenst make sense neither
  • In you code, types in the CMD_CONTROL_t are uint_16 but actualy they are all signed: int16_t.
    Also be carefull in converting structures to a bytes: for 32-bit systems members like int16_t may take 4 bytes actually, unless you specify structure as 'packed'.

    I still advise to use libraries and start from examples that published at github. SerialControl.ino contains various use cases of CMD_CONTROL command.