[wpilib] Add metadata to all dashboard ".type" entries (#6799)

This commit is contained in:
Ryan Blue
2024-07-02 16:31:50 -04:00
committed by GitHub
parent 7366a03fc9
commit 6a5448322b
12 changed files with 95 additions and 23 deletions

View File

@@ -5,9 +5,12 @@
#include "frc/smartdashboard/MechanismLigament2d.h"
#include <wpi/StringExtras.h>
#include <wpi/json.h>
using namespace frc;
static constexpr std::string_view kSmartDashboardType = "line";
MechanismLigament2d::MechanismLigament2d(std::string_view name, double length,
units::degree_t angle,
double lineWeight,
@@ -21,8 +24,9 @@ MechanismLigament2d::MechanismLigament2d(std::string_view name, double length,
void MechanismLigament2d::UpdateEntries(
std::shared_ptr<nt::NetworkTable> table) {
m_typePub = table->GetStringTopic(".type").Publish();
m_typePub.Set("line");
m_typePub = table->GetStringTopic(".type").PublishEx(
nt::StringTopic::kTypeString, {{"SmartDashboard", kSmartDashboardType}});
m_typePub.Set(kSmartDashboardType);
m_colorEntry = table->GetStringTopic("color").GetEntry("");
m_colorEntry.Set(m_color);