- Forum
- RIO I/O Expansion Card and Navigation Computer
- Linux Installation & Programming
- Python Documentation
Python Documentation
Just wanted to ask if there is any detailed information yet regarding the Python implementation for the RIO. Any help or exampleswould be appreciated.
Many Thanks
Guy Halligan
Please Log in or Create an account to join the conversation.
- opal
Please take a look at file rioboard_test.py and RioBoard.h provided along with the rest of RIO software.
The first one is an example of how to call Python bundle functions from RIO library. The second one (C-header file) contains definitions for all functions the library provides, with some comments.
If this information was not enough don't hesitate to drop another messages here with more detailed question, like describing what exactly are you having trouble to find.
Regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- opal
Just try:
#import rioboard
Please Log in or Create an account to join the conversation.
#import rioboard
do nothing? Is it not just a comment with that hashtag?
import rioboard
Returns:
Traceback (most recent call last) :
File "<pyshell#1>, line 1, in <module>
import rioboard
ImportError: No module named rioboard
Running the rioboard_test.py gives an syntax error calling the first function (rioboard.Init()) but it doesnt complain on the module import.
This is done on e fresh install with your recommended files ive got from you in recent discussion. All ive done before trying this is running the rioboard_test
Also ive tried in both Python 2.7.3 and Python 3.2.3
Please Log in or Create an account to join the conversation.
- opal
You are right, sorry for the typo.QuiXXotic wrote: Well i might be completly wrong here but doesnt
#import rioboard
do nothing? Is it not just a comment with that hashtag?
Please try starting the Python shell from the "/riofiles" directory to find out if it is the reason.import rioboard
Returns:
Traceback (most recent call last) : File "<pyshell#1>, line 1, in <module> import rioboard ImportError: No module named rioboard
Running the rioboard_test.py gives an syntax error calling the first function (rioboard.Init()) but it doesnt complain on the module import.
This is done on e fresh install with your recommended files ive got from you in recent discussion. All ive done before trying this is running the rioboard_test
Also ive tried in both Python 2.7.3 and Python 3.2.3
Alternatively modify sys.path for your Python installation adding "/riofiles" to it:
export PYTHONPATH=$PYTHONPATH:/riofiles
We will add this to future versions of RIO Board software update script.
Please Log in or Create an account to join the conversation.
After second reboot since rioboard installation the daemon now starts to mess up again it seems. I see the starting script during bootup but when i start the C rioboard_test it complains about the shared memory. So i move into
/etc/init.d
./rioboard_d start
Then i start the C rioboard_test and it seems to work. Then i stop it and start the python rioboard_test.py
python /riofiles/raspio-src/rioboard_test.py
Test_CallEachFn: Calling init() ...
DBG: RioBoard Shared Memory ID=32769; Run "ipcs -m" command to verify
DBG: RioBoard Shared Memory segment attached to process at [0xb6f67000]
Test_CallEachFn: Calling SetPWMChannel() ...
Traceback (most recent call last):
File "/riofiles/raspio-src/rioboard_test.py", line 29, in <module>
Test_CallEachFn()
File "/riofiles/raspio-src/rioboard_test.py", line 7, in Test_CallEachFn
rioboard.SetPWMChannel(0,1)
AttributeError: ´module´object has no attribute ´SetPWMChanell`
I removed SetPWMChannel from the test program just to see what happened:
Test_CallEachFn: Calling init() ...
DBG: RioBoard Shared Memory ID=32769; Run "ipcs -m" command to verify
DBG: RioBoard Shared Memory segment attached to process at [0xb6f66000]
Test_CallEachFn: Calling ResetDigitalOutput() ...
Test_CallEachFn: Calling SetDigitalOutput() ...
Test_CallEachFn: Calling WriteDigitalInput() ...
Traceback (most recent call last):
File "/riofiles/raspio-src/rioboard_test.py", line 29, in <module>
Test_CallEachFn()
File "/riofiles/raspio-src/rioboard_test.py", line 13, in Test_CallEachFn
rioboard.WriteDigitalInput(0,1)
AttributeError: ´module´object has no attribute ´WriteDigitalInput`
Do i mess up with the sudo rights or why doesnt anything work as it should? :S
Please Log in or Create an account to join the conversation.
- opal
Yes - keep it in startup script.QuiXXotic wrote: Ok! that made it work kind of. Can i put that export command into the startup script since now i have to type it in everytime ive rebooted?
You seem to have an obsolete Python test file. Please try the attached one:QuiXXotic wrote: After second reboot since rioboard installation the daemon now starts to mess up again it seems. I see the starting script during bootup but when i start the C rioboard_test it complains about the shared memory. So i move into
and start the script/etc/init.d./rioboard_d start
Then i start the C rioboard_test and it seems to work. Then i stop it and start the python rioboard_test.pyand get some errors.python /riofiles/raspio-src/rioboard_test.pyTest_CallEachFn: Calling init() ... DBG: RioBoard Shared Memory ID=32769; Run "ipcs -m" command to verify DBG: RioBoard Shared Memory segment attached to process at [0xb6f67000] Test_CallEachFn: Calling SetPWMChannel() ... Traceback (most recent call last): File "/riofiles/raspio-src/rioboard_test.py", line 29, in <module> Test_CallEachFn() File "/riofiles/raspio-src/rioboard_test.py", line 7, in Test_CallEachFn rioboard.SetPWMChannel(0,1) AttributeError: ´module´object has no attribute ´SetPWMChanell`
Sorry for the confusion - we are working hard to bring update scripts, documentation and tests up to date. Please let us know if the attached script worked for you.
Please Log in or Create an account to join the conversation.
Im not 100% sure how and where to add that
export PYTHONPATH=$PYTHONPATH./riofiles
this is what wish to do since the daemon isnt starting as it should and the pythonpath arent permanently added.
1)autologin
2)export pythonpath
3)start rioboard daemon
4)start a.py script
I hoped to only need to solve the autologin and start a script problem.
Looking forward to updated files and documentation. Really want to get this to work. We would like to use this product for a serialproduced product.
Please Log in or Create an account to join the conversation.
- opal
To figure out the distributive details please execute:
cat /etc/*-release
About your intention to use Rio Board in your product - this is an exciting news. From our side we will do our best to simplify/speedup your work.
Please Log in or Create an account to join the conversation.
- Forum
- RIO I/O Expansion Card and Navigation Computer
- Linux Installation & Programming
- Python Documentation