Comments on: Programming a Raspberry Pi Robot Using Python and OpenCV http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/ Tutorials and updates from Dawn Robotics Mon, 09 Nov 2015 16:39:02 +0000 hourly 1 http://wordpress.org/?v=3.7.11 By: Alan http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-886 Mon, 04 May 2015 18:59:48 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-886 Hi Kevin,

Sorry for the delayed reply.

The command line I’m referred to in the article is the windows command line. You can get to this by opening up the run menu (hold windows key and R, or select Run in the start menu) and then type in cmd.

When the command line is open you navigate to the correct directory using the cd command and then you can run the command given.

Hope that helps, let me know if you need more info.

Regards

Alan

]]>
By: Kevin Cook http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-885 Sat, 02 May 2015 17:03:29 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-885 The instructions to install setup.py returns an invalid instruction although Python and the other elements are installed. It fails at c:\Python etc etc . Can’t get beyond that point. Any more specific guidance on how to progress this? I’m running the code from the Python command line after moving to the folder containing the websocket data.
Thanks.

Kevin.

]]>
By: Kevin Cook http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-884 Sat, 02 May 2015 11:08:31 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-884 To which command line are you referring to? I assume the one which comes up via running Pyhton27,exe? If so then all I get is a syntax error. (I used copy and paste to copy your lines to the editor.)
Or have I got it wrong again. The robot, by the way is working well and |I’m progressing to putting the ultrasound sensors on it , hence the query. I’m sure there will be more!

•Now download the py_websockets_bot library (repository) from https://bitbucket.org/DawnRobotics/py_websockets_bot/downloads
•Unpack the library to a folder and navigate to it on the command line
•Run the following command from the command line
c:\Python27\python.exe setup.py install

]]>
By: Alan http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-665 Tue, 13 Jan 2015 11:16:06 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-665 Hi Bastian,

Yeah, it can take a while to get your head around distributed robot control, although it sounds like your control program is shaping up nicely. :)

I think that it would be a good feature to provide a way that allows people to easily add their own GPIO code to the web server, or to add in custom websockets commands. Although I need to have a think about how this could be done elegantly. In the meantime, if you wanted to add your own commands to the websocket interface then you can modify robot_web_server.py on the robot and eddit the on_message routine (line 83 onwards).

Regards

Alan

]]>
By: Bastian http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-657 Mon, 12 Jan 2015 19:21:03 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-657 Hi Alan,
Thanks again for you response. Your method works for collecting readings from a sensor. I used it for a script comparing the Seeed ultrasonic sensor (controlled by the mini driver) and the HC-SR04 (through the GPIO pins of the Pi). It cannot be used for controlling devices through the Pi. Example: I’m using different colors of led’s to give visual feedback on the routines in process at the bot. (“blink_red” is shorter than a sensible print-statement and easier to follow while the bot rides along).
I loved the possibility of running remote scripts (IDLE on my W8 machine works friendlier than the version on the Pi. It saves a lot of time copying code to the Pi for execution. And: I’m also playing with openCV together with some code snippets of face++, which is a bit heavy computing for the Pi)
I was hoping the GPIO library could be copied into the Python lib on my W8 computer so that IDLE could use and interpret it. My thought: at the end, WebSockets only transfers compiled instructions that will be executed by the Pi-CPU. It’s obvious: I better should leave it for a while ;-0)

]]>
By: Alan http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-655 Mon, 12 Jan 2015 11:42:26 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-655 Hi there,

I’m afraid that there’s no way I know of that you can get the code ‘import RPi.GPIO as GPIO’ to work on a remote Windows 8 machine as that machine simply won’t have the GPIO pins to talk to. Instead, you need to write GPIO code on the Raspberry Pi, and git it to send back data to your script running on Windows 8. We talk a little bit about how you can do this in the post on attaching sensors to your Pi. In the section titled ‘Connecting Sensors to the Raspberry Pi’. Here you essentially write a bit of code to read sensors using the GPIO pins, and then send back data as sensor data which the py_websockets_bot library can see.

Hope that helps. If you need anything explained in more detail, please let me know.

Regards

Alan

]]>
By: Bastian http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-651 Sat, 10 Jan 2015 16:11:53 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-651 This works fine and opens a lot of perspectives/opportunities!
Just one question pending: where/how can one copy the modules and classes from the Pi Robot to a W8-computer to enable using GPIO pins?
Without those one will soon get:
“import RPi.GPIO as GPIO
ImportError: No module named RPi.GPIO”

]]>
By: Adrian http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-639 Mon, 05 Jan 2015 10:48:56 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-639 In python idle you can just run the script given edit default “local host ” to your ip address.
See below

parser.add_argument( “hostname”, default=”192.168.137.110″, nargs=’?', help=”The ip address of the robot” )
This save going to the command line you can just work in normal python environment.
Hope this helps

]]>
By: james martel http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-495 Sat, 27 Sep 2014 01:14:24 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-495 Hi
I have managed to get a few different types of sensors to report values back to my pi’s usi ng the latest SD image on both REVB and REVB+ 4 Wheeled drive robots. I have followed alan’s advice to tie the trig and echo pins on my 4 pin ultrasonic sensor together and got a reading that responded to my moving hand. I am also using some i2c sensors but I am using a linksprite raspberrypi hub/ interface with arduino IDE code to read them….not proficient or unable to find python example code. Basically now I know all my sensors work on this robot…but need to write up the sensor config.py files for each to get them to display via websockets. It displays temp…light or dark…lines…motion…compass…3 axis accelerometer…. now to get sound or speech recognition….HAL9000 here I come.

]]>
By: Mick F http://blog.dawnrobotics.co.uk/2014/06/programming-raspberry-pi-robot-using-python-opencv/#comment-464 Thu, 21 Aug 2014 23:57:26 +0000 http://blog.dawnrobotics.co.uk/?p=554#comment-464 Alan,
Amazing… All is working. (using IDLE, the command line failed)
It was the following line that confused me, (help=”The ip address of the robot”)
parser.add_argument( “hostname”, default=”localhost”, nargs=’?', help=”The ip address of the robot” )
I took it too literal and thought this was the ACTUAL IP address!!
I tried the battery_test.py to check and after changing the IP address, perfect.

Python 2.7 is actually IDLE for windows, confusing with the Raspberry pi have the same program name.

I Must remember not to try and browse the Internet when connected to the PI robot!!

I will now be setting up my grandsons PC for accessing the pi_robot :)

Really excellent work.
Mick

]]>