Program Listing for File base_robot.hpp

Return to documentation for file (fang-mcb-project/src/robot/base_robot.hpp)

#pragma once

#include "irobot.hpp"

#include "driver/drivers.hpp"
#include "control/command/command_pack.hpp"

#include "tap/control/subsystem.hpp"
#include "tap/control/command_scheduler.hpp"

#include <memory>

namespace fang::robot
{
    class BaseRobot : public IRobot
    {
    public:
        // Even though inheritors need to use maker functions, the benefits
        // of testability and ownership are worth it
        using Subsystems = std::vector<std::unique_ptr<tap::control::Subsystem>>;
        using CommandPacks = std::vector<std::unique_ptr<command::CommandPack>>;

        BaseRobot
        (
            tap::control::CommandScheduler& commandScheduler,
            Subsystems&& subsystems,
            CommandPacks&& commandPacks
        );

        BaseRobot(BaseRobot&& baseRobot);

        virtual void initialize() override;

        virtual void update() {};
    protected:
        void registerSubsystems();
        void initializeSubsystems();
        void initializeCommandPacks();
    private:
        tap::control::CommandScheduler& commandScheduler_;
        Subsystems subsystems_;
        CommandPacks commandPacks_;
    };
}