I throw myself onto the mercy of the Forum, I'm making my propeller freeze
vanmunch
Posts: 568
I think it's solved. I'll let you know in a day or two. Thanks!
Hello,
I thought that I had been making great progress on my robot until I let it take more than one step. I found that the program freezes so I'm guessing that I'm writing over one part of the program with another or something. I've whittled down the program so that it's just using three of the six legs and it doesn't bother trying to touch the ground (its a hexapod that has toe sensors that allow it to know if it's touching the ground or if the side of the foot hits something). The program still freezes, but now it goes through about 4 cycles before it stops. I've never had a programing class so it might be something as simple as my IF statements etc.
Quick overview of how the robot works. It has a "master direction" (normally determined by the direction the Ping))) is looking) that is the direction the robot want to walk. The hexapod is round with six legs spaced at 60 degree intervals. Using the master direction and the leg placement, the program determines how much of movement should be done with the hips or with the foot. The program then determines the legs' start and end values for the hip and foot. Once this is done the leg moves the hip a little bit, checks to see if the toe sensor is touching something, if it isn't it moves on to the next hip . This repeats until all of the hips are in their starting positions. Then it does the same with the feet. The program freezes irregardless of whether or not the toe sensor detects something and the program seems to like to freeze during the middle of the "foot" placement phase.
Thanks again for your time. Any suggestions would be greatly appreciated.
Dave
vanmunch
Hello,
I thought that I had been making great progress on my robot until I let it take more than one step. I found that the program freezes so I'm guessing that I'm writing over one part of the program with another or something. I've whittled down the program so that it's just using three of the six legs and it doesn't bother trying to touch the ground (its a hexapod that has toe sensors that allow it to know if it's touching the ground or if the side of the foot hits something). The program still freezes, but now it goes through about 4 cycles before it stops. I've never had a programing class so it might be something as simple as my IF statements etc.
Quick overview of how the robot works. It has a "master direction" (normally determined by the direction the Ping))) is looking) that is the direction the robot want to walk. The hexapod is round with six legs spaced at 60 degree intervals. Using the master direction and the leg placement, the program determines how much of movement should be done with the hips or with the foot. The program then determines the legs' start and end values for the hip and foot. Once this is done the leg moves the hip a little bit, checks to see if the toe sensor is touching something, if it isn't it moves on to the next hip . This repeats until all of the hips are in their starting positions. Then it does the same with the feet. The program freezes irregardless of whether or not the toe sensor detects something and the program seems to like to freeze during the middle of the "foot" placement phase.
Thanks again for your time. Any suggestions would be greatly appreciated.
Dave
vanmunch
Comments
Or it might not, but that sure seemed like a quick way to insult the poor guy! :-)
Vanmunch, with just a very quick glance I don't see any repeat loops in your code... how are you getting it to repeat the next sequence?
Bill
As Bill suspects, I think you are managing your loops incorrectly.
You have method A call method B which then calls C. Method C calls method A in order to loop the program. This is wrong. Off with your head. (So much for mercy of the forum.) Okay not off with your head but you probably need to work through some of the Propeller Education Kit tutorials (find it from the Help menu).
You need a repeat loop.
Okay, we'll give you a suspended sentence.
I'm really glad you're using the Propeller. Your robots are about to be even cooler!
Don't give up on the Prop, you be glad you learned to use it.
Duane
Here's an example of the problem.
MoveHipsGroup0 calls MoveHipLPaw which calls MoveHipRF which calls MoveHipLR which calls MoveHipsGroup0 (Now we are back where we started.)
This kind of code will work for a little while but before long you'll run out of stack space.
Just out of interest, what sort of motors/servos are you using?
Re recursive loops, back in the olden days you could have cheated and used GOTO and had your code jumping all over the place. But it isn't too hard to rewrite code so it doesn't do this. To distill books worth (nay, University courses) of knowledge into something very simple, there is a concept called Top Down Programming, where you start at the top and work down. (The opposite is a subsumption architecture where you work on moving a joint, then a leg and work up. Check out the robotics work by Rodney Brooks http://en.wikipedia.org/wiki/Rodney_Brooks).
So and then you might add something And then you can start to flesh out what moveforward does in terms of individual joint movements.
I think you already have 99% of the actual code working, it is just the big picture stuff about how the main loop works.
PUB MoveHips
repeat
LeftFrontHip
' returns from LeftFrontHip here ready to loop again.
PUB LeftFrontHip
if LeftFrontHipPosition == HipStartingPostition
RightRearHip
LeftFrontHipPosition := LeftFrontHipPosition +1
' back from RightRearHiphere
'program returns to MoveHips now
PUB RightRearHip
if RightRearHipPosition == RightRearHipPostition
RightRearHipPosition := RightRearHipPosition + 1
'program returns to LeftFrontHip
... and I don't need to tell "RightRearHip" to go to "LeftFrontHipPosition" because it automatically goes back to it
Thanks again everyone!
Dave
vanmunch
Sorry, I was just writting. The servos are Hi-tech 645 MG being controled with two propeller servo controlers. I'll post some more information on the robot, but I think my wife is about ready to go to supper without me.
Thanks for the further explination, that helps a lot!
"...supper getting cold..." if only you knew... We live in the center of the US, Iowa, and right now we're in the middle of a huge blizzard. Everythings closed, even work!
I always wanted to make a hexapod. I did once go and buy 18 servos but the power to weight ratio was too low. I think the secret is the metal gears.
So it is really cool watching your robot walk because I know how hard (and expensive) it is to get these things working.
I see it was walking around in the snow. I've heard Iowa gets really really cold. Right now here in Australia our biggest problem is wind as we are being attacked by this giant cyclone. Someone has gone and put a picture of the cyclone on a scale map of the USA. See attached.
You mentioned watching your fingers. If one of those legs gets jammed, what gives out first? The gears, the joints or does the motor stall? Do you need current sensors on the servos?
I was able to work on it some more today, so I might have something to show by the end of the weekend. I'll have to post the new and improved code so that you can let me know if there are any other lurking icebergs in my code.
With these servos the motor will just stall, but if you get your finger caught at the joint, it will give you a blood blister. The servos that you really have to watch out for are the ones with 444 oz of torque, but those also cost ~100 US so I guess they pinch your wallet too.
As far as getting it to walk, I just watched what other people videos looked like and did trial and error. The body was designed and sold by the folks at Lynxmotion
http://www.lynxmotion.com/
and I've used the basic design a couple of times. Let me know if you want more info. I'll be posting my "Farming robot" in the projects forum in a couple of weeks. Thanks again for your help and watch out for that cyclone!
Dave
vanmunch
I'm curious, what is the "normal" computer science approach/mentality to programming?