Search  
Monday, January 05, 2009 ..:: Forum ::.. Register  Login
 HomePage Minimize

 Print   

 Products Minimize

 Print   

 MSRS Minimize

 Print   

      
 RoboticsConnection Forum Minimize
SearchForum Home
  Discussions  Serializer Robot Controller  Encoders in .NE...
 Encoders in .NET
 
 8/14/2007 11:37:15 AM
cmercada
1 posts


Encoders in .NET
Hello,
In the Serializer manual, there is a message that can be sent to the serializer to retrieve the current speed in RPMs of an encoder, but there doesn't seem to be a way of getting the speed of the wheel inherently using the .NET framework provided. In my application, I calculate the RPM using a timer event that triggers every half second using a formula that looks like this:

(newEncoderCount-oldEncoderCount)/(encoderResolution*60)

but this doesn't seem to give me a very correct answer. Is there some way of retrieving the wheel speed using the .NET framework or is there a more accurate way of calculating the speed in the program?

Thanks in advance,
Christopher
 8/14/2007 2:16:30 PM
jason
158 posts
5th


Re: Encoders in .NET

Well, currently there isn't, BUT THERE SHOULD BE! :) I don't know how we missed that.  I'll add it this weekend, and put a new release out.  We need to add functionality for some of our other sensors anyway.

 


Jason Summerour
President,
Summerour Robotics Corp
Microsoft MVP
www.roboticsconnection.com
 8/27/2007 3:09:29 PM
jason
158 posts
5th


Re: Encoders in .NET

Christopher,

I just added a LeftVelocity/RightVelocity property to the DifferentialMotorController class, and a Velocity property to the DCMotorControllerBase classes.  Having added it to the DCMotorControllerBase class means that the PwmDCMotorController class will inherit this functionality.

To be able to get the latest value of the Velocity for PwmDCMotorController class instance, you will need to use the following sequence:

    pwmMotor.Update();         // This queries the value of the velocity on the Serializer,
                               // waits and processes the response, and sets the value of the Velocity Property.
    vel = pwmMotor.Velocity;   // Then, you read the property for the value.

You perform a similar operation with the DifferentialMotorController class too:

    diffMoCo.Update();   
    leftVel = diffMoCo.LeftVelocity;
    rightVel = diffMoCo.RightVelocity;

Also note, that this will require a firmware update, so that you can query the motor velocities separately.  So, we will release a new firmware version too (v1.4.2).  Right now, the command 'vel' returns both velocities'.  We're changing it so that you can specify the motor you want queried for velocity (e.g. "vel 1", or "vel 1 2").

I'll test these changes by Wednesday, and then release it.

Sorry for the delay...We've just been swamped... :)


Jason Summerour
President,
Summerour Robotics Corp
Microsoft MVP
www.roboticsconnection.com
 8/28/2007 1:58:30 PM
jason
158 posts
5th


Re: Encoders in .NET

Christopher,

I also modified the PIDMotorController class to have a Motor1Velocity and Motor2Velocity Property.

To obtain the velocities, you invoke the same interface as above (note: pmc = PIDMotorController):

   pmc.Update();     // This queries the value of the velocity for both motors on the Serializer,
                     // waits and processes the response, and sets the value of Motor 1 & 2 Velocity Properties.
   Console.WriteLine("Motor 1 Velocity: {0}", pmc.Motor1Velocity);
   Console.WriteLine("Motor 2 Velocity: {0}", pmc.Motor2Velocity);

I'll have this tested, and out on the site by Wednesday night.  I've already modified the 'vel' command in the v1.4.3 firmware, and have tested it.

I also added a LineFollowingSensor to the .NET library, so customers can utilitze our I2C Line Following Sensor.


Jason Summerour
President,
Summerour Robotics Corp
Microsoft MVP
www.roboticsconnection.com
 8/28/2007 11:25:27 PM
jason
158 posts
5th


CRe: Encoders in .NET

Christopher,

Okay, all  of the changes have been made, and tested with both the .NET library, and the Serializer firmware...Now I just need to get the documentation updated. :)  I'll do that tomorrow.

The modifications to the 'vel' command within the firmware allow it to be backwards compatible.  So, if 'vel' is typed, then both values for Motor 1 and Motor 2 are returned (like before), else if a motor id (or both) is/are specified, then those specific velocities will be returned.

   >vel
   0 0
   >

   >vel 1
   15
   >

   >vel 1 2
   14 16
   >

 


Jason Summerour
President,
Summerour Robotics Corp
Microsoft MVP
www.roboticsconnection.com
  Discussions  Serializer Robot Controller  Encoders in .NE...

SearchSearch  Forum HomeForum Home    Print   

Copyright 2004-2007 Summerour Robotics Corp   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2009 by DotNetNuke Corporation