Conversation
This PR fixes https://epics.anl.gov/tech-talk/2026/msg00212.php by writing the motor velocity into status_.velocity, where it is later read from when the motorRecord fields are populated.
|
While the fix looks correct as such, it may be useful to separate the actual velocity |
|
@tboegi, the data structure only has one velocity element, which is clearly intended for the readback velocity: motor/motorApp/MotorSrc/asynMotorController.h Lines 105 to 110 in 0cb7d76 This PR looks good to me. |
|
@kmpeters : Isnt pC_->motorVelocity_ the setpoint for the move ? When we mix setpoint with readback, the following can happen:
If the driver/poller writes 0.0 to motorVelocity_ between 1) and 2) we have a problem: |
|
@tboegi I understand your concern. However, motorPosition_ and motorEncoderPosition_ are treated identically to how motorVelocity_ is treated in this PR. They are used to SET the position and encoder position here: and here: But they are also used to read back the actual positions, for example here: How is motorVelocity_ different from this? I agree that it would be cleaner to have separate parameters for the "set" values and the "readback" values. But to do that for motorPosition_ and motorEncoderPosition_ I believe would break backwards compatibility for all model 3 drivers. |
|
@tboegi's comment is absolutely valid and I did think about introducing a motorSetVelocity_ entry - but did refrain from that due to the backwards compatibility issues @MarkRivers mentioned. In my tests, I had no issues because I only write to motorVelocity_ when the motor is already moving, therefore avoiding the race condition. To mitigate this issue, maybe we could document somewhere that the field should only be written to when the motor is moving (e.g. in the header of asynMotorController.h next to the index declaration)? In general, it would probably be helpful to document for asynMotor which paramLib entry interacts with which field(s). For example, what is the difference between motorResolution_ and motorRecResolution_ and which one is MRES? |
|
I think that motorSetVelocity_ would be the same as motorVelocity_ : it is the setpoint. |
|
@kmpeters @MarkRivers @StefanMathis |
This PR fixes https://epics.anl.gov/tech-talk/2026/msg00212.php by writing the motor velocity into status_.velocity, where it is later read from when the motorRecord fields are populated.