Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
DriveToWaypointCommand.h
1#pragma once
2
3#include "../navtypes.h"
4#include "../utils/time.h"
5#include "../world_interface/data.h"
6#include "CommandBase.h"
7
8#include <chrono>
9#include <optional>
10
11namespace commands {
12
19public:
31 DriveToWaypointCommand(const navtypes::point_t& target, double thetaKP, double driveVel,
32 double slowDriveThresh, double doneThresh,
33 util::dseconds closeToTargetDur);
34
42 void setState(const navtypes::pose_t& pose, robot::types::datatime_t time);
43
51 command_t getOutput() override;
52
58 bool isDone() override;
59
60private:
61 navtypes::point_t target;
62 navtypes::pose_t pose;
63 double thetaKP;
64 double driveVel;
65 double slowDriveThresh;
66 double doneThresh;
67 bool setStateCalledBeforeOutput;
68 util::dseconds closeToTargetDur;
69 std::optional<robot::types::datatime_t> lastRecordedTime;
70 std::optional<robot::types::datatime_t> closeToTargetStartTime;
71};
72
73} // namespace commands
Definition CommandBase.h:10
void setState(const navtypes::pose_t &pose, robot::types::datatime_t time)
Must be called before getOutput() for each iteration.
Definition DriveToWaypointCommand.cpp:19
bool isDone() override
Returns whether the DriveToWaypointCommand has finished its navigation task.
Definition DriveToWaypointCommand.cpp:47
command_t getOutput() override
Gets the angular velocity and forward speed to run the robot at in order to navigate robot to target.
Definition DriveToWaypointCommand.cpp:26
DriveToWaypointCommand(const navtypes::point_t &target, double thetaKP, double driveVel, double slowDriveThresh, double doneThresh, util::dseconds closeToTargetDur)
Creates a new DriveToWaypointCommand with the specified targeting information.
Definition DriveToWaypointCommand.cpp:11
std::chrono::time_point< dataclock > datatime_t
A point in time as measured by dataclock.
Definition data.h:31
Definition CommandBase.h:5