anki / drive-sdk

Anki Drive SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

library method anki_vehicle_msg_turn_180() does nothing

OpenHelios opened this issue · comments

Using the library method anki_vehicle_msg_turn_180() does nothing. For testing I have added a command turn:

{ "turn",          cmd_anki_vehicle_turn,  "turn vehicle", "turn the vehicle by 180°"},

and the following method:

static void cmd_anki_vehicle_turn(int argcp, char **argvp) {
        uint8_t* value;
    size_t plen;
        int handle;
        if (conn_state != STATE_CONNECTED) {
                failed("Disconnected\n");
                return;
        }
        handle = vehicle.write_char.value_handle;
        rl_printf("turn 180°\n");
        anki_vehicle_msg_t msg;
        plen = anki_vehicle_msg_turn_180(&msg);
        value = (uint8_t *)&msg;
        gatt_write_char(attrib, handle, value, plen, NULL, NULL);
}

Commands used with vehicle-tool:

connect
sdk-mode 1
set-speed 400
turn

@chapados Thanks a lot for updating to firmware version 0x266e.

With the recently published pull request #27 on branch firmware-version-266e the turn method works (car use firmware 0x266e) after fixing the bug introduced with this pull request:

diff --git a/src/protocol.c b/src/protocol.c
index 0c5f3eb..0c00133 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -192,7 +192,7 @@ uint8_t anki_vehicle_msg_turn(anki_vehicle_msg_t *msg,

     anki_vehicle_msg_turn_t *m = (anki_vehicle_msg_turn_t *)msg;
     memset(m, 0, sizeof(anki_vehicle_msg_turn_t));
-    m->size = ANKI_VEHICLE_MSG_BASE_SIZE;
+    m->size = ANKI_VEHICLE_MSG_C2V_TURN_SIZE;
     m->msg_id = ANKI_VEHICLE_MSG_C2V_TURN;
     m->type = (uint8_t)type;
     m->trigger = (uint8_t)trigger;

commented

@chapados Thanks for updating the sdk to work with the overdrive firmware!

I'm involved in this project: https://github.com/NoveroResearch/tragediy

We also noticed the bug mentioned by @OpenHelios regarding the turn message.

We were also wondering if there was any possibility of changing the behaviour of the vehicles in case they leave the track and try to find it again. Right now especially the vehicles with overdrive firmware run a lot of "rescue maneuvers", meaning they drive in circles or spin around their own axis etc., trying to find the track.
From our perspective this is not ideal and it would be great if this could be influenced or turned off somehow, so I wanted to ask if there is any way to influence this behaviour via an (undocumented) message.