Git Product home page Git Product logo

pyaer's Introduction

PyAER


GitHub release PyPI - Version build license DOI

Linux macOS AMD64 ARM

DVS128 eDVS DVS240C DVS346 DVXLite DVX EVK

WARNING: This repository is under major refactor. There is no specific timeline. You are advised to build from scratch from the master branch.

Special thanks to iniVation for making this possible!

The project is in its Beta development stage, please submit an issue if you encountered a problem.

NEWS As from 0.2.5, we switched CI/CD from Travis CI to Github Actions because the building on travis-ci.org is ceased. We are looking for solutions to produce ARM64 build.

Why PyAER?

iniVation has released DV, a new platform and an SDK for accessing and developing with event cameras.

For robotics projects, you may find rpg_dvs_ros when you use ROS.

So the natural question is: why PyAER?

In a nutshell, PyAER is a combination of a Pythonic libcaer and a light-weight "ROS". PyAER serves as an agile package that focus on fast development and extensibility. In fact, in some scenario, e.g., edge devices, PyAER is more user friendly than other alternatives.

Design Principle

  • Minimum installation effort.
  • Clean, simple, easy to manage.
  • Well documented, human-readable code.

Installation

  1. Install libcaer dependency (RECOMMEND)

    # for Ubuntu
    sudo apt-get install libcaer-dev
    # for macOS
    brew tap inivation/inivation
    brew install libcaer --with-libserialport --with-opencv

    Update udev rules if you use a Linux system:

    $ bash <(curl -s https://raw.githubusercontent.com/duguyue100/pyaer/master/install-udev.sh)

    NOTE: The libcaer installation has taken care of the udev update. However, if the problem persists, please try it.

  2. Install pyaer from pypi (RECOMMEND)

    $ pip install pyaer
  3. Install pyzmq and h5py

    $ pip install pyzmq
    $ pip install h5py
    

    NOTE: pyzmq is not available on ARM-based computer, you will need to build yourself.

Development

For development purpose, you might build pyaer from source. Please follow the instructions in INSTALL_FROM_SOURCE.md

Running Examples

  • The scripts folder provides some examples for you to play with.

  • Extra more advanced demos are available at pyaer-demo.

Limitations and Notes

  • 2022-08-05: Address the building issue with the latest libcaer release.

  • 2022-06-07: We now switch to follow libcaer official release.

  • 2021-12-01: For DAVIS346 Color model, we now support color events.

  • 2021-01-13: DVXplorer cameras are officially supported (Thanks iniVation) for borrowing devices. Samsung EVK support is yet to be tested.

  • 2020-12-02: From 0.2.0, we support a zeromq-based communication module that allow users to leverage multiple processes during development. It can support multiple devices and concurrent logging and visualization. If you are familiar with ROS, you should find this feature comfortable.

  • DYNAP is generally supported. We are currently looking for the correct bias configuration mechanism so that it can easily support the use of the device. We have mapped some core functions that are essential to device configuration.

Contacts

Yuhuang Hu Email: [email protected]

pyaer's People

Contributors

duguyue100 avatar jereroy avatar tobidelbruck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyaer's Issues

Multiple running

Is it possible to open two terminals and access the same dynapse?

Running issue with dvxplorer and jetson nano

Hello,

First of all, thank you very much for this library! I have a problem when I run dvxplorer_test.py on my jetson nano. I have the following errors:

Device ID: 1
Device Serial Number: DXM00013
Device USB bus Number: 2
Device USB device address: 3
Device String: DVXplorer ID-1 SN-DXM00013 [2:3]
Device Firmware Version: 8
Logic Version: 18
Device Chip ID: 20
Device is master.
MUX has statistics: False
Device size X: 640
Device size Y: 480
DVS has statistics: False
IMU Type: 3
EXT input has generator: False
2022-02-26 14:05:40 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137065).
2022-02-26 14:05:40 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137070).
2022-02-26 14:05:40 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137075).
2022-02-26 14:05:40 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG WRITE: failed SPI config write' (code 64 at time 137081).
2022-02-26 14:05:40 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG WRITE: failed SPI config write' (code 64 at time 137100).
2022-02-26 14:05:41 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137869).
2022-02-26 14:05:41 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137874).
2022-02-26 14:05:41 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137880).
2022-02-26 14:05:41 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137885).
2022-02-26 14:05:41 (TZ-0800): ERROR: DVXplorer ID-1 SN-DXM00013 [2:3]: Error message: 'VR_CPLD_CONFIG READ: failed SPI config read' (code 64 at time 137890).
{'mux_timestamp_reset': 0, 'drop_extinput_on_transfer_stall': 0, 'mux_drop_dvs_on_transfer_stall': 0, 'imu_accel_data_rate': 6, 'imu_accel_filter': 2, 'imu_accel_range': 1, 'imu_gyro_data_rate': 5, 'imu_gyro_filter': 2, 'imu_gyro_range': 2, 'extinput_detect_rising_edges': 0, 'extinput_detect_falling_edges': 0, 'extinput_detect_pulses': 0, 'extinput_detect_pulse_polarity': 0, 'extinput_detect_pulse_length': 0, 'usb_early_packet_delay': 0, 'current_range_log': 0, 'current_range_sf': 1, 'current_range_on': 1, 'current_range_nrst': 0, 'current_range_loga': 1, 'current_range_logd': 1, 'current_level_sf': 1, 'current_level_noff': 0, 'current_amp': 4, 'current_on': 0, 'current_off': 8}
Traceback (most recent call last):
File "dvxplorer_test.py", line 48, in
device.get_event("events_hist")
TypeError: 'NoneType' object is not iterable

On my laptop, there's no problem, everything works fine.

Can you help me please ?

Thank you !

Best regards !

aise ImportError("libcaer might not be in the LD_LIBRARY_PATH "

Hi,

I am trying to run davis240_test.py on my Mac laptop but getting this error:

"ImportError: libcaer might not be in the LD_LIBRARY_PATH or your numpy might not be the required version.Try to load _libcaer_wrap.so from the package directory, this will provide more information."

Can you please advise me ?

Regards,
Y

Running problem

dongchen@dongchen-ThinkPad-T430s:~$ python2 test_dynapse.py
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
Traceback (most recent call last):
File "test_dynapse.py", line 7, in
from pyaer.dynapse import DYNAPSE
File "/home/dongchen/.local/lib/python2.7/site-packages/pyaer/init.py", line 22, in
raise ImportError("libcaer might not be in the LD_LIBRARY_PATH "
ImportError: libcaer might not be in the LD_LIBRARY_PATH or your numpy might not be the required version.Try to load _libcaer_wrap.so from the package directory, this will provide more information.

External input

Hi!

I am trying to synchronize a DAVIS346(slave) with another camera (master) using the PyAER bindings.

With the jAER software, I can enable a signal detector and detect my special events fine. However, I can't write my config on the on-board flash memory and use my code in python since it's not yet supported.

Is there a way I can enable signal detector directly with the PyAER bindings?

Thanks a lot!

Frame display issue in pyaer

Thanks for this awesome easy-to-use tool!

I have an issue. I'm using a DAVIS346 Color (Red). When I run davis346_test.py, the events output displays motion as expected in the "image" window. However, the image frame shown in the "frame" window is not correctly displayed. Below is an example of what the "frame" window looks like:
frame

By contrast, below is how the jAER application displays the frame with no change in the camera position:
jaer

For some reason, the frame shown in pyAER appears zoomed in quite a bit, and there are 3 of everything (so if I move the camera to the left in the "frame" image above, I'll see a third clock). Do you know why this might be happening? I wonder if the replicated objects are from RGB channels sent from the camera being somehow mishandled in the wrapper and shown as grayscale?

Thanks again!

raise ImportError("libcaer might not be in the LD_LIBRARY_PATH "

Hello,

Currently, I am trying to access my DAVIS346 using your package. However, I got this error when importing pyaer.

raise ImportError("libcaer might not be in the LD_LIBRARY_PATH "
ImportError: libcaer might not be in the LD_LIBRARY_PATH or your numpy might not be the required version.Try to load _libcaer_wrap.so from the package directory, this will provide more information.

Here is the detail of my environment.
OS: Ubuntu 18
Python: 3.6.9
Numpy: 1.19.5
Pyaer: 0.2.6 (installed with pip3 install pyaer)
Libcaer version: 3.3.14-2~bionic (installed with sudo apt-get install libcaer)

I have followed #14 but the problem still persists. Could you please tell me what should I do? Thanks in advance.

Error: Device logic version too old with version 18

Hi @duguyue100,

I'm trying to run davis346_test.py on a fairly new DAVIS346. However, I get the following error:

ERROR: DAVIS ID-1: Device logic version too old. You have version 18; but at least version 9912 is required. Please updated by following the Flashy upgrade documentation at 'https://inivation.com/support/software/reflashing/'.
2019-01-24 22:28:55 (TZ-0500): CRITICAL: DAVIS ID-1: Failed to open device, see above log message for more information (errno=-6).
Traceback (most recent call last):
  File "davis346_test.py", line 14, in <module>
    device = DAVIS(noise_filter=True)
  File "/home/dsmi/anaconda3/envs/neuromorphic/lib/python3.6/site-packages/pyaer/davis.py", line 52, in __init__
    dev_address_restrict, serial_number)
  File "/home/dsmi/anaconda3/envs/neuromorphic/lib/python3.6/site-packages/pyaer/davis.py", line 156, in open
    serial_number)
  File "/home/dsmi/anaconda3/envs/neuromorphic/lib/python3.6/site-packages/pyaer/device.py", line 86, in open
    raise ValueError("The device is failed to open.")
ValueError: The device is failed to open.

The error message is a little confusing since 18 is the latest version, but I assume it just means the logic version is incompatible, perhaps with libcaer? I believe install-libcaer.sh installs the latest version of libcaer, but you also pointed out in the other open issue that version 3 will break the API. Do you think that's the cause of this issue?

Thanks!

Running error

The test script is scripts/dynapse_test.py, right? But it returns an error:

Device ID: 1
Device is master.
Device Serial Number: 00000000
Device String: Dynap-se ID-1 SN-00000000 [3:7]
Device USB bus Number: 3
Device USB device address: 7
Logic Version: 5
Logic Clock: 90
Chip ID: 64
AER has statistics: True
MUX has statistics: True
Traceback (most recent call last):
File "dynapse_test.py", line 39, in
fpga_bias=True, scope=scope)
File "/home/dongchen/.local/lib/python2.7/site-packages/pyaer/dynapse.py", line 162, in set_bias_from_json
scope=scope)
File "/home/dongchen/.local/lib/python2.7/site-packages/pyaer/dynapse.py", line 324, in set_bias
self.set_fpga_bias(bias_obj)
File "/home/dongchen/.local/lib/python2.7/site-packages/pyaer/dynapse.py", line 382, in set_fpga_bias
bias_obj["mux_timestamp_reset"])
TypeError: 'NoneType' object has no attribute 'getitem'

