WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::FieldObject2d Class Reference

Game field object on a Field2d. More...

#include <wpi/smartdashboard/FieldObject2d.hpp>

Public Member Functions

 FieldObject2d (std::string_view name, const private_init &)
 FieldObject2d (FieldObject2d &&rhs)
FieldObject2doperator= (FieldObject2d &&rhs)
void SetPose (const wpi::math::Pose2d &pose)
 Set the pose from a Pose object.
void SetPose (wpi::units::meter_t x, wpi::units::meter_t y, wpi::math::Rotation2d rotation)
 Set the pose from x, y, and rotation.
wpi::math::Pose2d GetPose () const
 Get the pose.
void SetPoses (std::span< const wpi::math::Pose2d > poses)
 Set multiple poses from an array of Pose objects.
void SetPoses (std::initializer_list< wpi::math::Pose2d > poses)
 Set multiple poses from an array of Pose objects.
void SetTrajectory (const wpi::math::Trajectory &trajectory)
 Sets poses from a trajectory.
std::vector< wpi::math::Pose2dGetPoses () const
 Get multiple poses.
std::span< const wpi::math::Pose2dGetPoses (wpi::util::SmallVectorImpl< wpi::math::Pose2d > &out) const
 Get multiple poses.

Friends

class Field2d

Detailed Description

Game field object on a Field2d.

Constructor & Destructor Documentation

◆ FieldObject2d() [1/2]

wpi::FieldObject2d::FieldObject2d ( std::string_view name,
const private_init &  )
inline

◆ FieldObject2d() [2/2]

wpi::FieldObject2d::FieldObject2d ( FieldObject2d && rhs)

Member Function Documentation

◆ GetPose()

wpi::math::Pose2d wpi::FieldObject2d::GetPose ( ) const

Get the pose.

Returns
2D pose, or 0,0,0 if unknown / does not exist

◆ GetPoses() [1/2]

std::vector< wpi::math::Pose2d > wpi::FieldObject2d::GetPoses ( ) const

Get multiple poses.

Returns
vector of 2D poses

◆ GetPoses() [2/2]

std::span< const wpi::math::Pose2d > wpi::FieldObject2d::GetPoses ( wpi::util::SmallVectorImpl< wpi::math::Pose2d > & out) const

Get multiple poses.

Parameters
outoutput wpi::util::SmallVector to hold 2D poses
Returns
span referring to output wpi::util::SmallVector

◆ operator=()

FieldObject2d & wpi::FieldObject2d::operator= ( FieldObject2d && rhs)

◆ SetPose() [1/2]

void wpi::FieldObject2d::SetPose ( const wpi::math::Pose2d & pose)

Set the pose from a Pose object.

Parameters
pose2D pose

◆ SetPose() [2/2]

void wpi::FieldObject2d::SetPose ( wpi::units::meter_t x,
wpi::units::meter_t y,
wpi::math::Rotation2d rotation )

Set the pose from x, y, and rotation.

Parameters
xX location
yY location
rotationrotation

◆ SetPoses() [1/2]

void wpi::FieldObject2d::SetPoses ( std::initializer_list< wpi::math::Pose2d > poses)

Set multiple poses from an array of Pose objects.

The total number of poses is limited to 85.

Parameters
posesarray of 2D poses

◆ SetPoses() [2/2]

void wpi::FieldObject2d::SetPoses ( std::span< const wpi::math::Pose2d > poses)

Set multiple poses from an array of Pose objects.

The total number of poses is limited to 85.

Parameters
posesarray of 2D poses

◆ SetTrajectory()

void wpi::FieldObject2d::SetTrajectory ( const wpi::math::Trajectory & trajectory)

Sets poses from a trajectory.

Parameters
trajectoryThe trajectory from which poses should be added.

◆ Field2d

friend class Field2d
friend

The documentation for this class was generated from the following file: