Getting distance traveled from PID controller?
Navigates to RoboticsConnection.com Home RoboticsConnection.com HomePage
RoboticsConnection User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Getting distance traveled from PID... Expand / Collapse
Author
Message
Posted Saturday, May 31, 2008 11:08 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Monday, December 01, 2008 8:40 AM
Posts: 40, Visits: 190
Hi Jason,

I've checked the .Net documentation on the PID controller interface and it's not clear to me if I can get the distance traveled between any two points in time. In other words, suppose I command my robot to move 48 inches but part way through it has to stop because of an obstacle. I'd like to be able to read off how far it traveled before stopping. If I were doing it at the firmware level I could clear the encoder counters then read off their values when the robot stopped.

Thanks!
patrick

Post #525
Posted Monday, June 02, 2008 12:09 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Thursday, June 26, 2008 11:27 PM
Posts: 30, Visits: 306
Hi

I did a lot of tests with PID.I think if you stop PID with cmd stop or other, you can querry the counter value and convert ticks to inch(the counter is reset only if you send a new pid cmd "i think").

Regards

Arnaud

Post #527
Posted Monday, June 02, 2008 6:50 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Monday, December 01, 2008 6:34 PM
Posts: 299, Visits: 426
Patrick,

As soon as you issue a PID command, the encoder values are reset.  So, you can simply create two WheelEncoder objects, set their Resolution and WheelDiameter properties, and query their value as soon as you stop the robot to obtain distance.

Best Regards,

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #530
Posted Monday, June 02, 2008 7:49 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Monday, December 01, 2008 8:40 AM
Posts: 40, Visits: 190
Thanks Arnaud and Jason! I don't know how I missed the WheelEncoder object--didn't think to look in the Sensors section of the docs instead of the PID section, though it makes sense that's where they should be. Now I am all set.

--patrick

Post #535
Posted Sunday, June 08, 2008 6:35 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Monday, December 01, 2008 8:40 AM
Posts: 40, Visits: 190
Hi Jason,

I may have found a glitch in the WheelEncoder object. The Resolution property is typed as a byte which is too small to hold the resolution of the encoders I am using (US Digital encoders that mount to a Lynxmotion gearhead motor). The resolution for these encoders is something like 6250 ticks per revolution which won't fit into a byte. Even the 624-pulse resolution of the Traxster motors won't fit into the byte value. By contrast, the PIDMotorController Resolution property is typed as an int and so I don't have the same problem there.

Thanks!
patrick
Post #550
Posted Monday, June 09, 2008 12:24 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Thursday, June 26, 2008 11:27 PM
Posts: 30, Visits: 306
Hi,

I have same problem with WheelEncoder. I'm interested by this resolution and it is true when we use PID we don't have problem with encoder resolution!!!

Regards

Arnaud

Post #552
Posted Tuesday, June 10, 2008 11:53 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Monday, December 01, 2008 6:34 PM
Posts: 299, Visits: 426
Hey guys,

Sorry for the delay...I've been taking a few needed vacation days.

I'll get that fixed in the lib, and released by this weekend.

Best Regards!

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #553
Posted Wednesday, June 11, 2008 8:15 PM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Monday, December 01, 2008 6:34 PM
Posts: 299, Visits: 426
Okay guys,

I just put a new Serializer .NET Lib release (1.2.3.1) out on the site:

     http://www.roboticsconnection.com/p-16-serializer-net-robot-controller.aspx

The only change was the WheelEncoder Resolution property type from a byte to an int.

Let me know how it works out...

I'll get the documentation updated this weekend (it's a pain).

Best Regards!

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #556
Posted Wednesday, June 11, 2008 8:25 PM