Streaks on image

streaks
streaks2

Do you know what could be the cause of the streaks that are showing up in the images above? I'm not observing it on the jAER display.

Thanks!

Manual Install Swig Build Issue

Hello,

For various reasons I have to do a manual install of payer on a windows machine. I followed the windows instructions to get libcaer and have been using MSYS2 / MINGW64 to get everything set up. I was able to get the custom swig library built and installed, but am having trouble actually building the pyaer repo.

Specifically, I cloned the repository, then ran the command: make install.

No errors seem to be generated from this command, however, the low level c/c++ module _libcaer_wrap is never generated (I assume this is the part that swig was required for). I was wondering if there are missing steps in the README that would generate this underlying module.

Thank you,
Steven Shearing

Patch level 1 is required

When I do python, the error shows that:
CRITICAL: DAVIS ID-1: Device logic patch level insufficient. You have patch level 0; but patch level 1 is required. Please update by following the Flashy documentation at 'https://inivation.com/support/software/reflashing/'.
2019-10-30 17:45:16 (TZ+0000): CRITICAL: DAVIS ID-1: Failed to open device, no matching device could be found or opened.
Traceback (most recent call last):
File "davis240_test.py", line 14, in
raise ValueError("The device is failed to open.")
ValueError: The device is failed to open.

Do you have any idea about this problem?

PIB Error

Hi
Running davis346_test.py gives me the following error:

Device ID: 1
Device is master.
Device Serial Number: 00000065
Device String: DAVIS ID-1 SN-00000065 [6:5]
Device USB bus Number: 6
Device USB device address: 5
Device size X: 346
Device size Y: 260
Logic Version: 18
Background Activity Filter: True
2019-07-31 13:59:57 (TZ+0200): ERROR: DAVIS ID-1 SN-00000065 [6:5]: Error message: 'PIB Error: Other PIB Error occurred!' (code 26 at time 5521).
2019-07-31 13:59:57 (TZ+0200): ERROR: DAVIS ID-1 SN-00000065 [6:5]: Error message: 'PIB Error: Other PIB Error occurred!' (code 26 at time 5526).
Traceback (most recent call last):
  File "davis346_test.py", line 33, in <module>
    device.set_bias_from_json("./scripts/configs/davis346_config.json")
  File "/home/dedennler/anaconda3/envs/E2VID/lib/python3.7/site-packages/pyaer/davis.py", line 213, in set_bias_from_json
    self.set_bias(bias_obj)
  File "/home/dedennler/anaconda3/envs/E2VID/lib/python3.7/site-packages/pyaer/davis.py", line 251, in set_bias
    bias_obj["aps_enabled"])
TypeError: 'NoneType' object is not subscriptable

latest-realease.whl is not a supported wheel on this platform.

When trying to install pyaer using the latest release build I get the following error messages:

pyaer-0.1.0a21-cp27-cp27mu-linux_x86_64.whl is not a supported wheel on this platform.
pyaer-0.1.0a20-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.

I installed pyaer via its source file, however, when trying to run the examples I get the follwoing error:

In [1]: from pyaer import libcaer
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~/Repositories/pyaer-beta/pyaer/libcaer_wrap.py in swig_import_helper()
     13         try:
---> 14             return importlib.import_module(mname)
     15         except ImportError:

/usr/lib/python3.5/importlib/__init__.py in import_module(name, package)
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 

/usr/lib/python3.5/importlib/_bootstrap.py in _gcd_import(name, package, level)

/usr/lib/python3.5/importlib/_bootstrap.py in _find_and_load(name, import_)

/usr/lib/python3.5/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ImportError: No module named 'pyaer._libcaer_wrap'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
~/Repositories/pyaer-beta/pyaer/__init__.py in <module>()
     19 try:
---> 20     from pyaer import libcaer_wrap as libcaer
     21 except ImportError:

~/Repositories/pyaer-beta/pyaer/libcaer_wrap.py in <module>()
     16             return importlib.import_module('_libcaer_wrap')
---> 17     _libcaer_wrap = swig_import_helper()
     18     del swig_import_helper

~/Repositories/pyaer-beta/pyaer/libcaer_wrap.py in swig_import_helper()
     15         except ImportError:
---> 16             return importlib.import_module('_libcaer_wrap')
     17     _libcaer_wrap = swig_import_helper()

/usr/lib/python3.5/importlib/__init__.py in import_module(name, package)
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 

ImportError: No module named '_libcaer_wrap'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-1-8a2c4e7ac7b0> in <module>()
----> 1 from pyaer import libcaer

~/Repositories/pyaer-beta/pyaer/__init__.py in <module>()
     20     from pyaer import libcaer_wrap as libcaer
     21 except ImportError:
---> 22     raise ImportError("libcaer might not be in the LD_LIBRARY_PATH "
     23                       "or your numpy might not be the required version."
     24                       "Try to load _libcaer_wrap.so from the package "

ImportError: libcaer might not be in the LD_LIBRARY_PATH or your numpy might not be the required version.Try to load _libcaer_wrap.so from the package directory, this will provide more information.

I added libcaer to the LD_LIBRARY_PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/schlowmo/Repositories/libcaer/

I am using Python 3.5.2
Swig is installed and can be imported using import swig. I also can import libcaer w/o problems using import libcaer

Wrong special event data

Hi!

I had some problems with the get_special_event function in device.py. The special event data returned was always 0 no matter what. The timestamp and the number of special event were fine.

I fixed it by modifying the get_special_event in pyflags.i :

%inline %{
void get_special_event(caerSpecialEventPacket event_packet, int64_t* event_vec, int32_t packet_len) {
    long i;
    for (i=0; i<(int)packet_len/2; i++) {
        caerSpecialEvent event = caerSpecialEventPacketGetEvent(event_packet, i);
        event_vec[i*2] = caerSpecialEventGetTimestamp(event);
        //event_vec[i*2+1] = caerSpecialEventGetData(event); <-- OLD ONE
        event_vec[i*2+1] =  U32T(le32toh(event->data) >> (SPECIAL_TYPE_SHIFT)) & (SPECIAL_TYPE_MASK); //<-- NEW ONE
    }
}
%}

However, I don't quite understand why it works.... The GET_NUMBITS32 function in the libcaer library always returns me 0.

Maybe it could cause other problems in the future?

Support device discovery in new pyaer

It turns out very difficult to serialize the caerDeviceDiscover function, I might just to find a way of encoding all device types into a number and transform them back from the python end.

Script examples bias path

Hi Yuhuang, i tried your library with a DAVIS240C using last version of libcAER (just wanted to try and see if it worked, i didn't want to change version) running the file in scripts/davis240_test.py, and it works besides a little problem with the bias file path. If i run the script from shell it doesn't find the bias parameters file, because you set the default search path for the json file as:

"./scripts/configs/davis240c_config.json"

but if you run it inside the script folder he can't find it. Changing to

"./configs/davis240c_config.json"

everything works without any change, so you can run the script directly. Eventually i would put in this function:

def load_json(file_path):

something like this for the IOError:

errorString = "Error when trying to load bias file, not found in the specified location"
print(errorString)
raise

So that we know there is a problem in the file location.

However, i don't know if you use spyder with Anaconda, but if you change the working directory directory to the pyaer directory (the top level one), it gives the errors:

ImportError: libcaer might not be in the LD_LIBRARY_PATH or your numpy might not be the required version.Try to load _libcaer_wrap.so from the package directory, this will provide more information.

It seems that when you do:

from pyaer import libcaer

It has conflict between the local directory pyaer and the one you installed with pip, because he searches for libcaer in the local directory, maybe for some reasons it has higher priority. Just to tell you, maybe this can happen to others.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.