View Single Post
  #5   Spotlight this post!  
Unread 08-09-2013, 01:00
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,092
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Controlling the individual speed of mecanum wheels within the main programme


You need to find the max absolute value, since speeds can be +/-.

Let fr, fl, rl, and rr be the 4 wheel speed commands in the range +/- 1. Then here's the pseudo-code:

Code:
max=fabs(fr);
if (max<fabs(fl)) max=fabs(fl);
if (max<fabs(rl)) max=fabs(rl);
if (max<fabs(rr)) max=fabs(rr);

if (max>1){fr/=max; fl/=max; rl/=max; rr/=max;}