Expose camera name in PhotonCamera (#523)

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
This commit is contained in:
Lavi Arzi
2022-12-25 07:01:57 +02:00
committed by GitHub
parent e1b39a1723
commit 8330bf9d92
3 changed files with 31 additions and 5 deletions

View File

@@ -58,14 +58,14 @@ class PhotonCamera {
* over.
*/
explicit PhotonCamera(std::shared_ptr<nt::NetworkTableInstance> instance,
const std::string& cameraName);
const std::string_view cameraName);
/**
* Constructs a PhotonCamera from the name of the camera.
* @param cameraName The nickname of the camera (found in the PhotonVision
* UI).
*/
explicit PhotonCamera(const std::string& cameraName);
explicit PhotonCamera(const std::string_view cameraName);
/**
* Returns the latest pipeline result.
@@ -131,6 +131,14 @@ class PhotonCamera {
*/
void SetLEDMode(LEDMode led);
/**
* Returns the name of the camera.
* This will return the same value that was given to the constructor as
* cameraName.
* @return The name of the camera.
*/
const std::string_view GetCameraName() const;
/**
* Returns whether the latest target result has targets.
* This method is deprecated; {@link PhotonPipelineResult#hasTargets()} should
@@ -163,6 +171,7 @@ class PhotonCamera {
nt::IntegerSubscriber ledModeSubscriber;
std::string path;
std::string m_cameraName;
mutable Packet packet;