update interfaces

This commit is contained in:
Brian Delhaisse
2019-07-01 01:54:49 +02:00
parent ffb820f592
commit 68e209adc7
7 changed files with 238 additions and 5 deletions
@@ -56,9 +56,9 @@ class AsusXtionInterface(CameraInterface):
to check if it is correctly detected and working properly.
References:
[1] https://github.com/danielelic/PyOpenNI2-Utility
[2] https://github.com/kanishkaganguly/OpenNIMultiSensorCapture
[3] https://docs.opencv.org/3.1.0/d7/d6f/tutorial_kinect_openni.html
- [1] https://github.com/danielelic/PyOpenNI2-Utility
- [2] https://github.com/kanishkaganguly/OpenNIMultiSensorCapture
- [3] https://docs.opencv.org/3.1.0/d7/d6f/tutorial_kinect_openni.html
"""
def __init__(self, use_thread=False, sleep_dt=0., verbose=False, use_rgb=True, use_depth=True, use_ir=False):
@@ -0,0 +1,73 @@
#!/usr/bin/env python
"""Define the RealSense depth camera input interface.
References:
- librealsense: https://github.com/IntelRealSense/librealsense
- python wrapper (pyrealsense2): https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python
"""
# TODO: implement this interface
import numpy as np
try:
import pyrealsense2 as rs
except ImportError as e:
raise ImportError(repr(e) + '\nTry to install `pyrealsens2`: pip install pyrealsense2'
'\nOr try to install from its repository: '
'https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python\n')
from pyrobolearn.tools.interfaces.camera import CameraInterface
__author__ = "Brian Delhaisse"
__copyright__ = "Copyright 2019, PyRoboLearn"
__credits__ = ["Brian Delhaisse"]
__license__ = "GNU GPLv3"
__version__ = "1.0.0"
__maintainer__ = "Brian Delhaisse"
__email__ = "briandelhaisse@gmail.com"
__status__ = "Development"
class RealSenseInterface(CameraInterface):
r"""RealSense Interface
References:
- librealsense: https://github.com/IntelRealSense/librealsense
- python wrapper (pyrealsense2): https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python
"""
def __init__(self, use_thread=False, sleep_dt=0., verbose=False, use_rgb=True, use_depth=True):
"""
Initialize the RealSense input interface.
Args:
use_thread (bool): If True, it will run the interface in a separate thread than the main one.
The interface will update its data automatically.
sleep_dt (float): If :attr:`use_thread` is True, it will sleep the specified amount before acquiring or
setting the next sample.
verbose (bool): If True, it will print information about the state of the interface. This is let to the
programmer what he / she wishes to print.
use_rgb (bool): If True, it will get the RGB camera image. Note that if this is enabled, you can not
get IR images at the same time.
use_depth (bool): If True, it will get the depth camera image.
"""
# TODO
super(RealSenseInterface, self).__init__(use_thread, sleep_dt, verbose)
###########
# Methods #
###########
def run(self):
"""Run the interface."""
pass # TODO
# Test the interface
if __name__ == '__main__':
pass
@@ -34,7 +34,7 @@ class WebcamInterface(CameraInterface):
tool (such as openpose).
References:
[1] https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html
- [1] https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html
"""
def __init__(self, webcam_id=0, filename=None, fps=20, frame_size=(640, 480), codec='XVID',
@@ -0,0 +1,6 @@
Haptic gloves:
- plexus: http://plexus.im/ (Linux, Python)
- vrgluv: https://www.vrgluv.com
- HaptX gloves: https://haptx.com/
@@ -7,7 +7,7 @@ Prerequisites:
Troubleshooting:
- if you get 'OSError: libspnav.so: cannot open shared object file: No such file or directory', you have to copy-paste
the file '/usr/lib/libspnav.so.0' to '/usr/lib/libspnav.so'
the file '/usr/lib/libspnav.so.0' to '/usr/lib/libspnav.so'
Dependencies:
- `pyrobolearn.tools.interfaces`
@@ -0,0 +1,74 @@
#!/usr/bin/env python
"""Define the Leap Motion hand tracking sensor input interface.
References:
- Leap Motion: https://www.leapmotion.com/
- Installation (Ubuntu): https://www.leapmotion.com/setup/desktop/linux/
- V2 tracking toolkit: https://developer.leapmotion.com/sdk/v2
- Python API: https://developer-archive.leapmotion.com/documentation/python/api/Leap_Classes.html
- Tutorials: https://www.youtube.com/playlist?list=PLgTGpidiW0iTELuljcIdTkA5SjHa5tudP
"""
# TODO: implement this interface
import numpy as np
try:
import Leap
except ImportError as e:
raise ImportError(repr(e) + '\nTry to install `Leap` (see references in class documentation)')
from pyrobolearn.tools.interfaces.sensors import SensorInterface
__author__ = "Brian Delhaisse"
__copyright__ = "Copyright 2019, PyRoboLearn"
__credits__ = ["Brian Delhaisse"]
__license__ = "GNU GPLv3"
__version__ = "1.0.0"
__maintainer__ = "Brian Delhaisse"
__email__ = "briandelhaisse@gmail.com"
__status__ = "Development"
class LeapMotionInterface(SensorInterface):
r"""Leap Motion Interface
References:
- Leap Motion: https://www.leapmotion.com/
- Installation (Ubuntu): https://www.leapmotion.com/setup/desktop/linux/
- V2 tracking toolkit: https://developer.leapmotion.com/sdk/v2
- Python API: https://developer-archive.leapmotion.com/documentation/python/api/Leap_Classes.html
- Tutorials: https://www.youtube.com/playlist?list=PLgTGpidiW0iTELuljcIdTkA5SjHa5tudP
"""
def __init__(self, use_thread=False, sleep_dt=0., verbose=False, use_rgb=True, use_depth=True):
"""
Initialize the RealSense input interface.
Args:
use_thread (bool): If True, it will run the interface in a separate thread than the main one.
The interface will update its data automatically.
sleep_dt (float): If :attr:`use_thread` is True, it will sleep the specified amount before acquiring or
setting the next sample.
verbose (bool): If True, it will print information about the state of the interface. This is let to the
programmer what he / she wishes to print.
"""
# TODO
super(LeapMotionInterface, self).__init__(use_thread, sleep_dt, verbose)
###########
# Methods #
###########
def run(self):
"""Run the interface."""
pass # TODO
# Test the interface
if __name__ == '__main__':
pass
@@ -0,0 +1,80 @@
#!/usr/bin/env python
"""Define the Myo armband sensor input interface.
Warnings: "Myo production has officially ended as of Oct 12, 2018 and is no longer available for purchase".
References:
- Myo Armband (webpage for support): https://support.getmyo.com/hc/en-us
- PyoConnect: http://www.fernandocosentino.net/pyoconnect/
- related useful repository: https://github.com/ijin/venus-lift-lights/blob/master/PyoConnect.py
- MyoLinux: https://github.com/brokenpylons/MyoLinux
- myo-python: https://github.com/NiklasRosenstein/myo-python
- Software for Thalmic's Myo armband: https://github.com/balandinodidonato/MyoToolkit
"""
# TODO: implement this interface
import numpy as np
try:
import myo
except ImportError as e:
raise ImportError(repr(e) + '\nTry to install `myo` or `PyoConnect`')
from pyrobolearn.tools.interfaces.sensors import SensorInterface
__author__ = "Brian Delhaisse"
__copyright__ = "Copyright 2019, PyRoboLearn"
__credits__ = ["Brian Delhaisse"]
__license__ = "GNU GPLv3"
__version__ = "1.0.0"
__maintainer__ = "Brian Delhaisse"
__email__ = "briandelhaisse@gmail.com"
__status__ = "Development"
class MyoArmbandInterface(SensorInterface):
r"""Myo Armband Interface
Warnings: "Myo production has officially ended as of Oct 12, 2018 and is no longer available for purchase".
References:
- Myo Armband (webpage for support): https://support.getmyo.com/hc/en-us
- PyoConnect: http://www.fernandocosentino.net/pyoconnect/
- related useful repository: https://github.com/ijin/venus-lift-lights/blob/master/PyoConnect.py
- MyoLinux: https://github.com/brokenpylons/MyoLinux
- myo-python: https://github.com/NiklasRosenstein/myo-python
- Software for Thalmic's Myo armband: https://github.com/balandinodidonato/MyoToolkit
"""
def __init__(self, use_thread=False, sleep_dt=0., verbose=False, use_rgb=True, use_depth=True):
"""
Initialize the RealSense input interface.
Args:
use_thread (bool): If True, it will run the interface in a separate thread than the main one.
The interface will update its data automatically.
sleep_dt (float): If :attr:`use_thread` is True, it will sleep the specified amount before acquiring or
setting the next sample.
verbose (bool): If True, it will print information about the state of the interface. This is let to the
programmer what he / she wishes to print.
"""
# TODO
super(MyoArmbandInterface, self).__init__(use_thread, sleep_dt, verbose)
###########
# Methods #
###########
def run(self):
"""Run the interface."""
pass # TODO
# Test the interface
if __name__ == '__main__':
pass