diff --git a/cmd/skylabify/skylabify.go b/cmd/skylabify/skylabify.go index 0dd1bd7..1e708a8 100644 --- a/cmd/skylabify/skylabify.go +++ b/cmd/skylabify/skylabify.go @@ -14,6 +14,7 @@ import ( "github.com/kschamplin/gotelem/skylab" "github.com/urfave/cli/v2" + "golang.org/x/exp/slog" ) // this command can be used to decode candump logs and dump json output. @@ -112,7 +113,11 @@ func run(ctx *cli.Context) (err error) { // parse the data []byte to a skylab packet cd.Data, err = skylab.FromCanFrame(uint32(cd.Id), rawData) - if err != nil { + var idErr *skylab.UnknownIdError + if errors.As(err, &idErr) { + // unknown id + slog.Info("unknown id", "err", err) + } else if err != nil { return err } diff --git a/skylab/skylab.go b/skylab/skylab.go index b2e3bc2..9f6fb5f 100644 --- a/skylab/skylab.go +++ b/skylab/skylab.go @@ -3,6 +3,7 @@ package skylab import ( "encoding/binary" "encoding/json" + "fmt" "math" // this is needed so that we can run make_skylab.go @@ -162,3 +163,12 @@ func (e *BusEvent) UnmarshalMsg(b []byte) ([]byte, error) { // we need to be able to parse the JSON as well. this is done using the // generator since we can use the switch/case thing since it's the fastest + + +type UnknownIdError struct { + id uint64 +} + +func (e *UnknownIdError) Error() string { + return fmt.Sprintf("unknown id: %x", e.id) +} diff --git a/skylab/skylab_gen.go b/skylab/skylab_gen.go index 4348f60..9a2366e 100644 --- a/skylab/skylab_gen.go +++ b/skylab/skylab_gen.go @@ -1,4 +1,4 @@ -// generated by gen_skylab.go at 2023-05-30 21:59:25.165613242 -0500 CDT m=+0.002722998 DO NOT EDIT! +// generated by gen_skylab.go at 2023-06-27 20:32:07.43630691 -0500 CDT m=+0.003975675 DO NOT EDIT! package skylab @@ -236,7 +236,7 @@ var idMap = map[uint32]bool{ // If the CAN ID is unknown, it will return an error. func FromCanFrame(id uint32, data []byte) (Packet, error) { if !idMap[id] { - return nil, errors.New("unknown id") + return nil, &UnknownIdError{ id } } switch id { case 0x10: @@ -1559,7 +1559,7 @@ type BmsModule struct { func (p *BmsModule) CANId() (uint32, error) { if p.Idx >= 36 { - return 0, errors.New("invalid packet index") + return 0, &UnknownIdError{ 0x1C } } return 0x1C + p.Idx, nil } @@ -2546,7 +2546,7 @@ type TrackerEnable struct { func (p *TrackerEnable) CANId() (uint32, error) { if p.Idx >= 6 { - return 0, errors.New("invalid packet index") + return 0, &UnknownIdError{ 0x610 } } return 0x610 + p.Idx, nil } @@ -3636,7 +3636,7 @@ type TrackerData struct { func (p *TrackerData) CANId() (uint32, error) { if p.Idx >= 6 { - return 0, errors.New("invalid packet index") + return 0, &UnknownIdError{ 0x600 } } return 0x600 + p.Idx, nil } @@ -5364,4 +5364,4 @@ func (p *WslSlipSpeedMeasurement) String() string { // The json representation that was used to generate this data. // can be used to share the parsing data for i.e dynamic python gui. -const SkylabDefinitions = `{"packets":[{"name":"bms_measurement","description":"Voltages for main battery and aux pack","id":16,"endian":"little","repeat":0,"offset":0,"data":[{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01,"bits":null},{"name":"aux_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"current","type":"float","units":"A","conversion":1,"bits":null}]},{"name":"battery_status","description":"Status bits for the battery","id":17,"endian":"little","repeat":0,"offset":0,"data":[{"name":"battery_state","type":"bitfield","units":"","conversion":0,"bits":[{"name":"startup"},{"name":"precharge"},{"name":"discharging"},{"name":"lv_only"},{"name":"charging"},{"name":"wall_charging"},{"name":"killed"}]},{"name":"contactor_state","type":"bitfield","units":"","conversion":0,"bits":[{"name":"battery_high_contactor"},{"name":"battery_low_contactor"},{"name":"battery_vicor_contactor"},{"name":"battery_pre_contactor"},{"name":"battery_high2_contactor"},{"name":"battery_low2_contactor"},{"name":"charger_high_contactor"},{"name":"charger_pre_contactor"}]},{"name":"lv_channel_status","type":"bitfield","units":"","conversion":0,"bits":[{"name":"aux_fault"},{"name":"main_fault"},{"name":"aux_power_valid"},{"name":"main_power_valid"},{"name":"aux_power_active"},{"name":"main_power_active"}]},{"name":"lv_control_status","type":"bitfield","units":"","conversion":0,"bits":[{"name":"aux_vicor_enable"},{"name":"bat_vicor_enable"},{"name":"aux_relay_held"},{"name":"aux_ref_enable"},{"name":"aux_charging_enable"},{"name":"kill_hv"},{"name":"kill_lv"},{"name":"start_button"}]}]},{"name":"bms_kill_reason","description":"Information for when the car kills","id":18,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reason1","type":"bitfield","units":"","conversion":0,"bits":[{"name":"OVERVOLT"},{"name":"UNDERVOLT"},{"name":"OVERTEMP"},{"name":"TEMP_DISCONNECT"},{"name":"COMM_FAIL"}]},{"name":"reason2","type":"bitfield","units":"","conversion":0,"bits":[{"name":"HARDWARE"},{"name":"KILL_PACKET"},{"name":"UKNOWN"},{"name":"OVERCURRENT"},{"name":"PRECHARGE_FAIL"},{"name":"AUX_OVER_UNDER"}]},{"name":"module","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"value","type":"float","units":"","conversion":0,"bits":null}]},{"name":"bms_module_min_max","description":"min and max cell voltages and temperatures","id":19,"endian":"little","repeat":0,"offset":0,"data":[{"name":"module_max_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"module_min_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"module_max_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"module_min_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null}]},{"name":"bms_soc","description":"State of charge","id":20,"endian":"little","repeat":0,"offset":0,"data":[{"name":"soc","type":"float","units":"","conversion":1,"bits":null}]},{"name":"bms_capacity","description":"State of charge","id":21,"endian":"little","repeat":0,"offset":0,"data":[{"name":"Ah","type":"float","units":"","conversion":1,"bits":null},{"name":"Wh","type":"float","units":"","conversion":1,"bits":null}]},{"name":"bms_currentlimit","description":"reports BP params for current","id":24,"endian":"little","repeat":0,"offset":0,"data":[{"name":"current_max","type":"int16_t","units":"A","conversion":0.01,"bits":null},{"name":"current_min","type":"int16_t","units":"A","conversion":0.01,"bits":null}]},{"name":"bms_fan_info","description":"BP Fans","id":25,"endian":"little","repeat":0,"offset":0,"data":[{"name":"fan1","type":"uint16_t","units":"RPM","conversion":1,"bits":null},{"name":"fan2","type":"uint16_t","units":"RPM","conversion":1,"bits":null},{"name":"fan3","type":"uint16_t","units":"RPM","conversion":1,"bits":null},{"name":"fan4","type":"uint16_t","units":"RPM","conversion":1,"bits":null}]},{"name":"bms_set_min_fan_speed","description":"packet which sets a minimum fan speed of BMS for a specific time frame in seconds","id":27,"endian":"little","repeat":0,"offset":0,"data":[{"name":"fan_percentage","type":"float","units":"percent","conversion":0,"bits":null},{"name":"time","type":"uint16_t","units":"s","conversion":0,"bits":null}]},{"name":"bms_module","description":"Voltage and temperature for a single module","id":28,"endian":"little","repeat":36,"offset":1,"data":[{"name":"voltage","type":"float","units":"V","conversion":1,"bits":null},{"name":"temperature","type":"float","units":"C","conversion":1,"bits":null}]},{"name":"bms_charger_response","description":"Response packet from BMS for indicating whether BMS is ready for charging","id":117,"endian":"","repeat":0,"offset":0,"data":[{"name":"response_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"charging_ready"}]}]},{"name":"dashboard_pedal_percentages","description":"ADC values from the brake and accelerator pedals.","id":656,"endian":"little","repeat":0,"offset":0,"data":[{"name":"accel_pedal_value","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"brake_pedal_value","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"car_state","description":"Car gear. Forward, neutral, reverse, etc.","id":657,"endian":"little","repeat":0,"offset":0,"data":[{"name":"state","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"dashboard_pedal_fault","description":"Target speed that the driver should maintain.","id":658,"endian":"little","repeat":0,"offset":0,"data":[{"name":"brake_fault_count","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"accel_fault_count","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"dashboard_system_timeout_test","description":"Exposes whether each system that dashboard is supposed to listen for packets from has sent a packet. Used for testing.","id":665,"endian":"little","repeat":0,"offset":0,"data":[{"name":"flag_set_0","type":"bitfield","units":"","conversion":0,"bits":[{"name":"steering_disconnected"},{"name":"vision_front_disconnected"},{"name":"vision_rear_disconnected"},{"name":"telemetry_disconnected"},{"name":"wsl_disconnected"},{"name":"wsr_disconnected"},{"name":"front_mppt_disconnected"},{"name":"rear_mppt_disconnected"}]}]},{"name":"car_speed","description":"speed of car in meters per second","id":666,"endian":"little","repeat":0,"offset":0,"data":[{"name":"speed","type":"float","units":"","conversion":0,"bits":null}]},{"name":"flight_computer_lv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":667,"endian":"little","repeat":0,"offset":0,"data":[{"name":"front_lights","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"rear_lights","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"steering","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"vision","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"driver_display","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"center_console","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"flight_computer_hv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":668,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bms","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"charger","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"wsl","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"wsr","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"mppt_front","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"mppt_rear","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"flight_computer_internal_state","description":"internal bools","id":669,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bms","type":"bitfield","units":"","conversion":0,"bits":[{"name":"battery_kill"},{"name":"cells_in_charging_threshold"},{"name":"first_packet_received"}]},{"name":"charger","type":"bitfield","units":"","conversion":0,"bits":[{"name":"proximity_detected"}]},{"name":"photon3","type":"bitfield","units":"","conversion":0,"bits":[{"name":"enable"}]},{"name":"wavesculptor","type":"bitfield","units":"","conversion":0,"bits":[{"name":"sending_reset"},{"name":"regen_enable"}]},{"name":"internal","type":"bitfield","units":"","conversion":0,"bits":[{"name":"accel_pedal_disconnect"},{"name":"brake_pedal_disconnect"}]}]},{"name":"power_to_drive","description":"calculated power required to drive the vehicle","id":414,"endian":"little","repeat":0,"offset":0,"data":[{"name":"moving_average_100","type":"int16_t","units":"","conversion":0,"bits":null},{"name":"moving_average_1k","type":"int16_t","units":"","conversion":0,"bits":null},{"name":"moving_average_10k","type":"int16_t","units":"","conversion":0,"bits":null}]},{"name":"array_power","description":"array power calculated from current and voltage measurements","id":415,"endian":"little","repeat":0,"offset":0,"data":[{"name":"front_array_channel_0","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"front_array_channel_1","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"rear_array_channel_0","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"rear_array_channel_1","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"vision_turn_signals_command","description":"Command to have the vision board illuminate or turn off left, right, or both turn signals","id":688,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_brake_lights_command","description":"Command to have the vision board illuminate or turn off the brake lights","id":689,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"brake_lights"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_headlights_command","description":"Command to have the vision board illuminate or turn off the headlights and high beams","id":690,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"brightness","type":"float","units":"","conversion":0,"bits":null}]},{"name":"vision_horn_command","description":"Command the vision board honk the horn, must be repeatedly sent otherwise the vision board will stop honking after a bit. See high_power.h for details.","id":691,"endian":"","repeat":0,"offset":0,"data":[{"name":"horn","type":"bitfield","units":"","conversion":0,"bits":[{"name":"horn"},{"name":"spare"}]}]},{"name":"vision_array_latches_command","description":"Command the vision board to open the array latches","id":692,"endian":"","repeat":0,"offset":0,"data":[{"name":"array_latches","type":"bitfield","units":"","conversion":0,"bits":[{"name":"array_front"},{"name":"array_rear"}]}]},{"name":"vision_rearview_command","description":"Command the vision board turn on the rear view cameras","id":693,"endian":"","repeat":0,"offset":0,"data":[{"name":"cameras","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]}]},{"name":"tracker_enable","description":"Enables/disables power trackers. Use 0x610 for the channel transmitting the data packet on 0x600, 0x611 for 0x601, et cetera. Sending 1 in the enable byte turns the tracker on; sending 0 turns it off.","id":1552,"endian":"little","repeat":6,"offset":1,"data":[{"name":"enable","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"distance_traveled","description":"distance of wavesculptor odometer","id":512,"endian":"little","repeat":0,"offset":0,"data":[{"name":"trip_distance","type":"float","units":"m","conversion":0,"bits":null}]},{"name":"charger_state","description":"Notifies whether the J1772 cable is plugged.","id":1395,"endian":"","repeat":0,"offset":0,"data":[{"name":"state_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"charger_plugged"}]},{"name":"charger_max_temp","type":"uint16_t","units":"C","conversion":0.001,"bits":null},{"name":"fault","type":"bitfield","units":"","conversion":0,"bits":[{"name":"CHARGER_OVERVOLT"},{"name":"CHARGER_OVERTEMP"},{"name":"CHARGER_CAN_TIMEOUT"},{"name":"BATTERY_HV_KILL"},{"name":"BATTERY_UNDERVOLT"},{"name":"BATTERY_OVERVOLT"},{"name":"BATTERY_CELL_OVERTEMP"},{"name":"BATTERY_CAN_TIMEOUT"}]},{"name":"charging_current","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"charger_bms_request","description":"Request packet for sending contactor commands from the charger to BP.","id":116,"endian":"","repeat":0,"offset":0,"data":[{"name":"request_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"charging_requested"}]}]},{"name":"charger_current_voltage","description":"Packet to request charging current/voltage set","id":1398,"endian":"","repeat":0,"offset":0,"data":[{"name":"max_current","type":"float","units":"A","conversion":0,"bits":null},{"name":"max_capacity","type":"float","units":"kWh","conversion":0,"bits":null}]},{"name":"charger_power","description":"Outputs the amount of power that the chargers are delivering.","id":1399,"endian":"","repeat":0,"offset":0,"data":[{"name":"power","type":"float","units":"W","conversion":0,"bits":null}]},{"name":"thunderstruck_control_message","description":"Control packet for thunderstruck chargers","id":417677348,"endian":"little","repeat":0,"offset":0,"data":[{"name":"Enable","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"CHARGE_VOLTAGE","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"CHARGE_CURRENT","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"LED_BLINK_PATTERN","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"RESERVED","type":"uint16_t","units":"V","conversion":1,"bits":null}]},{"name":"vision_status_front","description":"Status of the front vision board outputs","id":694,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","units":"","conversion":0,"bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","units":"","conversion":0,"bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"vision_status_rear","description":"Status of the rear vision board outputs","id":695,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","units":"","conversion":0,"bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","units":"","conversion":0,"bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"lights_front_id","description":"Unique identification packet for front lights board","id":768,"endian":"","repeat":0,"offset":0,"data":[{"name":"board_id","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"fault_code","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"lights_back_id","description":"Unique identification packet for back lights board","id":769,"endian":"","repeat":0,"offset":0,"data":[{"name":"board_id","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"fault_code","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"vision_id","description":"Unique identification packet for vision","id":770,"endian":"","repeat":0,"offset":0,"data":[{"name":"board_id","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"fault_code","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"steering_press_count_1","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":576,"endian":"","repeat":0,"offset":0,"data":[{"name":"button0","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button1","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button2","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button3","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button4","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button5","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button6","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_press_count_2","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":592,"endian":"","repeat":0,"offset":0,"data":[{"name":"button7","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button8","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button9","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button10","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_button_colors_1","description":"This packet controls each button's color. Each byte is a hex color code.","id":577,"endian":"","repeat":0,"offset":0,"data":[{"name":"button0","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button1","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button2","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button3","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button4","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button5","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button6","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_button_colors_2","description":"This packet controls each button's color. Each byte is a hex color code.","id":593,"endian":"","repeat":0,"offset":0,"data":[{"name":"button7","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button8","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button9","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button10","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_horn","description":"This packet controls the state of the horn.","id":578,"endian":"","repeat":0,"offset":0,"data":[{"name":"horn","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"thunderstruck_status_message","description":"Status packet for thunderstruck chargers","id":418063424,"endian":"little","repeat":0,"offset":0,"data":[{"name":"STATUS_FLAGS","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"CHARGE_FLAGS","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"OUTPUT_VOLTAGE","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"OUTPUT_CURRENT","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"CHARGER_TEMP","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"RESERVED","type":"uint8_t","units":"V","conversion":1,"bits":null}]},{"name":"tracker_data","description":"Tracker data. Each channel transmits on a specific ID, which should be specified along with the tracker, most likely 0x600-0x603.","id":1536,"endian":"little","repeat":6,"offset":1,"data":[{"name":"array_voltage","type":"uint16_t","units":"V","conversion":0.01,"bits":null},{"name":"array_current","type":"uint16_t","units":"A","conversion":0.001,"bits":null},{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01,"bits":null},{"name":"temperature","type":"uint16_t","units":"C","conversion":0.01,"bits":null}]},{"name":"tritium_motor_drive","description":"Tritium Motor Drive Command","id":289,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_velocity","type":"float","units":"","conversion":0,"bits":null},{"name":"motor_current","type":"float","units":"","conversion":0,"bits":null}]},{"name":"tritium_motor_power","description":"Tritium Motor Power Command","id":290,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved","type":"float","units":"","conversion":0,"bits":null},{"name":"bus_current","type":"float","units":"","conversion":0,"bits":null}]},{"name":"tritium_reset","description":"Tritium Reset Command","id":291,"endian":"little","repeat":0,"offset":0,"data":[{"name":"unused1","type":"float","units":"","conversion":0,"bits":null},{"name":"unused2","type":"float","units":"","conversion":0,"bits":null}]},{"name":"bms_ah_set","description":"write state of charge, use with caution","id":22,"endian":"little","repeat":0,"offset":0,"data":[{"name":"ah","type":"uint32_t","units":"","conversion":0.00001,"bits":null}]},{"name":"bms_wh_set","description":"write state of charge, use with caution","id":23,"endian":"little","repeat":0,"offset":0,"data":[{"name":"wh","type":"uint32_t","units":"","conversion":0.00001,"bits":null}]},{"name":"bms_kill","description":"packet to cause BMS kill","id":26,"endian":"little","repeat":0,"offset":0,"data":[{"name":"kill_type","type":"bitfield","units":"","conversion":0,"bits":[{"name":"KILL_HARD"}]}]},{"name":"telemetry_rtc_reset","description":"Reset telemetry's real-time clock (RTC).","id":1792,"endian":"","repeat":0,"offset":0,"data":[{"name":"year","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"month","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"day","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"hour","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"minute","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"second","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"wsr_identification","description":"WS RIGHT Identification Information","id":320,"endian":"little","repeat":0,"offset":0,"data":[{"name":"tritium_id","type":"uint32_t","units":"","conversion":0,"bits":null},{"name":"serial_number","type":"uint32_t","units":"","conversion":0,"bits":null}]},{"name":"wsr_status_information","description":"WS RIGHT Status Information","id":321,"endian":"little","repeat":0,"offset":0,"data":[{"name":"limit_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"error_flags_0","type":"bitfield","units":"","conversion":0,"bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","units":"","conversion":0,"bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"reserved","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"wsr_bus_measurement","description":"WS RIGHT Bus Measurement","id":322,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bus_voltage","type":"float","units":"V","conversion":0,"bits":null},{"name":"bus_current","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsr_velocity","description":"WS RIGHT Velocity Measurement","id":323,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_velocity","type":"float","units":"rpm","conversion":0,"bits":null},{"name":"vehicle_velocity","type":"float","units":"m/s","conversion":0,"bits":null}]},{"name":"wsr_phase_current","description":"WS RIGHT Phase Current Measurement","id":324,"endian":"little","repeat":0,"offset":0,"data":[{"name":"phase_b_current","type":"float","units":"A rms","conversion":0,"bits":null},{"name":"phase_c_current","type":"float","units":"A rms","conversion":0,"bits":null}]},{"name":"wsr_motor_voltage_vector","description":"WS RIGHT Motor Voltage Vector Measurement","id":325,"endian":"little","repeat":0,"offset":0,"data":[{"name":"vq","type":"float","units":"V","conversion":0,"bits":null},{"name":"vd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_motor_current_vector","description":"WS RIGHT Motor Current Vector Measurement","id":326,"endian":"little","repeat":0,"offset":0,"data":[{"name":"iq","type":"float","units":"A","conversion":0,"bits":null},{"name":"id","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsr_motor_backemf","description":"WS RIGHT Motor BackEMF Measurement / Prediction","id":327,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bemfq","type":"float","units":"V","conversion":0,"bits":null},{"name":"bemfd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_15_165_voltage_rail","description":"WS RIGHT 15 and 1.65 Voltage Rail Measurement","id":328,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reference_165v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_15v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_25_12_voltage_rail","description":"WS RIGHT 2.5V and 1.2V Voltage Rail Measurement","id":329,"endian":"little","repeat":0,"offset":0,"data":[{"name":"supply_12v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_25v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_heatsink_motor_temp","description":"WS RIGHT Heat-sink \u0026 Motor Temperature Measurement","id":331,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"heatsink_temp","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsr_dsp_board_temp","description":"WS RIGHT DPS Board Temperature Measurement","id":332,"endian":"little","repeat":0,"offset":0,"data":[{"name":"dsp_board_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsr_reserved","description":"WS RIGHT Reserved","id":333,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved0","type":"float","units":"","conversion":0,"bits":null},{"name":"reserved1","type":"float","units":"","conversion":0,"bits":null}]},{"name":"wsr_odometer_bus_amphours_measurement","description":"WS RIGHT Odometer and Bus AmpHours Measurement","id":334,"endian":"little","repeat":0,"offset":0,"data":[{"name":"odometer","type":"float","units":"m","conversion":0,"bits":null},{"name":"dc_bus_amphours","type":"float","units":"Ah","conversion":0,"bits":null}]},{"name":"wsr_slip_speed_measurement","description":"WS RIGHT Slip Speed Measurement","id":343,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null},{"name":"slip_speed","type":"float","units":"Hz","conversion":0,"bits":null}]},{"name":"wsl_identification","description":"WS LEFT Identification Information","id":256,"endian":"little","repeat":0,"offset":0,"data":[{"name":"tritium_id","type":"uint32_t","units":"","conversion":0,"bits":null},{"name":"serial_number","type":"uint32_t","units":"","conversion":0,"bits":null}]},{"name":"wsl_status_information","description":"WS LEFT Status Information","id":257,"endian":"little","repeat":0,"offset":0,"data":[{"name":"limit_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"error_flags_0","type":"bitfield","units":"","conversion":0,"bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","units":"","conversion":0,"bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"reserved","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"wsl_bus_measurement","description":"WS LEFT Bus Measurement","id":258,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bus_voltage","type":"float","units":"V","conversion":0,"bits":null},{"name":"bus_current","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsl_velocity","description":"WS LEFT Velocity Measurement","id":259,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_velocity","type":"float","units":"rpm","conversion":0,"bits":null},{"name":"vehicle_velocity","type":"float","units":"m/s","conversion":0,"bits":null}]},{"name":"wsl_phase_current","description":"WS LEFT Phase Current Measurement","id":260,"endian":"little","repeat":0,"offset":0,"data":[{"name":"phase_b_current","type":"float","units":"A rms","conversion":0,"bits":null},{"name":"phase_c_current","type":"float","units":"A rms","conversion":0,"bits":null}]},{"name":"wsl_motor_voltage_vector","description":"WS LEFT Motor Voltage Vector Measurement","id":261,"endian":"little","repeat":0,"offset":0,"data":[{"name":"vq","type":"float","units":"V","conversion":0,"bits":null},{"name":"vd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_motor_current_vector","description":"WS LEFT Motor Current Vector Measurement","id":262,"endian":"little","repeat":0,"offset":0,"data":[{"name":"iq","type":"float","units":"A","conversion":0,"bits":null},{"name":"id","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsl_motor_backemf","description":"WS LEFT Motor BackEMF Measurement / Prediction","id":263,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bemfq","type":"float","units":"V","conversion":0,"bits":null},{"name":"bemfd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_15_165_voltage_rail","description":"WS LEFT 15 and 1.65 Voltage Rail Measurement","id":264,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reference_165v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_15v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_25_12_voltage_rail","description":"WS LEFT 2.5V and 1.2V Voltage Rail Measurement","id":265,"endian":"little","repeat":0,"offset":0,"data":[{"name":"supply_12v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_25v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_heatsink_motor_temp","description":"WS LEFT Heat-sink \u0026 Motor Temperature Measurement","id":267,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"heatsink_temp","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsl_dsp_board_temp","description":"WS LEFT DPS Board Temperature Measurement","id":268,"endian":"little","repeat":0,"offset":0,"data":[{"name":"dsp_board_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsl_odometer_bus_amphours_measurement","description":"WS LEFT Odometer and Bus AmpHours Measurement","id":270,"endian":"little","repeat":0,"offset":0,"data":[{"name":"odometer","type":"float","units":"m","conversion":0,"bits":null},{"name":"dc_bus_amphours","type":"float","units":"Ah","conversion":0,"bits":null}]},{"name":"wsl_reserved","description":"WS LEFT Reserved","id":269,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved0","type":"float","units":"","conversion":0,"bits":null},{"name":"reserved1","type":"float","units":"","conversion":0,"bits":null}]},{"name":"wsl_slip_speed_measurement","description":"WS LEFT Slip Speed Measurement","id":279,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null},{"name":"slip_speed","type":"float","units":"Hz","conversion":0,"bits":null}]}],"boards":[{"name":"bms","transmit":["bms_measurement","bms_capacity","bms_charger_response","battery_status","bms_kill_reason","bms_module_min_max","bms_soc","bms_currentlimit","bms_fan_info","bms_module"],"receive":["bms_kill","bms_wh_set","bms_ah_set","bms_set_min_fan_speed","charger_bms_request"]},{"name":"charger","transmit":["charger_state","charger_bms_request","charger_power"],"receive":["bms_charger_response","battery_status","bms_module_min_max","bms_measurement","charger_current_voltage","bms_capacity"]},{"name":"flight_computer","transmit":["tracker_enable","vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","tritium_motor_drive","steering_button_colors_1","steering_button_colors_2","tritium_reset","dashboard_pedal_percentages","car_state","car_speed","dashboard_pedal_fault","flight_computer_hv_board_disconnect_counts","flight_computer_lv_board_disconnect_counts","flight_computer_internal_state","power_to_drive","array_power","distance_traveled"],"receive":["bms_module_min_max","charger_state","steering_press_count_1","steering_press_count_2","wsl_velocity","wsr_velocity","steering_horn","bms_kill_reason","bms_measurement","tracker_data","vision_status_front","vision_status_rear","wsl_odometer_bus_amphours_measurement","wsr_odometer_bus_amphours_measurement"]},{"name":"g4_example","transmit":["vision_status_front","vision_headlights_command","tracker_data","demo_packet"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","demo_packet"]},{"name":"lights","transmit":["vision_status_front","vision_status_rear","lights_front_id","lights_back_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","bms_kill_reason"]},{"name":"skylab2_demo","transmit":["vision_status_front","vision_headlights_command","tracker_data"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command"]},{"name":"steering","transmit":["steering_press_count_1","steering_press_count_2","steering_horn"],"receive":["steering_button_colors_1","steering_button_colors_2"]},{"name":"vision","transmit":["vision_status_front","vision_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","vision_array_latches_command","vision_rearview_command"]}]}` \ No newline at end of file +const SkylabDefinitions = `{"packets":[{"name":"bms_measurement","description":"Voltages for main battery and aux pack","id":16,"endian":"little","repeat":0,"offset":0,"data":[{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01,"bits":null},{"name":"aux_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"current","type":"float","units":"A","conversion":1,"bits":null}]},{"name":"battery_status","description":"Status bits for the battery","id":17,"endian":"little","repeat":0,"offset":0,"data":[{"name":"battery_state","type":"bitfield","units":"","conversion":0,"bits":[{"name":"startup"},{"name":"precharge"},{"name":"discharging"},{"name":"lv_only"},{"name":"charging"},{"name":"wall_charging"},{"name":"killed"}]},{"name":"contactor_state","type":"bitfield","units":"","conversion":0,"bits":[{"name":"battery_high_contactor"},{"name":"battery_low_contactor"},{"name":"battery_vicor_contactor"},{"name":"battery_pre_contactor"},{"name":"battery_high2_contactor"},{"name":"battery_low2_contactor"},{"name":"charger_high_contactor"},{"name":"charger_pre_contactor"}]},{"name":"lv_channel_status","type":"bitfield","units":"","conversion":0,"bits":[{"name":"aux_fault"},{"name":"main_fault"},{"name":"aux_power_valid"},{"name":"main_power_valid"},{"name":"aux_power_active"},{"name":"main_power_active"}]},{"name":"lv_control_status","type":"bitfield","units":"","conversion":0,"bits":[{"name":"aux_vicor_enable"},{"name":"bat_vicor_enable"},{"name":"aux_relay_held"},{"name":"aux_ref_enable"},{"name":"aux_charging_enable"},{"name":"kill_hv"},{"name":"kill_lv"},{"name":"start_button"}]}]},{"name":"bms_kill_reason","description":"Information for when the car kills","id":18,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reason1","type":"bitfield","units":"","conversion":0,"bits":[{"name":"OVERVOLT"},{"name":"UNDERVOLT"},{"name":"OVERTEMP"},{"name":"TEMP_DISCONNECT"},{"name":"COMM_FAIL"}]},{"name":"reason2","type":"bitfield","units":"","conversion":0,"bits":[{"name":"HARDWARE"},{"name":"KILL_PACKET"},{"name":"UKNOWN"},{"name":"OVERCURRENT"},{"name":"PRECHARGE_FAIL"},{"name":"AUX_OVER_UNDER"}]},{"name":"module","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"value","type":"float","units":"","conversion":0,"bits":null}]},{"name":"bms_module_min_max","description":"min and max cell voltages and temperatures","id":19,"endian":"little","repeat":0,"offset":0,"data":[{"name":"module_max_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"module_min_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"module_max_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"module_min_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null}]},{"name":"bms_soc","description":"State of charge","id":20,"endian":"little","repeat":0,"offset":0,"data":[{"name":"soc","type":"float","units":"","conversion":1,"bits":null}]},{"name":"bms_capacity","description":"State of charge","id":21,"endian":"little","repeat":0,"offset":0,"data":[{"name":"Ah","type":"float","units":"","conversion":1,"bits":null},{"name":"Wh","type":"float","units":"","conversion":1,"bits":null}]},{"name":"bms_currentlimit","description":"reports BP params for current","id":24,"endian":"little","repeat":0,"offset":0,"data":[{"name":"current_max","type":"int16_t","units":"A","conversion":0.01,"bits":null},{"name":"current_min","type":"int16_t","units":"A","conversion":0.01,"bits":null}]},{"name":"bms_fan_info","description":"BP Fans","id":25,"endian":"little","repeat":0,"offset":0,"data":[{"name":"fan1","type":"uint16_t","units":"RPM","conversion":1,"bits":null},{"name":"fan2","type":"uint16_t","units":"RPM","conversion":1,"bits":null},{"name":"fan3","type":"uint16_t","units":"RPM","conversion":1,"bits":null},{"name":"fan4","type":"uint16_t","units":"RPM","conversion":1,"bits":null}]},{"name":"bms_set_min_fan_speed","description":"packet which sets a minimum fan speed of BMS for a specific time frame in seconds","id":27,"endian":"little","repeat":0,"offset":0,"data":[{"name":"fan_percentage","type":"float","units":"percent","conversion":0,"bits":null},{"name":"time","type":"uint16_t","units":"s","conversion":0,"bits":null}]},{"name":"bms_module","description":"Voltage and temperature for a single module","id":28,"endian":"little","repeat":36,"offset":1,"data":[{"name":"voltage","type":"float","units":"V","conversion":1,"bits":null},{"name":"temperature","type":"float","units":"C","conversion":1,"bits":null}]},{"name":"bms_charger_response","description":"Response packet from BMS for indicating whether BMS is ready for charging","id":117,"endian":"","repeat":0,"offset":0,"data":[{"name":"response_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"charging_ready"}]}]},{"name":"dashboard_pedal_percentages","description":"ADC values from the brake and accelerator pedals.","id":656,"endian":"little","repeat":0,"offset":0,"data":[{"name":"accel_pedal_value","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"brake_pedal_value","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"car_state","description":"Car gear. Forward, neutral, reverse, etc.","id":657,"endian":"little","repeat":0,"offset":0,"data":[{"name":"state","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"dashboard_pedal_fault","description":"Target speed that the driver should maintain.","id":658,"endian":"little","repeat":0,"offset":0,"data":[{"name":"brake_fault_count","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"accel_fault_count","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"dashboard_system_timeout_test","description":"Exposes whether each system that dashboard is supposed to listen for packets from has sent a packet. Used for testing.","id":665,"endian":"little","repeat":0,"offset":0,"data":[{"name":"flag_set_0","type":"bitfield","units":"","conversion":0,"bits":[{"name":"steering_disconnected"},{"name":"vision_front_disconnected"},{"name":"vision_rear_disconnected"},{"name":"telemetry_disconnected"},{"name":"wsl_disconnected"},{"name":"wsr_disconnected"},{"name":"front_mppt_disconnected"},{"name":"rear_mppt_disconnected"}]}]},{"name":"car_speed","description":"speed of car in meters per second","id":666,"endian":"little","repeat":0,"offset":0,"data":[{"name":"speed","type":"float","units":"","conversion":0,"bits":null}]},{"name":"flight_computer_lv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":667,"endian":"little","repeat":0,"offset":0,"data":[{"name":"front_lights","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"rear_lights","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"steering","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"vision","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"driver_display","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"center_console","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"flight_computer_hv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":668,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bms","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"charger","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"wsl","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"wsr","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"mppt_front","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"mppt_rear","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"flight_computer_internal_state","description":"internal bools","id":669,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bms","type":"bitfield","units":"","conversion":0,"bits":[{"name":"battery_kill"},{"name":"cells_in_charging_threshold"},{"name":"first_packet_received"}]},{"name":"charger","type":"bitfield","units":"","conversion":0,"bits":[{"name":"proximity_detected"}]},{"name":"photon3","type":"bitfield","units":"","conversion":0,"bits":[{"name":"enable"}]},{"name":"wavesculptor","type":"bitfield","units":"","conversion":0,"bits":[{"name":"sending_reset"},{"name":"regen_enable"}]},{"name":"internal","type":"bitfield","units":"","conversion":0,"bits":[{"name":"accel_pedal_disconnect"},{"name":"brake_pedal_disconnect"}]}]},{"name":"power_to_drive","description":"calculated power required to drive the vehicle","id":414,"endian":"little","repeat":0,"offset":0,"data":[{"name":"moving_average_100","type":"int16_t","units":"","conversion":0,"bits":null},{"name":"moving_average_1k","type":"int16_t","units":"","conversion":0,"bits":null},{"name":"moving_average_10k","type":"int16_t","units":"","conversion":0,"bits":null}]},{"name":"array_power","description":"array power calculated from current and voltage measurements","id":415,"endian":"little","repeat":0,"offset":0,"data":[{"name":"front_array_channel_0","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"front_array_channel_1","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"rear_array_channel_0","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"rear_array_channel_1","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"vision_turn_signals_command","description":"Command to have the vision board illuminate or turn off left, right, or both turn signals","id":688,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_brake_lights_command","description":"Command to have the vision board illuminate or turn off the brake lights","id":689,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"brake_lights"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_headlights_command","description":"Command to have the vision board illuminate or turn off the headlights and high beams","id":690,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"brightness","type":"float","units":"","conversion":0,"bits":null}]},{"name":"vision_horn_command","description":"Command the vision board honk the horn, must be repeatedly sent otherwise the vision board will stop honking after a bit. See high_power.h for details.","id":691,"endian":"","repeat":0,"offset":0,"data":[{"name":"horn","type":"bitfield","units":"","conversion":0,"bits":[{"name":"horn"},{"name":"spare"}]}]},{"name":"vision_array_latches_command","description":"Command the vision board to open the array latches","id":692,"endian":"","repeat":0,"offset":0,"data":[{"name":"array_latches","type":"bitfield","units":"","conversion":0,"bits":[{"name":"array_front"},{"name":"array_rear"}]}]},{"name":"vision_rearview_command","description":"Command the vision board turn on the rear view cameras","id":693,"endian":"","repeat":0,"offset":0,"data":[{"name":"cameras","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]}]},{"name":"tracker_enable","description":"Enables/disables power trackers. Use 0x610 for the channel transmitting the data packet on 0x600, 0x611 for 0x601, et cetera. Sending 1 in the enable byte turns the tracker on; sending 0 turns it off.","id":1552,"endian":"little","repeat":6,"offset":1,"data":[{"name":"enable","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"distance_traveled","description":"distance of wavesculptor odometer","id":512,"endian":"little","repeat":0,"offset":0,"data":[{"name":"trip_distance","type":"float","units":"m","conversion":0,"bits":null}]},{"name":"charger_state","description":"Notifies whether the J1772 cable is plugged.","id":1395,"endian":"","repeat":0,"offset":0,"data":[{"name":"state_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"charger_plugged"}]},{"name":"charger_max_temp","type":"uint16_t","units":"C","conversion":0.001,"bits":null},{"name":"fault","type":"bitfield","units":"","conversion":0,"bits":[{"name":"CHARGER_OVERVOLT"},{"name":"CHARGER_OVERTEMP"},{"name":"CHARGER_CAN_TIMEOUT"},{"name":"BATTERY_HV_KILL"},{"name":"BATTERY_UNDERVOLT"},{"name":"BATTERY_OVERVOLT"},{"name":"BATTERY_CELL_OVERTEMP"},{"name":"BATTERY_CAN_TIMEOUT"}]},{"name":"charging_current","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"charger_bms_request","description":"Request packet for sending contactor commands from the charger to BP.","id":116,"endian":"","repeat":0,"offset":0,"data":[{"name":"request_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"charging_requested"}]}]},{"name":"charger_current_voltage","description":"Packet to request charging current/voltage set","id":1398,"endian":"","repeat":0,"offset":0,"data":[{"name":"max_current","type":"float","units":"A","conversion":0,"bits":null},{"name":"max_capacity","type":"float","units":"kWh","conversion":0,"bits":null}]},{"name":"charger_power","description":"Outputs the amount of power that the chargers are delivering.","id":1399,"endian":"","repeat":0,"offset":0,"data":[{"name":"power","type":"float","units":"W","conversion":0,"bits":null}]},{"name":"thunderstruck_control_message","description":"Control packet for thunderstruck chargers","id":417677348,"endian":"little","repeat":0,"offset":0,"data":[{"name":"Enable","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"CHARGE_VOLTAGE","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"CHARGE_CURRENT","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"LED_BLINK_PATTERN","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"RESERVED","type":"uint16_t","units":"V","conversion":1,"bits":null}]},{"name":"vision_status_front","description":"Status of the front vision board outputs","id":694,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","units":"","conversion":0,"bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","units":"","conversion":0,"bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"vision_status_rear","description":"Status of the rear vision board outputs","id":695,"endian":"","repeat":0,"offset":0,"data":[{"name":"lights","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","units":"","conversion":0,"bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","units":"","conversion":0,"bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","units":"","conversion":0,"bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"lights_front_id","description":"Unique identification packet for front lights board","id":768,"endian":"","repeat":0,"offset":0,"data":[{"name":"board_id","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"fault_code","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"lights_back_id","description":"Unique identification packet for back lights board","id":769,"endian":"","repeat":0,"offset":0,"data":[{"name":"board_id","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"fault_code","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"vision_id","description":"Unique identification packet for vision","id":770,"endian":"","repeat":0,"offset":0,"data":[{"name":"board_id","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01,"bits":null},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001,"bits":null},{"name":"fault_code","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"steering_press_count_1","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":576,"endian":"","repeat":0,"offset":0,"data":[{"name":"button0","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button1","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button2","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button3","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button4","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button5","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button6","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_press_count_2","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":592,"endian":"","repeat":0,"offset":0,"data":[{"name":"button7","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button8","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button9","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button10","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_button_colors_1","description":"This packet controls each button's color. Each byte is a hex color code.","id":577,"endian":"","repeat":0,"offset":0,"data":[{"name":"button0","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button1","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button2","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button3","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button4","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button5","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button6","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_button_colors_2","description":"This packet controls each button's color. Each byte is a hex color code.","id":593,"endian":"","repeat":0,"offset":0,"data":[{"name":"button7","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button8","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button9","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"button10","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"steering_horn","description":"This packet controls the state of the horn.","id":578,"endian":"","repeat":0,"offset":0,"data":[{"name":"horn","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"thunderstruck_status_message","description":"Status packet for thunderstruck chargers","id":418063424,"endian":"little","repeat":0,"offset":0,"data":[{"name":"STATUS_FLAGS","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"CHARGE_FLAGS","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"OUTPUT_VOLTAGE","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"OUTPUT_CURRENT","type":"uint16_t","units":"V","conversion":1,"bits":null},{"name":"CHARGER_TEMP","type":"uint8_t","units":"V","conversion":1,"bits":null},{"name":"RESERVED","type":"uint8_t","units":"V","conversion":1,"bits":null}]},{"name":"tracker_data","description":"Tracker data. Each channel transmits on a specific ID, which should be specified along with the tracker, most likely 0x600-0x603.","id":1536,"endian":"little","repeat":6,"offset":1,"data":[{"name":"array_voltage","type":"uint16_t","units":"V","conversion":0.01,"bits":null},{"name":"array_current","type":"uint16_t","units":"A","conversion":0.001,"bits":null},{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01,"bits":null},{"name":"temperature","type":"uint16_t","units":"C","conversion":0.01,"bits":null}]},{"name":"tritium_motor_drive","description":"Tritium Motor Drive Command","id":289,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_velocity","type":"float","units":"","conversion":0,"bits":null},{"name":"motor_current","type":"float","units":"","conversion":0,"bits":null}]},{"name":"tritium_motor_power","description":"Tritium Motor Power Command","id":290,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved","type":"float","units":"","conversion":0,"bits":null},{"name":"bus_current","type":"float","units":"","conversion":0,"bits":null}]},{"name":"tritium_reset","description":"Tritium Reset Command","id":291,"endian":"little","repeat":0,"offset":0,"data":[{"name":"unused1","type":"float","units":"","conversion":0,"bits":null},{"name":"unused2","type":"float","units":"","conversion":0,"bits":null}]},{"name":"bms_ah_set","description":"write state of charge, use with caution","id":22,"endian":"little","repeat":0,"offset":0,"data":[{"name":"ah","type":"uint32_t","units":"","conversion":0.00001,"bits":null}]},{"name":"bms_wh_set","description":"write state of charge, use with caution","id":23,"endian":"little","repeat":0,"offset":0,"data":[{"name":"wh","type":"uint32_t","units":"","conversion":0.00001,"bits":null}]},{"name":"bms_kill","description":"packet to cause BMS kill","id":26,"endian":"little","repeat":0,"offset":0,"data":[{"name":"kill_type","type":"bitfield","units":"","conversion":0,"bits":[{"name":"KILL_HARD"}]}]},{"name":"telemetry_rtc_reset","description":"Reset telemetry's real-time clock (RTC).","id":1792,"endian":"","repeat":0,"offset":0,"data":[{"name":"year","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"month","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"day","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"hour","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"minute","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"second","type":"uint8_t","units":"","conversion":0,"bits":null}]},{"name":"wsr_identification","description":"WS RIGHT Identification Information","id":320,"endian":"little","repeat":0,"offset":0,"data":[{"name":"tritium_id","type":"uint32_t","units":"","conversion":0,"bits":null},{"name":"serial_number","type":"uint32_t","units":"","conversion":0,"bits":null}]},{"name":"wsr_status_information","description":"WS RIGHT Status Information","id":321,"endian":"little","repeat":0,"offset":0,"data":[{"name":"limit_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"error_flags_0","type":"bitfield","units":"","conversion":0,"bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","units":"","conversion":0,"bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"reserved","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"wsr_bus_measurement","description":"WS RIGHT Bus Measurement","id":322,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bus_voltage","type":"float","units":"V","conversion":0,"bits":null},{"name":"bus_current","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsr_velocity","description":"WS RIGHT Velocity Measurement","id":323,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_velocity","type":"float","units":"rpm","conversion":0,"bits":null},{"name":"vehicle_velocity","type":"float","units":"m/s","conversion":0,"bits":null}]},{"name":"wsr_phase_current","description":"WS RIGHT Phase Current Measurement","id":324,"endian":"little","repeat":0,"offset":0,"data":[{"name":"phase_b_current","type":"float","units":"A rms","conversion":0,"bits":null},{"name":"phase_c_current","type":"float","units":"A rms","conversion":0,"bits":null}]},{"name":"wsr_motor_voltage_vector","description":"WS RIGHT Motor Voltage Vector Measurement","id":325,"endian":"little","repeat":0,"offset":0,"data":[{"name":"vq","type":"float","units":"V","conversion":0,"bits":null},{"name":"vd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_motor_current_vector","description":"WS RIGHT Motor Current Vector Measurement","id":326,"endian":"little","repeat":0,"offset":0,"data":[{"name":"iq","type":"float","units":"A","conversion":0,"bits":null},{"name":"id","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsr_motor_backemf","description":"WS RIGHT Motor BackEMF Measurement / Prediction","id":327,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bemfq","type":"float","units":"V","conversion":0,"bits":null},{"name":"bemfd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_15_165_voltage_rail","description":"WS RIGHT 15 and 1.65 Voltage Rail Measurement","id":328,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reference_165v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_15v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_25_12_voltage_rail","description":"WS RIGHT 2.5V and 1.2V Voltage Rail Measurement","id":329,"endian":"little","repeat":0,"offset":0,"data":[{"name":"supply_12v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_25v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsr_heatsink_motor_temp","description":"WS RIGHT Heat-sink \u0026 Motor Temperature Measurement","id":331,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"heatsink_temp","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsr_dsp_board_temp","description":"WS RIGHT DPS Board Temperature Measurement","id":332,"endian":"little","repeat":0,"offset":0,"data":[{"name":"dsp_board_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsr_reserved","description":"WS RIGHT Reserved","id":333,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved0","type":"float","units":"","conversion":0,"bits":null},{"name":"reserved1","type":"float","units":"","conversion":0,"bits":null}]},{"name":"wsr_odometer_bus_amphours_measurement","description":"WS RIGHT Odometer and Bus AmpHours Measurement","id":334,"endian":"little","repeat":0,"offset":0,"data":[{"name":"odometer","type":"float","units":"m","conversion":0,"bits":null},{"name":"dc_bus_amphours","type":"float","units":"Ah","conversion":0,"bits":null}]},{"name":"wsr_slip_speed_measurement","description":"WS RIGHT Slip Speed Measurement","id":343,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null},{"name":"slip_speed","type":"float","units":"Hz","conversion":0,"bits":null}]},{"name":"wsl_identification","description":"WS LEFT Identification Information","id":256,"endian":"little","repeat":0,"offset":0,"data":[{"name":"tritium_id","type":"uint32_t","units":"","conversion":0,"bits":null},{"name":"serial_number","type":"uint32_t","units":"","conversion":0,"bits":null}]},{"name":"wsl_status_information","description":"WS LEFT Status Information","id":257,"endian":"little","repeat":0,"offset":0,"data":[{"name":"limit_flags","type":"bitfield","units":"","conversion":0,"bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t","units":"","conversion":0,"bits":null},{"name":"error_flags_0","type":"bitfield","units":"","conversion":0,"bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","units":"","conversion":0,"bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t","units":"","conversion":0,"bits":null},{"name":"reserved","type":"uint16_t","units":"","conversion":0,"bits":null}]},{"name":"wsl_bus_measurement","description":"WS LEFT Bus Measurement","id":258,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bus_voltage","type":"float","units":"V","conversion":0,"bits":null},{"name":"bus_current","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsl_velocity","description":"WS LEFT Velocity Measurement","id":259,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_velocity","type":"float","units":"rpm","conversion":0,"bits":null},{"name":"vehicle_velocity","type":"float","units":"m/s","conversion":0,"bits":null}]},{"name":"wsl_phase_current","description":"WS LEFT Phase Current Measurement","id":260,"endian":"little","repeat":0,"offset":0,"data":[{"name":"phase_b_current","type":"float","units":"A rms","conversion":0,"bits":null},{"name":"phase_c_current","type":"float","units":"A rms","conversion":0,"bits":null}]},{"name":"wsl_motor_voltage_vector","description":"WS LEFT Motor Voltage Vector Measurement","id":261,"endian":"little","repeat":0,"offset":0,"data":[{"name":"vq","type":"float","units":"V","conversion":0,"bits":null},{"name":"vd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_motor_current_vector","description":"WS LEFT Motor Current Vector Measurement","id":262,"endian":"little","repeat":0,"offset":0,"data":[{"name":"iq","type":"float","units":"A","conversion":0,"bits":null},{"name":"id","type":"float","units":"A","conversion":0,"bits":null}]},{"name":"wsl_motor_backemf","description":"WS LEFT Motor BackEMF Measurement / Prediction","id":263,"endian":"little","repeat":0,"offset":0,"data":[{"name":"bemfq","type":"float","units":"V","conversion":0,"bits":null},{"name":"bemfd","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_15_165_voltage_rail","description":"WS LEFT 15 and 1.65 Voltage Rail Measurement","id":264,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reference_165v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_15v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_25_12_voltage_rail","description":"WS LEFT 2.5V and 1.2V Voltage Rail Measurement","id":265,"endian":"little","repeat":0,"offset":0,"data":[{"name":"supply_12v","type":"float","units":"V","conversion":0,"bits":null},{"name":"supply_25v","type":"float","units":"V","conversion":0,"bits":null}]},{"name":"wsl_heatsink_motor_temp","description":"WS LEFT Heat-sink \u0026 Motor Temperature Measurement","id":267,"endian":"little","repeat":0,"offset":0,"data":[{"name":"motor_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"heatsink_temp","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsl_dsp_board_temp","description":"WS LEFT DPS Board Temperature Measurement","id":268,"endian":"little","repeat":0,"offset":0,"data":[{"name":"dsp_board_temp","type":"float","units":"C","conversion":0,"bits":null},{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null}]},{"name":"wsl_odometer_bus_amphours_measurement","description":"WS LEFT Odometer and Bus AmpHours Measurement","id":270,"endian":"little","repeat":0,"offset":0,"data":[{"name":"odometer","type":"float","units":"m","conversion":0,"bits":null},{"name":"dc_bus_amphours","type":"float","units":"Ah","conversion":0,"bits":null}]},{"name":"wsl_reserved","description":"WS LEFT Reserved","id":269,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved0","type":"float","units":"","conversion":0,"bits":null},{"name":"reserved1","type":"float","units":"","conversion":0,"bits":null}]},{"name":"wsl_slip_speed_measurement","description":"WS LEFT Slip Speed Measurement","id":279,"endian":"little","repeat":0,"offset":0,"data":[{"name":"reserved","type":"float","units":"C","conversion":0,"bits":null},{"name":"slip_speed","type":"float","units":"Hz","conversion":0,"bits":null}]}],"boards":[{"name":"bms","transmit":["bms_measurement","bms_capacity","bms_charger_response","battery_status","bms_kill_reason","bms_module_min_max","bms_soc","bms_currentlimit","bms_fan_info","bms_module"],"receive":["bms_kill","bms_wh_set","bms_ah_set","bms_set_min_fan_speed","charger_bms_request"]},{"name":"charger","transmit":["charger_state","charger_bms_request","charger_power"],"receive":["bms_charger_response","battery_status","bms_module_min_max","bms_measurement","charger_current_voltage","bms_capacity"]},{"name":"flight_computer","transmit":["tracker_enable","vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","tritium_motor_drive","steering_button_colors_1","steering_button_colors_2","tritium_reset","dashboard_pedal_percentages","car_state","car_speed","dashboard_pedal_fault","flight_computer_hv_board_disconnect_counts","flight_computer_lv_board_disconnect_counts","flight_computer_internal_state","power_to_drive","array_power","distance_traveled"],"receive":["bms_module_min_max","charger_state","steering_press_count_1","steering_press_count_2","wsl_velocity","wsr_velocity","steering_horn","bms_kill_reason","bms_measurement","tracker_data","vision_status_front","vision_status_rear","wsl_odometer_bus_amphours_measurement","wsr_odometer_bus_amphours_measurement"]},{"name":"g4_example","transmit":["vision_status_front","vision_headlights_command","tracker_data","demo_packet"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","demo_packet"]},{"name":"lights","transmit":["vision_status_front","vision_status_rear","lights_front_id","lights_back_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","bms_kill_reason"]},{"name":"skylab2_demo","transmit":["vision_status_front","vision_headlights_command","tracker_data"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command"]},{"name":"steering","transmit":["steering_press_count_1","steering_press_count_2","steering_horn"],"receive":["steering_button_colors_1","steering_button_colors_2"]},{"name":"vision","transmit":["vision_status_front","vision_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","vision_array_latches_command","vision_rearview_command"]}]}` diff --git a/skylab/templates/golang.go.tmpl b/skylab/templates/golang.go.tmpl index 1cb219c..46aae41 100644 --- a/skylab/templates/golang.go.tmpl +++ b/skylab/templates/golang.go.tmpl @@ -48,7 +48,7 @@ type {{$structName}} struct { func (p *{{$structName}}) CANId() (uint32, error) { {{- if .Repeat }} if p.Idx >= {{.Repeat}} { - return 0, errors.New("invalid packet index") + return 0, &UnknownIdError{ {{ printf "0x%X" .Id }} } } return {{ printf "0x%X" .Id }} + p.Idx, nil {{- else }} @@ -114,7 +114,7 @@ var idMap = map[uint32]bool{ // If the CAN ID is unknown, it will return an error. func FromCanFrame(id uint32, data []byte) (Packet, error) { if !idMap[id] { - return nil, errors.New("unknown id") + return nil, &UnknownIdError{ id } } switch id { {{- range $p := .Packets }} @@ -167,4 +167,4 @@ func FromJson (id uint32, raw []byte) (Packet, error) { // The json representation that was used to generate this data. // can be used to share the parsing data for i.e dynamic python gui. -const SkylabDefinitions = `{{json . | printf "%s" }}` \ No newline at end of file +const SkylabDefinitions = `{{json . | printf "%s" }}`