-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Time Trigger API Support for nidaqmx-python #471
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the types aren't correct here. Some tests would have found a lot of issues, I think?
New Start Trigger | ||
|
||
Args: | ||
when (nidaqmx.constants.DateTime): Specifies when to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right type. I added AbsoluteTime in _lib_time.py that we should accept. We should also accept a datetime
and a hightime
from the std library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interpreter interface should only use datetime/hightime, not the ctypes and gRPC specific types.
The interpreter implementations should be responsible for converting datetime/hightime to/from AbsoluteTime/google.protobuf.Timestamp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, you're right. I'm just remembering everything we talked about when I added AbsoluteTime
. AbsoluteTime
is the type that the lib_interpreter uses to interface with the CAPI. google.protobuf.Timestamp
for the grpc_interpreter. In addition, the top-level API should accept datetime
or hightime
as well. So just pass them down to the interpreter and each will convert to their respective types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some starting points:
- Library
- gRPC
with cfunc.arglock: | ||
if cfunc.argtypes is None: | ||
cfunc.argtypes = [ | ||
lib_importer.task_handle, DateTime, ctypes.c_int] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When should be an AbsoluteTime
. AbsoluteTime
is a ctypes type that should work correctly here, I think.
def cfg_time_start_trig(self, task, when, timescale): | ||
response = self._invoke( | ||
self._client.CfgTimeStartTrig, | ||
grpc_types.CfgTimeStartTrigRequest(task=task, when=when, timescale_raw=timescale)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what type does the grpc lib use for when?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to this config function, several time trigger attributes are missing from start_trigger.py and similar classes. Are these on your radar?
https://www.ni.com/docs/en-US/bundle/ni-daqmx-properties/page/daqmxprop/daqmxtrigger.html
- Start:Time:When
- Start:Timestamp:Value
- Reference:Timestamp:Value
- More:Arm Start:Time:When
- More:Arm Start:Timestamp:Value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps, I might've missed the attributes out, will look into adding those.
What does this Pull Request accomplish?
This PR adds Time Trigger API support for the following functions in nidaqmx-python:
DAQmxCfgTimeStartTrig
Remaining API yet to be added (due to functions missing in daqmxAPISharp.json):
DAQmxCfgAnlgMultiEdgeRefTrig
DAQmxCfgAnlgMultiEdgeStartTrig
Work Item: [DAQmx] Add Time Triggers API support for nidaqmx-python
Why should this Pull Request be merged?
It provide support for Time Trigger in python.
What testing has been done?