Skip to content

File Sensor.hpp

File List > astrea > trace > trace > platforms > sensors > Sensor.hpp

Go to the documentation of this file

#pragma once

#include <memory>

#include <astro/astro.fwd.hpp>
#include <astro/platforms/Payload.hpp>
#include <astro/types/typedefs.hpp>

#include <trace/platforms/AccessObject.hpp>
#include <trace/platforms/sensors/fov/FieldOfView.hpp>
#include <trace/risesets/AccessArray.hpp>
#include <trace/trace.fwd.hpp>

namespace astrea {
namespace trace {

class SensorParameters : public astro::PayloadParameters {
  public:
    SensorParameters(
        const FieldOfView* fov                                                               = nullptr,
        const astro::CartesianVector<Distance, astro::frames::dynamic::ric>& boresight       = astro::NADIR_RIC,
        const astro::CartesianVector<Distance, astro::frames::dynamic::ric>& attachmentPoint = astro::CENTER
    ) :
        astro::PayloadParameters(boresight, attachmentPoint),
        _fov(fov)
    {
    }

    virtual ~SensorParameters() = default;

    const FieldOfView* get_fov() const { return _fov; }

    void set_fov(FieldOfView* fov) { _fov = fov; }

  protected:
    const FieldOfView* _fov; 
};

class Sensor : public AccessObject, public astro::Payload<Sensor, SensorParameters> {

    friend Payload<Sensor, SensorParameters>;

  public:
    template <typename Parent_T>
        requires(std::is_base_of_v<astro::FrameReference, Parent_T>)
    Sensor(const Parent_T& parent, const SensorParameters& parameters) :
        AccessObject(),
        Payload<Sensor, SensorParameters>(parent, parameters)
    {
    }

    virtual ~Sensor() = default;

    std::size_t get_id() const { return _id; }

    bool contains(const astro::RadiusVector<astro::frames::earth::icrf>& sensor2target, const astro::Date& date) const;

  private:
    std::size_t generate_id() const
    {
        static std::size_t idCounter = 0;
        return idCounter++;
    }
};

using SensorPlatform = astro::PayloadPlatform<Sensor>;

} // namespace trace
} // namespace astrea