Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame^] | 1 | // Provides a plot for debugging robot state-related issues. |
| 2 | import {AosPlotter} from '../../../aos/network/www/aos_plotter'; |
| 3 | import {BLUE, BROWN, CYAN, GREEN, PINK, RED, WHITE} from '../../../aos/network/www/colors'; |
| 4 | import * as proxy from '../../../aos/network/www/proxy'; |
| 5 | |
| 6 | import Connection = proxy.Connection; |
| 7 | |
| 8 | const TIME = AosPlotter.TIME; |
| 9 | const DEFAULT_WIDTH = AosPlotter.DEFAULT_WIDTH * 2; |
| 10 | const DEFAULT_HEIGHT = AosPlotter.DEFAULT_HEIGHT * 3; |
| 11 | |
| 12 | export function plotSuperstructure(conn: Connection, element: Element): void { |
| 13 | const aosPlotter = new AosPlotter(conn); |
| 14 | //const goal = aosPlotter.addMessageSource( |
| 15 | // '/superstructure', 'y2024.control_loops.superstructure.Goal'); |
| 16 | //const output = aosPlotter.addMessageSource( |
| 17 | // '/superstructure', 'y2024.control_loops.superstructure.Output'); |
| 18 | //const status = aosPlotter.addMessageSource( |
| 19 | // '/superstructure', 'y2024.control_loops.superstructure.Status'); |
| 20 | const position = aosPlotter.addMessageSource( |
| 21 | '/superstructure', 'y2024.control_loops.superstructure.Position'); |
| 22 | //const robotState = aosPlotter.addMessageSource('/aos', 'aos.RobotState'); |
| 23 | |
| 24 | const positionPlot = |
| 25 | aosPlotter.addPlot(element, [DEFAULT_WIDTH, DEFAULT_HEIGHT / 2]); |
| 26 | positionPlot.plot.getAxisLabels().setTitle('States'); |
| 27 | positionPlot.plot.getAxisLabels().setXLabel(TIME); |
| 28 | positionPlot.plot.getAxisLabels().setYLabel('wonky state units'); |
| 29 | positionPlot.plot.setDefaultYRange([-1.0, 2.0]); |
| 30 | } |