OpenServo.com Forum Index OpenServo.com
Discussion of the OpenServo project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Porting software to OpenServo Version 3 boards
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software
View previous topic :: View next topic  
Author Message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Sat Jan 19, 2008 4:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
eric_lmi



Joined: 08 Mar 2007
Posts: 41

PostPosted: Sat Jan 19, 2008 4:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Sat Jan 19, 2008 5:21 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
eric_lmi



Joined: 08 Mar 2007
Posts: 41

PostPosted: Mon Jan 21, 2008 12:04 pm    Post subject: Reply with quote

Where is the function filter_update?
don't really understand how the filter works
Back to top
View user's profile Send private message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Mon Jan 21, 2008 12:24 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software All times are GMT
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
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