Show Posts
Pages: 1 2 [3] 4
31  Topics / Robotics / Re: controlling 3 rc servos from one rc signal on: November 28, 2012, 03:23:33 pm
Just to make things fun the 1000/2000 is a little vague I have a spectrum Dx7 transmitter and AR6100E reciever 1099/1899 but that varies a bit. That why I check against 1500 for the switch, as it is either on or off. 

I built a dummy airboat , basically everything required mounted to a board, to play with ESC's, receivers and servos.  That was a good learning experience.
32  Topics / Robotics / Re: controlling 3 rc servos from one rc signal on: November 28, 2012, 11:41:25 am
No that code would not be in those examples, what you need to do is take the value from the transmitter channel(s) then create the servos movements you want from there.  You are basically creating a servo mix based on the transmitter value.

So when you flick the gear switch, you call the routines to move the servos so here is an example :

This 1st chunk simply loops waits from me flick the switch, in my case position 1 on my gear switch is the high position about 1800.
The Park Bot code then moves, all my Hexapods servos to the park position.  Note this is an isolated piece of code to test functions it does not do any intelligent testing, it will perform the Park_bot section until the switch is set back to zero.  I was using this to confirm the servos return to the same position each time.

In the Park_bot section I move each of the 18 servos in turn, that code is of no real use to you as I use an alternate wire library to control my servos.  But in you case the idea is the same, read your switch, have a routine to unlock the gear,raise the gear and close the doors.  Each servo is controlled separately so you will have to play with that code.  But get each section working then tie it together.  It is actually pretty simple.

Code:
// Wait for Reciever Gear switch to go to the 1 postions

ch[5] = pulseIn(Gear,HIGH, 25000); // Read the pulse width of

while (ch[5] > 1500)

{
 delay(1000);
 Serial.println("Flip Gear switch to 1 to continue");
 ch[5] = pulseIn(8,HIGH, 25000); // Read the pulse width of


Park_bot();

33  Topics / Robotics / Re: Obstacle avoidance with an UGV -HELP PLEASE- on: November 26, 2012, 05:16:51 pm
Hi,

Just to make sure I understand what you what the sensors to do, no code thoughts here.

You are using the sensors strictly to determine how close you are to an object and ideal stay a given distance away to avoid collisions, or to stay centered in a "lane" between obstacles.

If I am correct, try mapping the sensor cones on paper.  Then put obstacles in to the cones figure out what you would need to do to avoid the collision.  In most cases it will be nothing, I think your approach will result in constant left / right servo movements that will result in a net nothing.

I agree with PaulS that there has to be a simpler way to code it.  I think you are over thinking the collision sensors.

Start with the front, left and right, ignore the two corner sensors.  Set a given distance where you think a collision is likely to occur for each group, all you initially do is check if you are over that range, if you are keep on motoring.  At the point any of the groups goes under the range then deal with the problem.  I would also set a dead stop range, where you know there is no way to avoid a hit easily. Get the code for the 3 sensors working then deal with the corners.

I may be telling you how to suck an egg, in which case I apologize. But when I look at it I think of driving down nasty little roads in my 4 wheel drive. If in doubt stop look and hedge to one side.  Move ahead slow and easy, with small corrections,and always remember hit the mountain don't go over the cliff.
34  Using Arduino / Programming Questions / Re: Servo Sweep with conditions on: November 23, 2012, 11:10:38 am
Not enough code, where do you set dht_dat[0] ?   Are you sure it is set? toss some debug print outs in your code right above
Quote
int analogValue2 = dht_dat[0];
.   It is a simple if statement they only fail when the conditions are not met, which leads back to my 1st question.
35  Using Arduino / Programming Questions / Re: Help for newbie programmer :) on: November 22, 2012, 11:33:32 pm
 I generally stay out of these, but I have to agree the 1st reply is the kind of thing that chases people away. Come off short, if you have answered this question 100 time sure, we are all human and different but offer some assistance.  Particularly when someone is new, the better they get at this the less of a bother them become.

Don't spoon feed by any means, suggest area's of research  a few links to examples or documentation.

I can not help with the OP's question it is outside what I do.
36  Topics / Robotics / Re: My quadruped - Tetrapod on: November 22, 2012, 06:07:00 pm
Battery, 7.4 Volts can kill your servos, I would suggest either buying a BEC (R/C world) or finding a similar way to reduce your voltage to 5 volts .  Depending on the number servos and amp draw a basic R/C BEC should handle your requirements.  Any R/C shop should carry the Castle Creation Brand, or a suitable substitute, they have both a 10 and 20 amp version.  If you go 20 amp you will have to replace the supply side wires.  You will also need a small fan to provide airflow as the R/C ones are assumed to mounted on a rapidly moving object.

Other than that I liked your explanation of IK, it was a lot clearer than a lot of the ones I have read.
37  Topics / Robotics / Re: SOLVED: Devantech SD21 servo contr. and desperate programmer, after one year... on: November 20, 2012, 12:17:54 pm
A little tidbit from Devantech if you are running version 7 of the firmware you can save your servo start positions

you write 0x5A to register 126 (dec)/7E (hex)

I use a different Ic2 library but I included an example here of my servo save function.  I have a little function that checks for the SD21 and returns the address, firmware version and battery voltage.  The voltage is a little useless as I use a BEC but it does confirm the BEC is functioning correctly.

Code notes:

The Address of the SD 21 is set globally
The delay is there to give the communication time to complete,
it is a debugging and testing setting only.

Code:
// Firmware Version 7 allows saving servo info

void Save_servo()
{
 // we write 0x5A to register 126 Decimal (7E hex)
 // fixed value
 
  err_c = I2c.write(SD21,0x7E);  // set the register pointer
  if (err_c != 0)
    {
      Serial.print(err_c);
      Serial.println("  Save_Servo - Error setting Servo pointer");
    } 

 err_c = I2c.write(SD21,0x7E,0x5A);
  if (err_c != 0)
    {
      Serial.print(err_c);
      Serial.println("   Save_Servo - Error Saving Servo setting");
    } 
 
 delay (10);


38  Topics / Robotics / Re: Servo motor speed adjust on: November 14, 2012, 03:34:09 pm
I am assuming you are controlling the servos directly and not using a separate servo controller ?

An SD21 servo controller gives you an option to set a speed register but that is over kill if you are using 2 or 3 servos.

The example used in the SD 21 documentation to explain the speed is shown below, but this handled by the servo controller

Quote
The servo pulses are automatically refreshed every 20mS. If the Speed register is zero (0x00) then the servo is simply set to the requested position. On power up the Speed registers are set to zero to give full speed, so unless you need to slow them down the Speed registers can be ignored. If the Speed register is set to something other than zero then that value is added to the current position every 20mS until the target position is reached. If you wish to move from 1000 to 2000 and the Speed register is set to 10, then it will take 2 seconds to reach the set position. The formula for the time it will take to make the move is:

((Target position-Start position)/Speed Reg)*20mS

Here are some examples:

Start Position     Target Position     Speed Reg     Time for Move
2000   1000   10   2000mS (2Sec)
1000   2000   10   2000mS (2Sec)
1000   2000   1      20000mS (20Sec)
1000   2000   100   200mS (0.2Sec)
1234   1987   69   220mS (0.22Sec)


Basically doing what your loop does but the load is moved to the servo controller.

This post may help http://arduino.cc/forum/index.php/topic,21975.0.html  It is titled Servo timer so it may have the functionality you need.
39  Topics / Robotics / Re: SOLVED: Devantech SD21 servo contr. and desperate programmer, after one year... on: November 05, 2012, 09:21:46 pm
Hi,

Well after blowing up a couple of servos due to a bad battery, I have built some simple code to mimic a walk with 3 legs on my Hexapod (new Servos are on the way). The walk is a simple 3 legged sweep forward then back, in a 20 count loop.  All was I looking for was SD21 function and to see if I had any major position issues.  At 6 volts positioning was not always good, at 5 Volts much better.

I did notice on my servos they got a little louder as the loop progressed, this is most likely a result of servo quality.  It seems to be only a couple of servos so no big issue there.
 
The Pod is sitting on a paint can so no weight on the servos at the moment.   

In the process I discovered a few things that you may l already know, but just in case.

The cheap servos are very voltage fussy, I found if the voltage was not steady and within the middle of the range, the positioning was quite poor.  To clean up my voltage I installed a BEC, Battery Eliminator Circuit.   In the R/C flight world it allows you to eliminate the battery for the receiver by supplying a steady 5 volts from your primary battery, and is ideal for small robots using this board.

My current BEC is only 10 Amps, but I have a 20 Amp on on the way.  This allows me to provide a steady 5 Volts to the Servos, the 20 Amp is adjustable for output voltage.  The down side is you need a fan, these generate a fair bit of heat under load and are designed to have airflow over them.  I have a little 5 volt computer fan I run off servo connector 21, it is about an inch square and generates enough airflow to keep things cool.

I found by using the BEC, I both protect my servos and seem to get better positioning, the power supplied to the servos side is only running the servos. Currently I use a 5 volt run from my bread board to power the logic side.  It is just a little simpler for debugging.  But it may also assist in keeping things cleaner.  When the bigger BEC comes I am going to running them both off the main battery and see if there is any difference.

I also found better positioning by slowing down the servo movement, I pass a speed, currently 12 (randomly selected).  Although it is a bit slow the servos seem to come back the same position.  At least they have not knocked over my endpoint sticks a small straw stood up smiley.
I need to play with that value.

Overall I am finding the SD21 does the job,  but information is hard to come by as you noted it does not seem very popular.

My final positioning tests will happen about week from now, I have a small FSR and have come up with a rig I can position under a leg.  In theory if the leg returns to the same position each time the FSR should have about the same reading.  I figure about 100 iterations at a variety of speeds should test the servo positioning pretty well and give me a set of benchmarks.


I use a Castle Creations BEC you can find some info here http://www.castlecreations.com/products/ccbec.html  I happen to be familiar with them, there are likely similar solutions in the robotics world.

I also switched to a different I2C library, primarily for better error control but it has some, at least to me nice features.

http://dsscircuits.com/articles/arduino-i2c-master-library.html


40  Using Arduino / Installation & Troubleshooting / Re: odd issue with Arduino Mega on: October 31, 2012, 03:15:03 pm
Thanks,

That resolved the problem.  I appreciate the assistance.
41  Using Arduino / Installation & Troubleshooting / Re: odd issue with Arduino Mega on: October 31, 2012, 02:56:50 pm
Hi,

Thanks for the very quick reply

No actually I am not, to connect the grounds, I am assuming the ground on the SD21 will go to ground on the Arduino, does it matter which one ?  I am assuming you would go to the ground beside the 5 volt pin ?

42  Using Arduino / Installation & Troubleshooting / odd issue with Arduino Mega on: October 31, 2012, 01:59:30 pm
This may be me but here is the situation

I am communicating via the I2C bus to a Devantech SD21 using an Ardunio Mega 2560

If I use the Arduino on board 5 volt and ground everything works ok.

If I try to use 5 volts to the SD21 and simply use the SDA/SCL from the Ardunio the sketch hangs, the 1st time it attempts to end the transmission.

It acts as if the SD21 is not powered by the external power, I did verify that power does exist at the appropriate pins on the SD21.

Am I missing something obvious ?  Have noticed this problem with other sketches as well that use the servo library to fire up an R/C ESC.

Any troubleshooting suggestions
43  Topics / Robotics / Re: SOLVED: Devantech SD21 servo contr. and desperate programmer, after one year... on: October 26, 2012, 10:02:28 am
Just a small up date, I have a little routine that pops all 6 legs of my hexapod to neutral positions, works fine in it's own little sketch.

Move it over to a larger sketch to be used as servo initialization it it does not always function correctly, similar to your issue with servos not returning to the exact same point.    I have a little more debugging to do, but I will keep this updated.
44  Topics / Robotics / Re: SOLVED: Devantech SD21 servo contr. and desperate programmer, after one year... on: October 24, 2012, 10:32:25 am
I have not noticed that so far, but  I will pay attention.  For power I am using a 7.4 Volt 2500 Lipo, with a 15c discharge rate.

But you can have 2 different issues the servos themselves, poorly made or cheap servos do not always get to the same point every time.

If it is power, you should be able to isolate it by raising your bot, removing all but 1 leg, actually remove the servos from the board. Run a few cycles and see where you end up.  If all is good keep adding legs back, until things start going off, at that point isolate just that leg.

If it all works ok in isolation then you have a power issue.

It is a pain in the but though.
45  Topics / Robotics / Re: SOLVED: Devantech SD21 servo contr. and desperate programmer, after one year... on: October 23, 2012, 05:20:16 pm
I was having issues with the high/low byte as well, turned out I found the worlds worst example of interfacing the SD21 and Arduino.
 If I could remember where I found it I would post a warning.   This post and quick test program had my servos working perfectly, in about 15 minutes, well except for speed but I can figure that out.

I am trying to build a graceful start and end leg positioning for a hexapod, basically an unfold from storage to start and a refold to finish. 

Servo speed is a key component, as well as battery life to know when to shutdown once it is autonomous.
Pages: 1 2 [3] 4