go_away

Author Topic: Spiraling Robot  (Read 732 times)

0 Members and 1 Guest are viewing this topic.

Offline robonerd137Topic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 1
Spiraling Robot
« on: July 02, 2013, 11:20:40 AM »
I have a robot that is setup so that when I set the wheels going at the same speed in opposite directions the robot spins in a circle but the center of the axle does not move. The wheels are separated by 100 cm and I would like to write an algorithm to make the robot travel in an archemedian spiral (eg. r = theta) for searching a field. your help is much appreciated.

Offline Mastermime

  • Supreme Robot
  • *****
  • Posts: 314
  • Helpful? 5
Re: Spiraling Robot
« Reply #1 on: July 02, 2013, 11:43:42 AM »
Whats the question?

Offline robonerd137Topic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 1
Re: Spiraling Robot
« Reply #2 on: July 02, 2013, 03:09:17 PM »
Basically I have a robot with two wheels and I would like the center of the axle of the two wheels to travel on a path that looks like the path in the image below.

http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Archimedean_spiral.svg/300px-Archimedean_spiral.svg.png

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,930
  • Helpful? 98
Re: Spiraling Robot
« Reply #3 on: July 02, 2013, 05:13:25 PM »
Hint: As the robot spirals outward, the curve becomes closer to a straight path.
Hint2: How do you make the robot go in a circle? How about a larger circle? Then a straight line.
Figure that out and you are 80% there.

Offline robonerd137Topic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 1
Re: Spiraling Robot
« Reply #4 on: August 01, 2013, 11:29:01 AM »
That is exactly how I started the problem, but then I came upon a math problem that I need help with. Here is the setup:

Let MAX_SPEED be the max speed of the wheel in either direction.

I set the right wheel to spin at a speed of SPEED_RIGHT = MAX_SPEED
Then I realized that the speed of the left wheel describes the radius of the robot.
I thought of the following situations:

If SPEED_LEFT = -MAX_SPEED
Then the robot will spin with a radius of 0, the center of the spin being in the center of the axle.

If SPEED_LEFT = 0
Then the robot will spin with a radius of HALF_AXLE_LENGTH, the center of the spin being where the left wheel touches the ground.

If SPEED_LEFT = MAX_SPEED
Then the robot will spin with a radius of INFINITY, the center of the spin being undefined.

Then I had to make a function of time that would increase the left wheel speed from -1 to +1, but I still am not sure of the function I should use to do this increase. When I solved this problem originally I made an algorithm that adjusts the wheel speed, but the algorithm requires a lot of calculations. Does anyone know of a function of time that could help me? Maybe an algorithm that relates SPEED_LEFT with radius?

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: Spiraling Robot
« Reply #5 on: August 01, 2013, 02:51:57 PM »
How precise does it need to be?

You could start with something that sets right speed to max, and sets left speed to min, and then run this algorithm:

Code: [Select]
forever() {
  float time = elapsed_seconds * SCALING_FACTOR;
  LEFT_SPEED = (1 - (2 / time)) * MAX_SPEED;
}

the SCALING_FACTOR depends on how "tight" you want the spiral, and how fast the robot travels. Start with it somewhere in the 1-3 range, perhaps.

This is not a "perfect" solution to your problem, but it will likely get you to scan the area in the approximate pattern that you want.

Offline robonerd137Topic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 1
Re: Spiraling Robot
« Reply #6 on: August 07, 2013, 12:22:07 PM »
@jwatte:
Does the equation you suggest make the robot cover equal area? Some spirals (for example r = e^theta) make the distance between the spirals increase, and others (for example r = ln theta) make the distance between the spirals decrease. For the spiral, r = theta, the distance between the spirals is constant. Which category does the algorithm you gave me fit into?

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: Spiraling Robot
« Reply #7 on: August 08, 2013, 12:17:03 PM »
If you actually need "equal area" coverage, then you need to solve the differential equation, and drive the wheels at the appropriate relative speeds at all times, preferably using wheel encoders to make sure the speed is right.


 


Get Your Ad Here

data_list