Skip to content

Commit

Permalink
updates for autogenerated aravis db/pvi
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jul 2, 2024
1 parent c5733e9 commit 72291db
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
// we also mount the project folder into a know location in the container
// this is where the ibek-support and ioc folders reside in the container build
// in this way the devcontainer and runtime look very similar
"source=${localWorkspaceFolder},target=/epics/generic-source,type=bind"
"source=${localWorkspaceFolder},target=/epics/generic-source,type=bind",
// mounting this helps with running phoebus outside the container
"source=${localWorkspaceFolder}/.generated-bobs,target=/epics/opi,type=bind"
]
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ ioc/config
# this gets updated during RTEMS builds in devcontainer but we dont want to commit it
# TODO this entry does not work - why on earth not?
ioc/configure/CONFIG_SITE.Common.linux-x86_64

# external generated bob folder TODO probalby will replace this with compose
.generated-bobs
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ COPY --from=runtime_prep /assets /
# install runtime system dependencies, collected from install.sh scripts
RUN ibek support apt-install-runtime-packages --skip-non-native

RUN chmod a+rw /epics/pvi-defs
# allow generated genicam files to be written for non root runtime user id
RUN chmod a+rw /epics/pvi-defs /epics/support/ADGenICam/db

CMD ["bash", "-c", "${IOC}/start.sh"]

Expand Down
23 changes: 16 additions & 7 deletions ioc/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,22 @@ elif [ -f ${ibek_src} ]; then
db_src=${RUNTIME_DIR}/ioc.subst
final_ioc_startup=${RUNTIME_DIR}/st.cmd

# Auto generate GenICam database
instance_id=$(grep -oP "(?<=ID:\s).*" ${ibek_src}) || true # https://regex101.com/r/358gq3/1
if [ -n "$instance_id" ]; then
mkdir -p /tmp/genicam
arv-tool-0.8 -a ${instance_id} genicam > /tmp/genicam/genicam.xml
python /epics/support/ADGenICam/scripts/makeDb.py /tmp/genicam/genicam.xml /tmp/genicam/genicam.template
pvi convert device --template /tmp/genicam/genicam.template /epics/pvi-defs/ /epics/support/ADGenICam/include/ADGenICam.h
# Find address (ID) and CLASS of the first camera in the IOC instance yaml.
# NOTE this does not support mixed types of cameras in the same IOC
# ONE camera per IOC instance is recommended
# Multiple cameras of the same type are supported
# Mixed cameras will work but may not expose all their GenICam config parameters
instance_class=$(grep -m1 -oP "(?<=CLASS:\s).*" ${ibek_src}) || true # https://regex101.com/r/358gq3/1
instance_id=$(grep -m1 -oP "(?<=ID:\s).*" ${ibek_src}) || true # https://regex101.com/r/358gq3/1
if [[ -n $instance_id ]]; then
if [[ $instance_class == "AutoADGenICam" ]]; then
# Auto generate GenICam database from camera parameters XML
arv-tool-0.8 -a ${instance_id} genicam > /tmp/genicam.xml
python /epics/support/ADGenICam/scripts/makeDb.py /tmp/genicam.xml /epics/support/ADGenICam/db/AutoADGenICam.template
fi
# Generate pvi device from the GenICam DB
pvi convert device --template /epics/support/ADGenICam/db/$instance_class.template /epics/pvi-defs/ /epics/support/ADGenICam/include/ADGenICam.h
mv /epics/pvi-defs/ADGenICam.pvi.device.yaml /epics/pvi-defs/$instance_class.pvi.device.yaml
fi

# get the ibek support yaml files this ioc's support modules
Expand Down

0 comments on commit 72291db

Please sign in to comment.