Demo entry 6357986

aqaze

   

Submitted by anonymous on Apr 24, 2017 at 11:51
Language: Python. Code size: 464 Bytes.

trueWindAngle=msg["TWA"];
trueWindSpeed=msg["TWS"];
boatSpeed = msg["BSP"];

apparentWindAngle = msg["AWA"];
apparentWindSpeed = msg["AWS"];

out1={};
out2={};

bsp = math.sin(apparentWindAngle)*apparentWindSpeed;

out1["TWS"] = math.cos(trueWindAngle)*0.6*trueWindSpeed;
out1["BSP"] = bsp;

if (bsp > 35):
  out2["Debug"] = "Too fast";
elif (bsp < 1.0):
  out2["Debug"] = "Too slow";
else:
  out2["Debug"] = "Cool";

rep = [ out1 , out2 ];

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).