Mecanum Function Input Graph
1323 3 2019-8-10
Uploading and Loding Picture ...(0/1)
o(^-^)o
MarkusXL
lvl.4
United States
Offline

Ok, so I want to do some specific crazy maneuvers with my mecanum wheels.  We have a Python function that rigidly fixes the ratios of all 4 wheel RPM commands so the wheels never bind - they are always working in unison, smooth like a ballet.  We can input streams of numbers into the function and the S1 will happily send streams of RPM speed commands (over the CAN bus) to each wheel which allows for some very interesting chassis movements that vary in real time.

Problem:  The movements are highly unpredicatable.  Toying with input streams gives widely varying results.

To help us reduce trial and error of tweaking input streams, it would nice to graph them to maybe get some better idea of what the chassis might do.

So I did some research, and found numpy and matplotlib.  These are modules you can install into your Python interpreter.  Usually.  I had to hack for hours on 3 different interpreters before installing a new 4th interpreter that is included in the Anaconda package.  I assigned this new interpreter to be the new default in PyCharm.

So, now we can plot the input curves for Vd (overall speed input), Vo ("Force of Turn" or Turning Factor), and Theta Zero (Direction of Translation, i.e. 90 = lateral slide right if Vo = 0).

Probably we want to make sure Vd starts at or near zero, but a jack rabbit start is not a big deal either.  There is a physical lag between RPM wheel commands and chassis translation - you have inertia and friction to consider.  It would fasinating to get real time chassis position data superimposed on this graph, but I don't see how I could collect such data.

In this graph, Green is Vd and is centered around Zero - the speed swings positive and negative (backwards)

Orange is Theta Zero (lateral sliding direction - varies from -90 to +90 but it could go in any direction - I wanted to keep it more or less 'forward' in direction) and Blue is Vo (Turning Factor, where 1.0 or -1.0 is a pretty hard turn, so I try to keep it between -0.8 and +0.8.  If the Speed Vd is increased, the Turn Factor can increase a bit.)

Here is the code that generates this graph:

import matplotlib.pyplot as plt
import numpy as np


Fs = 8000
f = 5
print(type(f))
sample = 100
x = np.arange(sample)
print(type(x))
y = (0.4 * (1 + np.sin(np.radians(x * 10))))
z = (0.2 * (1 + np.cos(np.radians(x * 10)))) + 0.2
t = (0.1 * (1 + np.sin(np.radians((x + 90) * 10)))) + 0.3
print(type(y))
plt.plot(x, y)
plt.plot(x, z)
plt.plot(x, t)
plt.xlabel('Counter in degrees (Y)')
plt.ylabel('Vo(Turning Factor)')

plt.show()

Mecanum Curves

Mecanum Curves
2019-8-10
Use props
DJI Stephen
DJI team
Offline

Hello and good day MarkusXL. Thank you for sharing these information with us. Great work and thank you for your valued support.
2019-8-10
Use props
David Martin Graff
Second Officer
Flight distance : 106566408 ft
  • >>>
United States
Offline

Nicely done - thanks again for sharing!
2019-8-24
Use props
MarkusXL
lvl.4
United States
Offline

Thanks I'm still working on this when I can!  I am convinced that if the proper amplitudes and phases of these inputs can be applied to our mechanum function, the S1 will perform some *very* interesting maneuvers.  I have stared at the wheels while applying varying manual movement commands and I can *almost see it*.  

So far I did manage to get the S1 to move in an interesting "collapsing spiral while spinning" pattern ending with a flat spin.  Work continues!
2019-8-25
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules