You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
robomaster-sdk/include/robomaster.h

39 lines
834 B
C

#pragma once
// Public stuff
struct Client;
typedef struct Client* Client;
#include "message.h"
#include "chassis.h"
#include "sdk.h"
// SIMPLE
// Create a client
// Connect to a drone
// Send messages
// Poll for responses
Client client_new();
void client_connect(Client client);
void poll_message(Client client, union Message* message);
static inline uint8_t host2byte(uint8_t host, uint8_t index) {
return index * 32 + host;
}
static inline void byte2host(uint8_t b, uint8_t* host, uint8_t* index) {
*host = (b & 0x1F);
*index = b >> 5;
}
/*
* Drive the wheels of the robot. Values should be [-1, 1]
*
* x: positive is forward, negative is backwards
* y: positive is right, negative is left
* r: positive is clockwise, negative is counterclockwise
*/
void drive(Client client, float x, float y, float r);