Commit 44d373e9 by Hideaki Tai

clear value when xbee data stop

parent 899f2016
...@@ -262,7 +262,9 @@ void setVelocity() ...@@ -262,7 +262,9 @@ void setVelocity()
unpacker.pop(); unpacker.pop();
} }
if (stopwatch.isRunning() && (stopwatch.ms() < XBEE_COMMAND_TIMEOUT_MS)) if (stopwatch.isRunning())
{
if (stopwatch.ms() < XBEE_COMMAND_TIMEOUT_MS)
{ {
if (b_motor_active) if (b_motor_active)
{ {
...@@ -270,9 +272,17 @@ void setVelocity() ...@@ -270,9 +272,17 @@ void setVelocity()
} }
else else
{ {
vel[0] = vel[1] = vel[2] = 0.f;
Serial.println("Emergency Switch Pressed!! Motor Disabled..."); Serial.println("Emergency Switch Pressed!! Motor Disabled...");
} }
} }
else
{
vel[0] = vel[1] = vel[2] = 0.f;
stopwatch.stop();
Serial.println("XBee Communication Timeout...");
}
}
} }
void sendStatus() void sendStatus()
......
  • Markdown is supported
    0% or
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or sign in to comment