Python troubles
9 years 3 months ago #29528653
by Guy
Python troubles was created by Guy
Hi, we have a board in for development purposes and have successfully fired it up and tested it. However I'm really struggling with the python implementation. Executing the test python file cannot load the rioboard module and therefore bombs out. Also I'm finding it near impossible to find any examples of code, which is really frustrating.
Please could one of your wizards point me in the right direction, this product has a lot of potential for us.
Many thanks in advance
Please could one of your wizards point me in the right direction, this product has a lot of potential for us.
Many thanks in advance
Please Log in or Create an account to join the conversation.
- opal
9 years 3 months ago #29528660
by opal
Replied by opal on topic Python troubles
Hello,
Please provide the output Python produces. Which version of Python do you use?
Make sure that "rioboard.so" is located in Python modules directory (like: /usr/lib/python2.7/rioboard.so)
About the documentation: dev.roboteq.com/dev1/index.php/docman/ri...1-rio-datasheet/file
And we are constantly working to make this documentation better and more detailed. Until it is released please fill free to come over and ask your questions here.
As for the test itself: we have renamed few functions in RIO Python interface. Please use the following code for testing:
Regards
Please provide the output Python produces. Which version of Python do you use?
Make sure that "rioboard.so" is located in Python modules directory (like: /usr/lib/python2.7/rioboard.so)
About the documentation: dev.roboteq.com/dev1/index.php/docman/ri...1-rio-datasheet/file
And we are constantly working to make this documentation better and more detailed. Until it is released please fill free to come over and ask your questions here.
As for the test itself: we have renamed few functions in RIO Python interface. Please use the following code for testing:
import rioboard
def Test_CallEachFn():
print "Test_CallEachFn: Calling Init() ..."
rioboard.Init()
print "Test_CallEachFn: Calling WritePWMOutput() ..."
rioboard.WritePWMOutput(0, 1)
print "Test_CallEachFn: Calling ResetDigitalOutput() ..."
rioboard.ResetDigitalOutput(0)
print "Test_CallEachFn: Calling SetDigitalOutput() ..."
rioboard.SetDigitalOutput()
print "Test_CallEachFn: Calling WriteAllDigitalOutputs() ..."
rioboard.WriteAllDigitalOutputs(0xAA)
print "Test_CallEachFn: Calling ReadDigitalInput() ..."
rioboard.ReadDigitalInput( 0)
print "Test_CallEachFn: Calling ReadAllDigitalInputs() ..."
rioboard.ReadAllDigitalInputs()
print "Test_CallEachFn: Calling ReadPulseAnaInput() ..."
rioboard.ReadPulseAnaInput( 0)
print "Test_CallEachFn: Calling WriteAnaOutput() ..."
rioboard.WriteAnaOutput(0, 1)
print "Test_CallEachFn: Calling GetRawBuf() ..."
rioboard.GetRawBuf()
print "Test_CallEachFn: DONE"
Test_CallEachFn()
Regards
Please Log in or Create an account to join the conversation.
9 years 3 months ago #29528665
by Guy
Replied by Guy on topic Python troubles
Hi Opal,
Thanks for the advice, the rioboard.so module was not present in /usr/lib/python2.7/, this now imports properly.
When I run the rioboard.Init() function it flags up a DBG error, complaining about shared memory issue, is this normal?
The rioboard.WriteAllDigitalOutputs() seems to work ok though.
Are there any examples of syntax anywhere, its all a bit trial and error at the moment and a crib sheet would be very welcome!
Many thanks for your time and help
Regards
Guy
Thanks for the advice, the rioboard.so module was not present in /usr/lib/python2.7/, this now imports properly.
When I run the rioboard.Init() function it flags up a DBG error, complaining about shared memory issue, is this normal?
The rioboard.WriteAllDigitalOutputs() seems to work ok though.
Are there any examples of syntax anywhere, its all a bit trial and error at the moment and a crib sheet would be very welcome!
Many thanks for your time and help
Regards
Guy
Please Log in or Create an account to join the conversation.
- opal
9 years 3 months ago #29528667
by opal
Replied by opal on topic Python troubles
Hello Guy
About shared memory error: please make sure daemon is running. You can test it with the command:
ps -A | grep rioboard_d
It should produce something like (numbers will be different):
1926 ? 03:32:38 rioboard_d
About the documentation: I will get back to you as soon as it is ready. Alternatively you can send me your email address in PM on forum.
About "rioboard.WriteAllDigitalOutputs()" call working on your side: did you actually measure the voltage on digital outputs on the board or just executed the function?
Regards
About shared memory error: please make sure daemon is running. You can test it with the command:
ps -A | grep rioboard_d
It should produce something like (numbers will be different):
1926 ? 03:32:38 rioboard_d
About the documentation: I will get back to you as soon as it is ready. Alternatively you can send me your email address in PM on forum.
About "rioboard.WriteAllDigitalOutputs()" call working on your side: did you actually measure the voltage on digital outputs on the board or just executed the function?
Regards
Please Log in or Create an account to join the conversation.
9 years 3 months ago #29528668
by Guy
Replied by Guy on topic Python troubles
Hi Opal,
thanks for the help again! These are the results
DBG: RioBoard Shared Memory ID=0; Run "ipcs -m" command to verify
DBG: RioBoard Shared Memory segment attached to process at [0xb6fb5000]
/riofiles# ps -A | grep rioboard_d
2033 ? 00:00:25 rioboard_d
The DBG is from the rioboard.Init()
I've rigged LED's to the Digital outputs and they seem to be working ok
I'm a bit confused with rioboard.ReadDigitalInput(0) I thought it would read the current state of D0 but it returns 0 if it is either on or off.
Very much looking forward to the documentation, but thanks to your help we are certainly getting up and running now
thanks for the help again! These are the results
DBG: RioBoard Shared Memory ID=0; Run "ipcs -m" command to verify
DBG: RioBoard Shared Memory segment attached to process at [0xb6fb5000]
/riofiles# ps -A | grep rioboard_d
2033 ? 00:00:25 rioboard_d
The DBG is from the rioboard.Init()
I've rigged LED's to the Digital outputs and they seem to be working ok
I'm a bit confused with rioboard.ReadDigitalInput(0) I thought it would read the current state of D0 but it returns 0 if it is either on or off.
Very much looking forward to the documentation, but thanks to your help we are certainly getting up and running now
Please Log in or Create an account to join the conversation.
- opal
9 years 3 months ago #29528670
by opal
Replied by opal on topic Python troubles
Hello Guy
rioboard.ReadDigitalInput(0) makes no sense of course. This might have been a typo. Please consider using script I posted above in this topic (post #29528660).
Let me know if you were successful running entire test script I posted.
Regards
rioboard.ReadDigitalInput(0) makes no sense of course. This might have been a typo. Please consider using script I posted above in this topic (post #29528660).
Let me know if you were successful running entire test script I posted.
Regards
Please Log in or Create an account to join the conversation.
9 years 3 months ago #29528678
by Guy
Replied by Guy on topic Python troubles
Hi Opal,
I ran the your script and here is the output:
Test_CallEachFn: Calling Init() ...
DBG: RioBoard Shared Memory ID=0; Run "ipcs -m" command to verify
DBG: RioBoard Shared Memory segment attached to process at [0xb6f53000]
Test_CallEachFn: Calling WritePWMOutput() ...
Test_CallEachFn: Calling ResetDigitalOutput() ...
Test_CallEachFn: Calling SetDigitalOutput() ...
Test_CallEachFn: Calling WriteAllDigitalOutputs() ...
Test_CallEachFn: Calling ReadDigitalInput() ...
Test_CallEachFn: Calling ReadAllDigitalInputs() ...
Test_CallEachFn: Calling ReadPulseAnaInput() ...
Test_CallEachFn: Calling WriteAnaOutput() ...
Test_CallEachFn: Calling GetRawBuf() ...
Test_CallEachFn: DONE
D2,D4,D6,D8 LEDS lit
the DBG only occurred on the rioboard.Init() so I'm guessing everything is ok.
I am working on the analogue inputs at the moment, but unfortunately our engineering team has given me 4-20ma pressure sensors rather than the 0-5v ones i specified, so have a bit of messing about first.
I'll let you know how I get on.
Thank you for all your help
Regards
Guy
I ran the your script and here is the output:
Test_CallEachFn: Calling Init() ...
DBG: RioBoard Shared Memory ID=0; Run "ipcs -m" command to verify
DBG: RioBoard Shared Memory segment attached to process at [0xb6f53000]
Test_CallEachFn: Calling WritePWMOutput() ...
Test_CallEachFn: Calling ResetDigitalOutput() ...
Test_CallEachFn: Calling SetDigitalOutput() ...
Test_CallEachFn: Calling WriteAllDigitalOutputs() ...
Test_CallEachFn: Calling ReadDigitalInput() ...
Test_CallEachFn: Calling ReadAllDigitalInputs() ...
Test_CallEachFn: Calling ReadPulseAnaInput() ...
Test_CallEachFn: Calling WriteAnaOutput() ...
Test_CallEachFn: Calling GetRawBuf() ...
Test_CallEachFn: DONE
D2,D4,D6,D8 LEDS lit
the DBG only occurred on the rioboard.Init() so I'm guessing everything is ok.
I am working on the analogue inputs at the moment, but unfortunately our engineering team has given me 4-20ma pressure sensors rather than the 0-5v ones i specified, so have a bit of messing about first.
I'll let you know how I get on.
Thank you for all your help
Regards
Guy
Please Log in or Create an account to join the conversation.
8 years 2 weeks ago #29530232
by mjepson
Replied by mjepson on topic Python troubles
I have no rioboard_d running.
When I start it with "service rioboard_d start" it gave an error about SPI, but I solved that by having SPI running through the use of raspi-config.
But now, the daemon won't run. It doesn't give an error, it just doesn't actually start. Every time I use ps -A it is not there.
I have a brand new Raspberry B model (since the B+ and 2 won't fit with the RIO board) with the latest (and upgraded) version of Raspbian Wheeze (installed through NOOBS).
How can I get the board to work?
When I start it with "service rioboard_d start" it gave an error about SPI, but I solved that by having SPI running through the use of raspi-config.
But now, the daemon won't run. It doesn't give an error, it just doesn't actually start. Every time I use ps -A it is not there.
I have a brand new Raspberry B model (since the B+ and 2 won't fit with the RIO board) with the latest (and upgraded) version of Raspbian Wheeze (installed through NOOBS).
How can I get the board to work?
Please Log in or Create an account to join the conversation.
Moderators: opal
Time to create page: 0.067 seconds