mirror of
https://github.com/supleed2/ELEC50003-P1-CW.git
synced 2024-12-22 21:45:49 +00:00
Charge cycles added (6hrs)
Heading orientation fixed
This commit is contained in:
parent
f0c4567102
commit
7dd064afe9
|
@ -256,11 +256,11 @@
|
||||||
var data = JSON.parse(raw_data);
|
var data = JSON.parse(raw_data);
|
||||||
|
|
||||||
state = data.st;
|
state = data.st;
|
||||||
batteryLevel = data.bV;
|
batteryLevel = data.bL;
|
||||||
batteryVoltage = data.bV;
|
batteryVoltage = data.bV;
|
||||||
batteryCycles = data.bC;
|
batteryCycles = data.bC;
|
||||||
totalTripDistance = data.tD;
|
totalTripDistance = data.tD;
|
||||||
currentHeading = data.cH + 180;
|
currentHeading = 180 - data.cH;
|
||||||
current_pos = data.pos;
|
current_pos = data.pos;
|
||||||
current_x = current_pos[0];
|
current_x = current_pos[0];
|
||||||
current_y = current_pos[1];
|
current_y = current_pos[1];
|
||||||
|
@ -349,7 +349,7 @@
|
||||||
function moveCmd(dist,hdg,spd){
|
function moveCmd(dist,hdg,spd){
|
||||||
mode = 1;
|
mode = 1;
|
||||||
reqDistance = dist;
|
reqDistance = dist;
|
||||||
reqHeading = hdg;
|
reqHeading = 360 - hdg;
|
||||||
reqSpeed = spd;
|
reqSpeed = spd;
|
||||||
reqCharge = 0;
|
reqCharge = 0;
|
||||||
pstop_time = 0;
|
pstop_time = 0;
|
||||||
|
|
|
@ -410,7 +410,8 @@ void sendToCommand()
|
||||||
tdoc["bV"] = batteryVoltage;
|
tdoc["bV"] = batteryVoltage;
|
||||||
tdoc["bL"] = 100; // tdoc["bL"] = batteryLevel; Hardcoded value as Energy is not present on demo Rover
|
tdoc["bL"] = 100; // tdoc["bL"] = batteryLevel; Hardcoded value as Energy is not present on demo Rover
|
||||||
time(&now);
|
time(&now);
|
||||||
tdoc["bC"] = (now - 1623750000)/21600; // tdoc["bC"] = batteryCycles; Estimates cycles in number of 6 hour periods
|
// Serial.println(now);
|
||||||
|
tdoc["bC"] = ((float)now - 1623000000.0)/21600.0; // tdoc["bC"] = batteryCycles; Estimates cycles in number of 6 hour periods
|
||||||
tdoc["tD"] = odometer;
|
tdoc["tD"] = odometer;
|
||||||
tdoc["cH"] = heading;
|
tdoc["cH"] = heading;
|
||||||
tdoc["pos"][0] = xpos;
|
tdoc["pos"][0] = xpos;
|
||||||
|
|
Loading…
Reference in a new issue