Emergency stop for robotic arm.
Sandhuamarinder
Posts: 85
I am working on Robot arm project. My professor is asking if you ·press the Emergency button robot arm should freeze. The arm doesnt freeze with what i am doing so. Thats the program·which i am working on.
i var word
Goto main:
For i = 110 to 1100 step 1
if switch= 0 then
GOTO·M1
pulsout shoulder,i
next
Goto Main
M1:
For i = 500 to 1100 step 1
pulsout shoulder,i
next
M1 loop is use less but it does what ever it needs to do but it doesnt freeze.
Post Edited (Sandhuamarinder) : 4/5/2010 2:47:10 AM GMT
i var word
Goto main:
For i = 110 to 1100 step 1
if switch= 0 then
GOTO·M1
pulsout shoulder,i
next
Goto Main
M1:
For i = 500 to 1100 step 1
pulsout shoulder,i
next
M1 loop is use less but it does what ever it needs to do but it doesnt freeze.
Post Edited (Sandhuamarinder) : 4/5/2010 2:47:10 AM GMT
Comments
In what you showed, the current servo position is in the variable "i" and your program exits from the movement loop when the switch on pin 0 is turned off (logic 0). The routine M1 should just output the same value ("i") every 20ms like
M1:
pulsout shoulder,i
pause 20
goto M1
Think about what your FOR loops do:
For i = 110 to 1100 step 1
pulsout shoulder,i
pause 20
next
This moves one servo over a range with control pulses from 0.22ms to 2.2ms in steps of 0.002ms which should take about 20 seconds to do at 20ms per step. Somewhere you have an emergency button which, when pressed, causes I/O pin 0 to go to ground, so you can add a test to every PULSOUT loop as you've done:
For i = 110 to 1100 step 1
if switch = 0 then goto M1
pulsout shoulder,i
pause 20
next
When the emergency switch is pressed and this test succeeds, the program jumps to M1 with the most recent value of "i" still in the variable. Every place in your program that moves this servo should leave "i" set to the last value used for a pulsout and go to M1 if the switch is closed. For M1, use the loop that I've shown above. This will lock the servo to the last position used until the Stamp is reset.
If you have multiple servos, use a different variable for each one for any loops and add other pulsout statements to the M1 loop for them like:
M1:
pulsout shoulder,i
pulsout elbow,j
pause 20
goto M1
Think about what I'm suggesting. Work out in your mind what happens. Try it. See what happens.
It worked
Thanks Alot
There is a thin and fuzzy line we collectively face here on the forums when it comes to questions having to do with classwork on any level. There is an obligation to help those who are working in our fields, while at the same time, there is also a conflicting obligation "not to do the work for the student". Somewhere, there is an honorable middle ground that we all try to find, guiding students to the answer, but not outright doing the work.
As a student works through the problem, and shows that they are at least trying to not just "copy code", but understand what's happening, more and more details are revealed.
When a student such as this starts "playing games" like this, it becomes very discouraging to those of us trying to find the right balance. The entire premise of these forums is to share knowledge, or as the statue in front of Fraber College says "Knowledge is Good".
I've seen fewer problems like this on the parallax forums, but I can say that on a couple of other forums, there is not a whole lot more discouraging than posts along the lines of "My semester long project is due next week, how do a make my project [noparse][[/noparse]insert specifics here]". One things that does top this is something along the lines of "I've deleted key information from my post so that anyone else can't use the information".
Hint to original poster: Most of your classmates have probably been working on this for a while, and had the answers long ago. I could be wrong, but my experience suggests I'm not.
The worst part about this stuff is that the folks like Mike Green who answer the questions rarely, if ever get credit. If they did, the number of degrees, both undergraduate and even graduate, they would have would indeed make a very nice "ego wall" display.
Continuing on my "editorial" comments, I can say, one of the most rewarding things I've ever experienced came from a semester long tutelage of a graduate student on another forum (robotics related), he posted a link to his final thesis. Listed as "advisers", with the same provenance as the professor guiding the graduate student on his thesis were the names of a number of the forum members (including myself). This student got what things were about - learning and sharing - not just "give ME the answers". Based on his grade and award of a Masters Degree, this was a lesson not lost on his professors.
Mike: Thank you for all your time and effort on these forums, and please don't let his jerk discourage you! I suspect that in the end, it's the idiots like this who wonder why they don't make it very far in the "real world" once they graduate (if they graduate). I guess we need to add another member to the "entitled society"...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
Click here to see my Nomad Build Log
As Mike stated, he didn't just answer the question for your benefit. This is a forum for Sharing.
The job of a professor is to teach you how to learn, not teach you everything there is to know, so don't blame the professor for "just" teaching you BASIC.
Typical of the "Entitled Society". Give ME the stuff, and do MY work FOR ME, and DON'T LET ANYONE else have it, because even though YOU DID IT for me, its MINE, all MINE!, and when all else fails blame somebody else ("My proffesor had teached us Basic just BASIC nothing else" and "He said sorry man do the research and figure it out by your self. So what was that.")
Did it ever occur to you that somebody else may have seen other ways to improve your program, and helped further, had you left things in place and had a better attitude? Did you ever hear the phrase "don't burn your bridges"? How much are people here going to be willing to help you in the future?
I'm sorry, I personally find the attitude disgusting. If you don't want to share, don't ask for help in a public open forum.
Moderators: If you find it necessary and/or desirable to delete my rantings, I understand. The Original Poster has hit a sensitive nerve...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
Click here to see my Nomad Build Log
One of the things about an honor system is that you have to behave honorably even if others do not. You have an obligation to report any knowledge you have of others' dishonesty to the authorities and they have an obligation to investigate and punish any infractions.
Have you seen any other "CLOSED THREAD" titles in this whole support forum ?
No you have not, there aren't any. So I have change the thread title back to what it was.
What you have done is very selfish. If all the members had your attitude no one would get any help.
And to claim that WE are harassing you just shows you're ungrateful mindset.
Many other members in this forum get paid very well to help clients. They provide their services here out of compasion. Something you have none of.
When/if you grow up you will find that there is much more satisfaction in helping others than there is in winning.
If you care to pay close attention you will learn much more from this thread than how to implement an emergency stop. You will learn a very important life lesson.
I truely hope that you do.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
Post Edited (Bean) : 4/4/2010 10:16:44 PM GMT
Peter KG6LSE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Carpe Ducktum" "seize the tape!!"
peterthethinker.com/tesla/Venom/Venom.html
Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway. —Tanenbaum, Andrew S.
LOL
i am using this
i var word
Switch pin 0
Main:
For i = 110 to 1100 step 1
if switch = 0 then
Goto M1
Pulsout shoulder,i
pause 18
Next
Goto Main:
M1:
Pulsout shoulder,i
pause 18
Goto M1
This is what i am using any way to figure it out. And my ic memory is almost full.
·
if switch = o then
goto m1
endif
i think this command is the problem i have to arrange it in some order to fix that falls of arm. Bcoz of this command it is lossing control
Like if you use debug with in the loop your robot arm shakes and gives vibrations becoz of that bcoz debug takes some mille seconds from that loop to debug it i think same here but this is taking less milli seconds thats why no vibrations. And loop is running bigger each time stamps checks it. Is the switch pressed or not. And there it is spending some milliseconds and loop is becoming bigger i think and it loose control at some points.
I am not sure if i am right.
But i think thats the problem for that. i had pm you my whole program but i think the problem is just in the loop the way i am using it.
Biggest problem·now my brain is not working any more. I am wroking on this project from last 3 days continously writting the code.
And other problem is due date of project is close. Boom
And its 4 people project i am working alone here. Rest are not helping me.
I notice that you have 5 servos. This is a lot for a Stamp to control, but you're not doing anything really complex with them, so it should work. I had mentioned before that you need to have a separate variable for each servo and you need to keep these variables up-to-date so that the servos can all be locked in their position when necessary. In some of your loops, you use constants for some of the servo pulse widths and you don't update the variables. For simplicity and to save code space, you might consider using a single subroutine for moving the servos like this:
a VAR word
b VAR word
c VAR word
d VAR word
e VAR word
' ***** This is an example of a typical loop in your program
b = 400
c = 600
d = 750
e = 1000
for a = 110 to 1100 step 1
gosub moveit
next
' ***** Here's the subroutine to do the actual servo movement
moveit:
pulsout servo1,a ' output a pulse to each of the servos
pulsout servo2,b
pulsout servo3,c ' these will range from 0.22ms to 2.2ms
pulsout servo4,d
pulsout servo5,e
pause 20 - (a+b+c+d+e)/500 ' adjust pause for the pulse widths
if emergency = 0 then goto moveit ' stay in this loop if emergency
return
Note that the variables are always up to date with the current position.
The servos need a control pulse about once every 20ms. The pause statement takes into account that the control pulses take time and the overall pause needs to compensate for this, particularly when you have more than 2 or 3 servos. Using a subroutine also allows you to build in the emergency switch test in one place rather than having it repeated throughout the program.
Note that, if you turn off the emergency switch (so it's value is 1), the program will continue where it left off. This may not be what you want, particularly if the emergency switch is a pushbutton rather than a toggle switch. If this is the case, you'll have to change the subroutine. You should be able to figure out how at this point.
·i try fixing·it now·and i will notify as the problem get fixed.
ERROR after doing all that
Data occupies same memory as program
i am now Out of memory · Not a good sign.
I have 2 stamps with me if someone can teach me how to use 2 stamps together then problem would be solved in easy way and i can write more codes. PLZ be at student level i am very dumb kid. I doesnt get complex stuff easily
Does any one know how to connect to stamps together and which pins i have to connect together of the stamps to make a commuication between each other and how i will give them a commands i am using basic stamp. BS2 version 2.5 Do i have to download program·in both stamps or in just one. How it will work can some put some picture of connection of pins or just describe·in detail·and some short example of program plz so i can understand how i have to serin and serout.
And one another question i am trying to pulsout 2 servos now in this way to give both of them motion so i can reduce my program size.
i var word
j var word
For i = 110 to 1100 step 1
·· For j = 500 to 1000 step 1
Pulsout shoulder,i
Pulsout elbow,j
Pause 20
next
next
I am geting vibrations which is obvious How i can make 2 servo move in the loop with out vibration this will reduce my program size and· will also look better to see. Arm doing 2 moves together.
Post Edited (Sandhuamarinder) : 4/5/2010 8:00:57 AM GMT
If you want the two servos to move at the same time, try something like this:
That should move the shoulder and elbow servos at the same time.·You can play around with the STEP value and PAUSE value to get the speed right.
As for being out of memory, see if you can put repeated code into a subroutine.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
Post Edited (Bean) : 4/5/2010 11:14:03 AM GMT
Nice. I am learning here alot.
if some one can teach me how to connect 2 stamps together that would be great.
2 basic stamps together (BS2) both of same (version 2.5)
Post Edited (Sandhuamarinder) : 4/5/2010 12:30:15 PM GMT
I'd keep trying to accomplish what you need to do with a single stamp.
I understand that you do not want to show all of your code, and that's fine. But is hard to give you advise on making the code smaller without seeing all of it.
Basically you want to look for section that are the same, and put that code into a subroutine.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
Thats the problem.
Ok so now i will try working 2 servos movement at same time it will save some space. I will catch you guys soon.
I was just thinking to do that bcoz one of my class mate did it . I dont know how. And i try asking him he just dont wants to give idea to anyone bcoz of the prize lol.
The reason you're getting vibrations is that the time between control pulses is too long. These servo control pulses have to occur at least 50 times a second or the servo will turn itself off until the next pulse comes along. The constant turning on and turning off causes the vibration. If you have a PAUSE 20 plus two PULSOUT statements that each take about 2ms, that's a total of 24ms which is too long for some servos. That's why I wrote the expression in the PAUSE statement the way I did earlier ... to compensate for the variable delays from the PULSOUT statements so the total time between pulses stayed around 20ms.
Connecting 2 stamps is complicated kind of stuff Seems like i cant do that now with small amount of time what i am left with. Needs alot of time understanding that what i see in manual RS- 485 so stessfull etc etc. Slave stamps and master.
Now i am trying figuring out the pause problem but sir i tried doing that what you said above using var word. But i am running out of memory new problem there sir.
Now i am just frustrated from this project . New problems again and again. Cant solve this any more · break time now.
After the break may be things get better. And my brain which is working on low battery now·needs recharging.
Thanks for all of your Help Mike Sir and Sir Bean
Post Edited (Sandhuamarinder) : 4/5/2010 1:52:45 PM GMT