Well, before I can do anything with velocity estimation, I need to just 
get the
scaled velocity pin exported.  I added a couple more elements to the encoder
structure :
  hal_float_t *vel;             /* output: scaled velocity */
  hal_float_t min_speed;        /* parameter: min speed for velocity 
estimation */

and exported the pin to HAL :
      retval = hal_pin_float_newf(HAL_OUT, &(slot->encoder[n].vel), comp_id,
            "ppmc.%d.encoder.%02d.vel",bus->busnum,bus->last_encoder);
      if (retval != 0) {
        return retval;
      }

and then wrote a value to it :
    *(slot->encoder[i].delta) = pos.l - slot->encoder[i].oldreading;
    *(slot->encoder[i].vel) = (pos.l - slot->encoder[i].oldreading) / 
(slot->encoder[i].scale * read_period);
The first line is old code and writes out the velocity in raw encoder 
counts, the second line is the new one
that writes out the velocity scaled by both linear scaling factor and 
sampling period.

I see the pin and can watch it with Halscope, but the vel pin always has 
a value of zero, even though the
line above produces a correct unscaled delta value.

Any ideas, have I missed something to get the value exported properly to 
the HAL pin?

Jon

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to