View Single Post
  #2   Spotlight this post!  
Unread 27-05-2016, 10:54
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: swerve drive with arduino mega 2560

Running a full swerve system on an Arduino is certainly possible, but it may be more of a challenge than you would like to take on. The biggest issue with the Arduino is that it does not have a floating point execution unit in the CPU. That means that all floating point operations have to be performed in software. Relatively speaking, this is very slow. In a typical swerve application, there are many FP operations required to determine steering angle, and wheel speed utilizing trig functions, PID loops, etc. If you attempted to do this directly on the Arduino, it would not have the processing power to perform these operations in a timely manner. A number of teams had swerve drives in the old IFI controller days. These controllers, while quicker than the Arduino - 40 MHz as opposed to 16 MHz for a Mega, also did not have a FP unit. Several strategies were used as work arounds to minimize or eliminate the need for floating point calculations including fixed point math and integer trig approximations. I would also recommend that you look into efficient interrupt driven routines for, what I will call, background tasks (encoders, analog signal A/D, PWM generation); again to minimize CPU usage and unnecessary delays.

For reference, I used an old IFI controller (2007 vintage - it was free) to make a swerve drive about a year ago using the techniques I mentioned above. It is a full swerve, with multiple modes including snake, and I am confident that I could make it work on an Arduino as well. However, I wouldn't recommend it unless you are willing to put a fair amount of time as it will not be easy (but a great learning experience!).

Mike
Reply With Quote