Cyclops

Update 30/12/2012 V2

Great success!  As described at the top of V8 of Cyclops on Paste bin:

/*
Cyclops8: As Cyclops6, moves towards light. Due to laziness, Forward movement run time depends on angle of light, however left and right turns are reduced to simply 200 m/s rather than calculated.
At the start of the loop, it checks whether any of the front edge sensor pins are over the edge, and if so, backs one wheel up to bring it back on.
If both edge sensors are on the desk, then carries out the usual sweep, and movement, however while moving continues to monitor the edge sensors.
If either edge sensor pass over the edge, the motors are stopped for the remainder of the movement time, although the clock keeps going until the timer has expired.
.... Or least thats what i think it does. It certainly appears to work from this angle.
 */

 

Servo Sweep and Blind Spot checks are on seperate tabs, not included in the PB, but i figure those have been repasted tooo many times.

Update 30/12/2012

I have eliminated the delays, but how i arrange the desired programing into the code is a new problem.

Not helped by my not brilliant grasp of programming basics. What does which bit when? I think there is a gap in between starting the motors, and releasing the motors, during the movement. This would be the place to put it i guess?....

Hmmmm...

Update 17/12/12

Back again. I ordered some new M-F jumpers off ebay, so can now utilise a few more inputs. Modded my "line follower" array, to fit better on the front of the bot, so will be using the same part for "edge detection". Due to this though, i need to remove all my movement delays, and replace them with actual timing, I understand the delays stop the arduino from doing anything else, so it could drive off the edge of the table!

Update 04/12/2012

I mapped the vertical axis, to the time delay between running the motors, and stopping the motors, while moving forwards in a straight line. If the light is outside of the "forwards" window (which i made more generous) it spins towards the light, for a delay time defined by the angle on the horizontal axis.

Before it moves anywhere, it "checks to the rear", which involves, pointing the horizontal axis straight forward, and then flipping the veritcal axis between 30 degrees to the rear, and forwards. If the light is greatest behind, it spins 180, if not it doesnt. I was going to measure the angle to the rear, but it didnt add any advantage, and the put the servo wires under a bit of unessecary stress.

Unfortunatly, this update makes for some pretty boring robotic action! It either spins, 180, or doesnt. Then turns approximately to the light, then drives to it, in about "70% of the required distance" chunks to allow for a few adjustments on the way. Once there it sits and stops (delay of 99999999, because i am lazy.)

Thanks to OddBot, i have split my code into tabs to:

  • The main control tab, with definitions, setup, and loop.
  • Blindspot check (to the rear)
  • Angle measurements
  • Decisions

Due to this, i wonder if i can copy and paste.....doesnt look like it, not easily. I will look into it!

Update: 29/11/2012

So i applied the same code, to the vertical servo. i had to make a little adjustment to the servo mounting, so stop the vertical servo from clashing with the body when in took a reading to the rightmost extreme angle. I was initially going to write a complicated constraint, which constrained the vertical value, based on the hoizontal position, but realised it would be a hinderence later on, and the problem would easily be solved by moving the vertical servo onto a slightly longer servo arm, so it sat further away from the pcbs by about 10 mm.

I have been trying to work out how to get angles off my motors. the easiest way would be to buy a pair of encoders! i did have an old ball type mouse, which i took the encoders out of, but in trying to get them work, fried the IR sensor (oops). The other option is to do it roughly, based on time. (6.9 seconds for a full rotation it seems) but my batteries started to die, and the timing all went to pot as the motors started to take longer and longer to turn. I gave up on this while they went on charge.

This is why i have the indicators though! i can simulate the motor movement, without having to enable the motors.

The code below, scans for the light, and then depending on its direction, it moves a little bit in that direction, a lot, quicker, for longer, or just rolls forward if the light is within a 20 degree window dead ahead. It then stops and repeats the scan.Update: 27/11/2012.

I hope to add the following features:

  • choose the distance to move, both in turning, and rolling foward, based on the angle of the light. A higher up light on the vertical axis, should require less of a movement (i'm aiming to bask under a celing mounted light)
  • Check behind! the vertical axis can reach 30 ish degree behind itself. I should check whether light is strongest behind first, and if so, spin around 180!

I still cant decide if dead reckoning will be useful. I think it would be easiest to implement by using some bought encoders. i havent left much space on my bot to introduce some home made/bodged ones....

Update: 27/11/2012.

 I got the horizontal servo to write three positions and populate three direction values pretty easily (left, centre, right). But wanted it to be able to identify and angle for the light before moving!

MixMar gave me a load of help, thanks MixMar. and having struggled with a complex if routine, suggested it used arrays. this wasnt simple (for me) at least, not least hindered by my mouting the servo so that "central" was 90, so i only wanted it to move between 40 and 130. (i had to do simple sums, but at every step of the routine, to cancel out the effect).  ANYHOO. i think the arrays were conflicting with something else in the sketch, and it was a bit complicated as i still had all the motor references in the code.

I stripped the code right back this evening in a sulk. While it is still mounted as in the pictures, the sketch ONLY works a single servo, and the Photo resistor. But it works! rad. I have recorded two values per cycle, a clockwise and a CCW sweep value, which it happens are 6 degrees apart (this will be the degrees possible on the cowl i guess), but the 6 degrees is reliable, so it gives me confidence the system works!. Here is the code: (Removed to save space, message me if you want to see it :) )

