Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   Jaguar/Victor question (http://www.chiefdelphi.com/forums/showthread.php?t=86065)

artdutra04 14-06-2010 02:46

Re: Jaguar/Victor question
 
Once you set up the P, I and D constants on the Jaguars, they can do all the PID calculations onboard itself. The only thing the main robot controller does is send it a new command position/velocity over the CAN bus.

You can easily use a small microcontroller to communicate to CAN bus devices; there are a thousand different ways to do this, but some of the easiest would be use a microcontroller which supports CAN natively, use a SPI-to-CAN hardware adapter, or use a RS232-to-CAN hardware adapter.

OR...

// What follows is not FRC-legal, but it's a really sweet (and cheap!) solution for offboard PID calculations for other projects.


Let's say you have a really simple speed controller. Maybe it's a Victor, or maybe it's a similar style one rated for different currents or voltages. And you want to use PID, and you want to do it offboard from your main controller. And you're looking to spend no more than a few bucks to do so. Luckily, the Atmel ATtiny series microcontrollers (among many others) was invented for this very reason!

For $1.94, you can buy an Atmel ATtiny13 microcontroller. With six I/O lines (including a 10-bit ADC) and the capability to run up to 20 MHz with an external crystal, you have your main robot controller output a desired output position* to the ATtiny. Once you write the code for it, the ATtiny takes in this signal, takes in the desired PID sensor (potentiometer, encoder, etc), processes the PID calculations, and then outputs the correct PWM signal. Voila, offboard PID!

* The simplest way I wan think of to achieve this (e.g. least additional custom hardware and software) is to plug the robot controller PWM data line into one of the digital I/Os on the ATtiny13, and write a bit-banged function to read the PWM input to ascertain what the 0-255 value was. Then calculate PID, and set the PWM output. To enable the PWM output you'll have to read through the Atmel product manual for the correct internal clock register values to enable PWM output.

nighterfighter 14-06-2010 08:27

Re: Jaguar/Victor question
 
Quote:

Originally Posted by Chris is me (Post 966527)
We're talking about someone's rule question, which would determine whether or not this small personal project is likely to be legal next year. This is useful information for people deciding whether or not to learn about the topic.

This project that I am doing doesn't involve FRC, or FIRST.

I can guarantee it isn't legal, because I will also be having a gas engine on board.


All times are GMT -5. The time now is 07:21.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi