Skip to content

Commit

Permalink
Merge pull request #70 from epics-modules/issue69
Browse files Browse the repository at this point in the history
Added motorAcsControl support and example
  • Loading branch information
keenanlang authored Feb 12, 2024
2 parents 45d102e + a513190 commit 5503ab0
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 0 deletions.
8 changes: 8 additions & 0 deletions iocBoot/iocxxx/examples/AcsMotion.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use the following line if motorAcsMotion is built as a submodule of motor
iocshLoad("$(MOTOR)/iocsh/ACS_Motion_tcp.iocsh", "INSTANCE=ACS1,IP_ADDR=10.0.0.100,NUM_AXES=8,IDLE_POLL=0.2")

# Load motor records
dbLoadTemplate("substitutions/AcsMotion.substitutions","P=$(PREFIX)")

# Load an asyn record for debugging
dbLoadRecords("$(ASYN)/db/asynRecord.db","P=$(PREFIX),R=asyn,PORT=ACS1_ETH,ADDR=0,OMAX=256,IMAX=256")
8 changes: 8 additions & 0 deletions iocBoot/iocxxx/examples/AcsMotionAuxIO.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use the following line if motorAcsMotion is built as a submodule of motor
iocshLoad("$(MOTOR)/iocsh/ACS_Motion_AuxIO_tcp.iocsh", "INSTANCE=ACS1_IO,IP_ADDR=10.0.0.100,NUM_CHAN=32,POLL_PERIOD=0.1")

# Load auxilliary I/O
dbLoadTemplate("substitutions/AcsMotionAuxIO.substitutions","P=$(PREFIX)")

# Load an asyn record for debugging
dbLoadRecords("$(ASYN)/db/asynRecord.db","P=$(PREFIX),R=io:asyn,PORT=ACS1_IO_ETH,ADDR=0,OMAX=256,IMAX=256")
163 changes: 163 additions & 0 deletions iocBoot/iocxxx/substitutions/AcsMotion.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#
# Note: the P macro, which is passed to all of the databases in this file, has the value $(PREFIX) and is set in the envVars file
#
file "$(MOTOR)/db/asyn_motor.db"
{
pattern
{N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
{1, "m$(N)", "asynMotor", ACS1, 0, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
{2, "m$(N)", "asynMotor", ACS1, 1, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
{3, "m$(N)", "asynMotor", ACS1, 2, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
{4, "m$(N)", "asynMotor", ACS1, 3, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
{5, "m$(N)", "asynMotor", ACS1, 4, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
{6, "m$(N)", "asynMotor", ACS1, 5, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
{7, "m$(N)", "asynMotor", ACS1, 6, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
{8, "m$(N)", "asynMotor", ACS1, 7, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{9, "m$(N)", "asynMotor", ACS1, 8, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{10, "m$(N)", "asynMotor", ACS1, 9, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{11, "m$(N)", "asynMotor", ACS1, 10, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{12, "m$(N)", "asynMotor", ACS1, 11, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{13, "m$(N)", "asynMotor", ACS1, 12, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{14, "m$(N)", "asynMotor", ACS1, 13, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{15, "m$(N)", "asynMotor", ACS1, 14, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
#!{16, "m$(N)", "asynMotor", ACS1, 15, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0001, 4, 100, -100, ""}
}

file "$(MOTOR)/db/profileMoveController.template"
{
pattern
{R, PORT, NAXES, NPOINTS, NPULSES, TIMEOUT}
{pm1:, ACS1, 8, 2000, 2000, 2.0}
}

file "$(MOTOR)/db/profileMoveAxis.template"
{
pattern
{R, M, NPOINTS, NREADBACK, PORT, ADDR, TIMEOUT, PREC}
{pm1:, 1, 2000, 2000, ACS1, 0, 2.0, 4}
{pm1:, 2, 2000, 2000, ACS1, 1, 2.0, 4}
{pm1:, 3, 2000, 2000, ACS1, 2, 2.0, 4}
{pm1:, 4, 2000, 2000, ACS1, 3, 2.0, 4}
{pm1:, 5, 2000, 2000, ACS1, 4, 2.0, 4}
{pm1:, 6, 2000, 2000, ACS1, 5, 2.0, 4}
{pm1:, 7, 2000, 2000, ACS1, 6, 2.0, 4}
{pm1:, 8, 2000, 2000, ACS1, 7, 2.0, 4}
}

file "$(MOTOR)/db/SPiiPlusAxisExtra.db"
{
pattern
{M, PORT, ADDR}
{m1, ACS1, 0}
{m2, ACS1, 1}
{m3, ACS1, 2}
{m4, ACS1, 3}
{m5, ACS1, 4}
{m6, ACS1, 5}
{m7, ACS1, 6}
{m8, ACS1, 7}
}

file "$(MOTOR)/db/SPiiPlusHoming.db"
{
pattern
{M, PORT, ADDR, TIMEOUT, VAL, MAX_DIST, OFFSET_POS, OFFSET_NEG}
{m1, ACS1, 0, 2.0, 0, 0.0, 0.0, 0.0}
{m2, ACS1, 1, 2.0, 0, 0.0, 0.0, 0.0}
{m3, ACS1, 2, 2.0, 0, 0.0, 0.0, 0.0}
{m4, ACS1, 3, 2.0, 0, 0.0, 0.0, 0.0}
{m5, ACS1, 4, 2.0, 0, 0.0, 0.0, 0.0}
{m6, ACS1, 5, 2.0, 0, 0.0, 0.0, 0.0}
{m7, ACS1, 6, 2.0, 0, 0.0, 0.0, 0.0}
{m8, ACS1, 7, 2.0, 0, 0.0, 0.0, 0.0}
}

file "$(MOTOR)/db/SPiiPlusJogging.db"
{
pattern
{M}
{m1}
{m2}
{m3}
{m4}
{m5}
{m6}
{m7}
{m8}
}

# These records work, but the initial values are all zero. Maybe HOPR/LOPR/DRVH/DRVL need to be set?
file "$(MOTOR)/db/SPiiPlusMaxParams.db"
{
pattern
{M, PORT, ADDR, MAX_VELO, MAX_ACCL, PREC}
{m1, ACS1, 0, 5.0, 20.0, 4}
{m2, ACS1, 1, 200.0, 1000.0, 4}
{m3, ACS1, 2, 200.0, 1000.0, 4}
{m4, ACS1, 3, 200.0, 1000.0, 4}
{m5, ACS1, 4, 200.0, 1000.0, 4}
{m6, ACS1, 5, 200.0, 1000.0, 4}
{m7, ACS1, 6, 200.0, 1000.0, 4}
{m8, ACS1, 7, 200.0, 1000.0, 4}
}

file "$(MOTOR)/db/SPiiPlusMaxParamsRbv.db"
{
pattern
{M, PORT, ADDR, PREC}
{m1, ACS1, 0, 4}
{m2, ACS1, 1, 4}
{m3, ACS1, 2, 4}
{m4, ACS1, 3, 4}
{m5, ACS1, 4, 4}
{m6, ACS1, 5, 4}
{m7, ACS1, 6, 4}
{m8, ACS1, 7, 4}
}

### The feedback database is helpful for troubleshooting encoder problems
#file "$(MOTOR)/db/SPiiPlusFeedback.db"
#{
#pattern
#{M, PORT, ADDR, PREC, SCAN}
#{m1, ACS1, 0, 6, 2}
#{m2, ACS1, 1, 6, 2}
#{m3, ACS1, 2, 6, 2}
#{m4, ACS1, 3, 6, 2}
#{m5, ACS1, 4, 6, 2}
#{m6, ACS1, 5, 6, 2}
#{m7, ACS1, 6, 6, 2}
#{m8, ACS1, 7, 6, 2}
#}

### The following databases are useful if programs are running on the ACS controller
## PINI can be set to YES for IOCs that use autosave so that global var output records initialize properly
#file "$(MOTOR)/db/SPiiPlusIntVar.db"
#{
#pattern
#{R, DESC, PORT, TAG}
#{c0:1001I, "Int 1", ACS1, 1001}
#}
#
## PINI can be set to YES for IOCs that use autosave so that global var output records initialize properly
#file "$(MOTOR)/db/SPiiPlusRealVar.db"
#{
#pattern
#{R, DESC, PORT, TAG, PREC}
#{c0:1002R, "Real 1", ACS1, 1002, 5}
#}
#
#file "$(MOTOR)/db/SPiiPlusProgram.db"
#{
#pattern
#{R, PORT, BUFF, NAME}
#{c0:, ACS1, 0, Test}
#}

### This is only used for during development and will be removed in the near future
#file "$(MOTOR)/db/SPiiPlusTest.db"
#{
#pattern
#{R, PORT}
#{pm1:, ACS1}
#}
115 changes: 115 additions & 0 deletions iocBoot/iocxxx/substitutions/AcsMotionAuxIO.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#
# Note: the P macro, which is passed to all of the databases in this file, has the value $(PREFIX) and is set in the envVars file
#

file "$(MOTOR)/db/SPiiPlusAuxLi.db"
{
pattern
{C, R, PORT, CHAN, SCAN}
# MP4U
{mp4u:, li0, ACS1_IO, 0, 2}
{mp4u:, li1, ACS1_IO, 1, 2}
{mp4u:, li2, ACS1_IO, 2, 2}
{mp4u:, li3, ACS1_IO, 3, 2}
}

file "$(MOTOR)/db/SPiiPlusAuxLo.db"
{
pattern
{C, R, PORT, CHAN, SCAN}
# MP4U
{mp4u:, lo0, ACS1_IO, 0, 2}
{mp4u:, lo1, ACS1_IO, 1, 2}
{mp4u:, lo2, ACS1_IO, 2, 2}
{mp4u:, lo3, ACS1_IO, 3, 2}
}

file "$(MOTOR)/db/SPiiPlusAuxBi.db"
{
pattern
{C, R, PORT, CHAN, MASK, SCAN}
# MP4U
{mp4u:, bi0:17, ACS1_IO, 0, 0x10000, 2}
{mp4u:, bi0:18, ACS1_IO, 0, 0x20000, 2}
{mp4u:, bi0:19, ACS1_IO, 0, 0x40000, 2}
{mp4u:, bi0:20, ACS1_IO, 0, 0x80000, 2}
{mp4u:, bi1:17, ACS1_IO, 1, 0x10000, 2}
{mp4u:, bi1:18, ACS1_IO, 1, 0x20000, 2}
{mp4u:, bi1:19, ACS1_IO, 1, 0x40000, 2}
{mp4u:, bi1:20, ACS1_IO, 1, 0x80000, 2}
{mp4u:, bi2:17, ACS1_IO, 2, 0x10000, 2}
{mp4u:, bi2:18, ACS1_IO, 2, 0x20000, 2}
{mp4u:, bi2:19, ACS1_IO, 2, 0x40000, 2}
{mp4u:, bi2:20, ACS1_IO, 2, 0x80000, 2}
{mp4u:, bi3:17, ACS1_IO, 3, 0x10000, 2}
{mp4u:, bi3:18, ACS1_IO, 3, 0x20000, 2}
{mp4u:, bi3:19, ACS1_IO, 3, 0x40000, 2}
{mp4u:, bi3:20, ACS1_IO, 3, 0x80000, 2}
}

file "$(MOTOR)/db/SPiiPlusAuxBo.db"
{
pattern
{C, R, PORT, CHAN, MASK, SCAN}
# MP4U
{mp4u:, bo0:8, ACS1_IO, 0, 0x100, 2}
{mp4u:, bo0:9, ACS1_IO, 0, 0x200, 2}
{mp4u:, bo1:8, ACS1_IO, 1, 0x100, 2}
{mp4u:, bo1:9, ACS1_IO, 1, 0x200, 2}
{mp4u:, bo2:8, ACS1_IO, 2, 0x100, 2}
{mp4u:, bo2:9, ACS1_IO, 2, 0x200, 2}
{mp4u:, bo3:8, ACS1_IO, 3, 0x100, 2}
{mp4u:, bo3:9, ACS1_IO, 3, 0x200, 2}
}

file "$(MOTOR)/db/SPiiPlusAuxAo.db"
{
pattern
{C, R, PORT, CHAN, SCAN, DRVL, DRVH, LOPR, HOPR, PREC}
# MP4U
{mp4u:, ao0, ACS1_IO, 0, 2, -10, 10, -10, 10, 3}
{mp4u:, ao1, ACS1_IO, 1, 2, -10, 10, -10, 10, 3}
{mp4u:, ao2, ACS1_IO, 2, 2, -10, 10, -10, 10, 3}
{mp4u:, ao3, ACS1_IO, 3, 2, -10, 10, -10, 10, 3}
{mp4u:, ao4, ACS1_IO, 4, 2, -10, 10, -10, 10, 3}
{mp4u:, ao5, ACS1_IO, 5, 2, -10, 10, -10, 10, 3}
{mp4u:, ao6, ACS1_IO, 6, 2, -10, 10, -10, 10, 3}
{mp4u:, ao7, ACS1_IO, 7, 2, -10, 10, -10, 10, 3}
{mp4u:, ao8, ACS1_IO, 8, 2, -10, 10, -10, 10, 3}
{mp4u:, ao9, ACS1_IO, 9, 2, -10, 10, -10, 10, 3}
{mp4u:, ao10, ACS1_IO, 10, 2, -10, 10, -10, 10, 3}
{mp4u:, ao11, ACS1_IO, 11, 2, -10, 10, -10, 10, 3}
{mp4u:, ao12, ACS1_IO, 12, 2, -10, 10, -10, 10, 3}
{mp4u:, ao13, ACS1_IO, 13, 2, -10, 10, -10, 10, 3}
{mp4u:, ao14, ACS1_IO, 14, 2, -10, 10, -10, 10, 3}
{mp4u:, ao15, ACS1_IO, 15, 2, -10, 10, -10, 10, 3}
# IOMps-EA0004V0
{mp4u:, ao16, ACS1_IO, 16, 2, -10, 10, -10, 10, 3}
{mp4u:, ao17, ACS1_IO, 17, 2, -10, 10, -10, 10, 3}
{mp4u:, ao18, ACS1_IO, 18, 2, -10, 10, -10, 10, 3}
{mp4u:, ao19, ACS1_IO, 19, 2, -10, 10, -10, 10, 3}
}

file "$(MOTOR)/db/SPiiPlusAuxAi.db"
{
pattern
{C, R, PORT, CHAN, SCAN, LOPR, HOPR, PREC}
# MP4U
{mp4u:, ai0, ACS1_IO, 0, 2, -10, 10, 3}
{mp4u:, ai1, ACS1_IO, 1, 2, -10, 10, 3}
{mp4u:, ai2, ACS1_IO, 2, 2, -10, 10, 3}
{mp4u:, ai3, ACS1_IO, 3, 2, -10, 10, 3}
{mp4u:, ai4, ACS1_IO, 4, 2, -10, 10, 3}
{mp4u:, ai5, ACS1_IO, 5, 2, -10, 10, 3}
{mp4u:, ai6, ACS1_IO, 6, 2, -10, 10, 3}
{mp4u:, ai7, ACS1_IO, 7, 2, -10, 10, 3}
{mp4u:, ai8, ACS1_IO, 8, 2, -10, 10, 3}
{mp4u:, ai9, ACS1_IO, 9, 2, -10, 10, 3}
{mp4u:, ai10, ACS1_IO, 10, 2, -10, 10, 3}
{mp4u:, ai11, ACS1_IO, 11, 2, -10, 10, 3}
{mp4u:, ai12, ACS1_IO, 12, 2, -10, 10, 3}
{mp4u:, ai13, ACS1_IO, 13, 2, -10, 10, 3}
{mp4u:, ai14, ACS1_IO, 14, 2, -10, 10, 3}
{mp4u:, ai15, ACS1_IO, 15, 2, -10, 10, 3}
}

4 changes: 4 additions & 0 deletions xxxApp/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ endif
endif
endif

ifdef MOTOR
$(DBD_NAME)_DBD += AcsMotionSupport.dbd
$(PROD_NAME)_LIBS := AcsMotion $($(PROD_NAME)_LIBS)
endif

ifeq ($(TIRPC), YES)
$(PROD_NAME)_SYS_LIBS += tirpc
Expand Down

0 comments on commit 5503ab0

Please sign in to comment.