# Need help to automate a 3 wheel Omni drive robot

Hello All,

I created a 3 wheel drive Omni wheel robot, I followed the vector approach to manually control it using joystick,

I am using 3 DC motors for driving.

Now I want to automate it to follow a sine wave, but I don't know how to approach it. I also want to control the number of cycles and amplitude of the sine wave.

Where will the sine wave be that it has to follow? Will it be a line on the floor?

...R

There will be obstacles present in the floor at a fixed distance one behind the other in a straight line pattern.

The bot should avoid the obstacle in the form of sine wave.

I hope you understand my situation.

Are you still using the joy stick? How does your robot know where the objects are located? Are you just wanting the robot to weave from left to right as it travels? If that is what you call a sine wave, how will the robot know where the sine wave begins?

Paul

Yes I will be using the joystick.

After nearing to the predefined obstacles. I will be pressing a button in the joystick so that it will automatically cross the obstacles in a sine wave pattern if viewed from above.

This is the condition. I hope you understand my situation.

Anand

MrAnand:
I will be pressing a button in the joystick so that it will automatically cross the obstacles in a sine wave pattern if viewed from above.

Unless there is a wide margin for error I reckon that will be difficult to achieve without some external position reference that the robot an use - for example using ultrasound to determine the distance to an obstacle.

If you don't believe me try making an obstacle course with 3 or 4 chairs and see if you can walk through it by counting steps with your eyes shut. And remember your brain power is a lot better than an Arduino.

...R

Hey this is a proof of concept for my task. Ignore the errors and slips. I don't want to use any feedback devices.

As the obstacle distance and dimensions are clearly known. I need to just input the amplitude and cycles to pass through them.

....A

MrAnand:

The concept is straightforward. Go forward distance X, turn angle Y, go forward distance Z turn angle A etc etc

What exactly are you having trouble with?

Can you make the robot move forward distance X reliably and turn angle Y reliably? If not then start with that.

...R

I can able to go forward and turn reliably.

I need a mathematical approach for sine wave tracing.

I think the mathematical approach would use sin() and cos() functions. Honestly with no idea of how the wheels are arranged on the robot, it's impossible to suggest any solution.

Why does it have to be sine? Why not four quarter-circles? That will look like a sine wave to most people.

I need to control the amplitude of the sine wave, with semicircle form it cannot be done.

Can you elaborate on how to use the sin, cos function?

I have attached my wheel configuration.

I would not even start with anything as complex as a part of a circle. I would implement a sine wave as a series of steps of a stairs. Start with large steps - maybe 3 or 5 steps from horizontal to vertical - and when that works nicely increase the number of steps gradually until you get a level of smoothness you are satisfied with.

The simplest way to implement a sine wave is with a look-up table. Use a spreadsheet to calculate the X and Y positions for (say) the 3 or 5 steps needed to move through 90°. Then put those values in an array in your Arduino program and move to them one after the other. For the other quarters of the sine wave just change the sign of the X or Y values as appropriate.

Calculating sine and cosine values on an Arduino is very slow and should be avoided if possible.

Also try to avoid using floating point values. You can get the effect of (say) 152.75 using integers by storing it as 15275.

...R

First issue, a Omni drive system would not need to turn.

It should be able to move sideways so instead of fun to calculate arc, you simply could do a “sawtooth” avoidance.

Read push button, change to +45degree offset from base heading and simply calculate distance C in the right angle triangle formula to know how long to keep that offset before switching to -45 degree offset from base heading for the same distance.

Unless you actually just want to stick a marker on this robot and draw curves with it.

Robin2:
The simplest way to implement a sine wave is with a look-up table.

I disagree. The sin() function is the simplest. It's not the best way for a lot of purposes but for something that needs to calculate sin() maybe 10 times per second, it's a lot more efficient in programmer time than trying to devise a lookup table when you've never heard of a lookup table before. I'll always get the simplest-to-program version working first and then optimise it later if it turns out to be too slow for the other requirements of the system.

So MrAnand, can you confirm that you have X and Y movements working on your robot (the first 4 diagrams in your image) and you want the robot to move along a sin wave aligned to X or Y? Are you going to need to change this axis in the future or will the human operator turn the robot so that X or Y is aligned with the object to be avoided? Does the step approximation (for small steps) sound like it's going to work for you?

The X, Y axis movement is working fine.

The axis will not be changed in future.

The human operator will align the bot with the axis of the obstacles.

For reference

I will align the bot in (0,0) coordinates and the obstacles will be present at (0,100), (0,200).

A single side of the bot is 50cm.

It should cross the obstacles in sine wave.

I think step approximations will result in lots of slips in real condition. So better I will avoid it.

....Anand

MorganS:
I disagree. The sin() function is the simplest. It's not the best way for a lot of purposes but for something that needs to calculate sin() maybe 10 times per second, it's a lot more efficient in programmer time than trying to devise a lookup table when you've never heard of a lookup table before.

To my mind the concept of making the device follow a "steps of stairs" pattern will be easier for a beginner, even if they do have to do a little research to learn about a look-up table.

YMMV.

...R

I will align the bot in (0,0) coordinates and the obstacles will be present at (0,100), (0,200). A single side of the bot is 50cm.

It should need to cross the obstacles in sine wave.

Can you successfully make the robot execute these straight line segment moves to avoid the objects?

(y,x) = (0,0) to (100, 100) to (-100,200) to (0, 300).

If so, have the robot move along this path yi = 100.0sin(xi2.0*M_PI/300.0)

Of course, the size of the mysterious objects matters.