Program Listing for File governed_diff_drive.hpp

Return to documentation for file (cosm/kin2D/governed_diff_drive.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <vector>
#include <utility>

#include "cosm/hal/actuators/diff_drive_actuator.hpp"
#include "cosm/kin2D/diff_drive.hpp"

/*******************************************************************************
 * Namespaces
 ******************************************************************************/
namespace cosm::kin2D::config {
struct diff_drive_config;
}
namespace cosm::tv {
class switchable_tv_generator;
} /* namespace tv */

namespace cosm::kin2D {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class governed_diff_drive final : public kin2D::diff_drive {
 public:
  governed_diff_drive(const config::diff_drive_config* config,
                      hal::actuators::diff_drive_actuator&& actuator)
      : diff_drive(config, std::move(actuator)) {}

  /* move only constructible/assignable to work with the saa subsystem */
  governed_diff_drive(governed_diff_drive&&) = default;
  governed_diff_drive& operator=(governed_diff_drive&&) = default;
  governed_diff_drive(const governed_diff_drive&) = delete;
  governed_diff_drive& operator=(const governed_diff_drive&) = delete;

  double active_throttle(void) const RCPPSW_PURE;

  double applied_throttle(void) const RCPPSW_PURE;

  void tv_generator(const tv::switchable_tv_generator* generator) {
    m_generators.push_back(generator);
  }

 private:
  /* clang-format off */
  std::vector<const tv::switchable_tv_generator*> m_generators{};
  /* clang-format on */
};

} /* namespace cosm::kin2D */