using api control example with no success
  • Hi! I am trying to control my gimbal via the serial api with limited success so far. The gimbal itself is working fine. I connected a HC-05 bluetooth device to it and controlling the board via the gui or the android app is working great as well via the bluetooth connection. I went on trying to control via an arduino controller but did not get the control example SerialControl working. So i started debuging the serial signal and it doesn't look too bad. I just had a quick look at the signal that comes out of the bluetooth device connected to the alexmos board with a serial monitor and get like ">CQõõõá>CQõõõU^>CQõõäøõ«úb>CQõõõá>CQõõõá>CQõõõU^>" when my arduino is connected. I didn't break it completely apart yet datawise but as far as i know the ">C" looks as it should. So at least my arduino is sending data and the bluetooth connection is working. Then i had a look at the data when the Android app is connected with the board and noticed the ongoing ">DD". So my first question would be ... do i need something else to make these arduino examples work? I have just the micro controller connected to the alexmos board (with working gimbal setup of course) no other RC is connected. Do i have to init the the control via api in any way or should it just work with the api commands send by arduino with the example sketch loaded. Do i need some sort of heartbeat to keep the "connection" alive? Before i start to debug the real transmitted data bytes in more detail. Does someone has some hint what could be the problem? bluetooth UART is on 115200 baud 8N1. But i guess the parity is not the problem because then it shouldn't work with the app either. Any advice is very much appreciated. By the way. I have firmware 2.43b9 installed.
    Thanx.
    Alex.
  • What example are you using? the one I used more than year ago required some coding still to get it working, the basic functionalities where ok though.
  • I used the recent version of the "Examples and libraries (ver.2.4)" and there the "SerialControl.ino" example. From this i used the Demo 1 to 4 but i tried Demo 1 by itself as well.
    this is basically it....

    #include
    #include
    #include


    // delay between commands, ms
    #define SBGC_CMD_DELAY 20

    void setup() {
    SBGC_Demo_setup();

    // Take a pause to let gimbal controller to initialize
    delay(3000);
    }

    void loop()
    {
    SBGC_cmd_control_data c = { 0, 0, 0, 0, 0, 0, 0 };


    // Move camera to initial position (all angles are zero)
    // Set speed 30 degree/sec
    c.mode = SBGC_CONTROL_MODE_ANGLE;
    c.speedROLL = c.speedPITCH = c.speedYAW = 30 * SBGC_SPEED_SCALE;
    SBGC_sendCommand(SBGC_CMD_CONTROL, &c, sizeof(c));
    delay(3000);



    blink_led(1);
    /////////////////// Demo 1. PITCH and YAW gimbal by 40 and 30 degrees both sides and return back.
    // Actual speed depends on PID setting.
    // Whait 5 sec to finish
    c.mode = SBGC_CONTROL_MODE_ANGLE;
    c.anglePITCH = SBGC_DEGREE_TO_ANGLE(40);
    c.angleYAW = SBGC_DEGREE_TO_ANGLE(30);
    SBGC_sendCommand(SBGC_CMD_CONTROL, &c, sizeof(c));
    delay(4000);
    c.anglePITCH = SBGC_DEGREE_TO_ANGLE(-40);
    c.angleYAW = SBGC_DEGREE_TO_ANGLE(-30);
    SBGC_sendCommand(SBGC_CMD_CONTROL, &c, sizeof(c));
    delay(8000);
    // .. and back
    c.anglePITCH = 0;
    c.angleYAW = 0;
    SBGC_sendCommand(SBGC_CMD_CONTROL, &c, sizeof(c));
    delay(4000);
    }
  • the includes got scrambled in the comment above but they are correct inttypes.h, SBGC.h, SBGC_Arduino.h
  • Hi, Alex.

    The most common problems are related to UART baud rate. Check that your Arduino board has the same baud rate that bluetooth module has. Also check that you properly select an arduino board type when uploading your sketch.

    Also note, that if you connect serial port to the UART connector on the SBGC board, you should not use USB (because it shares the same port). Power board from a battery.
  • Hi Alex,

    Bluetooth is on 115200 no parity 1 stopbit on both modules (Master and slave) setup. And since the control with the android app with the very same slave bluetooth module is working i guess the bluetooth receiver is not the problem. Serial from Arduino is on 115200 as well and as is wrote the bytes i see received by the slave when i have the arduino connected look quite ok. SBGC board is powerd by battery and i don't use the same serial as usb. Anyway. I just wanted the verify if i need some kind of heartbeat signal or some kind of init process to start the communication which doesn't seem to be case right?
    I think for the next step i will just remove the bluetooth connection (what i should done from the very beginning) and look at the real bytes in hex to see what actually is transmitted and received and if it is according to the api.

    Thanx for giving it some thoughts.


  • Hallo,

    I have the same problem. Could you solve it?