Raspberry Pi Camera Robot (Chassis Bundle)

If you need technical help with anything you've bought from Dawn Robotics, please post here.

Raspberry Pi Camera Robot (Chassis Bundle)

Postby jarrah » Fri Apr 25, 2014 4:57 pm

Hello,

I'm having issues making my recently delivered camera robot work, so I'd like to ask some questions to help me troubleshoot the issues please.

Useful Info:
- I'm using the supplied Edimax EW-7811Un wifi module.
- I'm powering it via a 5v mains supply for the time being (until the batteries arrive).
- I'm using the SD card image downloaded from this site.

1 - Are there any commands I can use to directly test movement of the wheels and pan/tilt mechanism of the robot without using the webpage?
- When the Pi boots up, the servos make a constant clicking noise, and I can see it making minute movements. I would like to try and manually move the camera to see if there's any connectivity issues.

2 - Should I use specific browsers to manoeuvre the robot?
- The first time I booted, I connected to the robot via wifi from my MacBook and opened the webpage via Google Chrome. The video was working fine, but only the left joystick was visible. However when I tried to move the nipple, the clicking noise on the servos started and they wouldn't move at all. Does it only work on specific browsers? I initially tried via my iPad but only the video was displayed, so should it work on there?

3 - How do I update the code to take advantage of the latest additions I see being applied on the code repository?
- I wonder if new code updates could help with some of the issues I'm experiencing, so I know a git pull command would pull the latest code changes, but how and where do I then copy the updates to?

I can make the servo clicking noise stop by unplugging the Mini Driver Board USB from the Pi (seeing as that's it's only power supply), and it still does the clicking when the board's switch is off when plugged back in.

Unfortunately after the first boot of the Pi, I'm now no longer able to connect via wifi (I can see the AP, but not connect - perhaps DHCP has broken), or when on a wired connection browse to the Pi's local IP to view the stream. Command line access is fine when on a wired network so I'll be able to run any commands for troubleshooting.

Any pointers would be great thanks!
jarrah
 
Posts: 6
Joined: Fri Apr 25, 2014 4:25 pm

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby jarrah » Sat Apr 26, 2014 5:26 pm

Good news is it's all working now that I'm using the batteries. :)

If I'm using mains power, I guess that batteries are still needed to fully power the Mini Driver Board? I presume that the USB power output from the Pi into the board isn't enough to power it all properly? Are there any workarounds, such as using the jumper leads to supply power from GPIO pins to the +/- battery pins on the Driver Board?

Can the joystick sensitivity be reduced because I find it can turn too quick before I have time to respond (due to the wifi lag)?

In terms of browser compatibility, it does now work ok on my iPad, must just have been an issue with powering the Pi via mains.

One question does remain though, how do I update all the code to use the latest updates please? I saw a comment about having a button to power down the Pi, as I'd certainly find that useful. :)

Another thing, does the camera set light exposure when first run? I found that it doesn't adjust as I go form light to dark areas?

Thanks for a fantastic product! I look forward to tinkering and adding extras to it over time.
jarrah
 
Posts: 6
Joined: Fri Apr 25, 2014 4:25 pm

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby Alan » Sat Apr 26, 2014 5:38 pm

Hi Jarrah,

Welcome to the forum. :) Also, sorry your post didn't appear straight away, I have an approval system in place to combat spam.

Sorry to hear you're having problems with your robot, I'll see if I can offer some pointers to get you going. Firstly, if running the Pi from a wall socket, then this will provide power to the Mini Driver board via both the USB cable, and the red and black jumper wires that are attached to the GPIO pins. The reason for 2 sets of wires is that the GPIO wires are needed to let the Mini Driver power the Pi when the robot is running off batteries (it doesn't seem to be possible to power the Pi ia the USB cable).

Power via the USB should power the Atmega8 chip on the Mini Driver and should also allow you to move the servos, (even when its power switch is off) but the motors won't move until you attach a battery pack to the mini driver and turn on the switch.

In answer to your questions

1. The file robot_control_test.py should make the pan/tilt head move back and forth. To run it you first need to stop the web server, so you'd run

sudo service robot_web_server stop
python robot_control_test.py

2. For the web interface, an up to date version of Chrome or Firefox should be ideal. The left joystick controls the motors, so won't do anything until you have batteries, but the right joystick controls the neck. There will be a short delay on start up before the joysticks are responsive as the web server has to connect via serial over the usb cable to the mini driver, but it shouldn't last for too long.

Can you navigate to <IP_ADDRESS_OF_PI>/logs.html and send me the output please?

A little bit of jitter on the neck servos can happen as the servos seek to go to a target angle, but I'm not sure about clicking. With the power turned off, can you turn the neck servos back and forth?

3. A new version of the software is going to be released this week, the main thing that this will bring is faster video streaming and support for more WiFi dongles. The current software should work to get the robot moving so I don't think that getting the new code is worth it at the moment.

The WiFi access point not working properly is a bit odd, but can be an indication of power supply problems. How many amps is your power supply rated for? (I use one that can supply 1.2A and don't have any problems). If it's not the power supply then can you send me the results of running

ifconfig wlan0

from the command line please?

Anyway, hopefully something here can get you closer to a working robot, please let me know how you get on.

Regards

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

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby Alan » Sat Apr 26, 2014 5:49 pm

Hey Jarrah,

Looks like you type quicker than me. :D

Glad to hear that you've got your robot working. Power does seem to be the root cause behind a lot of problems.

With regards to powering the motors from the Pi GPIO, I think you're out of luck. The trouble is that they'd probably pull so much current that they'd either trip the fuse on the Pi's power line, or else burn out the Pi, before the motors started to move.

You can play around with max forward, and turning speeds by changing MAX_ABS_MOTOR_SPEED, and
MAX_ABS_TURN_SPEED, in robot_web_server.py. These correspond roughly to the percentage of battery voltage sent to the motors, and if running off 6 rechargeable AA batteries (7.2V) should probably not be pushed too close to 100% as the motors are happiest with about 5V.

As for the software update, this will come on Monday or Tuesday, so I'd wait for that to begin with, and then I'm hoping that a git pull should be sufficient from then onwards. The software update should also fix the exposure issues as I've moved away from using raspistill.

Regards

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

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby jarrah » Sat Apr 26, 2014 6:17 pm

Thanks very much Alan!!

Yeah those issues I had when plugged into the mains were a bit odd, I've got a good power supply that's not caused me any issues before so I think it was because I removed the GPIO jumpers given that you said both USB and GPIO connections are required. (I'll try it again later with those plugged in).

Thank you for explaining which commands and settings I can use to tinker with the robot.

I'd like to have a go at customising the web interface to have simple buttons for forwards, backwards, left and right, purely for the purpose of controlling the robot over the internet due to lag issues. Even with direct wifi access I found it was too easy to accidentally turn the robot when I just wanted to go straight forward, so it could be even worse with a higher lag (hence the question about reducing sensitivity). So before I go diving into the code, do you think this would be possible?

Following on from that I want to try and create a button that resets the camera to face forwards, so that if you can't see the robot and have turned the camera, you can reset it to know which way is straight for the robot. Also perhaps a button that turns the robot in 90 degree chunks?

In the long term I want to try and use two power sources to maximise battery life. Perhaps the 4-battery container for the wheels, and another high capacity battery just for the Pi, but I have no idea if that's even possible at the moment. :)

Anyway, lots of ideas so you may hear more from me as I tinker along. :)
jarrah
 
Posts: 6
Joined: Fri Apr 25, 2014 4:25 pm

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby jarrah » Sun Apr 27, 2014 12:53 pm

All working now when powered by the mains. You were right about power, I was using a 1A source so moving to 2.1A did the trick. :)

I still get the annoying buzzing/clicking noise when the servos aren't being moved. It's as if lots of little commands are being sent to the servos making it move left and right in tiny increments. I can see it making tiny panning movements - a tiny bit left and tiny bit right, never staying still or being quiet (it doesn't turn left or right in any large movements as it essentially stays in the same position). This happens whether I stop or start robot_web_server.py.

I can successfully run python robot_control_test.py - as soon as I press it the servo noise stops. It then starts again just before the camera moves around (after the connected=True), with the noise and tiny moves continuing afterwards.

Edit: More telling though is it still does this when the Pi has been shut down, but power is still being supplied... A firmware issue on the mini driver board perhaps?

To answer an earlier question, I can move the servos manually when power is off. I used this method to find the centre points of the servos before assembling.

Thanks for your help!
jarrah
 
Posts: 6
Joined: Fri Apr 25, 2014 4:25 pm

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby Alan » Sun Apr 27, 2014 9:05 pm

Hi Jarrah,

Glad to hear you're having fun with your robot. :)

If you'd like to change the web interface then you can edit the web pages in the www folder. The joysticks use javascript and send their current x, y position to the web server running on the Pi. You could therefore perhaps create direction buttons and have them send joystick commands.

To reset the camera facing forward, tap on the right joystick.

Turning accurately with the robot, and indeed, even driving in a straight line, can be a bit of a challenge with the robot, as 2 DC motors given the same voltage will tend to turn at different speeds. This is usually solved by adding wheel encoders to a robot to measure the speed at which they turn, although you can also get by by tuning the relative speed of the wheels. So for example, on one test robot I've got, the left wheel runs a bit faster than the right wheel, so I multiply its speed by 0.9, and then it's much easier to drive the robot. This will be exposed as a setting in the new software I keep talking about...

Your battery ideas are good. The Pi is pretty power hungry so a USB powerbank can work well.

With regards to the servo buzzing, I think what you're seeing is the servo seeking back and forth past a set angle. I've ignored this in the past as the shake wasn't severe enough to affect the camera image, but following on from your post, I've been giving it some more thought over the weekend. I don't think that it's a problem with the servo, but instead perhaps as you suggest, a problem with the firmware on the Mini Driver. Specifically, I'm thinking that the PWM signal generated for the pan servo may be jittery. The silence that you observe when starting the robot_control_test.py script is due to the fact that the Mini Driver is rebooted when the script opens the serial connection to it. Whilst the reboot is taking place, no PWM signal is sent to the servo.

One thing that I'm curious about, which I need to test in the office tomorrow, is, are you getting the same jitter and buzzing on the tilt servo? If not, then does the pan servo buzz if you plug it into the pins used by the tilt servo?

Regards

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

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby jarrah » Mon Apr 28, 2014 9:57 am

Good idea - by unplugging the servo cables I see that it's the tilt servo making the buzzing noise. I just assumed that as the pan servo was jittering that it was the culprit.

Interestingly, as you suggested I plugged the pan servo into the tilt pins but no buzzing occurred. However, putting the tilt servo into the pan pins did resume the buzzing, so no matter which pins the tilt uses it still buzzes. Faulty servo perhaps?
jarrah
 
Posts: 6
Joined: Fri Apr 25, 2014 4:25 pm

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby jarrah » Mon Apr 28, 2014 6:18 pm

Here's a thought - rather than creating buttons on the web interface, do you know if it's possible to assign movement to keyboard keys?

For example, the robot movement could be mapped to WSAD, and the pan/tilt to the arrow keys.

Unfortunately I know nothing about javascript, so I guess my ask is can this be actually done on a desktop web browser? I'd love to be able to move the robot around the house from my laptop using the keyboard for fast and easy manoeuvring (guided only by the cam), rather than having to keep checking that my mouse pointer is on the buttons. This would help with keeping in a straight line too. :)

I see that it has something to do with the code below, and from what I can see does it pass positional X/Y variables to /robot_control? Once I understand how the script passes out the control variables, I'm going to see if it works with something like this http://dmauro.github.io/Keypress/
Code: Select all
             webSocketURL = "http://" + window.location.hostname + "/robot_control";
             cameraURL = "http://" + window.location.hostname + ":8080/?action=stream";
             socket = new SockJS( webSocketURL );
         
             $("#camera").attr( "src", cameraURL );
   
             $('#motor_stick').joystick({
                 xSnap: true,
                 ySnap: true,
                 moveEvent: function(pos) {
                    if ( socket.readyState == SockJS.OPEN ) {
                        socket.send( "Move " + pos.x + " " + pos.y ); } },
                 endEvent: function(pos) {
                    if ( socket.readyState == SockJS.OPEN ) {
                        socket.send( "Move " + pos.x + " " + pos.y ); } }
jarrah
 
Posts: 6
Joined: Fri Apr 25, 2014 4:25 pm

Re: Raspberry Pi Camera Robot (Chassis Bundle)

Postby Alan » Mon Apr 28, 2014 7:25 pm

Hi Jarrah,

I'm afraid that I'm something of a Javascript noob myself so can't offer much advice. But I think that you're on the right lines looking at the keypress library (haven't seen that one before, but its demo looks cool :)).

When passing joystick commands to the robot it's basically passing the x and y axis of the joystick. So

Move 0.0 1.0 # Go forwards
Move 1.0 0.0 # Turn right
Move -1.0 0.0 # Turn left

Not sure about the servo buzzing implying a broken servo as I've seen it on a number of pan/tilt servos when using the Mini Driver. At the moment I'm thinking that it may be something to do with the implementation of the Arduino servo library on the Mini Driver, as the Mini Driver uses the Atmega8 which is not a common Arduino chip. I need to test my servos with an Arduino UNO to see if that has the same problem.

Regards

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


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 0 guests