My first hurdles

The brains of your robot

My first hurdles

Postby Bastian » Fri Nov 28, 2014 12:23 pm

Hi,
Let me start with some introduction. I'm an absolue novice in robotics. Just recently started realising a childhoods dream by purcasing the assembly kit. Great stuff and neat delivery! I finished assembly and encountered and solved the first "no-show" (i.e. no accesspoint). My last serious coding was done in COBOL and assembly on MVS, using IBM-JCL (yep: I'm that old). So I'm doing hard time study on Linux, Python, HTML and JavaScript.All this just to point out that I'm (still) an absolute novice on these topics as well.

At this point I encounter two challenges for which I cannot find a soluttion yet and I long for some guidance on a third topic.

My first challenge is the remote control. This seems to be dependant of the browser or HTTP or something like that. Entering 192.168.42.1 on an Ipad-air gives a perfect camera view and shut-down button, but no control buttons for the wheels and servo's. Using IE on my desktop (Windows9') gives me working controls, but no camera image. Using Chrome on my desktops shows all, but the controls can only be touched with the mouse (I have a SmartTouch desktop). Debugging the HTML in IE stops a the imagesize line, but changing that doesn´t help. I´ve been browsing the JS, CSS and HTML files in the www folder but have to admit that my knowledge is still far too small. Could anyone give me some practical hints'?~

My second challenge is the network configuration. As long as I´m connected to the Raspberry through a utp cable I can SSH or use a VNC app. Works, but for expermenting with the bot I´m convicted to the attack. Trying to SSH or use a VNC terminal through wifi gives different kind of no_go´s. Cannot this be done? Do I need a second wifi dongle? Or can I change some config here?

My third topic is about my ambitions. I like to get the robot working autonomously. First use some basic programmes for autonomous rides, than adding sensors (distance, contact) and hopefully using sight in the future as well. I´ve spend allready a lot of hours browsing the overwelming info on these topics, but I just cannot find answers for some basic questions like: how can I start a pyscript on the robot and which pins can I use on the Arduino (or should I do that on the Raspberry'?) to connect additional sensors. There is a lot of documentation and sources for me to study, but I cannot find the starting point, which makes all the rest a bit too fuzzy for me.

My excuses for the epic size of this. I won´t do that anymore. This was merely driven by my passion to learn fast.
Be assured that I appreciate every reaction on this!
Bastian
 
Posts: 23
Joined: Fri Nov 28, 2014 11:30 am

Re: My first hurdles

Postby Alan » Wed Dec 03, 2014 6:33 pm

Hi Bastian,

Welcome to the forum. :) Sorry for the delayed reply, it often takes a while for the first post to be approved unfortunately.

Hopefully you've been able to make a bit of progress since your post, but in answer to your questions

Sorry to hear the web interface is being tempermental. Could you try Chrome on your Ipad? Also, depending upon how the page has loaded in Safari the controls may just be out of sight, can you try scrolling left and right a bit? I may need to tweak the web interface a bit to make it more reliable on a wider range of browsers.

For the network configuration you can setup the Wifi to connecto to your router. This is all done via the command line unfortunately by editing /etc/network/interfaces. Lots of tutorials on Google about setting up raspberry pi wifi. This looks like a good tutorial, they have a section on command line setup towards the bottom.

To write scripts for the robot, have a look at this blog post. The post talks about writing scripts that run on a controlling computer. But you can also copy scripts that aren't too computationaly heavy to the Pi, ssh in and run them from there.

To add extra sensors onto the robot, this blog post shows how it can be done.

Anyway, hopefully that helps a bit. Please let me know if you need any more detail on any of the areas.

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am

Re: My first hurdles

Postby Bastian » Wed Dec 03, 2014 10:11 pm

Hi Alan,

