WPILibC++  2020.3.2
Field2d.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2020 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <hal/SimDevice.h>
11 #include <units/units.h>
12 
13 #include "frc/geometry/Pose2d.h"
14 #include "frc/geometry/Rotation2d.h"
15 
16 namespace frc {
17 
34 class Field2d {
35  public:
36  Field2d();
37 
43  void SetRobotPose(const Pose2d& pose);
44 
52  void SetRobotPose(units::meter_t x, units::meter_t y, Rotation2d rotation);
53 
60 
61  private:
62  Pose2d m_pose;
63 
64  hal::SimDevice m_device;
65  hal::SimDouble m_x;
66  hal::SimDouble m_y;
67  hal::SimDouble m_rot;
68 };
69 
70 } // namespace frc
frc::Field2d
2D representation of game field (for simulation).
Definition: Field2d.h:34
frc::Rotation2d
A rotation in a 2d coordinate frame represented a point on the unit circle (cosine and sine).
Definition: Rotation2d.h:22
frc::Field2d::GetRobotPose
Pose2d GetRobotPose()
Get the robot pose.
frc::Pose2d
Represents a 2d pose containing translational and rotational elements.
Definition: Pose2d.h:23
frc::Field2d::SetRobotPose
void SetRobotPose(const Pose2d &pose)
Set the robot pose from a Pose object.
frc
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16