I am trying to access gyroscope data with its associated timestamp from my ADIS16495 IMU connected to a raspberry pi 4B running Kuiper Linux. I was able to get basic acceleration data using the pyadi-iio library (channels 0-6), but when trying to access channel 7 (timestamp), I received an error saying "Exception: RX mapping exceeds available channels." When running iio_info (see attached file), I verified that there was a timestamp channel (timestamp: (input, index: 7, format: le:S64/64>>0)). The code that produced this error is also below.
import adi
import time
# Connect to the imu
imu = adi.adis16495()
# Make the output a dictionary that shows field names
#imu.rx_annotated=True
imu.rx_enabled_channels = [7]
# Set buffer to sample rate to capture exactly one second of data
imu.rx_buffer_size=imu.sample_rate
#print(imu.rx_channel_names)
#print(imu.current_timestamp_clock)
print("Sample rate:", imu.sample_rate, "measurements per second")
for _ in range(60):
# Get data
data = imu.rx()
# Get timestamp
timestamp = time.gmtime()
# Display information
print(timestamp)
print(data)
Is there a way to access this channel with the pyadi-iio or similar resource? Ideally I would like to be able to access the IMU data via python.
Thanks!
iio_info version: 0.26 (git tag:5e1e9cb5)
Libiio version: 0.26 (git tag: 5e1e9cb) backends: local xml ip usb serial
IIO context created with local backend.
Backend version: 0.26 (git tag: 5e1e9cb)
Backend description string: Linux analog 6.1.54-v7l+ #1 SMP Mon Dec 2 10:56:39 UTC 2024 armv7l
IIO context has 4 attributes:
hw_carrier: Raspberry Pi 4 Model B Rev 1.1
dtoverlay: adis16480,vc4-kms-v3d,dwc2
local,kernel: 6.1.54-v7l+
uri: local:
IIO context has 4 devices:
hwmon0: cpu_thermal
1 channels found:
temp1: (input)
2 channel-specific attributes found:
attr 0: crit value: 110000
attr 1: input value: 42842
No trigger on this device
hwmon1: rpi_volt
1 channels found:
in0: (input)
1 channel-specific attributes found:
attr 0: lcrit_alarm value: 0
No trigger on this device
iio:device0: adis16495-1 (buffer capable)
16 channels found:
anglvel_x: (input, index: 0, format: be:S32/32>>0)
5 channel-specific attributes found:
attr 0: calibbias value: 0
attr 1: calibscale value: 0
attr 2: filter_low_pass_3db_frequency value: 0
attr 3: raw value: 728554
attr 4: scale value: 0.000000001
anglvel_y: (input, index: 1, format: be:S32/32>>0)
5 channel-specific attributes found:
attr 0: calibbias value: 0
attr 1: calibscale value: 0
attr 2: filter_low_pass_3db_frequency value: 0
attr 3: raw value: 866767
attr 4: scale value: 0.000000001
anglvel_z: (input, index: 2, format: be:S32/32>>0)
5 channel-specific attributes found:
attr 0: calibbias value: 0
attr 1: calibscale value: 0
attr 2: filter_low_pass_3db_frequency value: 0
attr 3: raw value: 234102
attr 4: scale value: 0.000000001
accel_x: (input, index: 3, format: be:S32/32>>0)
5 channel-specific attributes found:
attr 0: calibbias value: 0
attr 1: calibscale value: 0
attr 2: filter_low_pass_3db_frequency value: 0
attr 3: raw value: 2059140
attr 4: scale value: 0.000000037
accel_y: (input, index: 4, format: be:S32/32>>0)
5 channel-specific attributes found:
attr 0: calibbias value: 0
attr 1: calibscale value: 0
attr 2: filter_low_pass_3db_frequency value: 0
attr 3: raw value: -3379474
attr 4: scale value: 0.000000037
accel_z: (input, index: 5, format: be:S32/32>>0)
5 channel-specific attributes found:
attr 0: calibbias value: 0
attr 1: calibscale value: 0
attr 2: filter_low_pass_3db_frequency value: 0
attr 3: raw value: 262280035
attr 4: scale value: 0.000000037
timestamp: (input, index: 7, format: le:S64/64>>0)
temp0: (input, index: 10, format: be:S16/16>>0)
3 channel-specific attributes found:
attr 0: offset value: 2000
attr 1: raw value: 103
attr 2: scale value: 12.500000
flags0: (input, WARN:iio_channel_get_type()=UNKNOWN, index: 17, format: be:U16/16>>0)
flags1: crc (input, WARN:iio_channel_get_type()=UNKNOWN, index: 18, format: be:U16/16>>0)
1 channel-specific attributes found:
attr 0: label value: crc
deltavelocity_x: (input, WARN:iio_channel_get_type()=UNKNOWN)
3 channel-specific attributes found:
attr 0: calibbias ERROR: Invalid argument (22)
attr 1: raw value: 517
attr 2: scale value: 0.000000046
deltaangl_x: (input, WARN:iio_channel_get_type()=UNKNOWN)
3 channel-specific attributes found:
attr 0: calibbias ERROR: Invalid argument (22)
attr 1: raw value: 2
attr 2: scale value: 0.000000002
deltavelocity_y: (input, WARN:iio_channel_get_type()=UNKNOWN)
3 channel-specific attributes found:
attr 0: calibbias ERROR: Invalid argument (22)
attr 1: raw value: -658
attr 2: scale value: 0.000000046
deltaangl_y: (input, WARN:iio_channel_get_type()=UNKNOWN)
3 channel-specific attributes found:
attr 0: calibbias ERROR: Invalid argument (22)
attr 1: raw value: -23
attr 2: scale value: 0.000000002
deltaangl_z: (input, WARN:iio_channel_get_type()=UNKNOWN)
3 channel-specific attributes found:
attr 0: calibbias ERROR: Invalid argument (22)
attr 1: raw value: -65499
attr 2: scale value: 0.000000002
deltavelocity_z: (input, WARN:iio_channel_get_type()=UNKNOWN)
3 channel-specific attributes found:
attr 0: calibbias ERROR: Invalid argument (22)
attr 1: raw value: 49571
attr 2: scale value: 0.000000046
3 device-specific attributes found:
attr 0: current_timestamp_clock value: realtime
attr 1: sampling_frequency value: 4250.000000
attr 2: waiting_for_supplier value: 0
2 buffer-specific attributes found:
attr 0: data_available value: 179
attr 1: direction value: in
Current trigger: trigger0(adis16495-1-dev0)
trigger0: adis16495-1-dev0
0 channels found:
No trigger on this device