Lee,
If the default asynMotorPoller() is used, the frequency at which the
poll() methods get called can vary, since the idle poll period is not
necessarily equal to the moving poll period. It looks like the call to
pcsControllerConfig sets both poll periods to the same value, so maybe
that hasn't been a problem.
If you create a dedicated poller thread to read the UDP stream, that
polling frequency can be independent of the pcsControllerConfig poll
periods. This is a common approach is used areaDetector drivers. One
example of these poller threads is pointGrey's imageGrabTask():
https://github.com/areaDetector/ADPointGrey/blob/9dda1cf68ec0757c64154144f197536d6a37622d/pointGreyApp/src/pointGrey.cpp#L880
It is likely you can make it work by reading the UDP stream in the poll
function, but I think a dedicated poller thread is a better solution.
Kevin
On 10/24/19 5:19 AM, Lee Hudson via Tech-talk wrote:
> Hi,
>
> I'm currently writing a motor driver and I'm not sure on the best way to
> implement a particular aspect of it. The main control link to the
> hardware is via TCP/IP, on startup the driver registers parameters of
> interest on the controller and the controller then sends all subscribed
> information out via UDP broadcasts. I think I need to create a udp
> server on the IOC, so far I am doing the following:
>
> *IOC boot script:*
>
> #TCP port for control, this works
>
> drvAsynIPPortConfigure("PCS1_CTRL", "192.168.113.10:51512", 100, 0, 0)
> asynOctetSetInputEos("PCS1_CTRL", 0, "\r\n")
> asynOctetSetOutputEos("PCS1_CTRL", 0, "\r\n")
>
> # Configure UDP port for Walter and Bai streams
> drvAsynIPServerPortConfigure(PCS1_UDP,"192.168.113.12:51513 udp", 10, 0,
> 0, 0)
> # Configure Walter and Bai PCS8000 controller
> pcsControllerConfig(PCS1, 0, 2, 20, 20)
>
> # Configure Walter and Bai PCS8000 Axis
> pcsAxisConfig(PCS1, 1)
>
> # Configure Walter and Bai PCS8000 Axis
> pcsAxisConfig(PCS1, 2)
>
>
> *Driver constructor(**class pcsController: public asynMotorController ):*
>
> /* Connect to pcsController controller TCP for control */
> status = pasynOctetSyncIO->connect(lowLevelPortName, 0,
> &pasynUserController_, NULL);*
> *
>
> *
> *
>
> pasynUserUDPStream = pasynManager->createAsynUser(0,0);
> status = pasynManager->connectDevice(pasynUserUDPStream,
> streamPortName,0);
> pasynInterface = pasynManager->findInterface(pasynUserUDPStream,
> asynOctetType, 1);*
> *
>
> pasynOctet = (asynOctet *) pasynInterface->pinterface;
> octetPvt=pasynInterface->drvPvt;
>
>
> *Driver poll():*
>
> status = pasynOctet->read(octetPvt, pasynUserUDPStream, rxBuffer, 65535 - 1,
> &nBytesIn, &eomReason);
>
>
> In the poll() method or perhaps a separate thread elsewhere I know I
> will have to update the asyn parameters manually and call
> callParamCallbacks() to get the record to update. Am I going about this
> the right way?
>
> Thanks in advance
>
> Lee
>
> --
>
> This e-mail and any attachments may contain confidential, copyright and
> or privileged material, and are for the use of the intended addressee
> only. If you are not the intended addressee or an authorised recipient
> of the addressee please notify us of receipt by returning the e-mail and
> do not use, copy, retain, distribute or disclose the information in or
> attached to the e-mail.
> Any opinions expressed within this e-mail are those of the individual
> and not necessarily of Diamond Light Source Ltd.
> Diamond Light Source Ltd. cannot guarantee that this e-mail or any
> attachments are free from viruses and we cannot accept liability for any
> damage which you may sustain as a result of software viruses which may
> be transmitted in or with the message.
> Diamond Light Source Limited (company no. 4375679). Registered in
> England and Wales with its registered office at Diamond House, Harwell
> Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
>
- References:
- UDP server in model 3 motor driver Lee Hudson via Tech-talk
- Navigate by Date:
- Prev:
UDP server in model 3 motor driver Lee Hudson via Tech-talk
- Next:
Re: iocLogServer, logstash & procServ Konrad, Martin 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
2023
2024
- Navigate by Thread:
- Prev:
UDP server in model 3 motor driver Lee Hudson via Tech-talk
- Next:
CA exception Rolf Keitel 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
2023
2024
|