mirror of
https://github.com/supleed2/ELEC50003-P1-CW.git
synced 2024-09-19 20:16:16 +00:00
Add ability for Drive to request current heading from Control
This commit is contained in:
parent
9463a14cdc
commit
fd76a692e1
|
@ -17,7 +17,7 @@ void loop()
|
||||||
{
|
{
|
||||||
DynamicJsonDocument rdoc(1024); // receive doc, not sure how big this needs to be
|
DynamicJsonDocument rdoc(1024); // receive doc, not sure how big this needs to be
|
||||||
deserializeJson(rdoc, Serial1); // Take JSON input from UART1
|
deserializeJson(rdoc, Serial1); // Take JSON input from UART1
|
||||||
int requiredHeading = rdoc["rH"];
|
int requiredHeading = rdoc["rH"]; // if -1: command in progress, returning requested heading, dist/sp to be ignored
|
||||||
int distance = rdoc["dist"];
|
int distance = rdoc["dist"];
|
||||||
float speed = rdoc["sp"];
|
float speed = rdoc["sp"];
|
||||||
int currentHeading = rdoc["cH"];
|
int currentHeading = rdoc["cH"];
|
||||||
|
@ -31,7 +31,7 @@ void loop()
|
||||||
// Do Drive stuff, set the 5 values above
|
// Do Drive stuff, set the 5 values above
|
||||||
|
|
||||||
DynamicJsonDocument tdoc(1024); // transmit doc, not sure how big this needs to be
|
DynamicJsonDocument tdoc(1024); // transmit doc, not sure how big this needs to be
|
||||||
tdoc["comp"] = commandComplete;
|
tdoc["comp"] = commandComplete; // If 0: command in progress, current heading requested
|
||||||
tdoc["mW"] = powerUsage_mW;
|
tdoc["mW"] = powerUsage_mW;
|
||||||
tdoc["mm"] = distTravelled_mm;
|
tdoc["mm"] = distTravelled_mm;
|
||||||
tdoc["pos"][0] = current_x;
|
tdoc["pos"][0] = current_x;
|
||||||
|
|
Loading…
Reference in a new issue