Thnx for answering! I realize I’m a 100% novice and probably ask for directions on stuff everyone else already knows. I've been playing a lot since my 1st post (it’s real fun!) and found out some bits and pieces in the mean while. Maybe it’s helping new starters a bit.
Browser:
Safari on Ipad doesn’t return the screen height and width correctly, so on Ipad the HTML interface only works in portrait mode (impatient as I am, the reason why I couldn’t find the controls in the first place). That works fine, so no reason for me to add something to the HTML config. IE (11) doesn’t accept streaming images anyway. MS-help suggests compatibility mode, Xactive filters, de-activate trace security, but nothing will help. Finally installing Mozilla Firefox did the trick; works correct at once.
Connecting:
I managed to get properly connected to the pi_web_server finally. For a VNC-connection one should use port 5901 i.s.o. the standard 5900. On my desktop I use TighVNC, on my Ipad only Vnc viewer of RealVNC worked fine (I only tried the free apps). For SSH on my Ipad, I use iTerminal of comcsoft. The tutorial you point out is very informative, so I suggest you put a link somewhere on your site tutorials.
Remote scripting:
I’ve read the blog, but am still searching for answers on a very basic question: How can I start a remote Python script? Do I use a command in the PyPe shell (and so, what’s the syntax)? Are there constraints for the location of the libraries (should I copy them to my desktop or include the pi_Path?). Probably these are no-brainers as well, but I just cannot find the right info or examples.
Adding sensors:
I reread the blog you indicate. It is informative, but again I’m left with some basic questions. I cannot figure out how the mini_driver pins can be used. For example the blog states that the only pins the ultrasonic sensor can use are D12. Why? How can I learn how to config the pins and their usage? The reason I’m seeking for info on the use of the Arduino, is that I found a lot of scripting examples for sensors, but they are all written for the GPIO pins of the Raspberry and do nee different libraries, etc. (On top: I’m lacking knowledge off Python to judge if they can be combined with the pi_web_sockets)
Another example: are the signals for the motors (wheels), digital (meaning once started, they keep on running until a stop is send) or analog (so I have to code duration functions for spinning)? Again: Sorry, but I’ve just started in robotics as well as coding and using Linux. (Another blunt one: why are red and black reversed/mirrored? I just cannot understand the operating principals and cannot find the right info on internet)
At all: I revive the fun I had when I got the first Commodore C64! Back in those days it also meant probing, searching, puzzling and trying to master the miracle at the end of the day. Raspberry and your service brought robotics into scope and electronics, linux, python, html now offer the same pleasure. Dawn offers great stuff to star with; good quality and support.
Cheers
Bas
Bastian
 
Posts: 23
Joined: Fri Nov 28, 2014 11:30 am

Re: My first hurdles

Postby Alan » Mon Dec 08, 2014 2:49 pm

Hi Bastian,

Very sorry for the delayed reply to this. I was out at the CamJam PiWars competition this weekend, and so everything got very hectic...

Thanks for the update on the browsers, I have a few changes I'm planning for the next release of the web interface so will make sure to improve the performance on iOS. I think that I may need to hire an experienced web developer if I want to make it work reliably on IE 11. :)

To start the Python scripts on the Pi, I tend to just ssh in and run them from the command line. No restriction on the location of libraries etc if you're using the py_websockets_bot library as it just connects to localhost to communicate with the web server.

For the sensors, it may help if you have a look at the firmware that runs on the mini driver. If you look in the bottom half of the 'loop()' function (line 345 or so) you should see the code that reads the sensors. We only have 1 pin that can handle the Ultrasonic sensor at the moment because it's quite a heavy process to read it. You could alter the code to add more Ultrasonic sensors if you want, or you could also attach the sensor to you Pi's GPIO pins and read them using Python. The basic idea with sensors attached to the mini driver is that you should just be able to plug digital or analog sensors into the mini driver, and then see results from them with py_websockets_bot. The example program get_sensor_readings.py is great for seeing this in action.

For the wheel motors, you set motor speeds using the set_motor_speeds command, and then need to resend the speed every second or so. This is because if you don't repeatedly send the speed, then the mini driver will shut off the motors as a saftey feature (so that the robot doesn't drive into a wall if WiFi is lost).

Hope some of that helps and it's not too confusing in places. Always happy to help out if you have code that you're trying to get running and want me to have a look at to get the robot to do various things.

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am

Re: My first hurdles

Postby Bastian » Wed Dec 10, 2014 10:19 am

Hi Alan,

Thanks for your reply. It helped me out. Together with your other posts on the structure of the software, it helped me a good way along.

Cheers,
Bas
Bastian
 
Posts: 23
Joined: Fri Nov 28, 2014 11:30 am


Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest