Well, I was thinking more of the decimal remainder than the modulas remainder.
But in trying to recreate the code, I'm seeing some big limitations in the theory.
The only way to end up at the exact Target Position, is to have a Position that is an exact multiple of V_Max.
With V_Max = 100, you can only get target positions of 1800, 1900, 2000, 2100 etc.
I would think you would want more precise targets ...
Currently, I can get +/- 5 counts from those targets by using the decimal remainder idea.
I think I can change it to reach any target position, but then I see more problems down the road.
This only ramps from 0 to a target.
It won't go from target to target.
Unless there's some other steps in the process that I'm missing.
Here's some output from the test program.
If I can figure the rest out, I'll post the code.
Code:
1 = Edit Max_Acceleration (10)
2 = Edit Max_Velocity (100)
3 = Edit TargetPosition (2000)
Enter = GO
>
0 0 0
10 10 10
10 20 30
10 30 60
10 40 100
10 50 150
10 60 210
10 70 280
10 80 360
10 90 450
10 100 550
10 100 650
10 100 750
10 100 850
10 100 950
10 100 1050
10 100 1150
10 100 1250
10 100 1350
10 100 1450
10 100 1550
10 90 1640
10 80 1720
10 70 1790
10 60 1850
10 50 1900
10 40 1940
10 30 1970
10 20 1990
10 10 2000
10 0 2000
1 = Edit Max_Acceleration (10)
2 = Edit Max_Velocity (100)
3 = Edit TargetPosition (2000)
Enter = GO
>1
Enter new Max_Acceleration (10):15
Max_Acceleration = 15
1 = Edit Max_Acceleration (15)
2 = Edit Max_Velocity (100)
3 = Edit TargetPosition (2000)
Enter = GO
>
0 0 0
14 14 14
14 28 42
14 42 84
14 57 141
14 71 212
14 85 297
14 99 396
14 100 496
14 100 596
14 100 696
14 100 796
14 100 896
14 100 996
14 100 1096
14 100 1196
14 100 1296
14 100 1396
14 100 1496
14 100 1596
14 100 1696
14 86 1782
14 72 1854
14 58 1912
14 43 1955
14 29 1984
14 15 1999
14 0 1999
1 = Edit Max_Acceleration (15)
2 = Edit Max_Velocity (100)
3 = Edit TargetPosition (2000)
Enter = GO
>3
Enter new TargetPosition (2000):1800
TargetPosition = 1800
1 = Edit Max_Acceleration (15)
2 = Edit Max_Velocity (100)
3 = Edit TargetPosition (1800)
Enter = GO
>
0 0 0
14 14 14
14 28 42
14 42 84
14 57 141
14 71 212
14 85 297
14 99 396
14 100 496
14 100 596
14 100 696
14 100 796
14 100 896
14 100 996
14 100 1096
14 100 1196
14 100 1296
14 100 1396
14 100 1496
14 86 1582
14 72 1654
14 57 1711
14 43 1754
14 29 1783
14 14 1797
14 0 1797
1 = Edit Max_Acceleration (15)
2 = Edit Max_Velocity (100)
3 = Edit TargetPosition (1800)
Enter = GO
>2
Enter new Max_Velocity (100):90
Max_Velocity = 90
1 = Edit Max_Acceleration (15)
2 = Edit Max_Velocity (90)
3 = Edit TargetPosition (1800)
Enter = GO
>
0 0 0
15 15 15
15 30 45
15 45 90
15 60 150
15 75 225
15 90 315
15 90 405
15 90 495
15 90 585
15 90 675
15 90 765
15 90 855
15 90 945
15 90 1035
15 90 1125
15 90 1215
15 90 1305
15 90 1395
15 90 1485
15 90 1575
15 75 1650
15 60 1710
15 45 1755
15 30 1785
15 15 1800
15 0 1800
1 = Edit Max_Acceleration (15)
2 = Edit Max_Velocity (90)
3 = Edit TargetPosition (1800)
Enter = GO
>
I'm just going from your description, I haven't tried to convert the original code.
My questions: - Is it supposed to be able to move to any target position? Not just a multiple of V_Max?
- Is it supposed to move from any position to any other position?
- Or is that part handled in your routines? And this is just a "profile" that gets mapped onto the movement?
Bookmarks