Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
TaskWait.cpp
00001 /* 00002 * TaskWait.cpp 00003 * Copyright (c) 2017, ZHAW 00004 * All rights reserved. 00005 */ 00006 00007 #include "TaskWait.h" 00008 00009 using namespace std; 00010 00011 /** 00012 * Creates a task object that waits for a given duration. 00013 */ 00014 TaskWait::TaskWait(Controller& controller, float duration) : controller(controller) { 00015 00016 this->duration = duration; 00017 00018 time = 0.0f; 00019 } 00020 00021 /** 00022 * Deletes the task object. 00023 */ 00024 TaskWait::~TaskWait() {} 00025 00026 /** 00027 * This method is called periodically by a task sequencer. 00028 * @param period the period of the task sequencer, given in [s]. 00029 * @return the status of this task, i.e. RUNNING or DONE. 00030 */ 00031 int TaskWait::run(float period) { 00032 00033 controller.setTranslationalVelocity(0.0f); 00034 controller.setRotationalVelocity(0.0f); 00035 00036 time += period; 00037 00038 if (time < duration) { 00039 00040 return RUNNING; 00041 00042 } else { 00043 00044 return DONE; 00045 } 00046 } 00047
Generated on Tue Aug 2 2022 10:35:51 by
