You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having an issue using the source_timestamp and reception_timestamp on a SampleInfo instance retrieved via fastdds.DataReader.take(). Specifically, I want to call to_ns() on the source_timestamp and reception_timestamp and am getting the following error. I have outlined my findings below and would appreciate any help!
terminate called after throwing an instance of 'Swig::DirectorMethodException'
what(): SWIG director method error. In method 'on_data_available': AttributeError: 'SwigPyObject' object has no attribute 'to_ns'
I have created the following function, get_data(), which is being used in the callback function to a SubscriberListener class I've created, which overrides the on_data_available( ) method of the fastdds.DataReader.
def get_data(data: fastdds.LoanableCollection, reader: fastdds.DataReader):
infos: fastdds.SampleInfoSeq = fastdds.SampleInfoSeq()
ret: fastdds.ReturnCode_t = reader.take(data, infos)
if ret == fastdds.ReturnCode_t.RETCODE_OK:
return (data, infos)
else:
return None
def callback(reader: fastdds.DataReader):
data_seq = GeneratedClassSeq()
data = get_data(data_seq, reader)
reception_ns = data[1][0].reception_timestamp.to_ns() # line that throws error
Now, I've checked the generated python bindings in fastdds.py, and do not understand what the issue is. The SampleInfoSeq class defines that I'm using defines __getItem__(), which I am using to get a SampleInfo instance. The SampleInfo class has properties reception_timestamp and source_timestamp, as defined below, which I am accessing via .reception_timestamp. I'm expecting the resultant object from that call to be of type Time_t, which according to fastdds.py has the to_ns() function, but I cannot properly call it.
The text was updated successfully, but these errors were encountered:
richiware
changed the title
Cannot convert SampleInfo timestamps to nanoseconds
Cannot convert SampleInfo timestamps to nanoseconds [19737]
Oct 16, 2023
I am having an issue using the
source_timestamp
andreception_timestamp
on aSampleInfo
instance retrieved viafastdds.DataReader.take()
. Specifically, I want to callto_ns()
on thesource_timestamp
andreception_timestamp
and am getting the following error. I have outlined my findings below and would appreciate any help!I have created the following function,
get_data()
, which is being used in the callback function to aSubscriberListener
class I've created, which overrides theon_data_available( )
method of thefastdds.DataReader
.Now, I've checked the generated python bindings in fastdds.py, and do not understand what the issue is. The
SampleInfoSeq
class defines that I'm using defines__getItem__()
, which I am using to get aSampleInfo
instance. TheSampleInfo
class has properties reception_timestamp and source_timestamp, as defined below, which I am accessing via.reception_timestamp
. I'm expecting the resultant object from that call to be of typeTime_t
, which according to fastdds.py has theto_ns()
function, but I cannot properly call it.From fastdds.py:
Documentation Referenced:
The text was updated successfully, but these errors were encountered: