frc6377 / crescendo_2024

Other
5 stars 2 forks source link

Swerve Telemetry is logging ( and sending to shuffleboard ) excessive updates #106

Closed caseyjbrotherton closed 8 months ago

caseyjbrotherton commented 8 months ago

Swerve is sending excessive updates to logs and network tables.
In two logs Pose is sent 2524 over 8 seconds, 1890 over 6 seconds. And there are multiple network tables updates a similar number of times

I am not sure if this is causing a problem. But we may want to consider how to reduce the shuffleboard calls.

Some ideas:

Here are some log file explorations reviewing the amount of swerve telemetry updates that are occurring:

$ cat FRC_20240129_013746.csv | awk -F"," 'BEGIN{a=0;e=0;first=-1;last=-1} /Enabled.true/{e=1} /Enabled.false/{e=0} /Autonomous.true/{a=1} /Autonomous.false/{a=0} a==1 && e==1 {last=$1;if ( first == -1 ) first = $1} END{print first,last,last-first}' | tail -1 45.403991 53.399579 7.99559 $ cat FRC_20240129_013746.csv | awk -F"," 'BEGIN{a=0;e=0} /Enabled.true/{e=1} /Enabled.false/{e=0} /Autonomous.true/{a=1} /Autonomous.false/{a=0} a==1 && e==1 && $2~/Pose|botpose_wpiblue|PathPlanner.Pose/{print $2}' | sort | uniq -c | sort -rn 2524 "NT:/Pose/robotPose" 356 "NT:/PathPlanner/targetPose" 356 "NT:/PathPlanner/currentPose" 26 "NT:/limelight/botpose_wpiblue" $ cat FRC_20240129_011041.csv | awk -F"," 'BEGIN{a=0;e=0} /Enabled.true/{e=1} /Enabled.false/{e=0} /Autonomous.true/{a=1} /Autonomous.false/{a=0} a==1 && e==1 && $2~/Pose|botpose_wpiblue|PathPlanner.Pose/{print $2}' | sort | uniq -c | sort -rn 1890 "NT:/Pose/robotPose" 538 "NT:/PathPlanner/targetPose" 538 "NT:/PathPlanner/currentPose" 19 "NT:/limelight/botpose_wpiblue" $ cat FRC_20240129_011041.csv | awk -F"," 'BEGIN{a=0;e=0;first=-1;last=-1} /Enabled.true/{e=1} /Enabled.false/{e=0} /Autonomous.true/{a=1} /Autonomous.false/{a=0} a==1 && e==1 {last=$1;if ( first == -1 ) first = $1} END{print first,last,last-first}' | tail -1 132.634553 138.825467 6.19091 $ cat FRC_20240129_011041.csv | awk -F"," 'BEGIN{a=0;e=0} /Enabled.true/{e=1} /Enabled.false/{e=0} /Autonomous.true/{a=1} /Autonomous.false/{a=0} a==1 && e==1 && $2~/NT:/{print $2}' | wc -l 34816 $ cat FRC_20240129_013746.csv | awk -F"," 'BEGIN{a=0;e=0} /Enabled.true/{e=1} /Enabled.false/{e=0} /Autonomous.true/{a=1} /Autonomous.false/{a=0} a==1 && e==1 && $2~/NT:/{print $2}' | wc -l 35890 $ cat FRC_20240129_011041.csv | awk -F"," 'BEGIN{a=0;e=0} /Enabled.true/{e=1} /Enabled.false/{e=0} /Autonomous.true/{a=1} /Autonomous.false/{a=0} a==1 && e==1 && $2~/NT:/{print $2}' | sort | uniq -c | sort -rn | head 1890 "NT:/Pose/robotPose" 1883 "NT:/Drive/Odometry Period" 1836 "NT:/Drive/Speed" 1833 "NT:/Drive/Velocity X" 1832 "NT:/Drive/Velocity Y" 1765 "NT:/SmartDashboard/Module 1/RootSpeed/Speed/length" 1759 "NT:/SmartDashboard/Module 0/RootSpeed/Speed/length" 1758 "NT:/SmartDashboard/Module 2/RootSpeed/Speed/length" 1756 "NT:/SmartDashboard/Module 3/RootSpeed/Speed/length" 791 "NT:/SmartDashboard/Module 0/RootSpeed/Speed/angle"

caseyjbrotherton commented 8 months ago

Commenting out the telemetry function entirely removes a large number of Loop overrun errors while the robot is just sitting and not doing anything.

@azvanderpas reviewed the code and it seemed to be for simulation.

We should use the telemetry function for simulation, and have a much less aggressive logging routine for when the robot is actually running.