openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Live torque

Open nuwandavek opened this issue 2 years ago • 1 comments

ToDo

  • ~~have a robust update logic for the corolla, like calibrationd~~ revisit if any issues
  • ~~resolve the first drive vs later drive discrepancies~~ revisit if any issues
  • ~~run with torqued on corolla & drive~~
  • ~~use in controlsd & drive~~
  • ~~good logic to save points (and continue in the next route)~~
  • ~~handle multiple resets case (reset decay)~~
  • ~~handle new platform (with the is_sane fn)~~
  • drive on rav4
  • use offset? (have to smart initialize it; current initialization is bad)
  • lower threshold for is_sane to some actual sane value

nuwandavek avatar Aug 16 '22 23:08 nuwandavek

After I initialize the data file I got below error

File "/data/openpilot/selfdrive/locationd/torqued.py", line 176, in main estimator = TorqueEstimator(CP, torque_params) File "/data/openpilot/selfdrive/locationd/torqued.py", line 82, in init params = log.Event.from_bytes(params).liveTorqueParameters if params is not None else None File "capnp/lib/capnp.pyx", line 3348, in capnp.lib.capnp._StructModule.from_b ytes File "capnp/lib/capnp.pyx", line 4143, in capnp.lib.capnp._FlatArrayMessageRea der.init ValueError: input length must be a multiple of eight bytes

bmrtech avatar Aug 26 '22 21:08 bmrtech

While I driving, I got "live torque params are numerically unstable NoneType: None" error and can not use openpilot unitil I delete the LiveTorqueParameters.

bmrtech avatar Aug 31 '22 07:08 bmrtech

While I driving, I got "live torque params are numerically unstable NoneType: None" error and can not use openpilot unitil I delete the LiveTorqueParameters.

Did you pull all latest changes? Could you send me the segment/route where it happened? torqued is pretty stable now with the latest changes, but there could be some numerical edge cases. I'll look into it if you get me a segment!

nuwandavek avatar Aug 31 '22 17:08 nuwandavek

I backported this to C2. I haven't gotten good results yet. For whatever reason, after 30 mins it really didn't want to stay in the lane and it would actually pull to the left and would not turn right. maybe its my setup but just providing my feedback . I want to use this for my new car port but obviously I have messed something up.

MoreTore avatar Sep 03 '22 08:09 MoreTore

After make latacc-to-torque generic, and overrideable applied. Vehicle ping pong at under 40 miles.
While I driving I got Low Communication Rate between Processes.

bmrtech avatar Sep 03 '22 14:09 bmrtech

Here is my LiveTorqueParameters. It just crashed. https://drive.google.com/file/d/1bvmoMT4i5oYhjg_4e-NoVEFQWF047Jz4/view?usp=sharing

bmrtech avatar Sep 03 '22 21:09 bmrtech

Torqued seems stable on my C2. I have the priority set to 4. I am not calling all_checks(). When i try running bridge it causes a com issue with carstate.

MoreTore avatar Sep 03 '22 23:09 MoreTore

After make latacc-to-torque generic, and overrideable applied. Vehicle ping pong at under 40 miles. While I driving I got Low Communication Rate between Processes.

@bmrtech Could you post the segment id? I want to look at the history a bit (routes before and after etc).

I backported this to C2. I haven't gotten good results yet. For whatever reason, after 30 mins it really didn't want to stay in the lane and it would actually pull to the left and would not turn right. maybe its my setup but just providing my feedback . I want to use this for my new car port but obviously I have messed something up.

@MoreTore Could you post your segment as well? I've been driving on the most recent commit on this branch and it looks fine (and recovers from any wrongly learnt state very quickly). So I suspect it entered into some un-recoverable state in your case.

Currently the is_sane threshold is not sane - I wanted to test the stability of the learnt values. Setting that should make it not deviate too much (It's in the todo as you can see). But segment ids are necessary for me to debug what's happening.

nuwandavek avatar Sep 04 '22 00:09 nuwandavek

After make latacc-to-torque generic, and overrideable applied. Vehicle ping pong at under 40 miles. While I driving I got Low Communication Rate between Processes.

@bmrtech Could you post the segment id? I want to look at the history a bit (routes before and after etc).

I backported this to C2. I haven't gotten good results yet. For whatever reason, after 30 mins it really didn't want to stay in the lane and it would actually pull to the left and would not turn right. maybe its my setup but just providing my feedback . I want to use this for my new car port but obviously I have messed something up.

@MoreTore Could you post your segment as well? I've been driving on the most recent commit on this branch and it looks fine (and recovers from any wrongly learnt state very quickly). So I suspect it entered into some un-recoverable state in your case.

Currently the is_sane threshold is not sane - I wanted to test the stability of the learnt values. Setting that should make it not deviate too much (It's in the todo as you can see). But segment ids are necessary for me to debug what's happening.

I had an unrelated issue. I had to make many changes when back porting and i missed something.

MoreTore avatar Sep 04 '22 02:09 MoreTore

So I have everything set up (i think) but there is still an issue for me. 'torqued' seems to be running, LiveTorqueParameters is there. The params don't seem to be updating as they are still at the initial_params values.

b'\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\x00Jv\xd0\x88#\n\x00\x00T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00?\x00\x00\x00\x00\n\xd7#<\x00\x00\x00\x00\x00\x00HB\x00\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00' ( liveValid = false, slopeRaw = 0, offsetRaw = 0, frictionCoefficientRaw = 0, slopeFiltered = 0.5, offsetFiltered = 0, frictionCoefficientFiltered = 0.01, totalBucketPoints = 0, decay = 50, maxResets = false, points = [] ) I must be missing something.

I guess its possible that the drive didn't meet all the requirements to add points. Seems like the guard statement for adding points in log_handler is too restrictive for some reason. I take a deeper look another time.

Ok so it looks like active is never true for me. active = np.interp(np.arange(t - MIN_ENGAGE_BUFFER, t, DT_MDL), np.array(self.raw_points['carControl_t']) + self.lag, self.raw_points['active']).astype(bool)

MoreTore avatar Sep 04 '22 07:09 MoreTore

  • [x] save on exit
  • [x] checks before caching: fingerprint, version, and tuning vals
  • [x] check timings
  • [x] add to process replay
  • [x] add to onroad tests

adeebshihadeh avatar Sep 08 '22 06:09 adeebshihadeh

Just tested the latest commits and it still doesn't seem to do anything. I still get really bad oscillations below 50km/h.

MoreTore avatar Sep 16 '22 01:09 MoreTore

Just tested the latest commits and it still doesn't seem to do anything. I still get really bad oscillations below 50km/h.

Without segments I really have no way of looking into it.

nuwandavek avatar Sep 16 '22 06:09 nuwandavek

Without segments I really have no way of looking into it.

My device is not official. I can send you my logs if you can use them locally. If not, I understand.

MoreTore avatar Sep 17 '22 16:09 MoreTore