View unanswered posts | View active topics It is currently Sat Aug 17, 2019 7:38 am

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
PID Control
Author Message
Rookie

Joined: Tue Nov 04, 2014 5:04 pm
Posts: 2
PID Control
Hi guys im attempting to learn PID control for my robotics classroom. I was looking over some example code and was wondering if anyone can explain some of these statements to me or maybe to the whole code. I have been unable to find any teaching source for PID and at this point I have excelled my teacher so he is unable to teach me this.

The things i dont know are what these things stand for nLastPos, nPos, nNumbOfHits, nSensor, nWeight, ++nCycles.

I have no idea what the n in front of the statements mean aswell.

Here is the code that I am looking at

Mon Jan 12, 2015 8:42 pm
Rookie

Joined: Wed Feb 24, 2010 11:51 pm
Posts: 31
Re: PID Control
Hi,

It is common in some styles of programming to prefix variable names with their type.

Thus, the 'n' prefix means this variable is a 'number'.

As for the other variables, I can guess at a couple of them, but the others aren't obvious when taken out of context. I can't follow the link you posted as it's blocked for me.

A PID control is designed to use sensors to adjust a robot in order to match a desired, or 'target', position or speed. To accomplish this task, the sensor is repeatedly sampled, and the reading is used to compute a correction, which is applied by turning a motor. Given that, I'd apply the following guesses to some of the variable names:
nSensor - is either the sensor number or the last raw value read from the sensor.
nPos - is probably the current position, derived from the last raw sensor value. This is where the sensor says the robot is right now.
nLastPos - is probably the last position. This is where the sensor says the robot was the last time it checked. Probably 1-20 milliseconds ago. This is used for the 'D' part of the PID calculation.

The others are unclear without context.

Terry

_________________
Vex & FLL Coach and robotics instructor

Tue Jan 13, 2015 1:41 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 2 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning