#pragma once
#include <memory>
#include <string_view>
#include <vector>
#include <networktables/NTSendable.h>
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <units/length.h>
#include <wpi/mutex.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/geometry/Pose2d.h"
#include "frc/geometry/Rotation2d.h"
#include "frc/smartdashboard/FieldObject2d.h"
namespace frc {
class Field2d : public nt::NTSendable, public wpi::SendableHelper<Field2d> {
public:
using Entry = size_t;
Field2d();
Field2d(Field2d&& rhs);
Field2d& operator=(Field2d&& rhs);
void SetRobotPose(const Pose2d& pose);
void SetRobotPose(units::meter_t x, units::meter_t y, Rotation2d rotation);
Pose2d GetRobotPose() const;
FieldObject2d* GetObject(std::string_view name);
FieldObject2d* GetRobotObject();
void InitSendable(nt::NTSendableBuilder& builder) override;
private:
std::shared_ptr<nt::NetworkTable> m_table;
mutable wpi::mutex m_mutex;
std::vector<std::unique_ptr<FieldObject2d>> m_objects;
};
}