View Single Post
  #12   Spotlight this post!  
Unread 17-01-2007, 06:42
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: mecanum programming

You're using terms that I don't understand. How does a wheel spin "inward" or "outward"?

This code is for a mecanum drive base, with four mecanum wheels all mounted so they spin either forward or backward. The "handedness" of the wheels is important, and it's possible to set things up in one of two ways. One way has the angled rollers contacting the floor so that the robot can very nearly spin in place without any of the wheels turning. This code assumes the other way, where the angled rollers resist spinning in place when the wheels are stationary.

The "meat" of the code is these four lines:
Code:
  	front_r = speed-turn+slide;
	front_l = speed+turn-slide;
	back_r = speed-turn-slide;
	back_l = speed+turn+slide;
All wheels drive at the same rate based on the (forward) speed. The left motors drive more and the right motors drive less based on the (right-hand) turn. The motors on one diagonal drive more in one direction, and the motors on the other diagonal drive more in the other direction, based on the sideways slide.

You might need to change the sign of some of these parts based on how your motors are wired.