Society of Robots - Robot Forum

Software => Software => Topic started by: rmore on July 10, 2012, 01:19:39 PM

Title: $50 robot...Code related basic question!
Post by: rmore on July 10, 2012, 01:19:39 PM
Hello All!

This is my first post in here! I am building the $50 robot and it has been a lot of fun so far. I learnt a great deal just by going thru the forum and looking at what problems other people faced while building this robot.

Thank you for this forum. You guys are a great help.

I have a basic question regarding the code. I do not understand how the numbers '44' and '25' were arrived at. Like the numbers in servo_left(44), servo_right(25).

What is the significance of these numbers? Why not use - say 45 and 24 instead? I probably am missing something very simple....but nevertheless please try to answer my question.

Thanks.

Rmore
Title: Re: $50 robot...Code related basic question!
Post by: adanvasco on July 11, 2012, 11:40:52 AM
Check this thread out:

http://www.societyofrobots.com/robotforum/index.php?topic=2724.msg52541#msg52541 (http://www.societyofrobots.com/robotforum/index.php?topic=2724.msg52541#msg52541)
Title: Re: $50 robot...Code related basic question!
Post by: rmore on July 12, 2012, 09:45:38 PM
Adanvasco,

Thank you for pointing me into the right direction. I now understand the 'magic' numbers.

I did not understand one thing that Admin said though -

     By varying the number - say 22 or 27 instead of 25, you can slow down or speed up your servo.

How is this possible? Isnt the servo supposed to rotate at a constant speed always?

Thanks.

Rmore
Title: Re: $50 robot...Code related basic question!
Post by: ErikY on July 13, 2012, 04:25:13 AM
Adanvasco,

Thank you for pointing me into the right direction. I now understand the 'magic' numbers.

I did not understand one thing that Admin said though -

     By varying the number - say 22 or 27 instead of 25, you can slow down or speed up your servo.

How is this possible? Isnt the servo supposed to rotate at a constant speed always?

Thanks.

Rmore

Admin wrote in his tutorial that by modifying a servo, you lose the ability to control angle position but gain the ability to control servo speed.
Title: Re: $50 robot...Code related basic question!
Post by: rmore on July 13, 2012, 10:29:21 AM
Yes, but how exactly does using '22' slow down a servo and '27' increase the speed of the servo?
As far as I understand, we are using two functions - delay_cycles and servo_left/right

Input to 'servo_left' function is speed - say 22.

And this speed (22) is then the input for delay_cycles. So the port is ON for that much of time. (time taken to execute delay_cycles(22).

In next case, the port would be ON for time taken to execute delay_cycles(27).

So the time the port is ON varies in both cases. How does that time variance correspond to different speeds?
I would think its just the servo that is operating for different time intervals (but at same speed).

I am just not getting this.

Please help me understand this concept.

Thanks.

Rmore
Title: Re: $50 robot...Code related basic question!
Post by: newInRobotics on July 15, 2012, 08:10:22 AM
How is this possible? Isnt the servo supposed to rotate at a constant speed always?
Servo does not rotate at constant speed. The further away destination angle is from current angle, the faster servo will rotate. So, if current angle is 0° and destination angle is 2° then servo will rotate slower than if current angle is 0° and destination angle is 15°. By modifying servo and gluing pot at 0° You can vary servo speed instead of destination angle. Does that make sense?
Title: Re: $50 robot...Code related basic question!
Post by: rmore on July 15, 2012, 09:16:17 AM
New In Robotics,

Thank you. Now I do get it. So by modifying the servo, you gain control over servo speed but lose control over servo positioning.

Thanks.

Rmore