Based on the same chassis, motors, wheels, and pcbs as my line follower, but this time i'm chasing light again.

I was originally going to have 5 photo resistors on a flower type thing, to locate the light, but it was causing me grief Then it occurred to me that if i mounted a single pr on a turret and gave it a cowel so it was more directionally sensitive it could be fun to try and do the work with servos instead.

The hardware is all in place, which took an hour or so this afternoon. I will start on coding it tomorrow. I think i want it to "bask". As in sit in the brightest light which could then theoretically be used for solar charging on a bigger project one day

I will be taking my "line follower" sketch, and chopping it up.

added a better cowel to the PR, by chopping up a pen with a dremel. And added "direction" LEDs, so i can test it on the desk without it wandering off! (there are seperate switches for the duino, and the motor shield)

 

Finds light, but using a single PR

  • Actuators / output devices: 2 servos, 2 geared motors
  • Control method: autonomous
  • CPU: Arduino
  • Operating system: Ubuntu
  • Power source: 9V for logic, 4xAA Ni-MH
  • Programming language: Arduino C++
  • Sensors / input devices: line follower, single Photo resistor mounted with a three pin interface, repurposed for edge detection
  • Target environment: Indoors - Carpet

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/cyclops-1

that looks like a boe bot.is

that looks like a boe bot.is that aluminum?

It is. I found a sheet of

It is. I found a sheet of 3mm alu lying around at work. Its a frame for a flourescent light. I cut a sheet out, bent it into an “n” shape, and then drilled and cut holes to mount the motors etc with 2.5mm machine screws. There aremore pictures of it on my line follower setup. it does look a bit like a boe bot, but it is all home made. Made it up as i went along really

i bet you can get a six leg

i bet you can get a six leg walker for it :smiley:

Nice Olly.

Nice that i could be of some help. :slight_smile:

Hope you get a video up soon of the little light follower.

Nice project, keep it up.

can you plees make a

can you plees make a template so i can make a bot like that to!!

hey again olly

you could use the same array for both sweeps as long as you overwrite the previous values with the new ones. then you save some room on the ram since the array take up some place. try to make one aray same size as you got now, but only named sweeparray or another suitable name. it should work exactly the same as it does know. 

good thinking. i hadnt

good thinking. i hadnt thought of that.

I currently have it set up to: Scan left and right, average the two readings, write the value (“look” towards the light on the horizontal plane) and then repeat for the vertical.

It ends up “looking” at the light, and delays for 10 seconds (to show it works)

now i need to make some decisions based on the two pieces of information. (map the angles, onto millisecond values for rotation of the wheels i guess, then repeat till the horizontal value is exactly vertical?)

I dont know really :s I made

I dont know really :s I made it up as i went along. I bought the motors, and had some servos knocking around. i wanted a platform i could be flexible with, to try lots of different projects. So i wanted to cut and drill holes for the servos, but also for other items too.

here is the chassis mid build. The hole is for the servo, but note there are no bolt holes yet, the slots in the back are for a velcro strap i use to hold the battery on. on of my motors is seen in the background.

|x

 

here is a link to my "Arduino projects" album on facebork

https://www.facebook.com/media/set/?set=a.626685393387.84802.309600433&type=1&l=f1bbfe427f

there are some various different builds on there. note that on one of the builds, the motor shield is upside down! This way, i can pull the arduino off the project, without disturbing the rest of the wiring. It didnt work out though, as i needed access to the headers on the motorshield! It wouild work fine if i use right angle headers i suppose.

I cant really make a template, as it was an evolution. but i can help you perhaps?

what materials do you have?

what tools?

there is no point in hoping to make a steel robot, if you can cut and drill the steel! aluminium is softer, but "rarer" in scrap.

you could use wood? or plastic if you had some pieces the right shape? I made mine out of cardboard first, as it is easy to cut and draw on, and you can try out lots of shapes easily. Then take the version that works, and remake it in the material of your choice?

look around the house for things you can use!

if you live in the SW of the UK, i can give you some pieces of aluminium!