Skip to content
Snippets Groups Projects
Commit ecbddb89 authored by kpetersn's avatar kpetersn
Browse files

Made multiple changes to 5-Add-virtual-motors.md:

* added more solutions
* enabled syntax highlighting in solutions
* added links
* added missing 'cd' in 5.7.2
parent fc97cf10
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ Use the same variable that was set in motorVMC's RELEASE.local file
```
$ cd ${IOC_DIR}/xxx
$ nano configure/RELEASE
$ gedit configure/RELEASE &
```
<details>
......@@ -20,14 +20,23 @@ MOTOR_VMC=/home/beams/USERNAME/PET-S2/epics/synApps/support/motorVMC
```
</details>
```
$ git diff RELEASE.local
```
<details>
<summary>solution</summary>
```
TODO
```diff
diff --git a/configure/RELEASE b/configure/RELEASE
index e7aba0e..39736e4 100644
--- a/configure/RELEASE
+++ b/configure/RELEASE
@@ -35,6 +35,8 @@ SUPPORT=/APSshare/epics/synApps_6_2_1/support
#TDS3000 = $(SUPPORT)/../nonSynAppsSupport/tds3000-2.4
#FLY = $(SUPPORT)/../nonSynAppsSupport/fly-0-0
+MOTOR_VMC=~/PET-S2/epics/synApps_6_2_1/support/motorVMC
+
# For a local, custom configuration; copy $(SUPPORT)/configure/RELEASE
# to this directory as the file MASTER_RELEASE, edit the file, comment out
# the above include, and uncomment the following line.
```
</details>
......@@ -36,7 +45,7 @@ TODO
Add the motorVMC database and library to **xxxApp/src/Makefile**
```
$ nano xxxApp/src/Makefile
$ gedit xxxApp/src/Makefile &
```
<details>
......@@ -69,7 +78,7 @@ endif
<details>
<summary>solution</summary>
```
```diff
$ git diff xxxApp/src/Makefile
diff --git a/xxxApp/src/Makefile b/xxxApp/src/Makefile
index 9692f5a..14855f8 100644
......@@ -98,7 +107,7 @@ $ make
<details>
<summary>output</summary>
```
```make
make -C ./configure install
make[1]: Entering directory '/home/beams/USERNAME/PET-S2/epics/synApps_6_2_1/ioc/xxx/configure'
perl -CSD /APSshare/epics/base-7.0.4.1/bin/rhel8-x86_64/makeMakefile.pl O.rhel8-x86_64 ../..
......@@ -124,7 +133,7 @@ make: *** [/APSshare/epics/base-7.0.4.1/configure/RULES_DIRS:85: configure.insta
### 5.4 Resolve the build error
This is the same build error as 4.5, so the solution is very similar.
This is the same build error as in [step 4.5](4-Deploy-motorVMC.md#45-build-motorvmc-attempt-2), so the solution is very similar.
<details>
<summary>solution</summary>
......@@ -132,15 +141,19 @@ This is the same build error as 4.5, so the solution is very similar.
```
$ echo "CHECK_RELEASE = NO" >> configure/CONFIG_SITE.local
```
Note: The **>>** is needed here because the file already exists. **>** was used in [step 4.6](4-Deploy-motorVMC.md#46-resolve-build-error-2) because the file needed to be created.
</details>
Note: The **>>** is needed here because the file already exists. **>** was used in step 4.6 because the file needed to be created.
### 5.5 Rebuild the IOC
```
$ make
```
<details>
<summary>output</summary>
TODO
</details>
### 5.6 Confirm the libvmc is included in the IOC's binary
......@@ -164,7 +177,12 @@ $ cp -p ${SUPPORT_DIR}/motorVMC/iocs/vmcIOC/iocBoot/iocvmc/vmc.cmd ${IOC_DIR}/xx
$ cp -p ${SUPPORT_DIR}/motorVMC/iocs/vmcIOC/iocBoot/iocvmc/vmc.substitutions ${IOC_DIR}/xxx/iocBoot/iocxxx/substitutions/
```
#### 5.7.2 Modify vmc.cmd
#### 5.7.2 Modify iocsh/vmc.cmd
```
$ cd ${IOC_DIR}/xxx/iocBoot/iocxxx
$ gedit iocsh/vmc.cmd &
```
Make the following changes:
......@@ -179,20 +197,67 @@ Make the following changes:
<details>
<summary>solution</summary>
```
TODO
```diff
diff --git a/iocBoot/iocxxx/iocsh/vmc.cmd b/iocBoot/iocxxx/iocsh/vmc.cmd
index 229b985..3754207 100644
--- a/iocBoot/iocxxx/iocsh/vmc.cmd
+++ b/iocBoot/iocxxx/iocsh/vmc.cmd
@@ -1,6 +1,6 @@
### Virtual Motor Controller support
-epicsEnvSet("VMC_PORT", "31337")
+epicsEnvSet("VMC_PORT", "33333")
drvAsynIPPortConfigure("VMC_ETH","127.0.0.1:$(VMC_PORT)", 0, 0, 0)
@@ -16,11 +16,11 @@ asynOctetSetInputEos("VMC_ETH",0,"\r\n")
asynOctetSetOutputEos("VMC_ETH",0,"\r")
# These motor records can get their prefix from the environment variable
-dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m1,DTYP=asynMotor,PORT=VMC1,ADDR=0,DESC=X,EGU=mm,DIR=Pos,VELO=1,VBAS=.1,ACCL=.2,BDST=0,BVEL=1,BACC=.2,MRES=.0025,PREC=4,DHLM=100,DLLM=-100,INIT=")
-dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m2,DTYP=asynMotor,PORT=VMC1,ADDR=1,DESC=Y,EGU=mm,DIR=Pos,VELO=1,VBAS=.1,ACCL=.2,BDST=0,BVEL=1,BACC=.2,MRES=.0025,PREC=4,DHLM=100,DLLM=-100,INIT=")
-dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m3,DTYP=asynMotor,PORT=VMC1,ADDR=2,DESC=Z,EGU=mm,DIR=Pos,VELO=1,VBAS=.1,ACCL=.2,BDST=0,BVEL=1,BACC=.2,MRES=.0025,PREC=4,DHLM=100,DLLM=-100,INIT=")
+#!dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m1,DTYP=asynMotor,PORT=VMC1,ADDR=0,DESC=X,EGU=mm,DIR=Pos,VELO=1,VBAS=.1,ACCL=.2,BDST=0,BVEL=1,BACC=.2,MRES=.0025,PREC=4,DHLM=100,DLLM=-100,INIT=")
+#!dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m2,DTYP=asynMotor,PORT=VMC1,ADDR=1,DESC=Y,EGU=mm,DIR=Pos,VELO=1,VBAS=.1,ACCL=.2,BDST=0,BVEL=1,BACC=.2,MRES=.0025,PREC=4,DHLM=100,DLLM=-100,INIT=")
+#!dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m3,DTYP=asynMotor,PORT=VMC1,ADDR=2,DESC=Z,EGU=mm,DIR=Pos,VELO=1,VBAS=.1,ACCL=.2,BDST=0,BVEL=1,BACC=.2,MRES=.0025,PREC=4,DHLM=100,DLLM=-100,INIT=")
# The dbLoadTemplate approach is a cleaner way to load multiple database instances
-#!dbLoadTemplate("vmc.substitutions", "P=$(PREFIX)")
+dbLoadTemplate("substitutions/vmc.substitutions", "P=$(PREFIX)")
# VirtualMotorController(
# portName The name of the asyn port that will be created for this driver
@@ -30,12 +30,12 @@ dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m3,DTYP=asynMotor,PORT=
# idlePollPeriod The time between polls when no axis is moving
# 1-second idle polling
-VirtualMotorCreateController("VMC1", "VMC_ETH", 3, 250, 1000)
+#!VirtualMotorCreateController("VMC1", "VMC_ETH", 3, 250, 1000)
# 10-second idle polling
#!VirtualMotorCreateController("VMC1", "VMC_ETH", 3, 250, 10000)
# No idle polling
#!VirtualMotorCreateController("VMC1", "VMC_ETH", 3, 250, 0)
# Extra axes, 10-second idle polling
-#!VirtualMotorCreateController("VMC1", "VMC_ETH", 8, 250, 10000)
+VirtualMotorCreateController("VMC1", "VMC_ETH", 8, 250, 10000)
-dbLoadRecords("$(ASYN)/db/asynRecord.db","P=$(PREFIX),R=asyn1,PORT=VMC_ETH,ADDR=0,OMAX=0,IMAX=0")
+dbLoadRecords("$(ASYN)/db/asynRecord.db","P=$(PREFIX),R=asyn_1,PORT=VMC_ETH,ADDR=0,OMAX=0,IMAX=0")
```
</details>
#### 5.7.3 Modify st.cmd.Linux
```
$ gedit st.cmd.Linux
```
Make the following change:
* Added a line that sources iocsh/vmc.cmd **after** common.iocsh and **before** iocInit
* Add a line that sources iocsh/vmc.cmd **after** common.iocsh and **before** iocInit
<details>
<summary>solution</summary>
```
```diff
$ git diff iocBoot/iocxxx/st.cmd.Linux
diff --git a/iocBoot/iocxxx/st.cmd.Linux b/iocBoot/iocxxx/st.cmd.Linux
index 588dda7..b8f6949 100644
......@@ -220,8 +285,8 @@ $ ./softioc/xxx.sh run
Scroll back until you see the error connecting to the virtual motor controller:
```
drvAsynIPPortConfigure("VMC_ETH","127.0.0.1:31337", 0, 0, 0)
2023/01/12 14:38:30.980 VMC_ETH -1 autoConnect could not connect: Can't connect to 127.0.0.1:31337: Connection refused
drvAsynIPPortConfigure("VMC_ETH","127.0.0.1:33333", 0, 0, 0)
2023/01/12 14:38:30.980 VMC_ETH -1 autoConnect could not connect: Can't connect to 127.0.0.1:33333: Connection refused
```
Ctrl+c to kill the IOC.
......@@ -249,13 +314,13 @@ Options:
#### 5.9.2 Start servery.py in a different terminal window
```
$ xterm -e "${SUPPORT_DIR}/motorVMC/python/server.py -p 30000" &
$ xterm -e "${SUPPORT_DIR}/motorVMC/python/server.py -p 33333" &
```
<details>
<summary>output</summary>
```
Listening on port 30000
Listening on port 33333
```
</details>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment