EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: Question about the best practice for integrating a stepper motor Python library into EPICS
From: Alexander Kessler via Tech-talk <tech-talk at aps.anl.gov>
To: Mark Rivers <rivers at cars.uchicago.edu>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 11 May 2023 16:46:35 +0200

Hello Mark,


Yes, it is a TCP Connection to HW.


'''

import socket

s = socket.socket()
timeout = 1.0

s.settimeout(timeout)

s.connect(host, port)

'''

Well, it's a P2P connection, I think client-server is not the right term here. I would say Phyton Code is the master, says that to do it, and HW is the slave.

No EPICS so far. I'm trying to make a device driver IOC from Python Lib. Because I am complete beginner, I want to ask for the better way to do it. I see two options:

  1. port to C++
  2.  create in Python a PV interface according to the motor record. https://epics-modules.github.io/motor/motorRecord.html
    The module motorVMC seems to do something like this.
    https://github.com/epics-motor/motorVMC.git

Best regards,

AlexK


Am 11.05.2023 um 14:30 schrieb Mark Rivers:
Hi Alex,
  • I have an in-house built stepper motor controller and a python library to control it. 
  • It simply opens a TCP socket, sends a command bytecode and queries some state bytes.
Do you mean that the Python library opens a socket to the controller and sends a command bytecode and queries bytes from the hardware?
Or do you mean that external software (like EPICS) opens a socket to the Python library and sends a bytecode?  
In other words is the Python library a socket server, or a socket client?

If the Python library is a socket client then how complex is it?  It might just be easier to replace it with a C++ asynMotorController that sends the bytecode and parses the response.

Mark



From: Tech-talk on behalf of Alexander Kessler via Tech-talk
Sent: Thursday, May 11, 2023 5:44 AM
To: tech-talk at aps.anl.gov
Subject: Question about the best practice for integrating a stepper motor Python library into EPICS

Dear community,

I have an in-house built stepper motor controller and a python library
to control it. It simply opens a TCP socket, sends a command bytecode
and queries some state bytes.
I would like to include the Python code in EPICS as my first productive
EPICS exercise. In C++, I would take EPICS engine module and create a
child class of asyncMotorControler.  But what is the best way to handle
it with Python? Is there an equivalent to C++ parent class on CAPROTO basis?

Thanks and best wishes,

AlexK

--
Alexander Kessler

Helmholtz-Institut-Jena
Fröbelstieg 3, 07743 Jena
phone:    +49-3641-947296
fax:      +49-3641-947299
email:    alexander.kessler at uni-jena.de
web:      http://www.rlp-ioq.uni-jena.de/
           http://www.hi-jena.de

Facility for Antiproton and Ion Research in Europe GmbH (FAIR GmbH) GSI Helmholtzzentrum für Schwerionenforschung GmbH Planckstraße 1, 64291 Darmstadt, Germany, www.fair-center.eu, www.gsi.de

Commercial Register / Handelsregister:
FAIR: Amtsgericht Darmstadt, HRB 89372
GSI: Amtsgericht Darmstadt, HRB 1528
Managing Directors / Geschäftsführung:
Professor Dr. Paolo Giubellino, Jörg Blaurock Chairman of the GSI Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
Ministerialdirigent Dr. Volkmar Dietz

-- 
Alexander Kessler

Helmholtz-Institut-Jena
Fröbelstieg 3, 07743 Jena
phone:    +49-3641-947296
fax:      +49-3641-947299
email:    alexander.kessler at uni-jena.de
web:      http://www.rlp-ioq.uni-jena.de/
          http://www.hi-jena.de

Facility for Antiproton and Ion Research in Europe GmbH (FAIR GmbH) GSI Helmholtzzentrum für Schwerionenforschung GmbH Planckstraße 1, 64291 Darmstadt, Germany, www.fair-center.eu, www.gsi.de

Commercial Register / Handelsregister:
FAIR: Amtsgericht Darmstadt, HRB 89372
GSI: Amtsgericht Darmstadt, HRB 1528
Managing Directors / Geschäftsführung:
Professor Dr. Paolo Giubellino, Jörg Blaurock Chairman of the GSI Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
Ministerialdirigent Dr. Volkmar Dietz

Attachment: OpenPGP_0x46F738458AEA89FF.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


References:
Re: Question about the best practice for integrating a stepper motor Python library into EPICS Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: Question about the best practice for integrating a stepper motor Python library into EPICS Ralph Lange via Tech-talk
Next: Re: Question about the best practice for integrating a stepper motor Python library into EPICS Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: Re: Question about the best practice for integrating a stepper motor Python library into EPICS Ralph Lange via Tech-talk
Next: Re: Question about the best practice for integrating a stepper motor Python library into EPICS Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
ANJ, 11 May 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·