From 0c8a25a2f4fae9b690f461e5d6697bc4fc20b315 Mon Sep 17 00:00:00 2001 From: saji Date: Mon, 12 Feb 2024 14:38:01 -0600 Subject: [PATCH] move parsers to internal library many fixes related to previous changes added import command --- cmd/gotelem/cli/client.go | 141 +++++- cmd/gotelem/cli/server.go | 10 +- cmd/gotelem/cli/socketcan.go | 14 +- cmd/skylabify/skylabify.go | 167 +------ frame_kind.go | 26 - http.go | 13 +- internal/db/db.go | 12 +- internal/logparsers/parsers.go | 168 +++++++ py/pytelem/skylab_attr.py | 11 +- skylab/skylab.go | 11 +- skylab/skylab_gen.go | 822 +++++++++++++++++++------------- skylab/templates/golang.go.tmpl | 14 +- 12 files changed, 861 insertions(+), 548 deletions(-) delete mode 100644 frame_kind.go create mode 100644 internal/logparsers/parsers.go diff --git a/cmd/gotelem/cli/client.go b/cmd/gotelem/cli/client.go index 54caf77..7d97ef6 100644 --- a/cmd/gotelem/cli/client.go +++ b/cmd/gotelem/cli/client.go @@ -1,21 +1,148 @@ package cli import ( + "bufio" + "errors" "fmt" + "io" + "os" + "strings" - "github.com/kschamplin/gotelem" + "github.com/kschamplin/gotelem/internal/db" + "github.com/kschamplin/gotelem/internal/logparsers" + "github.com/kschamplin/gotelem/skylab" "github.com/urfave/cli/v2" ) +var parsersString string + func init() { subCmds = append(subCmds, clientCmd) + parsersString = func() string { + // create a string like "'telem', 'candump', 'anotherparser'" + keys := make([]string, len(logparsers.ParsersMap)) + i := 0 + for k := range logparsers.ParsersMap { + keys[i] = k + i++ + } + s := strings.Join(keys, "', '") + return "'" + s + "'" + }() +} + +var importCmd = &cli.Command{ + Name: "import", + Aliases: []string{"i"}, + Usage: "import a log file into a database", + ArgsUsage: "[log file]", + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: "format", + Aliases: []string{"f"}, + Usage: "the format of the log file. One of " + parsersString, + Value: "telem", + }, + &cli.PathFlag{ + Name: "database", + Aliases: []string{"d", "db"}, + Usage: "the path of the database", + Value: "./gotelem.db", + }, + &cli.UintFlag{ + Name: "batch-size", + Usage: "the maximum size of each SQL transaction", + Value: 50, + }, + }, + Action: importAction, +} + +func importAction(ctx *cli.Context) error { + path := ctx.Args().Get(0) + if path == "" { + fmt.Println("missing log file!") + cli.ShowAppHelpAndExit(ctx, -1) + } + fstream, err := os.Open(path) + if err != nil { + return err + } + fReader := bufio.NewReader(fstream) + + pfun, ok := logparsers.ParsersMap[ctx.String("format")] + if !ok { + fmt.Println("invalid format provided: must be one of " + parsersString) + cli.ShowAppHelpAndExit(ctx, -1) + } + + dbPath := ctx.Path("database") + db, err := db.OpenTelemDb(dbPath) + if err != nil { + return fmt.Errorf("error opening database: %w", err) + } + + // we should batch data, avoiding individual transactions to the database. + bSize := ctx.Uint("batch-size") + eventsBatch := make([]*skylab.BusEvent, bSize) + + batchIdx := 0 + + // stats for imports + n_packets := 0 + n_unknown := 0 + n_error := 0 + for { + line, err := fReader.ReadString('\n') + if err != nil { + if errors.Is(err, io.EOF) { + break // end of file, go to the flush sequence + } + return err + } + f, err := pfun(line) + var idErr *skylab.UnknownIdError + if errors.As(err, &idErr) { + // unknown id + fmt.Printf("unknown id %v\n", idErr.Error()) + n_unknown++ + continue + } else if err != nil { + // TODO: we should consider absorbing all errors. + fmt.Printf("got an error %v\n", err) + n_error++ + continue + } + n_packets++ + eventsBatch[batchIdx] = f + batchIdx++ + if batchIdx >= int(bSize) { + // flush it!!!! + err = db.AddEventsCtx(ctx.Context, eventsBatch...) + if err != nil { + fmt.Printf("error adding to database %v\n", err) + } + batchIdx = 0 // reset the batch + } + + } + // check if we have remaining packets and flush them + if batchIdx > 0 { + err = db.AddEventsCtx(ctx.Context, eventsBatch[:batchIdx]...) // note the slice here! + if err != nil { + fmt.Printf("error adding to database %v\n", err) + } + } + fmt.Printf("import status: %d successful, %d unknown, %d errors\n", n_packets, n_unknown, n_error) + + return nil } var clientCmd = &cli.Command{ - Name: "client", - Aliases: []string{"c"}, - Usage: "interact with a gotelem server", - ArgsUsage: "[server url]", + Name: "client", + Aliases: []string{"c"}, + Subcommands: []*cli.Command{importCmd}, + Usage: "Client utilities and tools", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "gui", @@ -24,13 +151,11 @@ var clientCmd = &cli.Command{ }, }, Description: ` -Connects to a gotelem server or relay. Can be used to +Connects to a gotelem server or relay. Also acts as a helper command line tool. `, Action: client, } - func client(ctx *cli.Context) error { return nil } - diff --git a/cmd/gotelem/cli/server.go b/cmd/gotelem/cli/server.go index 713e3f2..3437c30 100644 --- a/cmd/gotelem/cli/server.go +++ b/cmd/gotelem/cli/server.go @@ -32,9 +32,10 @@ var serveFlags = []cli.Flag{ Usage: "file to store log to", }, &cli.PathFlag{ - Name: "db", - Value: "gotelem.db", - Usage: "database to serve", + Name: "db", + Aliases: []string{"d"}, + DefaultText: "gotelem.db", + Usage: "database to serve, if not specified will use memory", }, } @@ -161,7 +162,6 @@ func (r *rpcService) Start(ctx *cli.Context, deps svcDeps) error { } func handleCon(conn net.Conn, broker *gotelem.Broker, l *slog.Logger, done <-chan struct{}) { - // reader := msgp.NewReader(conn) subname := fmt.Sprint("tcp", conn.RemoteAddr().String()) @@ -353,7 +353,7 @@ func (d *dbLoggingService) Start(cCtx *cli.Context, deps svcDeps) (err error) { for { select { case msg := <-rxCh: - tdb.AddEventsCtx(cCtx.Context, msg) + tdb.AddEventsCtx(cCtx.Context, &msg) case <-cCtx.Done(): return } diff --git a/cmd/gotelem/cli/socketcan.go b/cmd/gotelem/cli/socketcan.go index 1994084..8f140aa 100644 --- a/cmd/gotelem/cli/socketcan.go +++ b/cmd/gotelem/cli/socketcan.go @@ -5,7 +5,7 @@ package cli import ( "time" - "github.com/kschamplin/gotelem" + "github.com/kschamplin/gotelem/internal/can" "github.com/kschamplin/gotelem/skylab" "github.com/kschamplin/gotelem/socketcan" "github.com/urfave/cli/v2" @@ -77,7 +77,7 @@ func (s *socketCANService) Start(cCtx *cli.Context, deps svcDeps) (err error) { defer broker.Unsubscribe("socketCAN") // make a channel to receive socketCAN frames. - rxCan := make(chan gotelem.Frame) + rxCan := make(chan can.Frame) go func() { for { @@ -89,27 +89,25 @@ func (s *socketCANService) Start(cCtx *cli.Context, deps svcDeps) (err error) { } }() - var frame gotelem.Frame + var frame can.Frame for { select { case msg := <-rxCh: - id, d, _ := skylab.ToCanFrame(msg.Data) + frame, err = skylab.ToCanFrame(msg.Data) - frame.Id = id - frame.Data = d s.sock.Send(&frame) case msg := <-rxCan: - p, err := skylab.FromCanFrame(msg.Id, msg.Data) + p, err := skylab.FromCanFrame(msg) if err != nil { logger.Warn("error parsing can packet", "id", msg.Id) continue } cde := skylab.BusEvent{ Timestamp: time.Now(), - Id: msg.Id, + Name: p.String(), Data: p, } broker.Publish("socketCAN", cde) diff --git a/cmd/skylabify/skylabify.go b/cmd/skylabify/skylabify.go index fe30fef..83d4021 100644 --- a/cmd/skylabify/skylabify.go +++ b/cmd/skylabify/skylabify.go @@ -2,19 +2,15 @@ package main import ( "bufio" - "encoding/hex" "encoding/json" "errors" "fmt" "io" "os" - "regexp" - "strconv" "strings" "syscall" - "time" - "github.com/kschamplin/gotelem/internal/can" + "github.com/kschamplin/gotelem/internal/logparsers" "github.com/kschamplin/gotelem/skylab" "github.com/urfave/cli/v2" "golang.org/x/exp/slog" @@ -46,6 +42,17 @@ required for piping candump into skylabify. Likewise, data should be stored with -l. ` + parsersString := func() string { + // create a string like "'telem', 'candump', 'anotherparser'" + keys := make([]string, len(logparsers.ParsersMap)) + i := 0 + for k := range logparsers.ParsersMap { + keys[i] = k + i++ + } + s := strings.Join(keys, "', '") + return "'" + s + "'" + }() app.Flags = []cli.Flag{ &cli.BoolFlag{ @@ -55,7 +62,7 @@ required for piping candump into skylabify. Likewise, data should be stored with &cli.StringFlag{ Name: "format", Aliases: []string{"f"}, - Usage: "the format of the incoming data. One of 'telem', 'candump'", + Usage: "the format of the incoming data. One of " + parsersString, }, } @@ -65,150 +72,6 @@ required for piping candump into skylabify. Likewise, data should be stored with } } -// A FormatError is an error when parsing a format. Typically we simply ignore -// these and move on, but they can optionally wrap another error that is fatal. -type FormatError struct { - msg string - err error -} - -func (e *FormatError) Error() string { - return fmt.Sprintf("%s:%s", e.msg, e.err.Error()) -} -func (e *FormatError) Unwrap() error { - return e.err -} - -func NewFormatError(msg string, err error) error { - return &FormatError{msg: msg, err: err} -} - -// A Parser takes a string containing one line of a particular log file -// and returns an associated skylab.BusEvent representing the packet. -// if no packet is found, an error is returned instead. -type ParserFunc func(string) (skylab.BusEvent, error) - -func parseCanDumpLine(dumpLine string) (b skylab.BusEvent, err error) { - // dumpline looks like this: - // (1684538768.521889) can0 200#8D643546 - // remove trailing newline - dumpLine = strings.TrimSpace(dumpLine) - segments := strings.Split(dumpLine, " ") - - var unixSeconds, unixMicros int64 - fmt.Sscanf(segments[0], "(%d.%d)", &unixSeconds, &unixMicros) - b.Timestamp = time.Unix(unixSeconds, unixMicros) - - // now we extract the remaining data: - hexes := strings.Split(segments[2], "#") // first portion is id, second is data - - id, err := strconv.ParseUint(hexes[0], 16, 64) - if err != nil { - err = NewFormatError("failed to parse id", err) - return - } - if (len(hexes[1]) % 2) != 0 { - err = NewFormatError("odd number of hex characters", nil) - return - } - rawData, err := hex.DecodeString(hexes[1]) - if err != nil { - err = NewFormatError("failed to decode hex data", err) - return - } - - frame := can.Frame{ - // TODO: fix extended ids. we assume not extended for now. - Id: can.CanID{Id: uint32(id), Extended: false}, - Data: rawData, - Kind: can.CanDataFrame, - } - - b.Data, err = skylab.FromCanFrame(frame) - - if err != nil { - err = NewFormatError("failed to parse can frame", err) - return - } - - // set the name - b.Name = b.Data.String() - - return -} - -func parseTelemLogLine(line string) (b skylab.BusEvent, err error) { - // strip trailng newline since we rely on it being gone - line = strings.TrimSpace(line) - // data is of the form - // 1698180835.318 0619D80564080EBE241 - // the second part there is 3 nibbles (12 bits, 3 hex chars) for can ID, - // the rest is data. - // this regex does the processing. - r := regexp.MustCompile(`^(\d+).(\d{3}) (\w{3})(\w+)$`) - - // these files tend to get corrupted. there are all kinds of nasties that can happen. - // defense against random panics - defer func() { - if r := recover(); r != nil { - err = NewFormatError("caught panic", nil) - } - }() - a := r.FindStringSubmatch(line) - if a == nil { - err = NewFormatError("no regex match", nil) - return - } - var unixSeconds, unixMillis int64 - // note that a contains 5 elements, the first being the full match. - // so we start from the second element - unixSeconds, err = strconv.ParseInt(a[1], 10, 0) - if err != nil { - err = NewFormatError("failed to parse unix seconds", err) - return - } - unixMillis, err = strconv.ParseInt(a[2], 10, 0) - if err != nil { - err = NewFormatError("failed to parse unix millis", err) - return - } - ts := time.Unix(unixSeconds, unixMillis*1e6) - - id, err := strconv.ParseUint(a[3], 16, 16) - if err != nil { - err = NewFormatError("failed to parse id", err) - return - } - - if len(a[4])%2 != 0 { - // odd hex chars, protect against a panic - err = NewFormatError("wrong amount of hex chars", nil) - } - rawData, err := hex.DecodeString(a[4]) - if err != nil { - err = NewFormatError("failed to parse hex data", err) - return - } - frame := can.Frame{ - Id: can.CanID{Id: uint32(id), Extended: false}, - Data: rawData, - Kind: can.CanDataFrame, - } - b.Timestamp = ts - b.Data, err = skylab.FromCanFrame(frame) - if err != nil { - err = NewFormatError("failed to parse can frame", err) - return - } - b.Name = b.Data.String() - - return -} - -var parseMap = map[string]ParserFunc{ - "telem": parseTelemLogLine, - "candump": parseCanDumpLine, -} func run(ctx *cli.Context) (err error) { path := ctx.Args().Get(0) @@ -229,9 +92,9 @@ func run(ctx *cli.Context) (err error) { fileReader := bufio.NewReader(istream) - var pfun ParserFunc + var pfun logparsers.ParserFunc - pfun, ok := parseMap[ctx.String("format")] + pfun, ok := logparsers.ParsersMap[ctx.String("format")] if !ok { fmt.Println("invalid format!") cli.ShowAppHelpAndExit(ctx, int(syscall.EINVAL)) diff --git a/frame_kind.go b/frame_kind.go deleted file mode 100644 index 4ee7502..0000000 --- a/frame_kind.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by "stringer -output=frame_kind.go -type Kind"; DO NOT EDIT. - -package gotelem - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[CanSFFFrame-0] - _ = x[CanEFFFrame-1] - _ = x[CanRTRFrame-2] - _ = x[CanErrFrame-3] -} - -const _Kind_name = "CanSFFFrameCanEFFFrameCanRTRFrameCanErrFrame" - -var _Kind_index = [...]uint8{0, 11, 22, 33, 44} - -func (i Kind) String() string { - if i >= Kind(len(_Kind_index)-1) { - return "Kind(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Kind_name[_Kind_index[i]:_Kind_index[i+1]] -} diff --git a/http.go b/http.go index 6fae3be..a762296 100644 --- a/http.go +++ b/http.go @@ -46,8 +46,6 @@ func TelemRouter(log *slog.Logger, broker *Broker, db *db.TelemDb) http.Handler // To future residents - you can add new API calls/systems in /api/v2 // Don't break anything in api v1! keep legacy code working! - // serve up a local status page. - return r } @@ -69,7 +67,7 @@ func apiV1(broker *Broker, db *db.TelemDb) chi.Router { r.Route("/packets", func(r chi.Router) { r.Get("/subscribe", apiV1PacketSubscribe(broker, db)) r.Post("/", func(w http.ResponseWriter, r *http.Request) { - var pkgs []skylab.BusEvent + var pkgs []*skylab.BusEvent decoder := json.NewDecoder(r.Body) if err := decoder.Decode(&pkgs); err != nil { w.WriteHeader(http.StatusTeapot) @@ -111,7 +109,7 @@ func apiV1(broker *Broker, db *db.TelemDb) chi.Router { // apiV1Subscriber is a websocket session for the v1 api. type apiV1Subscriber struct { - idFilter []uint32 // list of Ids to subscribe to. If it's empty, subscribes to all. + nameFilter []string // names of packets we care about. } // this is a websocket stream. @@ -143,13 +141,14 @@ func apiV1PacketSubscribe(broker *Broker, db *db.TelemDb) http.HandlerFunc { case <-r.Context().Done(): return case msgIn := <-sub: - if len(sess.idFilter) == 0 { + if len(sess.nameFilter) == 0 { // send it. wsjson.Write(r.Context(), c, msgIn) } - for _, id := range sess.idFilter { - if id == msgIn.Id { + for _, name := range sess.nameFilter { + if name == msgIn.Name { // send it + wsjson.Write(r.Context(), c, msgIn) break } } diff --git a/internal/db/db.go b/internal/db/db.go index 867bc1a..7f98916 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -7,7 +7,6 @@ import ( "database/sql" "encoding/json" "fmt" - "strconv" "strings" "time" @@ -72,11 +71,11 @@ func (tdb *TelemDb) SetVersion(version int) error { // sql expression to insert a bus event into the packets database.1 const sqlInsertEvent = ` -INSERT INTO "bus_events" (ts, name, data) VALUES ($1, $2, json($3)); +INSERT INTO "bus_events" (ts, name, data) VALUES ` // AddEvent adds the bus event to the database. -func (tdb *TelemDb) AddEventsCtx(ctx context.Context, events ...skylab.BusEvent) (err error) { +func (tdb *TelemDb) AddEventsCtx(ctx context.Context, events ...*skylab.BusEvent) (err error) { // tx, err := tdb.db.BeginTx(ctx, nil) if err != nil { @@ -107,7 +106,7 @@ func (tdb *TelemDb) AddEventsCtx(ctx context.Context, events ...skylab.BusEvent) tx.Rollback() return } - //TODO: log the number of rows modified/inserted + //TODO: log the number of rows modified/inserted _, err = stmt.ExecContext(ctx, vals...) if err != nil { tx.Rollback() @@ -118,12 +117,11 @@ func (tdb *TelemDb) AddEventsCtx(ctx context.Context, events ...skylab.BusEvent) return } -func (tdb *TelemDb) AddEvents(events ...skylab.BusEvent) (err error) { +func (tdb *TelemDb) AddEvents(events ...*skylab.BusEvent) (err error) { return tdb.AddEventsCtx(context.Background(), events...) } - /// Query fragment guide: /// We need to be able to easily construct safe(!) and meaningful queries programatically /// so we make some new types that can be turned into SQL fragments that go inside the where clause. @@ -198,7 +196,7 @@ func (tdb *TelemDb) GetEvents(limit int, where ...QueryFrag) (events []skylab.Bu BusEv := skylab.BusEvent{ Timestamp: time.UnixMilli(int64(ev.Timestamp)), - Name: ev.Name, + Name: ev.Name, } BusEv.Data, err = skylab.FromJson(ev.Name, ev.Data) diff --git a/internal/logparsers/parsers.go b/internal/logparsers/parsers.go new file mode 100644 index 0000000..e4b47cc --- /dev/null +++ b/internal/logparsers/parsers.go @@ -0,0 +1,168 @@ +package logparsers + +import ( + "encoding/hex" + "fmt" + "regexp" + "strconv" + "strings" + "time" + + "github.com/kschamplin/gotelem/internal/can" + "github.com/kschamplin/gotelem/skylab" +) + +// A FormatError is an error when parsing a format. Typically we simply ignore +// these and move on, but they can optionally wrap another error that is fatal. +type FormatError struct { + msg string + err error +} + +func (e *FormatError) Error() string { + if e.err != nil { + return fmt.Sprintf("%s:%s", e.msg, e.err.Error()) + } + return fmt.Sprintf("%s", e.msg) + +} +func (e *FormatError) Unwrap() error { + return e.err +} + +func NewFormatError(msg string, err error) error { + return &FormatError{msg: msg, err: err} +} + +// A Parser takes a string containing one line of a particular log file +// and returns an associated skylab.BusEvent representing the packet. +// if no packet is found, an error is returned instead. +type ParserFunc func(string) (*skylab.BusEvent, error) + +func parseCanDumpLine(dumpLine string) (b *skylab.BusEvent, err error) { + // dumpline looks like this: + // (1684538768.521889) can0 200#8D643546 + // remove trailing newline + dumpLine = strings.TrimSpace(dumpLine) + segments := strings.Split(dumpLine, " ") + + var unixSeconds, unixMicros int64 + fmt.Sscanf(segments[0], "(%d.%d)", &unixSeconds, &unixMicros) + + // now we extract the remaining data: + hexes := strings.Split(segments[2], "#") // first portion is id, second is data + + id, err := strconv.ParseUint(hexes[0], 16, 64) + if err != nil { + err = NewFormatError("failed to parse id", err) + return + } + if (len(hexes[1]) % 2) != 0 { + err = NewFormatError("odd number of hex characters", nil) + return + } + rawData, err := hex.DecodeString(hexes[1]) + if err != nil { + err = NewFormatError("failed to decode hex data", err) + return + } + + frame := can.Frame{ + // TODO: fix extended ids. we assume not extended for now. + Id: can.CanID{Id: uint32(id), Extended: false}, + Data: rawData, + Kind: can.CanDataFrame, + } + + b = &skylab.BusEvent{ + Timestamp: time.Unix(unixSeconds, unixMicros), + } + + b.Data, err = skylab.FromCanFrame(frame) + + if err != nil { + err = NewFormatError("failed to parse can frame", err) + return + } + + // set the name + b.Name = b.Data.String() + + return +} + +func parseTelemLogLine(line string) (b *skylab.BusEvent, err error) { + // strip trailng newline since we rely on it being gone + line = strings.TrimSpace(line) + // data is of the form + // 1698180835.318 0619D80564080EBE241 + // the second part there is 3 nibbles (12 bits, 3 hex chars) for can ID, + // the rest is data. + // this regex does the processing. + r := regexp.MustCompile(`^(\d+).(\d{3}) (\w{3})(\w+)$`) + + // these files tend to get corrupted. there are all kinds of nasties that can happen. + // defense against random panics + defer func() { + if r := recover(); r != nil { + err = NewFormatError("caught panic", nil) + } + }() + a := r.FindStringSubmatch(line) + if a == nil || len(a) != 5 { + err = NewFormatError("no regex match", nil) + return + } + var unixSeconds, unixMillis int64 + // note that a contains 5 elements, the first being the full match. + // so we start from the second element + unixSeconds, err = strconv.ParseInt(a[1], 10, 0) + if err != nil { + err = NewFormatError("failed to parse unix seconds", err) + return + } + unixMillis, err = strconv.ParseInt(a[2], 10, 0) + if err != nil { + err = NewFormatError("failed to parse unix millis", err) + return + } + ts := time.Unix(unixSeconds, unixMillis*1e6) + + id, err := strconv.ParseUint(a[3], 16, 16) + if err != nil { + err = NewFormatError("failed to parse id", err) + return + } + + if len(a[4])%2 != 0 { + // odd hex chars, protect against a panic + err = NewFormatError("wrong amount of hex chars", nil) + } + rawData, err := hex.DecodeString(a[4]) + if err != nil { + err = NewFormatError("failed to parse hex data", err) + return + } + frame := can.Frame{ + Id: can.CanID{Id: uint32(id), Extended: false}, + Data: rawData, + Kind: can.CanDataFrame, + } + + b = &skylab.BusEvent{ + Timestamp: ts, + } + b.Data, err = skylab.FromCanFrame(frame) + if err != nil { + err = NewFormatError("failed to parse can frame", err) + return + } + b.Name = b.Data.String() + + return +} + +var ParsersMap = map[string]ParserFunc{ + "telem": parseTelemLogLine, + "candump": parseCanDumpLine, +} diff --git a/py/pytelem/skylab_attr.py b/py/pytelem/skylab_attr.py index 4b17230..06061f6 100644 --- a/py/pytelem/skylab_attr.py +++ b/py/pytelem/skylab_attr.py @@ -3,6 +3,9 @@ from typing import Dict, Optional, List, Union from enum import Enum from attrs import define, field, validators +# we define a validator for our names - alphanumeric and underscores +# most things can't support numbers as the first character, so we don't either. +name_validator = validators.matches_re(r"^[A-Za-z_][A-Za-z0-9_]?$") @define class Bus(): @@ -58,7 +61,7 @@ class FieldType(str, Enum): @define class CustomTypeDef(): - name: str + name: str = field(validator=[name_validator]) base_type: FieldType # should be a strict size values: Union[List[str], Dict[str, int]] @@ -66,11 +69,11 @@ class CustomTypeDef(): @define class BitfieldBit(): "micro class to represent one bit in bitfields" - name: str + name: str = field(validator=[name_validator]) @define class Field(): - name: str = field(validator=[validators.matches_re(r"^[A-Za-z0-9_]+$")]) + name: str = field(validator=[name_validator]) type: FieldType #metadata @@ -80,7 +83,7 @@ class Field(): @define class BitField(): - name: str = field(validator=[validators.matches_re(r"^[A-Za-z0-9_]+$")]) + name: str = field(validator=[name_validator]) type: str = field(default="bitfield", init=False) # it's a constant value bits: List[BitfieldBit] diff --git a/skylab/skylab.go b/skylab/skylab.go index 62e6363..48038b7 100644 --- a/skylab/skylab.go +++ b/skylab/skylab.go @@ -12,6 +12,7 @@ import ( // this is needed so that we can run make_skylab.go // without this, the yaml library will be removed // when we run `go mod tidy` + "github.com/kschamplin/gotelem/internal/can" _ "gopkg.in/yaml.v3" ) @@ -62,7 +63,7 @@ type Unmarshaler interface { // Ider is a packet that can get its ID, based on the index of the packet, if any. type Ider interface { - CANId() (uint32, error) + CanId() (can.CanID, error) } // Sizer allows for fast allocation. @@ -71,13 +72,15 @@ type Sizer interface { } // CanSend takes a packet and makes CAN framing data. -func ToCanFrame(p Packet) (id uint32, data []byte, err error) { +func ToCanFrame(p Packet) (f can.Frame, err error) { - id, err = p.CANId() + + f.Id, err = p.CanId() if err != nil { return } - data, err = p.MarshalPacket() + f.Data, err = p.MarshalPacket() + f.Kind = can.CanDataFrame return } diff --git a/skylab/skylab_gen.go b/skylab/skylab_gen.go index 0bc8504..f9938c5 100644 --- a/skylab/skylab_gen.go +++ b/skylab/skylab_gen.go @@ -1,4 +1,4 @@ -// generated by gen_skylab.go at 2024-02-12 01:42:40.427923631 -0600 CST m=+0.004005217 DO NOT EDIT! +// generated by gen_skylab.go at 2024-02-12 10:42:55.884248761 -0600 CST m=+0.003327461 DO NOT EDIT! package skylab @@ -111,144 +111,144 @@ var nameToIdMap = map[string]can.CanID{ // list of every packet ID. can be used for O(1) checks. var idMap = map[can.CanID]bool{ - can.CanID{ Id: 0x10, Extended: false }: true, - can.CanID{ Id: 0x11, Extended: false }: true, - can.CanID{ Id: 0x12, Extended: false }: true, - can.CanID{ Id: 0x13, Extended: false }: true, - can.CanID{ Id: 0x14, Extended: false }: true, - can.CanID{ Id: 0x15, Extended: false }: true, - can.CanID{ Id: 0x18, Extended: false }: true, - can.CanID{ Id: 0x19, Extended: false }: true, - can.CanID{ Id: 0x1B, Extended: false }: true, - can.CanID{ Id: 0x40, Extended: false }: true, - can.CanID{ Id: 0x41, Extended: false }: true, - can.CanID{ Id: 0x42, Extended: false }: true, - can.CanID{ Id: 0x43, Extended: false }: true, - can.CanID{ Id: 0x44, Extended: false }: true, - can.CanID{ Id: 0x45, Extended: false }: true, - can.CanID{ Id: 0x46, Extended: false }: true, - can.CanID{ Id: 0x47, Extended: false }: true, - can.CanID{ Id: 0x48, Extended: false }: true, - can.CanID{ Id: 0x49, Extended: false }: true, - can.CanID{ Id: 0x4A, Extended: false }: true, - can.CanID{ Id: 0x4B, Extended: false }: true, - can.CanID{ Id: 0x4C, Extended: false }: true, - can.CanID{ Id: 0x4D, Extended: false }: true, - can.CanID{ Id: 0x4E, Extended: false }: true, - can.CanID{ Id: 0x4F, Extended: false }: true, - can.CanID{ Id: 0x50, Extended: false }: true, - can.CanID{ Id: 0x51, Extended: false }: true, - can.CanID{ Id: 0x52, Extended: false }: true, - can.CanID{ Id: 0x53, Extended: false }: true, - can.CanID{ Id: 0x54, Extended: false }: true, - can.CanID{ Id: 0x55, Extended: false }: true, - can.CanID{ Id: 0x56, Extended: false }: true, - can.CanID{ Id: 0x57, Extended: false }: true, - can.CanID{ Id: 0x58, Extended: false }: true, - can.CanID{ Id: 0x59, Extended: false }: true, - can.CanID{ Id: 0x5A, Extended: false }: true, - can.CanID{ Id: 0x5B, Extended: false }: true, - can.CanID{ Id: 0x5C, Extended: false }: true, - can.CanID{ Id: 0x5D, Extended: false }: true, - can.CanID{ Id: 0x5E, Extended: false }: true, - can.CanID{ Id: 0x5F, Extended: false }: true, - can.CanID{ Id: 0x60, Extended: false }: true, - can.CanID{ Id: 0x61, Extended: false }: true, - can.CanID{ Id: 0x62, Extended: false }: true, - can.CanID{ Id: 0x63, Extended: false }: true, + { Id: 0x10, Extended: false }: true, + { Id: 0x11, Extended: false }: true, + { Id: 0x12, Extended: false }: true, + { Id: 0x13, Extended: false }: true, + { Id: 0x14, Extended: false }: true, + { Id: 0x15, Extended: false }: true, + { Id: 0x18, Extended: false }: true, + { Id: 0x19, Extended: false }: true, + { Id: 0x1B, Extended: false }: true, + { Id: 0x40, Extended: false }: true, + { Id: 0x41, Extended: false }: true, + { Id: 0x42, Extended: false }: true, + { Id: 0x43, Extended: false }: true, + { Id: 0x44, Extended: false }: true, + { Id: 0x45, Extended: false }: true, + { Id: 0x46, Extended: false }: true, + { Id: 0x47, Extended: false }: true, + { Id: 0x48, Extended: false }: true, + { Id: 0x49, Extended: false }: true, + { Id: 0x4A, Extended: false }: true, + { Id: 0x4B, Extended: false }: true, + { Id: 0x4C, Extended: false }: true, + { Id: 0x4D, Extended: false }: true, + { Id: 0x4E, Extended: false }: true, + { Id: 0x4F, Extended: false }: true, + { Id: 0x50, Extended: false }: true, + { Id: 0x51, Extended: false }: true, + { Id: 0x52, Extended: false }: true, + { Id: 0x53, Extended: false }: true, + { Id: 0x54, Extended: false }: true, + { Id: 0x55, Extended: false }: true, + { Id: 0x56, Extended: false }: true, + { Id: 0x57, Extended: false }: true, + { Id: 0x58, Extended: false }: true, + { Id: 0x59, Extended: false }: true, + { Id: 0x5A, Extended: false }: true, + { Id: 0x5B, Extended: false }: true, + { Id: 0x5C, Extended: false }: true, + { Id: 0x5D, Extended: false }: true, + { Id: 0x5E, Extended: false }: true, + { Id: 0x5F, Extended: false }: true, + { Id: 0x60, Extended: false }: true, + { Id: 0x61, Extended: false }: true, + { Id: 0x62, Extended: false }: true, + { Id: 0x63, Extended: false }: true, - can.CanID{ Id: 0x75, Extended: false }: true, - can.CanID{ Id: 0x38, Extended: false }: true, - can.CanID{ Id: 0x37, Extended: false }: true, - can.CanID{ Id: 0x290, Extended: false }: true, - can.CanID{ Id: 0x291, Extended: false }: true, - can.CanID{ Id: 0x292, Extended: false }: true, - can.CanID{ Id: 0x299, Extended: false }: true, - can.CanID{ Id: 0x29A, Extended: false }: true, - can.CanID{ Id: 0x29B, Extended: false }: true, - can.CanID{ Id: 0x29C, Extended: false }: true, - can.CanID{ Id: 0x29D, Extended: false }: true, - can.CanID{ Id: 0x19E, Extended: false }: true, - can.CanID{ Id: 0x19F, Extended: false }: true, - can.CanID{ Id: 0x119, Extended: false }: true, - can.CanID{ Id: 0x120, Extended: false }: true, - can.CanID{ Id: 0x2B0, Extended: false }: true, - can.CanID{ Id: 0x2B1, Extended: false }: true, - can.CanID{ Id: 0x2B2, Extended: false }: true, - can.CanID{ Id: 0x2B3, Extended: false }: true, - can.CanID{ Id: 0x2B4, Extended: false }: true, - can.CanID{ Id: 0x2B5, Extended: false }: true, - can.CanID{ Id: 0x610, Extended: false }: true, - can.CanID{ Id: 0x611, Extended: false }: true, - can.CanID{ Id: 0x612, Extended: false }: true, - can.CanID{ Id: 0x613, Extended: false }: true, - can.CanID{ Id: 0x614, Extended: false }: true, - can.CanID{ Id: 0x615, Extended: false }: true, + { Id: 0x75, Extended: false }: true, + { Id: 0x38, Extended: false }: true, + { Id: 0x37, Extended: false }: true, + { Id: 0x290, Extended: false }: true, + { Id: 0x291, Extended: false }: true, + { Id: 0x292, Extended: false }: true, + { Id: 0x299, Extended: false }: true, + { Id: 0x29A, Extended: false }: true, + { Id: 0x29B, Extended: false }: true, + { Id: 0x29C, Extended: false }: true, + { Id: 0x29D, Extended: false }: true, + { Id: 0x19E, Extended: false }: true, + { Id: 0x19F, Extended: false }: true, + { Id: 0x119, Extended: false }: true, + { Id: 0x120, Extended: false }: true, + { Id: 0x2B0, Extended: false }: true, + { Id: 0x2B1, Extended: false }: true, + { Id: 0x2B2, Extended: false }: true, + { Id: 0x2B3, Extended: false }: true, + { Id: 0x2B4, Extended: false }: true, + { Id: 0x2B5, Extended: false }: true, + { Id: 0x610, Extended: false }: true, + { Id: 0x611, Extended: false }: true, + { Id: 0x612, Extended: false }: true, + { Id: 0x613, Extended: false }: true, + { Id: 0x614, Extended: false }: true, + { Id: 0x615, Extended: false }: true, - can.CanID{ Id: 0x19D, Extended: false }: true, - can.CanID{ Id: 0x573, Extended: false }: true, - can.CanID{ Id: 0x74, Extended: false }: true, - can.CanID{ Id: 0x576, Extended: false }: true, - can.CanID{ Id: 0x577, Extended: false }: true, - can.CanID{ Id: 0x18E54024, Extended: true }: true, - can.CanID{ Id: 0x2B6, Extended: false }: true, - can.CanID{ Id: 0x2B7, Extended: false }: true, - can.CanID{ Id: 0x300, Extended: false }: true, - can.CanID{ Id: 0x301, Extended: false }: true, - can.CanID{ Id: 0x302, Extended: false }: true, - can.CanID{ Id: 0x240, Extended: false }: true, - can.CanID{ Id: 0x250, Extended: false }: true, - can.CanID{ Id: 0x241, Extended: false }: true, - can.CanID{ Id: 0x251, Extended: false }: true, - can.CanID{ Id: 0x242, Extended: false }: true, - can.CanID{ Id: 0x18EB2440, Extended: true }: true, - can.CanID{ Id: 0x600, Extended: false }: true, - can.CanID{ Id: 0x601, Extended: false }: true, - can.CanID{ Id: 0x602, Extended: false }: true, - can.CanID{ Id: 0x603, Extended: false }: true, - can.CanID{ Id: 0x604, Extended: false }: true, - can.CanID{ Id: 0x605, Extended: false }: true, + { Id: 0x19D, Extended: false }: true, + { Id: 0x573, Extended: false }: true, + { Id: 0x74, Extended: false }: true, + { Id: 0x576, Extended: false }: true, + { Id: 0x577, Extended: false }: true, + { Id: 0x18E54024, Extended: true }: true, + { Id: 0x2B6, Extended: false }: true, + { Id: 0x2B7, Extended: false }: true, + { Id: 0x300, Extended: false }: true, + { Id: 0x301, Extended: false }: true, + { Id: 0x302, Extended: false }: true, + { Id: 0x240, Extended: false }: true, + { Id: 0x250, Extended: false }: true, + { Id: 0x241, Extended: false }: true, + { Id: 0x251, Extended: false }: true, + { Id: 0x242, Extended: false }: true, + { Id: 0x18EB2440, Extended: false }: true, + { Id: 0x600, Extended: false }: true, + { Id: 0x601, Extended: false }: true, + { Id: 0x602, Extended: false }: true, + { Id: 0x603, Extended: false }: true, + { Id: 0x604, Extended: false }: true, + { Id: 0x605, Extended: false }: true, - can.CanID{ Id: 0x121, Extended: false }: true, - can.CanID{ Id: 0x122, Extended: false }: true, - can.CanID{ Id: 0x123, Extended: false }: true, - can.CanID{ Id: 0x161, Extended: false }: true, - can.CanID{ Id: 0x162, Extended: false }: true, - can.CanID{ Id: 0x163, Extended: false }: true, - can.CanID{ Id: 0x16, Extended: false }: true, - can.CanID{ Id: 0x17, Extended: false }: true, - can.CanID{ Id: 0x1A, Extended: false }: true, - can.CanID{ Id: 0x700, Extended: false }: true, - can.CanID{ Id: 0x140, Extended: false }: true, - can.CanID{ Id: 0x141, Extended: false }: true, - can.CanID{ Id: 0x142, Extended: false }: true, - can.CanID{ Id: 0x143, Extended: false }: true, - can.CanID{ Id: 0x144, Extended: false }: true, - can.CanID{ Id: 0x145, Extended: false }: true, - can.CanID{ Id: 0x146, Extended: false }: true, - can.CanID{ Id: 0x147, Extended: false }: true, - can.CanID{ Id: 0x148, Extended: false }: true, - can.CanID{ Id: 0x149, Extended: false }: true, - can.CanID{ Id: 0x14B, Extended: false }: true, - can.CanID{ Id: 0x14C, Extended: false }: true, - can.CanID{ Id: 0x14D, Extended: false }: true, - can.CanID{ Id: 0x14E, Extended: false }: true, - can.CanID{ Id: 0x157, Extended: false }: true, - can.CanID{ Id: 0x100, Extended: false }: true, - can.CanID{ Id: 0x101, Extended: false }: true, - can.CanID{ Id: 0x102, Extended: false }: true, - can.CanID{ Id: 0x103, Extended: false }: true, - can.CanID{ Id: 0x104, Extended: false }: true, - can.CanID{ Id: 0x105, Extended: false }: true, - can.CanID{ Id: 0x106, Extended: false }: true, - can.CanID{ Id: 0x107, Extended: false }: true, - can.CanID{ Id: 0x108, Extended: false }: true, - can.CanID{ Id: 0x109, Extended: false }: true, - can.CanID{ Id: 0x10B, Extended: false }: true, - can.CanID{ Id: 0x10C, Extended: false }: true, - can.CanID{ Id: 0x10E, Extended: false }: true, - can.CanID{ Id: 0x10D, Extended: false }: true, - can.CanID{ Id: 0x117, Extended: false }: true, + { Id: 0x121, Extended: false }: true, + { Id: 0x122, Extended: false }: true, + { Id: 0x123, Extended: false }: true, + { Id: 0x161, Extended: false }: true, + { Id: 0x162, Extended: false }: true, + { Id: 0x163, Extended: false }: true, + { Id: 0x16, Extended: false }: true, + { Id: 0x17, Extended: false }: true, + { Id: 0x1A, Extended: false }: true, + { Id: 0x700, Extended: false }: true, + { Id: 0x140, Extended: false }: true, + { Id: 0x141, Extended: false }: true, + { Id: 0x142, Extended: false }: true, + { Id: 0x143, Extended: false }: true, + { Id: 0x144, Extended: false }: true, + { Id: 0x145, Extended: false }: true, + { Id: 0x146, Extended: false }: true, + { Id: 0x147, Extended: false }: true, + { Id: 0x148, Extended: false }: true, + { Id: 0x149, Extended: false }: true, + { Id: 0x14B, Extended: false }: true, + { Id: 0x14C, Extended: false }: true, + { Id: 0x14D, Extended: false }: true, + { Id: 0x14E, Extended: false }: true, + { Id: 0x157, Extended: false }: true, + { Id: 0x100, Extended: false }: true, + { Id: 0x101, Extended: false }: true, + { Id: 0x102, Extended: false }: true, + { Id: 0x103, Extended: false }: true, + { Id: 0x104, Extended: false }: true, + { Id: 0x105, Extended: false }: true, + { Id: 0x106, Extended: false }: true, + { Id: 0x107, Extended: false }: true, + { Id: 0x108, Extended: false }: true, + { Id: 0x109, Extended: false }: true, + { Id: 0x10B, Extended: false }: true, + { Id: 0x10C, Extended: false }: true, + { Id: 0x10E, Extended: false }: true, + { Id: 0x10D, Extended: false }: true, + { Id: 0x117, Extended: false }: true, } // FromCanFrame creates a Packet from a given CAN ID and data payload. @@ -453,7 +453,7 @@ func FromCanFrame(f can.Frame) (Packet, error) { var res = &SteeringHorn{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{ Id: 0x18EB2440, Extended: true }: + case can.CanID{ Id: 0x18EB2440, Extended: false }: var res = &ThunderstruckStatusMessage{} res.UnmarshalPacket(f.Data) return res, nil @@ -1008,8 +1008,10 @@ type BmsMeasurement struct { Current float32 `json:"current"` } -func (p *BmsMeasurement) CANId() (uint32, error) { - return 0x10, nil +func (p *BmsMeasurement) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x10 + return c, nil } func (p *BmsMeasurement) Size() uint { @@ -1258,8 +1260,10 @@ type BatteryStatus struct { PackChoice BatteryStatusPackChoice `json:"pack_choice"` } -func (p *BatteryStatus) CANId() (uint32, error) { - return 0x11, nil +func (p *BatteryStatus) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x11 + return c, nil } func (p *BatteryStatus) Size() uint { @@ -1383,8 +1387,10 @@ type BmsKillReason struct { Value float32 `json:"value"` } -func (p *BmsKillReason) CANId() (uint32, error) { - return 0x12, nil +func (p *BmsKillReason) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x12 + return c, nil } func (p *BmsKillReason) Size() uint { @@ -1428,8 +1434,10 @@ type BmsModuleMinMax struct { ModuleMinVoltage uint16 `json:"module_min_voltage"` } -func (p *BmsModuleMinMax) CANId() (uint32, error) { - return 0x13, nil +func (p *BmsModuleMinMax) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x13 + return c, nil } func (p *BmsModuleMinMax) Size() uint { @@ -1466,8 +1474,10 @@ type BmsSoc struct { Soc float32 `json:"soc"` } -func (p *BmsSoc) CANId() (uint32, error) { - return 0x14, nil +func (p *BmsSoc) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x14 + return c, nil } func (p *BmsSoc) Size() uint { @@ -1499,8 +1509,10 @@ type BmsCapacity struct { Wh float32 `json:"Wh"` } -func (p *BmsCapacity) CANId() (uint32, error) { - return 0x15, nil +func (p *BmsCapacity) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x15 + return c, nil } func (p *BmsCapacity) Size() uint { @@ -1536,8 +1548,10 @@ type BmsCurrentlimit struct { CurrentMin int16 `json:"current_min"` } -func (p *BmsCurrentlimit) CANId() (uint32, error) { - return 0x18, nil +func (p *BmsCurrentlimit) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x18 + return c, nil } func (p *BmsCurrentlimit) Size() uint { @@ -1577,8 +1591,10 @@ type BmsFanInfo struct { Fan4 uint16 `json:"fan4"` } -func (p *BmsFanInfo) CANId() (uint32, error) { - return 0x19, nil +func (p *BmsFanInfo) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x19 + return c, nil } func (p *BmsFanInfo) Size() uint { @@ -1618,8 +1634,10 @@ type BmsSetMinFanSpeed struct { Time uint16 `json:"time"` } -func (p *BmsSetMinFanSpeed) CANId() (uint32, error) { - return 0x1B, nil +func (p *BmsSetMinFanSpeed) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x1B + return c, nil } func (p *BmsSetMinFanSpeed) Size() uint { @@ -1657,11 +1675,13 @@ type BmsModule struct { Idx uint32 `json:"idx"` } -func (p *BmsModule) CANId() (uint32, error) { +func (p *BmsModule) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} if p.Idx >= 36 { - return 0, &UnknownIdError{ 0x40 } + return c, &UnknownIdError{ 0x40 } } - return 0x40 + p.Idx, nil + c.Id = 0x40 + p.Idx + return c, nil } func (p *BmsModule) Size() uint { @@ -1710,8 +1730,10 @@ type BmsChargerResponse struct { ResponseFlags BmsChargerResponseResponseFlags `json:"response_flags"` } -func (p *BmsChargerResponse) CANId() (uint32, error) { - return 0x75, nil +func (p *BmsChargerResponse) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x75 + return c, nil } func (p *BmsChargerResponse) Size() uint { @@ -1758,8 +1780,10 @@ type ChassisIsolationFault struct { FaultDetected ChassisIsolationFaultFaultDetected `json:"fault_detected"` } -func (p *ChassisIsolationFault) CANId() (uint32, error) { - return 0x38, nil +func (p *ChassisIsolationFault) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x38 + return c, nil } func (p *ChassisIsolationFault) Size() uint { @@ -1998,8 +2022,10 @@ type BmsImdInfo struct { DVifcStatus2 BmsImdInfoDVifcStatus2 `json:"d_vifc_status_2"` } -func (p *BmsImdInfo) CANId() (uint32, error) { - return 0x37, nil +func (p *BmsImdInfo) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x37 + return c, nil } func (p *BmsImdInfo) Size() uint { @@ -2039,8 +2065,10 @@ type DashboardPedalPercentages struct { BrakePedalValue uint8 `json:"brake_pedal_value"` } -func (p *DashboardPedalPercentages) CANId() (uint32, error) { - return 0x290, nil +func (p *DashboardPedalPercentages) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x290 + return c, nil } func (p *DashboardPedalPercentages) Size() uint { @@ -2073,8 +2101,10 @@ type CarState struct { State uint8 `json:"state"` } -func (p *CarState) CANId() (uint32, error) { - return 0x291, nil +func (p *CarState) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x291 + return c, nil } func (p *CarState) Size() uint { @@ -2106,8 +2136,10 @@ type DashboardPedalFault struct { AccelFaultCount uint8 `json:"accel_fault_count"` } -func (p *DashboardPedalFault) CANId() (uint32, error) { - return 0x292, nil +func (p *DashboardPedalFault) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x292 + return c, nil } func (p *DashboardPedalFault) Size() uint { @@ -2191,8 +2223,10 @@ type DashboardSystemTimeoutTest struct { FlagSet0 DashboardSystemTimeoutTestFlagSet0 `json:"flag_set_0"` } -func (p *DashboardSystemTimeoutTest) CANId() (uint32, error) { - return 0x299, nil +func (p *DashboardSystemTimeoutTest) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x299 + return c, nil } func (p *DashboardSystemTimeoutTest) Size() uint { @@ -2223,8 +2257,10 @@ type CarSpeed struct { Speed float32 `json:"speed"` } -func (p *CarSpeed) CANId() (uint32, error) { - return 0x29A, nil +func (p *CarSpeed) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x29A + return c, nil } func (p *CarSpeed) Size() uint { @@ -2260,8 +2296,10 @@ type FlightComputerLvBoardDisconnectCounts struct { CenterConsole uint8 `json:"center_console"` } -func (p *FlightComputerLvBoardDisconnectCounts) CANId() (uint32, error) { - return 0x29B, nil +func (p *FlightComputerLvBoardDisconnectCounts) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x29B + return c, nil } func (p *FlightComputerLvBoardDisconnectCounts) Size() uint { @@ -2307,8 +2345,10 @@ type FlightComputerHvBoardDisconnectCounts struct { MpptRear uint8 `json:"mppt_rear"` } -func (p *FlightComputerHvBoardDisconnectCounts) CANId() (uint32, error) { - return 0x29C, nil +func (p *FlightComputerHvBoardDisconnectCounts) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x29C + return c, nil } func (p *FlightComputerHvBoardDisconnectCounts) Size() uint { @@ -2453,8 +2493,10 @@ type FlightComputerInternalState struct { Internal FlightComputerInternalStateInternal `json:"internal"` } -func (p *FlightComputerInternalState) CANId() (uint32, error) { - return 0x29D, nil +func (p *FlightComputerInternalState) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x29D + return c, nil } func (p *FlightComputerInternalState) Size() uint { @@ -2495,8 +2537,10 @@ type PowerToDrive struct { MovingAverage10K int16 `json:"moving_average_10k"` } -func (p *PowerToDrive) CANId() (uint32, error) { - return 0x19E, nil +func (p *PowerToDrive) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x19E + return c, nil } func (p *PowerToDrive) Size() uint { @@ -2534,8 +2578,10 @@ type ArrayPower struct { RearArrayChannel1 uint16 `json:"rear_array_channel_1"` } -func (p *ArrayPower) CANId() (uint32, error) { - return 0x19F, nil +func (p *ArrayPower) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x19F + return c, nil } func (p *ArrayPower) Size() uint { @@ -2573,8 +2619,10 @@ type ArrayEnergy struct { Energy float32 `json:"energy"` } -func (p *ArrayEnergy) CANId() (uint32, error) { - return 0x119, nil +func (p *ArrayEnergy) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x119 + return c, nil } func (p *ArrayEnergy) Size() uint { @@ -2606,8 +2654,10 @@ type ArrayEnergyReset struct { Energy float32 `json:"energy"` } -func (p *ArrayEnergyReset) CANId() (uint32, error) { - return 0x120, nil +func (p *ArrayEnergyReset) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x120 + return c, nil } func (p *ArrayEnergyReset) Size() uint { @@ -2674,8 +2724,10 @@ type VisionTurnSignalsCommand struct { Lights VisionTurnSignalsCommandLights `json:"lights"` } -func (p *VisionTurnSignalsCommand) CANId() (uint32, error) { - return 0x2B0, nil +func (p *VisionTurnSignalsCommand) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B0 + return c, nil } func (p *VisionTurnSignalsCommand) Size() uint { @@ -2737,8 +2789,10 @@ type VisionBrakeLightsCommand struct { Lights VisionBrakeLightsCommandLights `json:"lights"` } -func (p *VisionBrakeLightsCommand) CANId() (uint32, error) { - return 0x2B1, nil +func (p *VisionBrakeLightsCommand) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B1 + return c, nil } func (p *VisionBrakeLightsCommand) Size() uint { @@ -2806,8 +2860,10 @@ type VisionHeadlightsCommand struct { Brightness float32 `json:"brightness"` } -func (p *VisionHeadlightsCommand) CANId() (uint32, error) { - return 0x2B2, nil +func (p *VisionHeadlightsCommand) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B2 + return c, nil } func (p *VisionHeadlightsCommand) Size() uint { @@ -2861,8 +2917,10 @@ type VisionHornCommand struct { Horn VisionHornCommandHorn `json:"horn"` } -func (p *VisionHornCommand) CANId() (uint32, error) { - return 0x2B3, nil +func (p *VisionHornCommand) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B3 + return c, nil } func (p *VisionHornCommand) Size() uint { @@ -2914,8 +2972,10 @@ type VisionArrayLatchesCommand struct { ArrayLatches VisionArrayLatchesCommandArrayLatches `json:"array_latches"` } -func (p *VisionArrayLatchesCommand) CANId() (uint32, error) { - return 0x2B4, nil +func (p *VisionArrayLatchesCommand) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B4 + return c, nil } func (p *VisionArrayLatchesCommand) Size() uint { @@ -2972,8 +3032,10 @@ type VisionRearviewCommand struct { Cameras VisionRearviewCommandCameras `json:"cameras"` } -func (p *VisionRearviewCommand) CANId() (uint32, error) { - return 0x2B5, nil +func (p *VisionRearviewCommand) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B5 + return c, nil } func (p *VisionRearviewCommand) Size() uint { @@ -3006,11 +3068,13 @@ type TrackerEnable struct { Idx uint32 `json:"idx"` } -func (p *TrackerEnable) CANId() (uint32, error) { +func (p *TrackerEnable) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} if p.Idx >= 6 { - return 0, &UnknownIdError{ 0x610 } + return c, &UnknownIdError{ 0x610 } } - return 0x610 + p.Idx, nil + c.Id = 0x610 + p.Idx + return c, nil } func (p *TrackerEnable) Size() uint { @@ -3042,8 +3106,10 @@ type DistanceTraveled struct { TripDistance float32 `json:"trip_distance"` } -func (p *DistanceTraveled) CANId() (uint32, error) { - return 0x19D, nil +func (p *DistanceTraveled) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x19D + return c, nil } func (p *DistanceTraveled) Size() uint { @@ -3146,8 +3212,10 @@ type ChargerState struct { ChargingCurrent float32 `json:"charging_current"` } -func (p *ChargerState) CANId() (uint32, error) { - return 0x573, nil +func (p *ChargerState) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x573 + return c, nil } func (p *ChargerState) Size() uint { @@ -3200,8 +3268,10 @@ type ChargerBmsRequest struct { RequestFlags ChargerBmsRequestRequestFlags `json:"request_flags"` } -func (p *ChargerBmsRequest) CANId() (uint32, error) { - return 0x74, nil +func (p *ChargerBmsRequest) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x74 + return c, nil } func (p *ChargerBmsRequest) Size() uint { @@ -3235,8 +3305,10 @@ type ChargerCurrentVoltage struct { MaxCapacity float32 `json:"max_capacity"` } -func (p *ChargerCurrentVoltage) CANId() (uint32, error) { - return 0x576, nil +func (p *ChargerCurrentVoltage) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x576 + return c, nil } func (p *ChargerCurrentVoltage) Size() uint { @@ -3270,8 +3342,10 @@ type ChargerPower struct { Power float32 `json:"power"` } -func (p *ChargerPower) CANId() (uint32, error) { - return 0x577, nil +func (p *ChargerPower) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x577 + return c, nil } func (p *ChargerPower) Size() uint { @@ -3311,8 +3385,10 @@ type ThunderstruckControlMessage struct { RESERVED uint16 `json:"RESERVED"` } -func (p *ThunderstruckControlMessage) CANId() (uint32, error) { - return 0x18E54024, nil +func (p *ThunderstruckControlMessage) CanId() (can.CanID, error) { + c := can.CanID{Extended: true} + c.Id = 0x18E54024 + return c, nil } func (p *ThunderstruckControlMessage) Size() uint { @@ -3483,8 +3559,10 @@ type VisionStatusFront struct { ArrayLatches VisionStatusFrontArrayLatches `json:"array_latches"` } -func (p *VisionStatusFront) CANId() (uint32, error) { - return 0x2B6, nil +func (p *VisionStatusFront) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B6 + return c, nil } func (p *VisionStatusFront) Size() uint { @@ -3653,8 +3731,10 @@ type VisionStatusRear struct { ArrayLatches VisionStatusRearArrayLatches `json:"array_latches"` } -func (p *VisionStatusRear) CANId() (uint32, error) { - return 0x2B7, nil +func (p *VisionStatusRear) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x2B7 + return c, nil } func (p *VisionStatusRear) Size() uint { @@ -3696,8 +3776,10 @@ type LightsFrontId struct { FaultCode uint16 `json:"fault_code"` } -func (p *LightsFrontId) CANId() (uint32, error) { - return 0x300, nil +func (p *LightsFrontId) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x300 + return c, nil } func (p *LightsFrontId) Size() uint { @@ -3739,8 +3821,10 @@ type LightsBackId struct { FaultCode uint16 `json:"fault_code"` } -func (p *LightsBackId) CANId() (uint32, error) { - return 0x301, nil +func (p *LightsBackId) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x301 + return c, nil } func (p *LightsBackId) Size() uint { @@ -3782,8 +3866,10 @@ type VisionId struct { FaultCode uint16 `json:"fault_code"` } -func (p *VisionId) CANId() (uint32, error) { - return 0x302, nil +func (p *VisionId) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x302 + return c, nil } func (p *VisionId) Size() uint { @@ -3826,8 +3912,10 @@ type SteeringPressCount1 struct { Button6 uint8 `json:"button6"` } -func (p *SteeringPressCount1) CANId() (uint32, error) { - return 0x240, nil +func (p *SteeringPressCount1) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x240 + return c, nil } func (p *SteeringPressCount1) Size() uint { @@ -3873,8 +3961,10 @@ type SteeringPressCount2 struct { Button10 uint8 `json:"button10"` } -func (p *SteeringPressCount2) CANId() (uint32, error) { - return 0x250, nil +func (p *SteeringPressCount2) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x250 + return c, nil } func (p *SteeringPressCount2) Size() uint { @@ -3917,8 +4007,10 @@ type SteeringButtonColors1 struct { Button6 uint8 `json:"button6"` } -func (p *SteeringButtonColors1) CANId() (uint32, error) { - return 0x241, nil +func (p *SteeringButtonColors1) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x241 + return c, nil } func (p *SteeringButtonColors1) Size() uint { @@ -3964,8 +4056,10 @@ type SteeringButtonColors2 struct { Button10 uint8 `json:"button10"` } -func (p *SteeringButtonColors2) CANId() (uint32, error) { - return 0x251, nil +func (p *SteeringButtonColors2) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x251 + return c, nil } func (p *SteeringButtonColors2) Size() uint { @@ -4002,8 +4096,10 @@ type SteeringHorn struct { Horn uint8 `json:"horn"` } -func (p *SteeringHorn) CANId() (uint32, error) { - return 0x242, nil +func (p *SteeringHorn) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x242 + return c, nil } func (p *SteeringHorn) Size() uint { @@ -4045,8 +4141,10 @@ type ThunderstruckStatusMessage struct { RESERVED uint8 `json:"RESERVED"` } -func (p *ThunderstruckStatusMessage) CANId() (uint32, error) { - return 0x18EB2440, nil +func (p *ThunderstruckStatusMessage) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x18EB2440 + return c, nil } func (p *ThunderstruckStatusMessage) Size() uint { @@ -4096,11 +4194,13 @@ type TrackerData struct { Idx uint32 `json:"idx"` } -func (p *TrackerData) CANId() (uint32, error) { +func (p *TrackerData) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} if p.Idx >= 6 { - return 0, &UnknownIdError{ 0x600 } + return c, &UnknownIdError{ 0x600 } } - return 0x600 + p.Idx, nil + c.Id = 0x600 + p.Idx + return c, nil } func (p *TrackerData) Size() uint { @@ -4138,8 +4238,10 @@ type TritiumMotorDriveL struct { MotorCurrent float32 `json:"motor_current"` } -func (p *TritiumMotorDriveL) CANId() (uint32, error) { - return 0x121, nil +func (p *TritiumMotorDriveL) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x121 + return c, nil } func (p *TritiumMotorDriveL) Size() uint { @@ -4173,8 +4275,10 @@ type TritiumMotorPowerL struct { BusCurrent float32 `json:"bus_current"` } -func (p *TritiumMotorPowerL) CANId() (uint32, error) { - return 0x122, nil +func (p *TritiumMotorPowerL) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x122 + return c, nil } func (p *TritiumMotorPowerL) Size() uint { @@ -4208,8 +4312,10 @@ type TritiumResetL struct { Unused2 float32 `json:"unused2"` } -func (p *TritiumResetL) CANId() (uint32, error) { - return 0x123, nil +func (p *TritiumResetL) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x123 + return c, nil } func (p *TritiumResetL) Size() uint { @@ -4243,8 +4349,10 @@ type TritiumMotorDriveR struct { MotorCurrent float32 `json:"motor_current"` } -func (p *TritiumMotorDriveR) CANId() (uint32, error) { - return 0x161, nil +func (p *TritiumMotorDriveR) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x161 + return c, nil } func (p *TritiumMotorDriveR) Size() uint { @@ -4278,8 +4386,10 @@ type TritiumMotorPowerR struct { BusCurrent float32 `json:"bus_current"` } -func (p *TritiumMotorPowerR) CANId() (uint32, error) { - return 0x162, nil +func (p *TritiumMotorPowerR) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x162 + return c, nil } func (p *TritiumMotorPowerR) Size() uint { @@ -4313,8 +4423,10 @@ type TritiumResetR struct { Unused2 float32 `json:"unused2"` } -func (p *TritiumResetR) CANId() (uint32, error) { - return 0x163, nil +func (p *TritiumResetR) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x163 + return c, nil } func (p *TritiumResetR) Size() uint { @@ -4347,8 +4459,10 @@ type BmsAhSet struct { Ah uint32 `json:"ah"` } -func (p *BmsAhSet) CANId() (uint32, error) { - return 0x16, nil +func (p *BmsAhSet) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x16 + return c, nil } func (p *BmsAhSet) Size() uint { @@ -4379,8 +4493,10 @@ type BmsWhSet struct { Wh uint32 `json:"wh"` } -func (p *BmsWhSet) CANId() (uint32, error) { - return 0x17, nil +func (p *BmsWhSet) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x17 + return c, nil } func (p *BmsWhSet) Size() uint { @@ -4427,8 +4543,10 @@ type BmsKill struct { KillType BmsKillKillType `json:"kill_type"` } -func (p *BmsKill) CANId() (uint32, error) { - return 0x1A, nil +func (p *BmsKill) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x1A + return c, nil } func (p *BmsKill) Size() uint { @@ -4464,8 +4582,10 @@ type TelemetryRtcReset struct { Second uint8 `json:"second"` } -func (p *TelemetryRtcReset) CANId() (uint32, error) { - return 0x700, nil +func (p *TelemetryRtcReset) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x700 + return c, nil } func (p *TelemetryRtcReset) Size() uint { @@ -4507,8 +4627,10 @@ type WsrIdentification struct { SerialNumber uint32 `json:"serial_number"` } -func (p *WsrIdentification) CANId() (uint32, error) { - return 0x140, nil +func (p *WsrIdentification) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x140 + return c, nil } func (p *WsrIdentification) Size() uint { @@ -4699,8 +4821,10 @@ type WsrStatusInformation struct { Reserved uint16 `json:"reserved"` } -func (p *WsrStatusInformation) CANId() (uint32, error) { - return 0x141, nil +func (p *WsrStatusInformation) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x141 + return c, nil } func (p *WsrStatusInformation) Size() uint { @@ -4744,8 +4868,10 @@ type WsrBusMeasurement struct { BusCurrent float32 `json:"bus_current"` } -func (p *WsrBusMeasurement) CANId() (uint32, error) { - return 0x142, nil +func (p *WsrBusMeasurement) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x142 + return c, nil } func (p *WsrBusMeasurement) Size() uint { @@ -4781,8 +4907,10 @@ type WsrVelocity struct { VehicleVelocity float32 `json:"vehicle_velocity"` } -func (p *WsrVelocity) CANId() (uint32, error) { - return 0x143, nil +func (p *WsrVelocity) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x143 + return c, nil } func (p *WsrVelocity) Size() uint { @@ -4818,8 +4946,10 @@ type WsrPhaseCurrent struct { PhaseCCurrent float32 `json:"phase_c_current"` } -func (p *WsrPhaseCurrent) CANId() (uint32, error) { - return 0x144, nil +func (p *WsrPhaseCurrent) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x144 + return c, nil } func (p *WsrPhaseCurrent) Size() uint { @@ -4855,8 +4985,10 @@ type WsrMotorVoltageVector struct { Vd float32 `json:"vd"` } -func (p *WsrMotorVoltageVector) CANId() (uint32, error) { - return 0x145, nil +func (p *WsrMotorVoltageVector) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x145 + return c, nil } func (p *WsrMotorVoltageVector) Size() uint { @@ -4892,8 +5024,10 @@ type WsrMotorCurrentVector struct { Id float32 `json:"id"` } -func (p *WsrMotorCurrentVector) CANId() (uint32, error) { - return 0x146, nil +func (p *WsrMotorCurrentVector) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x146 + return c, nil } func (p *WsrMotorCurrentVector) Size() uint { @@ -4929,8 +5063,10 @@ type WsrMotorBackemf struct { Bemfd float32 `json:"bemfd"` } -func (p *WsrMotorBackemf) CANId() (uint32, error) { - return 0x147, nil +func (p *WsrMotorBackemf) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x147 + return c, nil } func (p *WsrMotorBackemf) Size() uint { @@ -4966,8 +5102,10 @@ type Wsr15165VoltageRail struct { Supply15V float32 `json:"supply_15v"` } -func (p *Wsr15165VoltageRail) CANId() (uint32, error) { - return 0x148, nil +func (p *Wsr15165VoltageRail) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x148 + return c, nil } func (p *Wsr15165VoltageRail) Size() uint { @@ -5003,8 +5141,10 @@ type Wsr2512VoltageRail struct { Supply25V float32 `json:"supply_25v"` } -func (p *Wsr2512VoltageRail) CANId() (uint32, error) { - return 0x149, nil +func (p *Wsr2512VoltageRail) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x149 + return c, nil } func (p *Wsr2512VoltageRail) Size() uint { @@ -5040,8 +5180,10 @@ type WsrHeatsinkMotorTemp struct { HeatsinkTemp float32 `json:"heatsink_temp"` } -func (p *WsrHeatsinkMotorTemp) CANId() (uint32, error) { - return 0x14B, nil +func (p *WsrHeatsinkMotorTemp) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x14B + return c, nil } func (p *WsrHeatsinkMotorTemp) Size() uint { @@ -5077,8 +5219,10 @@ type WsrDspBoardTemp struct { Reserved float32 `json:"reserved"` } -func (p *WsrDspBoardTemp) CANId() (uint32, error) { - return 0x14C, nil +func (p *WsrDspBoardTemp) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x14C + return c, nil } func (p *WsrDspBoardTemp) Size() uint { @@ -5112,8 +5256,10 @@ type WsrReserved struct { Reserved1 float32 `json:"reserved1"` } -func (p *WsrReserved) CANId() (uint32, error) { - return 0x14D, nil +func (p *WsrReserved) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x14D + return c, nil } func (p *WsrReserved) Size() uint { @@ -5149,8 +5295,10 @@ type WsrOdometerBusAmphoursMeasurement struct { DcBusAmphours float32 `json:"dc_bus_amphours"` } -func (p *WsrOdometerBusAmphoursMeasurement) CANId() (uint32, error) { - return 0x14E, nil +func (p *WsrOdometerBusAmphoursMeasurement) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x14E + return c, nil } func (p *WsrOdometerBusAmphoursMeasurement) Size() uint { @@ -5186,8 +5334,10 @@ type WsrSlipSpeedMeasurement struct { SlipSpeed float32 `json:"slip_speed"` } -func (p *WsrSlipSpeedMeasurement) CANId() (uint32, error) { - return 0x157, nil +func (p *WsrSlipSpeedMeasurement) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x157 + return c, nil } func (p *WsrSlipSpeedMeasurement) Size() uint { @@ -5221,8 +5371,10 @@ type WslIdentification struct { SerialNumber uint32 `json:"serial_number"` } -func (p *WslIdentification) CANId() (uint32, error) { - return 0x100, nil +func (p *WslIdentification) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x100 + return c, nil } func (p *WslIdentification) Size() uint { @@ -5413,8 +5565,10 @@ type WslStatusInformation struct { Reserved uint16 `json:"reserved"` } -func (p *WslStatusInformation) CANId() (uint32, error) { - return 0x101, nil +func (p *WslStatusInformation) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x101 + return c, nil } func (p *WslStatusInformation) Size() uint { @@ -5458,8 +5612,10 @@ type WslBusMeasurement struct { BusCurrent float32 `json:"bus_current"` } -func (p *WslBusMeasurement) CANId() (uint32, error) { - return 0x102, nil +func (p *WslBusMeasurement) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x102 + return c, nil } func (p *WslBusMeasurement) Size() uint { @@ -5495,8 +5651,10 @@ type WslVelocity struct { VehicleVelocity float32 `json:"vehicle_velocity"` } -func (p *WslVelocity) CANId() (uint32, error) { - return 0x103, nil +func (p *WslVelocity) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x103 + return c, nil } func (p *WslVelocity) Size() uint { @@ -5532,8 +5690,10 @@ type WslPhaseCurrent struct { PhaseCCurrent float32 `json:"phase_c_current"` } -func (p *WslPhaseCurrent) CANId() (uint32, error) { - return 0x104, nil +func (p *WslPhaseCurrent) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x104 + return c, nil } func (p *WslPhaseCurrent) Size() uint { @@ -5569,8 +5729,10 @@ type WslMotorVoltageVector struct { Vd float32 `json:"vd"` } -func (p *WslMotorVoltageVector) CANId() (uint32, error) { - return 0x105, nil +func (p *WslMotorVoltageVector) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x105 + return c, nil } func (p *WslMotorVoltageVector) Size() uint { @@ -5606,8 +5768,10 @@ type WslMotorCurrentVector struct { Id float32 `json:"id"` } -func (p *WslMotorCurrentVector) CANId() (uint32, error) { - return 0x106, nil +func (p *WslMotorCurrentVector) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x106 + return c, nil } func (p *WslMotorCurrentVector) Size() uint { @@ -5643,8 +5807,10 @@ type WslMotorBackemf struct { Bemfd float32 `json:"bemfd"` } -func (p *WslMotorBackemf) CANId() (uint32, error) { - return 0x107, nil +func (p *WslMotorBackemf) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x107 + return c, nil } func (p *WslMotorBackemf) Size() uint { @@ -5680,8 +5846,10 @@ type Wsl15165VoltageRail struct { Supply15V float32 `json:"supply_15v"` } -func (p *Wsl15165VoltageRail) CANId() (uint32, error) { - return 0x108, nil +func (p *Wsl15165VoltageRail) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x108 + return c, nil } func (p *Wsl15165VoltageRail) Size() uint { @@ -5717,8 +5885,10 @@ type Wsl2512VoltageRail struct { Supply25V float32 `json:"supply_25v"` } -func (p *Wsl2512VoltageRail) CANId() (uint32, error) { - return 0x109, nil +func (p *Wsl2512VoltageRail) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x109 + return c, nil } func (p *Wsl2512VoltageRail) Size() uint { @@ -5754,8 +5924,10 @@ type WslHeatsinkMotorTemp struct { HeatsinkTemp float32 `json:"heatsink_temp"` } -func (p *WslHeatsinkMotorTemp) CANId() (uint32, error) { - return 0x10B, nil +func (p *WslHeatsinkMotorTemp) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x10B + return c, nil } func (p *WslHeatsinkMotorTemp) Size() uint { @@ -5791,8 +5963,10 @@ type WslDspBoardTemp struct { Reserved float32 `json:"reserved"` } -func (p *WslDspBoardTemp) CANId() (uint32, error) { - return 0x10C, nil +func (p *WslDspBoardTemp) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x10C + return c, nil } func (p *WslDspBoardTemp) Size() uint { @@ -5828,8 +6002,10 @@ type WslOdometerBusAmphoursMeasurement struct { DcBusAmphours float32 `json:"dc_bus_amphours"` } -func (p *WslOdometerBusAmphoursMeasurement) CANId() (uint32, error) { - return 0x10E, nil +func (p *WslOdometerBusAmphoursMeasurement) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x10E + return c, nil } func (p *WslOdometerBusAmphoursMeasurement) Size() uint { @@ -5863,8 +6039,10 @@ type WslReserved struct { Reserved1 float32 `json:"reserved1"` } -func (p *WslReserved) CANId() (uint32, error) { - return 0x10D, nil +func (p *WslReserved) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x10D + return c, nil } func (p *WslReserved) Size() uint { @@ -5900,8 +6078,10 @@ type WslSlipSpeedMeasurement struct { SlipSpeed float32 `json:"slip_speed"` } -func (p *WslSlipSpeedMeasurement) CANId() (uint32, error) { - return 0x117, nil +func (p *WslSlipSpeedMeasurement) CanId() (can.CanID, error) { + c := can.CanID{Extended: false} + c.Id = 0x117 + return c, nil } func (p *WslSlipSpeedMeasurement) Size() uint { @@ -5931,4 +6111,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","Extended":false,"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","Extended":false,"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":"pack_choice","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"large_pack"},{"Name":"small_pack"}]}]},{"Name":"bms_kill_reason","Description":"Information for when the car kills","Id":18,"Endian":"little","Extended":false,"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":"AUX_OVERTEMP"}]},{"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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":64,"Endian":"little","Extended":false,"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":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"response_flags","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"charging_ready"}]}]},{"Name":"chassis_isolation_fault","Description":"chassiss is not isolated from the battery","Id":56,"Endian":"","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"fault_detected","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"isolation_fault"}]}]},{"Name":"bms_imd_info","Description":"information from chassis isolation","Id":55,"Endian":"","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"d_imc_r_iso","Type":"uint16_t","Units":"","Conversion":0,"Bits":null},{"Name":"d_imc_status_1","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"isolation_fault"},{"Name":"chassis_fault"},{"Name":"system_failure"},{"Name":"calibration_running"},{"Name":"self_test_running"},{"Name":"isolation_warning"},{"Name":"reserved"},{"Name":"reserved_2"}]},{"Name":"d_imc_status_2","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"reserved"},{"Name":"reserved_2"},{"Name":"reserved_3"},{"Name":"reserved_4"},{"Name":"reserved_5"},{"Name":"reserved_6"},{"Name":"reserved_7"},{"Name":"reserved_8"}]},{"Name":"d_vifc_status_1","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"insulation_measurment"},{"Name":"imc_connectivity_not_implemented"},{"Name":"imc_alive_satus_detection"},{"Name":"reserved"},{"Name":"vifc_command_not_implemented"},{"Name":"reserved_2"},{"Name":"reserved_3"},{"Name":"reserved_4"}]},{"Name":"d_vifc_status_2","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"insulation_resistance_value"},{"Name":"reserved"},{"Name":"reserved_2"},{"Name":"reserved_3"},{"Name":"imc_self_test_overAll"},{"Name":"imc_self_test_parameterConfig"},{"Name":"reserved_4"},{"Name":"reserved_5"}]}]},{"Name":"dashboard_pedal_percentages","Description":"ADC values from the brake and accelerator pedals.","Id":656,"Endian":"little","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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":"array_energy","Description":"cumulative energy received from the array","Id":281,"Endian":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"energy","Type":"float","Units":"Joule","Conversion":0,"Bits":null}]},{"Name":"array_energy_reset","Description":"resets cumulative energy received from the array","Id":288,"Endian":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"energy","Type":"float","Units":"Joule","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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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","Extended":false,"Repeat":6,"Offset":1,"Data":[{"Name":"enable","Type":"uint8_t","Units":"","Conversion":0,"Bits":null}]},{"Name":"distance_traveled","Description":"distance of wavesculptor odometer","Id":413,"Endian":"little","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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","Extended":true,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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","Extended":true,"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","Extended":false,"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_l","Description":"Tritium Motor Drive Command","Id":289,"Endian":"little","Extended":false,"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_l","Description":"Tritium Motor Power Command","Id":290,"Endian":"little","Extended":false,"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_l","Description":"Tritium Reset Command","Id":291,"Endian":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"unused1","Type":"float","Units":"","Conversion":0,"Bits":null},{"Name":"unused2","Type":"float","Units":"","Conversion":0,"Bits":null}]},{"Name":"tritium_motor_drive_r","Description":"Tritium Motor Drive Command","Id":353,"Endian":"little","Extended":false,"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_r","Description":"Tritium Motor Power Command","Id":354,"Endian":"little","Extended":false,"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_r","Description":"Tritium Reset Command","Id":355,"Endian":"little","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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":"","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","chassis_isolation_fault"]},{"Name":"bridge_board","Transmit":["chassis_isolation_fault"],"Receive":["bms_imd_info","battery_status"]},{"Name":"charger","Transmit":["charger_state","charger_bms_request","charger_power","thunderstruck_control_message"],"Receive":["bms_charger_response","battery_status","bms_module_min_max","bms_measurement","charger_current_voltage","bms_capacity","thunderstruck_status_message"]},{"Name":"flight_computer","Transmit":["tracker_enable","vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","tritium_motor_drive_l","tritium_motor_drive_r","steering_button_colors_1","steering_button_colors_2","tritium_reset_l","tritium_reset_r","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","array_energy","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","array_energy_reset","wsr_odometer_bus_amphours_measurement"]},{"Name":"g4_example","Transmit":["vision_status_front","vision_headlights_command","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"],"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"]}]}` +const SkylabDefinitions = `{"Packets":[{"Name":"bms_measurement","Description":"Voltages for main battery and aux pack","Id":16,"Endian":"little","Extended":false,"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","Extended":false,"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":"pack_choice","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"large_pack"},{"Name":"small_pack"}]}]},{"Name":"bms_kill_reason","Description":"Information for when the car kills","Id":18,"Endian":"little","Extended":false,"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":"AUX_OVERTEMP"}]},{"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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":64,"Endian":"little","Extended":false,"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":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"response_flags","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"charging_ready"}]}]},{"Name":"chassis_isolation_fault","Description":"chassiss is not isolated from the battery","Id":56,"Endian":"","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"fault_detected","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"isolation_fault"}]}]},{"Name":"bms_imd_info","Description":"information from chassis isolation","Id":55,"Endian":"","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"d_imc_r_iso","Type":"uint16_t","Units":"","Conversion":0,"Bits":null},{"Name":"d_imc_status_1","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"isolation_fault"},{"Name":"chassis_fault"},{"Name":"system_failure"},{"Name":"calibration_running"},{"Name":"self_test_running"},{"Name":"isolation_warning"},{"Name":"reserved"},{"Name":"reserved_2"}]},{"Name":"d_imc_status_2","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"reserved"},{"Name":"reserved_2"},{"Name":"reserved_3"},{"Name":"reserved_4"},{"Name":"reserved_5"},{"Name":"reserved_6"},{"Name":"reserved_7"},{"Name":"reserved_8"}]},{"Name":"d_vifc_status_1","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"insulation_measurment"},{"Name":"imc_connectivity_not_implemented"},{"Name":"imc_alive_satus_detection"},{"Name":"reserved"},{"Name":"vifc_command_not_implemented"},{"Name":"reserved_2"},{"Name":"reserved_3"},{"Name":"reserved_4"}]},{"Name":"d_vifc_status_2","Type":"bitfield","Units":"","Conversion":0,"Bits":[{"Name":"insulation_resistance_value"},{"Name":"reserved"},{"Name":"reserved_2"},{"Name":"reserved_3"},{"Name":"imc_self_test_overAll"},{"Name":"imc_self_test_parameterConfig"},{"Name":"reserved_4"},{"Name":"reserved_5"}]}]},{"Name":"dashboard_pedal_percentages","Description":"ADC values from the brake and accelerator pedals.","Id":656,"Endian":"little","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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":"array_energy","Description":"cumulative energy received from the array","Id":281,"Endian":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"energy","Type":"float","Units":"Joule","Conversion":0,"Bits":null}]},{"Name":"array_energy_reset","Description":"resets cumulative energy received from the array","Id":288,"Endian":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"energy","Type":"float","Units":"Joule","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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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","Extended":false,"Repeat":6,"Offset":1,"Data":[{"Name":"enable","Type":"uint8_t","Units":"","Conversion":0,"Bits":null}]},{"Name":"distance_traveled","Description":"distance of wavesculptor odometer","Id":413,"Endian":"little","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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","Extended":true,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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":"","Extended":false,"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","Extended":false,"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","Extended":false,"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_l","Description":"Tritium Motor Drive Command","Id":289,"Endian":"little","Extended":false,"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_l","Description":"Tritium Motor Power Command","Id":290,"Endian":"little","Extended":false,"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_l","Description":"Tritium Reset Command","Id":291,"Endian":"little","Extended":false,"Repeat":0,"Offset":0,"Data":[{"Name":"unused1","Type":"float","Units":"","Conversion":0,"Bits":null},{"Name":"unused2","Type":"float","Units":"","Conversion":0,"Bits":null}]},{"Name":"tritium_motor_drive_r","Description":"Tritium Motor Drive Command","Id":353,"Endian":"little","Extended":false,"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_r","Description":"Tritium Motor Power Command","Id":354,"Endian":"little","Extended":false,"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_r","Description":"Tritium Reset Command","Id":355,"Endian":"little","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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":"","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","Extended":false,"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","chassis_isolation_fault"]},{"Name":"bridge_board","Transmit":["chassis_isolation_fault"],"Receive":["bms_imd_info","battery_status"]},{"Name":"charger","Transmit":["charger_state","charger_bms_request","charger_power","thunderstruck_control_message"],"Receive":["bms_charger_response","battery_status","bms_module_min_max","bms_measurement","charger_current_voltage","bms_capacity","thunderstruck_status_message"]},{"Name":"flight_computer","Transmit":["tracker_enable","vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","tritium_motor_drive_l","tritium_motor_drive_r","steering_button_colors_1","steering_button_colors_2","tritium_reset_l","tritium_reset_r","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","array_energy","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","array_energy_reset","wsr_odometer_bus_amphours_measurement"]},{"Name":"g4_example","Transmit":["vision_status_front","vision_headlights_command","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"],"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 9b7ea79..b8b8034 100644 --- a/skylab/templates/golang.go.tmpl +++ b/skylab/templates/golang.go.tmpl @@ -45,15 +45,17 @@ type {{$structName}} struct { {{- end }} } -func (p *{{$structName}}) CANId() (uint32, error) { +func (p *{{$structName}}) CanId() (can.CanID, error) { + c := can.CanID{Extended: {{.Extended}}} {{- if .Repeat }} if p.Idx >= {{.Repeat}} { - return 0, &UnknownIdError{ {{ printf "0x%X" .Id }} } + return c, &UnknownIdError{ {{ printf "0x%X" .Id }} } } - return {{ printf "0x%X" .Id }} + p.Idx, nil + c.Id = {{ printf "0x%X" .Id }} + p.Idx {{- else }} - return {{ printf "0x%X" .Id }}, nil + c.Id = {{ printf "0x%X" .Id }} {{- end }} + return c, nil } func (p *{{$structName}}) Size() uint { @@ -107,10 +109,10 @@ var idMap = map[can.CanID]bool{ {{ range $p := .Packets -}} {{ if $p.Repeat }} {{ range $idx := Nx (int $p.Id) $p.Repeat $p.Offset -}} - can.CanID{ Id: {{ $idx | printf "0x%X"}}, Extended: {{$p.Extended}} }: true, + { Id: {{ $idx | printf "0x%X"}}, Extended: {{$p.Extended}} }: true, {{ end }} {{- else }} - can.CanID{ Id: {{ $p.Id | printf "0x%X" }}, Extended: {{$p.Extended}} }: true, + { Id: {{ $p.Id | printf "0x%X" }}, Extended: {{$p.Extended}} }: true, {{- end}} {{- end}} }