View Single Post
  #5   Spotlight this post!  
Unread 04-11-2014, 20:34
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Can someone explain this code?

Quote:
Originally Posted by lineskier View Post
Here's what I've interpreted so far. The rotate left/right may be flipped.

This is a rather strange convention.
leftMotorSpeed = moveValue - rotateValue;
rightMotorSpeed = Math.max(moveValue, rotateValue);

It's probably trying to make sure the right motor is going faster than the left (i.e. turning left), but regardless this is probably not the ideal way to code this.
That part is a copy of the WPILib arcadeDrive method. You can see how it works here: http://www.chiefdelphi.com/forums/sh...0&postcount=11
Reply With Quote