Skip to content

CarStateTransceiver not working #7

Open

Description

@Corecii

CarStateTransceiver is created, and mode_.isGo_ is true, but car state is not being updated.

Possible causes: bad setup in Unity, bad NeworkViewId, Distance code isn't running CarDirectives read, write, or update properly

Next step: investigate if it's receiving any data at all.

Activity

  1. Corecii commented on Dec 25, 2018

    @Corecii
    OwnerAuthor

    This bug was caused by...

    1. The server would properly receive the car state bits, which is held within a single 32 bit integer
    2. The server would properly assign those bits to the Bits_ property of the CarStateTransceiver
    3. The server would -- actually -- properly compare if cars were idle or not, because that used a direct comparison of the Bits_ property between zero and the car state.
    4. The server would not call Serialize to convert from Bits_ to an actual car state.
    5. The server would stream out by converting the car state properties to bits -- the properties which wee never serialized in from the streamed in bits.

    This means that the server had the right bits for the car state, but those bits never became proper values, so the properties were always zero.


    In version 0.1.3, this was fixed with a workaround:

    • Received car state bits do not go into the CircularBuffer for CarDirectives
    • Received car state is manually streamed in using the main CarDirectives in the CarLogic, instead of using a CarDirectives in the CircularBuffer
    • CarDirectives.Serialize is manually called to convert the car bits to car state properties.

    This in effect assumes that the most recently received car state is the newest and ignores the timestamp attached to the state.

    It should be possible to go back to using the CircularBuffer and just call Serialize on the main CarDirectives in CarLogic after running Update. This will bring behavior back to Distance's, where the timestamp matters and the most recently received state is not assumed to be the newest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions