Commit Graph

49 Commits

Author SHA1 Message Date
Torsten Bögershausen 2906f3d8f9 Add field RSTM: Restore Mode
Partly revert the following commit:
  commit 3090983c31
  Author: Ron Sluiter <rsluiter@users.noreply.github.com>
  Date:   Wed Jul 29 15:50:23 2015 +0000
      Bug fix for target position (VAL/DVAL/RVAL) initialization error
      when the motor record is configured to do retries.
And from the release notes:

6) Kevin Peterson discovered an initialization bug when the motor record is
    configured to do retries. When configured to do retries, the motor
    record issues incremental rather than absolute moves. If the motor
    behaves badly (e.g., a piezo stiction motor) the controller's absolute
    step count can be far from its' absolute readback position. The motor
    record initialization logic that determines how the target positions
    are initialized at boot-up was not taking into consideration whether
    or not the motor record is configured to do retries, and therefore,
    whether or not absolute or incremental moves were issued by the motor
    record. With this release, if the motor record is configured to do
    retries, then the controller's absolute position is ignored (because
    the controller's absolute position was "corrupted" by retries) and the
    autosave/restore position is used to set the controllers position.

    Switching between retries on and off (relative vs. absolute moves)
    between reboots will cause unpredictable results and is not covered
    by this bug fix.

   Files modified: motor_init_record_com() in MotorSrc/motordevCom.cc
                   init_controller()       in MotorSrc/devMotorAsyn.c

Commit 3090983c improves the situation for setups where autosave is
used, and makes things worse when autosave is not used.
When autosave is not used and the motor is configured to do retries,
the the DVAL field is loaded into the controller regardless.
And because DVAL is 0.0 at startup, the controller position is lost.

The first issue report is found here:
"Problem with R6-10 issue 6 fix - controller position can be lost on reboot"
https://github.com/epics-modules/motor/issues/85

And the we have another issue report here:
"IOC zeroes encoder on startup"
https://github.com/motorapp/Galil-3-0/issues/13

A possible way forward is discussed here:
"Add a field to the motor record to allow always restoring the
 autosaved position"
https://github.com/epics-modules/motor/issues/151

This commit adds the "RSTM" field:
- 0 Disables restoring the autosaved position
- 1 Always restores the autosaved position
- 2 Uses the same logic as motorRecord 6.9 (or older)
- 3 Uses the same logic as motorRecord 6.10

This numbering maps 0 and 1 somewhat to false/true, uses 2/3 for
special handlings and leaves room for more choices.

E.g. "use the encoder value, if valid, fall back to autosave if not.
Or "use the URIP/RDBL" if possible.
I am getting off-topic,
those improvements should be done in later commits anyway.
2020-06-10 07:55:22 +02:00
Torsten Bögershausen 5198a2d552 Clean up the EPICS_VERSION/rec sup, use motor_epics_inc.h
Refactor the changes for the deprecated RECSUP in later EPICS base
version, which need a typedef for struct rset.
Unite all common code and put it into a single include file.
Add motor_epics_inc.h.
2018-09-19 07:48:00 +02:00
Torsten Bögershausen 71e417b4db define VERSION_INT when using older EPICS bases
Newer EPICS base versions define VERSION_INT, but older don't.
Add a conditional #define to compile against those older bases, like 3.14
2018-09-18 18:04:05 +02:00
Torsten Bögershausen eb3566976d More adaptions to base-3.16/7.0 with typed rset
Remove more compiler warnings when compiling against the base 7.0 branch.
Note:
Some of the model1/2 drivers still give a warning. As I can not test the
code, leave those files untouched.
2018-09-18 16:30:25 +02:00
Torsten Bögershausen 532afdc5a0 Remove all lines with svn keywords
They have no meaning in Git, are not updated and may cause unwanted diffs when
otherwise nothing is changed in a file
2015-11-23 08:23:12 +01:00
Ron Sluiter 3090983c31 Bug fix for target position (VAL/DVAL/RVAL) initialization error when the motor record is configured to do retries. 2015-07-29 15:50:23 +00:00
Ron Sluiter 95819d8a2a RMP and REP were being posted with same value. Moved CA posting of changes to the RMP, REP and RVEL fields from motor record to update_values(). 2014-09-11 15:28:26 +00:00
mp49 ea2616382d devMotorAsyn: always do SET_ENC_RATIO at the beginning of the init_controller function. This fixes an issue that was causing set position to fail in some cases. 2014-08-05 15:58:40 +00:00
MarkRivers a73fe0a869 Removed tabs; improved asynPrint debugging output 2014-05-06 18:31:56 +00:00
Ron Sluiter 807d8c1d98 Support for motor record raw actual velocity (RVEL). 2013-01-02 22:51:49 +00:00
kmpeters 964b585840 Modified devMotorAsyn.c so that moveRequestPending is incremented when jogging. 2012-12-21 19:30:11 +00:00
MarkRivers 4a753987b7 Improve debugging output by printing pasynUser->reason as well 2012-10-09 14:32:23 +00:00
MarkRivers eee1820445 Changed spelling of motorXGain and motorClosedLoop parameters 2012-03-01 19:30:18 +00:00
mp49 a498fd318e motor: added logic to init_record in Asyn device support to support setting the encoder ratio. 2011-05-20 16:23:05 +00:00
MarkRivers 803e2c89b7 Broke asynMotorDriver into asynMotorController and asynMotorAxis 2011-04-01 20:02:18 +00:00
MarkRivers b4dea6782e Changed a few variable names to avoid abbreviations 2011-03-28 18:25:08 +00:00
MarkRivers df194902ce Changed from asynMotorStatus interface to standard asynGenericPointer interface; use header file to define strings; use drvUser interface rather than hardcoded enum values for pasynUser->reason 2009-12-16 07:10:18 +00:00
MarkRivers 369935dccb Added errlog.h 2009-09-01 14:05:38 +00:00
Ron Sluiter 79ad5810f6 MRP's fix for motor simulator stuck in Moving state after multiple LOAD_POS
commands to the same position; set needUpdate = 1 in asynCallback() before
dbProcess.
2009-05-01 17:55:28 +00:00
Ron Sluiter 10dd6744ff Clear moveRequestPending. 2009-04-24 17:22:38 +00:00
Ron Sluiter 2bd8b43dc3 Can't call dbProcess before dbScanLockOK. 2009-04-24 17:20:45 +00:00
Ron Sluiter d8473b91c6 - Prevent moveRequestPending being left nonzero after LOAD_POS command.
- Minor compiler warnings eliminated.
2009-04-15 18:36:18 +00:00
Ron Sluiter a2843f4b45 Adds the SET_POSITION case to the moveRequestPending logic. 2009-02-09 19:51:34 +00:00
mp49 16198f3684 Called dbProcess instead of pmr->rset->process to aid debugging. 2008-12-01 12:18:35 +00:00
mp49 f8afb15c7d In the status updates, removed the check for not needUpdate before processing the record. This fixes the odd state that motors sometimes get into at startup after having the values written down to the controller, where they do not update their positions, even if the underlying axis moves, unless they are processed first. 2008-11-14 15:18:38 +00:00
Ron Sluiter 781dc22517 Minor compiler error. 2008-06-04 21:56:30 +00:00
Peter Denison bcce2174d8 Change initialisation order so that autosave is actually dependent on the
values read back from the controller for asyn motors.
2008-05-19 15:56:01 +00:00
Ron Sluiter 2e27086c90 asyn motor GET_INFO support update. 2008-04-02 19:48:23 +00:00
Peter Denison 98f2ba3854 Improve error reporting e.g. with bad axis number 2007-09-20 10:34:47 +00:00
Peter Denison dd8934bbda Correct initialisation order in devMotorAsyn.c to make sure autosaved values
get picked up as the initial motor position, val, dval, rbv, etc
Fix initialisation of motors on Linux with autosave (was trying to lock a
   previously-destroyed mutex)
2007-09-18 12:41:59 +00:00
MarkRivers 25d699eb73 Removed status argument from interrupt callbacks 2007-04-23 20:32:04 +00:00
MarkRivers 99438abc45 Added status argument in callbacks; deleted unused resolution variable 2007-04-17 21:05:42 +00:00
MarkRivers 4a1236f6c9 Added asynPrint for debugging 2007-02-13 22:02:18 +00:00
Peter Denison b40820e90b Enabled autosave on asynMotor to restore DVAL after power cycle by writing new
init_controller routine and calling LOAD_POS
2007-02-03 12:07:17 +00:00
Peter Denison 30fc158af1 Added encoder position to status TRACEIO asynPrint call 2007-02-02 13:50:46 +00:00
Peter Denison c54e52644b Oops - copy structures explicitly instead of relying on gcc extension
Changed round function to floor(x+0.5) since we seem to be picking up the wrong definition of round()
2006-09-06 12:27:47 +00:00
Peter Denison ede6b73b0e Fix 'not ready' error by removing needUpdate=1 on MotorStatus
use MotorStatus interface for all status calls
add start position to motor simulator
2006-08-10 08:12:47 +00:00
Peter Denison 2965527681 Implement locking to prevent race condition where periodic status can
arrive before a sent move command has reached the controller
2006-07-20 17:10:37 +00:00
Peter Denison 785307839c Added new asyn interface for atomic status callbacks, and converted
devMotorAsyn.c and drvMotorAsyn.c to use it
Added STATUS_* reason codes to get at individual bits of status
Fix SET_{LOW,HIGH}_LIMIT command when MRES negative
2006-07-01 20:08:56 +00:00
Peter Denison ad11d7ec6f Interface changes:
Removed motorAxisPrimitive, motorAxisSetLogParam
    motorAxisSetLog now takes a logParam parameter
    drvMotorAsynConfigure takes an extra can_block parameter
    Simulator create function only takes int parameters to avoid problems
        passing double parameters from the vxWorks shell on PowerPC arch
Functional changes:
    Order of drvMotorAsyn interrupt callbacks has been changed to pass back
        Float64 interrupts (typically position, etc.) before Int32 interrupts
        (typically status), so that a move reaches its desired position before
        it is signalled as complete. This is not a complete solution.
    More parameter checking, particularly of axis number
2006-06-06 08:50:14 +00:00
MarkRivers fd67e23c38 Print statusCallback in hex, not decimal 2006-04-29 19:01:15 +00:00
MarkRivers 68cf987621 Fixed problem with callbacks occuring before interruptAccept=1; don't send resolution to driver any more 2006-04-19 22:09:17 +00:00
Peter Denison ea31f13f13 Get initial values from the motor controller to avoid move to zero at startup 2006-04-19 12:56:35 +00:00
MarkRivers 071f932661 Moved debugging in buildTrans; send resolution in init_record 2006-04-08 20:10:26 +00:00
MarkRivers 16ebe6291f Fixes from Peter Denison for jog 2006-04-08 00:22:06 +00:00
MarkRivers 8fae7bebb0 Fix from Peter Denison for jog 2006-04-06 19:39:09 +00:00
MarkRivers 690096a7a4 Fix from Peter for home command 2006-04-06 19:25:33 +00:00
MarkRivers 87131fc463 Changed int32_t and uint32_t to epicInt32 and epicsUInt32 2006-03-23 00:24:20 +00:00
MarkRivers 9793a5d4e8 New files for asyn interface 2006-03-21 22:41:54 +00:00