Implement simple SDK API
This commit is contained in:
+3
-4
@@ -11,7 +11,6 @@ Client client_new() {
|
||||
struct Client* client = malloc(sizeof(struct Client));
|
||||
memset(client, 0, sizeof(struct Client));
|
||||
// TODO: Make this configurable
|
||||
client->hostbyte = host2byte(CLIENT_HOST, CLIENT_INDEX);
|
||||
return client;
|
||||
}
|
||||
|
||||
@@ -19,8 +18,6 @@ void client_connect(Client client) {
|
||||
client->sdk_conn = connection_new(0, 0, 30030, "192.168.2.1");
|
||||
// TODO: This should probably use the source IP in the response body
|
||||
client->dev_conn = connection_new(10010, "192.168.2.24", 20020, "192.168.2.1");
|
||||
|
||||
set_sdk_connection(client, CONNECTION_WIFI_AP, 0, 10010);
|
||||
}
|
||||
|
||||
void poll_message(Client client, union Message* resp) {
|
||||
@@ -32,5 +29,7 @@ void poll_message(Client client, union Message* resp) {
|
||||
|
||||
void drive(Client client, float x, float y, float r) {
|
||||
float w1 = y + x + r, w2 = y - x -r, w3 = y + x -r, w4 = y - x + r;
|
||||
set_wheel_speed(client, w1 * 1000, -w2 * 1000, -w3 * 1000, w4 * 1000);
|
||||
union Request req;
|
||||
set_wheel_speed(&req, client->seq, false, w1 * 1000, -w2 * 1000, -w3 * 1000, w4 * 1000);
|
||||
req_send(client->dev_conn, &req);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user