| View previous topic :: View next topic |
| Author |
Message |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Sat Jan 19, 2008 4:22 pm Post subject: |
|
|
Hi eric,
At the moment I am using a bit of both. The pot sets a one calibration value for the EMF feedback value on each new position change.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
eric_lmi
Joined: 08 Mar 2007 Posts: 41
|
Posted: Sat Jan 19, 2008 4:46 pm Post subject: |
|
|
Barry
i am trying to make it EMF only, but still far away to success
do you think it is achievable? have you updated hourly snapshot
wanna learn what you did.
Eric |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Sat Jan 19, 2008 5:21 pm Post subject: |
|
|
Eric,
I am only using the EMF for speed sensing, and the pot is still used for positional sensing. I don't believe the pot can be dropped for positional as yet.
In its simplest form, without the calibration of the pot feedback, here is how I am using the EMF sensed data.
The initial sign change is because the EMF always reads a positive value. I am using the current direction vector from the pot value to get the sign as below.
| Code: |
sign = filtered_position - previous_position;
if (sign < 0)
sign = -1;
else
sign = 1;
current_velocity = sign * filter_update(banks_read_word(INFORMATION_BANK, REG_BACKEMF_HI, REG_BACKEMF_LO), &filter_reg_emf);
|
Filter_update has been changed to allow filtering of any variable.
I would be interested to hear your thoughts on this.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
eric_lmi
Joined: 08 Mar 2007 Posts: 41
|
Posted: Mon Jan 21, 2008 12:04 pm Post subject: |
|
|
Where is the function filter_update?
don't really understand how the filter works |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Mon Jan 21, 2008 12:24 pm Post subject: |
|
|
filter_update is at the top of pid.c and is an implementation of a digital low pass filter. The details for how this works are well written here: http://www.edn.com/article/CA6335310.html
You can pretty much take the filtering component out of the equation for the EMF as it makes very little difference, but should you wish to update filter function, you will need to look at something like this:
| Code: |
static int16_t filter_update(int16_t input, int16_t *filter_source)
{
// Update the filter with the current input.
*filter_source = *filter_source - (*filter_source >> FILTER_SHIFT) + input;
// Scale output for unity gain.
return (int16_t) (*filter_source >> FILTER_SHIFT);
}
|
Thus preserving the filter value for the next pass and returning the newly filtered value. filter source should be a static int16_t and passed by address to the filter_update function. Not pretty, but allows for multiple values to be filtered in the pid algo.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|