Add simple drive function to API

The wheel speed function requires setting individual wheel speed. And
knowledge of the max and min values. The simple drive function can
accept x, y, and r speeds from -1 to 1, and will compute the wheel
speeds for the user to achieve the desired velocity.
This commit is contained in:
2023-02-02 16:33:09 -06:00
parent 79682c1d04
commit b415b9d591
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -29,3 +29,8 @@ void poll_message(Client client, union Message* resp) {
connection_read(conn, 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);
}