mcdeoliveira / rcpy Goto Github PK
View Code? Open in Web Editor NEWPython Library for Robotics Cape on Beaglebone Black and Beaglebone Blue
License: MIT License
Python Library for Robotics Cape on Beaglebone Black and Beaglebone Blue
License: MIT License
I'm working on a BeagleBone Blue running the latest image (2018-10-7) suggested in the Strawson online manual, flashed to onboard storage.
I've started getting frequent crashes working in python, controlling dc motors. A typical crash output is included below.
I can reproduce the issue reliably with steps like:
Most of the time, it crashes with a segmentation fault in Python. Sometimes it will exhibit other erratic behavior, like move one motor but not the other, or run at 100% duty cycle when 20% was specified. Sometimes, it runs fine. It looks like something isn't getting properly cleaned up.
I was also able to duplicate the issue as follows, outside of the cloud9 IDE:
Console output:
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.114586] Internal error: : 1028 [#1] PREEMPT SMP ARM
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.233418] Process rc_test_motors (pid: 1884, stack limit = 0xd2026218)
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.240148] Stack: (0xd2027e18 to 0xd2028000)
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.244526] 7e00: 00000001 00000320
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.252745] 7e20: 00001f40 d2027e7c db422900 c081df48 db422920 00001f40 00000000 dc6ce910
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.260962] 7e40: d2027e74 d2027e50 c081b72c c081df54 c1504dc8 00000000 dc60c994 db422900
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.269180] 7e60: 00000004 dc568b80 d2027eb4 d2027e78 c081be7c c081b618 00001f40 00009c40
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.277396] 7e80: 00001f40 00000000 00000001 77533b88 00000004 c081be00 dc6ce900 00000003
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.285613] 7ea0: 00000000 d2027f68 d2027ecc d2027eb8 c092f108 c081be0c c092f0e0 dc6ce900
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.293830] 7ec0: d2027ee4 d2027ed0 c03855c4 c092f0ec 00000004 dc6ce900 d2027f1c d2027ee8
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.302048] 7ee0: c0384c10 c0385580 00000003 00000000 db5fa988 c0384b18 dc788480 bed0d558
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.310265] 7f00: d2027f68 00000000 bed0d558 00000004 d2027f34 d2027f20 c02f9258 c0384b24
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.318482] 7f20: 00000004 dc788480 d2027f64 d2027f38 c02f943c c02f923c 00000000 c031bba0
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.326699] 7f40: c1504dc8 dc788480 00000003 00000000 dc788480 bed0d558 d2027fa4 d2027f68
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.334916] 7f60: c02f96a4 c02f9394 00000003 00000000 d2027fa4 77533b88 c030e758 b6f30620
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.343133] 7f80: b6f30000 00000041 00000004 c01090e4 d2026000 00000000 00000000 d2027fa8
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.351351] 7fa0: c0108f00 c02f9654 b6f30620 b6f30000 00000003 bed0d558 00000004 b6f3061c
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.359568] 7fc0: b6f30620 b6f30000 00000041 00000004 00000000 00000000 004fd000 00000000
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.367785] 7fe0: 00000000 bed0d554 b6ef2363 b6ed13b6 200d0030 00000003 00000000 00000000
Message from syslogd@beaglebone at Oct 18 19:38:42 ...
kernel:[ 222.446978] Code: e5980000 e6ffa07e eb049325 e5985028 (e1d570b0)
Segmentation fault
Thoughts or additional troubleshooting suggestions appreciated!
Thanks,
The C code from strawson design no longer require Sudo access to operate. However, using this library still requires sudo access, else it errors out.
I can provide examples if needed, however the code provided for examples will reflect this.
Specifically battery voltage and DC?
What is needed to add these
Hello Friend. whenever I try to run rc_mip_balance.py. returns errors I have the last stretch image and followed all the installation steps.
rcpy.gpio as gpio File "/usr/local/lib/python3.5/dist-packages/rcpy/gpio.py", line 4, in import gpiod ImportError: libgpiod.so.2: can not open shared object file: No such file or directory Initiating cleanup ... Done with cleanupinstallation.
Brand new Image with rc_version 0.3.4
sudo apt-get install python3 python3-pip
sudo apt-get install python3-dev
Installed 1 Gb swap according to this:
https://sheldondwill.wordpress.com/2013/12/14/beaglebone-black-ubuntu-adding-a-swapfile/
Here is the error:
root@beaglebone:/home/debian# sudo pip3 install rcpy
Downloading/unpacking rcpy
Downloading rcpy-0.3.5.tar.gz
Running setup.py (path:/tmp/pip-build-9ntf9he6/rcpy/setup.py) egg_info for package rcpy
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
Installing collected packages: rcpy
Running setup.py install for rcpy
building 'rcpy._rcpy' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c src/_rcpy.c -o build/temp.linux-armv7l-3.4/src/_rcpy.o
arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.4/src/_rcpy.o -lroboticscape -lrt -o build/lib.linux-armv7l-3.4/rcpy/_rcpy.cpython-34m.so
building 'rcpy._mpu9250' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c src/_mpu9250.c -o build/temp.linux-armv7l-3.4/src/_mpu9250.o
src/_mpu9250.c: In function ‘mpu9250_read’:
src/_mpu9250.c:335:26: error: ‘rc_imu_read_mutex’ undeclared (first use in this function)
pthread_mutex_lock( &rc_imu_read_mutex );
^
src/_mpu9250.c:335:26: note: each undeclared identifier is reported only once for each function it appears in
src/_mpu9250.c:338:25: error: ‘rc_imu_read_condition’ undeclared (first use in this function)
pthread_cond_wait( &rc_imu_read_condition, &rc_imu_read_mutex );
^
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-9ntf9he6/rcpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-7snt5rok-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.4
creating build/lib.linux-armv7l-3.4/rcpy
copying rcpy/button.py -> build/lib.linux-armv7l-3.4/rcpy
copying rcpy/led.py -> build/lib.linux-armv7l-3.4/rcpy
copying rcpy/encoder.py -> build/lib.linux-armv7l-3.4/rcpy
copying rcpy/mpu9250.py -> build/lib.linux-armv7l-3.4/rcpy
copying rcpy/gpio.py -> build/lib.linux-armv7l-3.4/rcpy
copying rcpy/init.py -> build/lib.linux-armv7l-3.4/rcpy
copying rcpy/motor.py -> build/lib.linux-armv7l-3.4/rcpy
creating build/lib.linux-armv7l-3.4/test
copying test/test_led.py -> build/lib.linux-armv7l-3.4/test
copying test/test_mpu9250.py -> build/lib.linux-armv7l-3.4/test
copying test/test_encoder.py -> build/lib.linux-armv7l-3.4/test
copying test/test_motor.py -> build/lib.linux-armv7l-3.4/test
copying test/init.py -> build/lib.linux-armv7l-3.4/test
copying test/test_rcpy.py -> build/lib.linux-armv7l-3.4/test
running build_ext
building 'rcpy._rcpy' extension
creating build/temp.linux-armv7l-3.4
creating build/temp.linux-armv7l-3.4/src
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c src/_rcpy.c -o build/temp.linux-armv7l-3.4/src/_rcpy.o
arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.4/src/_rcpy.o -lroboticscape -lrt -o build/lib.linux-armv7l-3.4/rcpy/_rcpy.cpython-34m.so
building 'rcpy._mpu9250' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c src/_mpu9250.c -o build/temp.linux-armv7l-3.4/src/_mpu9250.o
src/_mpu9250.c: In function ‘mpu9250_read’:
src/_mpu9250.c:335:26: error: ‘rc_imu_read_mutex’ undeclared (first use in this function)
pthread_mutex_lock( &rc_imu_read_mutex );
^
src/_mpu9250.c:335:26: note: each undeclared identifier is reported only once for each function it appears in
src/_mpu9250.c:338:25: error: ‘rc_imu_read_condition’ undeclared (first use in this function)
pthread_cond_wait( &rc_imu_read_condition, &rc_imu_read_mutex );
^
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-9ntf9he6/rcpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-7snt5rok-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-9ntf9he6/rcpy
Storing debug log for failure in /root/.pip/pip.log
I am currently using Ubuntu 16.04.5 LTS on Beaglebone Blue after following the John Hopkins Edumip/ROS tutorial. I continue to get stuck while trying to install libgpiod. Here is my process:
sudo apt-get update
and sudo apt-get upgrade
./autogen.sh --enable-tools=yes --enable-bindings-python --prefix=/usr/local
checking sys/poll.h usability... yes checking sys/poll.h presence... yes checking for sys/poll.h... yes checking linux/gpio.h usability... no checking linux/gpio.h presence... no checking for linux/gpio.h... no configure: error: linux/gpio.h header not found (needed to build the library)
I want to note that I have been successful in installing rcpy on Debian 9.3 however I ran problems when trying to install ROS. I tried the above process for Ubuntu.
I would appreciate any help and advise on switching back to a specific Debian version!
I'm running a program which drives two motors on M1 and M2 ports on beaglebone Blue.
This program has run today multiple times, and has errored out the last two times. No hardware changes were made.
debian@beaglebone:~/SCUTTLE/software/python/basics$ sudo python3 L3_telemetry.py
/usr/local/lib/python3.7/dist-packages/rcpy-0.5.1-py3.7-linux-armv7l.egg/rcpy/__init__.py:116: UserWarning: > Robotics cape initialized
warnings.warn('> Robotics cape initialized')
/usr/local/lib/python3.7/dist-packages/rcpy-0.5.1-py3.7-linux-armv7l.egg/rcpy/__init__.py:127: UserWarning: > Installing signal handlers
warnings.warn('> Installing signal handlers')
WARNING: no accelerometer calibration data found
Please run rc_calibrate_accel
WARNING: no accelerometer calibration data found
Please run rc_calibrate_accel
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
DEBUG: Adafruit_BBIO: set_pin_mode() :: Pinmux file: /sys/devices/platform/ocp/ocp:P9_23_pinmux/state, mode: gpioDEBUG: Adafruit_BBIO: set_pin_mode(): beaglebone_blue() is TRUE; return BBIO_OK
DEBUG: Adafruit_BBIO: set_pin_mode() :: Pinmux file: /sys/devices/platform/ocp/ocp:P9_28_pinmux/state, mode: gpioDEBUG: Adafruit_BBIO: set_pin_mode(): beaglebone_blue() is TRUE; return BBIO_OK
ERROR in rc_pwm_init, export failed for subsystem 1 channel 0
tried accessing /sys/class/pwm/pwm-4:0/enable
ERROR in rc_motor_init, failed to initialize pwm subsystem 1
Traceback (most recent call last):
File "L3_telemetry.py", line 21, in <module>
import L2_speed_control as sc
File "/home/debian/SCUTTLE/software/python/basics/L2_speed_control.py", line 8, in <module>
import L1_motors as m # for controlling motors
File "/home/debian/SCUTTLE/software/python/basics/L1_motors.py", line 7, in <module>
import rcpy.motor as motor
File "/usr/local/lib/python3.7/dist-packages/rcpy-0.5.1-py3.7-linux-armv7l.egg/rcpy/motor.py", line 2, in <module>
from rcpy._motor import *
SystemError: initialization of _motor failed without raising an exception
Initiating cleanup...
Done with cleanup
debian@beaglebone:~/SCUTTLE/software/python/basics$
I wanted to know how I could write a python script for reading RC-signals on the beagle bone PRU?
Running this results in the following:
/usr/local/lib/python3.5/dist-packages/rcpy/__init__.py:116: UserWarning: > Robotics cape initialized warnings.warn('> Robotics cape initialized') /usr/local/lib/python3.5/dist-packages/rcpy/__init__.py:127: UserWarning: > Installing signal handlers warnings.warn('> Installing signal handlers') Traceback (most recent call last): File "/var/lib/cloud9/examples/robot/python/rcpy_blink.py", line 4, in <module> import rcpy.gpio as gpio File "/usr/local/lib/python3.5/dist-packages/rcpy/gpio.py", line 4, in <module> import gpiod ImportError: libgpiod.so.2: cannot open shared object file: No such file or directory Initiating cleanup... Done with cleanup
i tested several other examples and they work fine, including ADC(Thank you sooo much!)
rc_version states 0.4.4
It would be nice to be able to read the pressure/temperature data from the BMP280 from rcpy. (Yes, you can get temperature from the IMU, but that's a junction temperature for calibrating biases, while the BMP280 provides air temperature.)
Looks like you have a great package here for working with the BeagleBone Blue.
I'm working with a Blue running "BeagleBoard.org Debian Image 2017-04-23"
I'm having trouble getting rcpy installed.
I've installed Robotics_Cape_Installer, ctrl and rcpy.
In ctrl I ran sudo python3 setup.py install and it appears to have installed without error.
However when installing in rcpy in get an error
$ cd rcpy
$ sudo python3 setup.py install
/usr/lib/python3/dist-packages/setuptools/dist.py:333: UserWarning: Normalizing '0.1a' to '0.1a0'
normalized_version,
running install
running bdist_egg
running egg_info
writing dependency_links to rcpy.egg-info/dependency_links.txt
writing rcpy.egg-info/PKG-INFO
writing top-level names to rcpy.egg-info/top_level.txt
reading manifest file 'rcpy.egg-info/SOURCES.txt'
writing manifest file 'rcpy.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
running build_ext
building 'rcpy.mpu9250' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c src/_mpu9250.c -o build/temp.linux-armv7l-3.5/src/_mpu9250.o
src/_mpu9250.c: In function ‘mpu9250_read’:
src/_mpu9250.c:335:26: error: ‘rc_imu_read_mutex’ undeclared (first use in this function)
pthread_mutex_lock( &rc_imu_read_mutex );
^~~~~~~~~~~~~~~~~
src/_mpu9250.c:335:26: note: each undeclared identifier is reported only once for each function it appears in
src/_mpu9250.c:338:25: error: ‘rc_imu_read_condition’ undeclared (first use in this function)
pthread_cond_wait( &rc_imu_read_condition, &rc_imu_read_mutex );
^~~~~~~~~~~~~~~~~~~~~
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
I don't know where rc_imu_read_mutex and rc_imu_read_condition are defined.
Any suggestions?
--Mark
Just a reminder that I need to add documentation for the adc functionality.
debian@beaglebone:/var/lib/cloud9$ cat /etc/dogtag
BeagleBoard.org Debian Image 2018-03-05
debian@beaglebone:/var/lib/cloud9$ rc_version
0.4.2
Running latest image and version of Robotics Cape. I've attached a log of the failure. Occurs after running: sudo pip3 install rcpy
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.