go away spammer

Author Topic: 50$ Robot Code Question  (Read 2432 times)

0 Members and 1 Guest are viewing this topic.

Offline yankeefan238Topic starter

  • Jr. Member
  • **
  • Posts: 23
  • Helpful? 0
50$ Robot Code Question
« on: January 23, 2009, 08:42:39 PM »
I don't understand this code about the servos :

void robot_turn_left(void)
   {
   servo_left(25);
   servo_right(25);
   }
void robot_turn_right(void)
   {
   servo_left(44);
   servo_right(44);
   }
void robot_go_straight(void)
   {
   servo_left(25);
   servo_right(44);
   }
void hold_position(void)//37
   {
   servo_left(39);//39
   servo_right(35);//35
   }

The code is from the robot_source_50_sharpIR_v1 folder. In the folder there is the file SoR_Utils.h and it has the above code in it. I don't get the part where it says:

void robot_turn_left(void)
   {
   servo_left(25);
   servo_right(25);
   }

This function is supposed to make the robot turn left and the values in the parenthesis are the speed of each servo, right? But I thought when you want the robot to turn left you would make servo_left lower than servo_right so that the left servo turns slower than the right. This would cause the robot to turn left. I'm wondering why the values in parenthesis are both at 25?!?!

I could be thinking about this all wrong...

Offline HDL_CinC_Dragon

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: 50$ Robot Code Question
« Reply #1 on: January 23, 2009, 11:40:40 PM »
The servos when mounted are in opposite directions thus when told to move in the same direction they actually move in a different direction. Directionally directional to the direction of the directed movement.
The parenthesis are not speeds, they are angles basically telling the servos to go to a certain angle but since they are modified for continuous rotation the pot that tells the circuit where the servo is never reaches that angle and thus keeps going.
« Last Edit: January 23, 2009, 11:41:19 PM by HDL_CinC_Dragon »
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline yankeefan238Topic starter

  • Jr. Member
  • **
  • Posts: 23
  • Helpful? 0
Re: 50$ Robot Code Question
« Reply #2 on: January 24, 2009, 10:18:24 AM »
Thanks a lot! That was driving me crazy.

 


Get Your Ad Here

data_list