Skip to content

Commit

Permalink
controlsd: deprecate startMonoTime (commaai#33445)
Browse files Browse the repository at this point in the history
* controlsd: deprecate startMonoTime

* update refs
  • Loading branch information
adeebshihadeh committed Sep 4, 2024
1 parent ffc089c commit 04eb73e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cereal/log.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,6 @@ struct SelfdriveState {

struct ControlsState @0x97ff69c53601abf1 {
cumLagMs @15 :Float32;
startMonoTime @48 :UInt64;
longitudinalPlanMonoTime @28 :UInt64;
lateralPlanMonoTime @50 :UInt64;

Expand Down Expand Up @@ -880,6 +879,7 @@ struct ControlsState @0x97ff69c53601abf1 {
personalityDEPRECATED @66 :LongitudinalPersonality;
vCruiseDEPRECATED @22 :Float32; # actual set speed
vCruiseClusterDEPRECATED @63 :Float32; # set speed to display in the UI
startMonoTimeDEPRECATED @48 :UInt64;
}

struct DrivingModelData {
Expand Down
7 changes: 2 additions & 5 deletions selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def state_control(self, CS):

return CC, lac_log

def publish_logs(self, CS, start_time, CC, lac_log):
def publish_logs(self, CS, CC, lac_log):
"""Send actuators and hud commands to the car, send controlsstate and MPC logging"""

# Orientation and angle rates can be useful for carcontroller
Expand Down Expand Up @@ -742,7 +742,6 @@ def publish_logs(self, CS, start_time, CC, lac_log):
controlsState.uiAccelCmd = float(self.LoC.pid.i)
controlsState.ufAccelCmd = float(self.LoC.pid.f)
controlsState.cumLagMs = -self.rk.remaining * 1000.
controlsState.startMonoTime = int(start_time * 1e9)
controlsState.forceDecel = bool(force_decel)

lat_tuning = self.CP.lateralTuning.which()
Expand Down Expand Up @@ -791,8 +790,6 @@ def publish_logs(self, CS, start_time, CC, lac_log):
self.pm.send('carControl', cc_send)

def step(self):
start_time = time.monotonic()

# Sample data from sockets and get a carState
CS = self.data_sample()
cloudlog.timestamp("Data sampled")
Expand All @@ -808,7 +805,7 @@ def step(self):
CC, lac_log = self.state_control(CS)

# Publish data
self.publish_logs(CS, start_time, CC, lac_log)
self.publish_logs(CS, CC, lac_log)

self.CS_prev = CS

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/compare_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def format_diff(results, log_paths, ref_commit):
if __name__ == "__main__":
log1 = list(LogReader(sys.argv[1]))
log2 = list(LogReader(sys.argv[2]))
ignore_fields = sys.argv[3:] or ["logMonoTime", "controlsState.startMonoTime", "controlsState.cumLagMs"]
ignore_fields = sys.argv[3:] or ["logMonoTime", "controlsState.cumLagMs"]
results = {"segment": {"proc": compare_logs(log1, log2, ignore_fields)}}
log_paths = {"segment": {"proc": {"ref": sys.argv[1], "new": sys.argv[2]}}}
diff_short, diff_long, failed = format_diff(results, log_paths, None)
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/process_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def locationd_config_pubsub_callback(params, cfg, lr):
"gpsLocationExternal", "gpsLocation",
],
subs=["selfdriveState", "controlsState", "carControl", "onroadEvents"],
ignore=["logMonoTime", "controlsState.startMonoTime", "controlsState.cumLagMs"],
ignore=["logMonoTime", "controlsState.cumLagMs"],
config_callback=controlsd_config_callback,
init_callback=get_car_params_callback,
should_recv_callback=controlsd_rcv_callback,
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ca8cca8eeca938c3802109d6ea25cb719dcc649a
455a17a0b94354adf4cab219f0f8c4c93760d596

0 comments on commit 04eb73e

Please sign in to comment.