Open jamcar23 opened 3 years ago
After speaking with some other members of the community I've decided that captn proto serialization is probably the easiest problem as there are multiple solutions. The easiest being to convert the code for the value / param into a string, serialize it into a hashmap, and then use runtime code generation to convert it back into python on the other side. There are other options like having opparamsd write the evaluated value into param text file (kinda like how Params works already) but either way, it's relatively easy to solve.
The bigger challenges are going to be 2 & 3 above, specifically: how will params be grouped together and how will opparams know how to evaluate them?
For challenge 2 I think some combination of 2.2 & 2.3 will work best, starting with 2.3 (param group class). Specifically:
- Perhaps Params could use a lambda / function to handle evaluation on a per param basis?
- Maybe there should be specific param class for the different types of param groups?
- e.g. a MultiBpParam which handles evaluating the params
- if we do this the param group class should be able to declare all need params to make the feature work (e.g. breakpoints will always need BP and V params.)
For challenge 3, 3.2 is still the best / only option I've thought of. I'm not sure if this will be the best approach, it would be a good idea to revisit this after solving challenge 2.
- Perhaps there is a fallback prop for the param group with a string in the format of [message].[field] which then gets converted to the submaster equivalent string and then uses the same runtime code generation as opEdit to turn it into python?
- e.g. carParams.steerActuatorDelay string becomes sm["carParams"].steerActuatorDelay string where sm is an existing SubMaster instance inside of opparamsd once the code is generated
Roadmap challenge 2:
The purpose of this issue is to outline the ideas, goals, and challenges of rewriting opparams to be its own dedicated process.
Goals
CP.steerActuatorDelay
withop_params.eval(STEER_ACTUATOR_DELAY)
(generalized to any prop from any message / state) in any location with no other code changes (import statement for OpParams will still be needed of course)opparamsd
) should read / write the param file(s)Challenges
opparamsd
handle validation and communicate with OpEdit in a request/response pattern?STEER_ACUATOR_DELAY
it needs to look atENABLE_LAT_PARAMS
,ENABLE_STEER_ACTUATOR_DELAY
,ENABLE_ACTUATOR_DELAY_BPS_MULTI
,STEER_ACTUATOR_DELAY_BP_MULTI
,STEER_ACTUATOR_DELAY_V_MULTI
,STEER_DELAY_MULTI_BP_SOURCE
,ENABLE_ACTUATOR_DELAY_BPS
,STEER_ACTUATOR_DELAY_BP
,STEER_ACTUATOR_DELAY_V
, andSTEER_ACTUATOR_DELAY
; how will opparams know all this?BP
andV
params.)CP.steerActuatorDelay
ifENABLE_STEER_ACTUATOR_DELAY
is false?[message].[field]
which then gets converted to the submaster equivalent string and then uses the same runtime code generation as opEdit to turn it into python?carParams.steerActuatorDelay
string becomessm["carParams"].steerActuatorDelay
string wheresm
is an existingSubMaster
instance inside ofopparamsd
once the code is generatedopparamsd
(and whatever it depends on)Implementation Ideas
opparamsd
when OpEdit request some param changeopparamsd
opparamsd
to listen for when the user is changing param valuesopparamsd
which then validates the change request and then sends a response back to OpEditopparamsd
without any of the read / write functionality (or the ability to update the params used by other processes)opparamsd