GithubHelp home page GithubHelp logo

zense_pywrapper_for_serial's Introduction

概要

センサ番号取得するためにzenseを起動するだけのモジュール

インストール

  1. 依存パッケージをインストールする(userのオプションはあってもなくてもインストールできる状態であればOK)
pip install --user -r requirements.txt
  1. 下のインストール説明に沿ってPicoZenseSDKをインストールし, 下のコマンドを入力する(docker-composeによるインストールの場合は基本この手順は不要) https://github.com/teaminaho/aspara_robo/blob/master/cv_setup.md
sudo ./install.sh
  1. zense_pywrapper_for_serialパッケージをインストールする(userオプションについては同様)
python setup.py install --user

使用例

In [1]: from zense_pywrapper_for_serial import PyPicoZenseModuleForSerial

In [2]: zns = PyPicoZenseModuleForSerial(0)
Detected 2 devices.
sensor_idx_:0
SERIAL : PD71A1DGD6260045P

In [3]: print(zns.getSerialNumber())
PD71A1DGD6260045P

In [4]: delete zns
    delete zns

In [5]: del zns

使用例2(print_zense_serial.shを使用する場合)

  1. print_zense_serial.shに実行権限を付与する
cd ./scripts
chmod +x print_zense_serial.sh
  1. zenseを1台のみ作業PCに接続し, zenseのLEDが点灯し2, 3秒待つ
  2. print_zense_serial.shを実行する
./print_zense_serial.sh
  1. 結果を見る
inaho-04@inaho04-NUC7i7DNKE:~/tmp/zense_pywrapper_for_serial/scripts$ ./print_zense_serial.sh 
Detected 1 devices.
sensor_idx_:0
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
SERIAL : PD71A1EGD8280137P

注意点

  • コード内でopencvは使用していないがsetup.pyのopencv参照の記述を削除するとエラーを吐く(センサAPIの方で陰的に参照している?)
  • 以前のコードではデストラクタ呼び出し時に必ずセグフォが発生していたがPsShutdown()の前にPsCloseDevice()を呼ぶことで解消された(ただ最新のコードではそもそもPsShutdown()を使っていない)

zense_pywrapper_for_serial's People

Contributors

yuki-inaho avatar takehironet avatar

Watchers

James Cloos avatar Dennis Romero L. avatar  avatar  avatar

zense_pywrapper_for_serial's Issues

メモリ使用量が大きい(何が、どこで、どのようにメモリを食っているか確認する)

top - 04:28:04 up  6:13, 17 users,  load average: 24.46, 23.44, 23.63
Tasks: 426 total,  10 running, 342 sleeping,   2 stopped,   0 zombie
%Cpu(s): 86.5 us, 10.7 sy,  0.0 ni,  2.3 id,  0.0 wa,  0.0 hi,  0.4 si,  0.0 st
KiB Mem : 16266416 total,   685544 free,  6802432 used,  8778440 buff/cache
KiB Swap: 31250428 total, 31127548 free,   122880 used.  8717472 avail Mem  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 6710 root      20   0 1283992 270860  30532 R  80.6  1.7  79:57.59 pico_zense_simp
 5821 root      20   0 2314452 272080 107264 S  75.7  1.7  85:56.03 python3
 6934 root      20   0 1282720 273812  30836 S  74.7  1.7  76:58.71 pico_zense_simp
 6330 root      20   0 1216600 202832  28668 S  54.9  1.2  78:00.74 pico_zense_simp
 9869 root      20   0 1090648  91332  17316 S  52.6  0.6  53:14.91 python
 5955 root      20   0 1219000 204380  29220 S  51.3  1.3  77:30.70 pico_zense_simp
 4892 root      20   0  541884  52968   6368 R  49.0  0.3  51:43.33 python
 3475 root      20   0 4186844  75516   6480 S  43.8  0.5  42:19.27 rosmaster
28088 inaho-p+  20   0 3503192 480216 227252 R  36.8  3.0  17:32.98 rviz

04:34
624MB

root      5627  2.1  3.8 3069808 624092 ?      Ssl  02:46   2:10 python /root/catkin_ws/src/aspara_detector/scripts/zense_serial_idx_manager.py

https://inaho-prj.slack.com/archives/CFN0KSX61/p1585078402276000

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.