Skip to content

Commit

Permalink
add match time and batt
Browse files Browse the repository at this point in the history
  • Loading branch information
r4stered committed Nov 1, 2024
1 parent 7b77f57 commit 5865df9
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 26 deletions.
167 changes: 141 additions & 26 deletions elastic-layout.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,81 @@
{
"version": 1.0,
"grid_size": 128,
"grid_size": 64,
"tabs": [
{
"name": "Teleoperated",
"grid_layout": {
"layouts": [],
"containers": [
{
"title": "BottomWheelTuningSetpoint",
"x": 512.0,
"y": 256.0,
"width": 512.0,
"title": "FMSInfo",
"x": 0.0,
"y": 0.0,
"width": 384.0,
"height": 128.0,
"type": "FMSInfo",
"properties": {
"topic": "/FMSInfo",
"period": 0.06
}
},
{
"title": "HasNote",
"x": 0.0,
"y": 448.0,
"width": 256.0,
"height": 128.0,
"type": "Number Slider",
"type": "Boolean Box",
"properties": {
"topic": "/Shooter/BottomWheelTuningSetpoint",
"topic": "/Feeder/HasNote",
"period": 0.06,
"data_type": "double",
"min_value": -7000.0,
"max_value": 7000.0,
"divisions": 3,
"update_continuously": true
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "None"
}
},
{
"title": "Auto Chooser",
"x": 512.0,
"y": 384.0,
"width": 512.0,
"title": "TouchingNote",
"x": 0.0,
"y": 320.0,
"width": 256.0,
"height": 128.0,
"type": "Boolean Box",
"properties": {
"topic": "/Intake/TouchingNote",
"period": 0.06,
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "None"
}
},
{
"title": "IsUpToSpeed",
"x": 0.0,
"y": 576.0,
"width": 256.0,
"height": 128.0,
"type": "Boolean Box",
"properties": {
"topic": "/Shooter/IsUpToSpeed",
"period": 0.06,
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "None"
}
},
{
"title": "Auto Chooser",
"x": 0.0,
"y": 128.0,
"width": 384.0,
"height": 192.0,
"type": "ComboBox Chooser",
"properties": {
"topic": "/SmartDashboard/Auto Chooser",
Expand All @@ -38,20 +84,89 @@
}
},
{
"title": "TopWheelTuningSetpoint",
"x": 512.0,
"y": 128.0,
"width": 512.0,
"title": "BatteryVoltage",
"x": 256.0,
"y": 320.0,
"width": 448.0,
"height": 128.0,
"type": "Number Slider",
"type": "Voltage View",
"properties": {
"topic": "/Shooter/TopWheelTuningSetpoint",
"topic": "/Metadata/BatteryVoltage",
"period": 0.06,
"data_type": "double",
"min_value": -7000.0,
"max_value": 7000.0,
"divisions": 3,
"update_continuously": true
"min_value": 4.0,
"max_value": 13.0,
"divisions": 5,
"inverted": false,
"orientation": "horizontal"
}
},
{
"title": "MatchTime",
"x": 256.0,
"y": 448.0,
"width": 448.0,
"height": 256.0,
"type": "Match Time",
"properties": {
"topic": "/Metadata/MatchTime",
"period": 0.06,
"data_type": "double",
"time_display_mode": "Minutes and Seconds",
"red_start_time": 15,
"yellow_start_time": 30
}
},
{
"title": "str_bl_cam-processed",
"x": 1408.0,
"y": 256.0,
"width": 256.0,
"height": 256.0,
"type": "Camera Stream",
"properties": {
"topic": "/CameraPublisher/str_bl_cam-processed",
"period": 0.06
}
},
{
"title": "str_br_cam-processed",
"x": 1664.0,
"y": 256.0,
"width": 256.0,
"height": 256.0,
"type": "Camera Stream",
"properties": {
"topic": "/CameraPublisher/str_br_cam-processed",
"period": 0.06
}
},
{
"title": "str_fl_cam-processed",
"x": 1408.0,
"y": 0.0,
"width": 256.0,
"height": 256.0,
"type": "Camera Stream",
"properties": {
"topic": "/CameraPublisher/str_fl_cam-processed",
"period": 0.06,
"resolution": [
320.0,
240.0
]
}
},
{
"title": "str_fr_cam-processed",
"x": 1664.0,
"y": 0.0,
"width": 256.0,
"height": 256.0,
"type": "Camera Stream",
"properties": {
"topic": "/CameraPublisher/str_fr_cam-processed",
"period": 0.06
}
}
]
Expand Down
2 changes: 2 additions & 0 deletions src/main/cpp/Robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ void Robot::RobotPeriodic() {
// m_container.GetVision().GetAngleToNote());

lastTotalLoopTime = now;
matchTimePub.Set(frc::DriverStation::GetMatchTime().value());
battVoltagePub.Set(frc::RobotController::GetBatteryVoltage().value());
}

void Robot::UpdateVision() {
Expand Down
2 changes: 2 additions & 0 deletions src/main/include/Robot.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class Robot : public frc::TimedRobot {
.GetTable("Looptime")
->GetDoubleTopic("RobotPeriodicLoopRate")
.Publish()};
nt::DoublePublisher matchTimePub{nt::NetworkTableInstance::GetDefault().GetTable("Metadata")->GetDoubleTopic("MatchTime").Publish()};
nt::DoublePublisher battVoltagePub{nt::NetworkTableInstance::GetDefault().GetTable("Metadata")->GetDoubleTopic("BatteryVoltage").Publish()};
std::array<frc::Pose3d, 5> cameraLocations;
nt::StructArrayPublisher<frc::Pose3d> cameraLocationsPub{
nt::NetworkTableInstance::GetDefault()
Expand Down

0 comments on commit 5865df9

Please sign in to comment.