View unanswered posts | View active topics It is currently Thu May 24, 2018 6:01 am

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Motor Controls
Author Message
Rookie

Joined: Mon Jan 24, 2011 2:40 pm
Posts: 2
Motor Controls
Hello,

I am making my 1st time posting, and have been reading and learning along on this forum for a bit. I have been saving this up and here goes.

Programming in and FTC environment, I have a need to drive straight (as possible ) a specific encoder count amount all with a sync'ed - left and right motor - distance, then turn a measured amount, drive straight a short distance, drive reverse, and next a small turn then drive forward a specific amount.... all in high accuracy and under speed control?

Is this possible, and can I get a good control using some of these?

Are all the system parameters available, for my use on the HiTechnic DC Motor Controller and Tetrix motors?

And there are many from the guide - such as;

nMotorPIDSpeedCtrl
nMotorEncoder[]
nMotorRunState[]
nSyncedMotors
nSyncedMotors
nSyncedTurnRatio

Just to name a few.

Are the following params implimented in my RobotC using the Tetrix drive motor with
encoders and are they really successfull?

From the Manual;
The following example will drive robot in a straight line and then turn the robot:

##

nSyncedMotors = synchBC; // Motor ‘C’ is slaved to motor ‘B’
// Drive in a straight line
nSyncedTurnRatio = +100; // Move in a straight line
nMotorEncoder[motorB] = 0;
nMotorEncoderTarget[motorB] = -1000; // move 1000 encoder counts and stop
motor[motorB] = 100;
while (nMotorEncoder[motorB] < 1000) // wait until movement is complete
{}
// Rotate in place to turn robot
nSyncedTurnRatio = -100; // Rotate in place
nMotorEncoderTarget[motorB] = 200; // move 200 encoder counts and stop
motor[motorB] = 50;
wait1Msec(3000);

##

- I think I have experienced the NXT reset condition that causes the PID control not to be downloaded from the NXT to the controller. The next operation occurs without any PID control and the robot moves in odd and unplanned paths.

- I2C bus delays and resets. Seems that I have seen delays in starting motorA and motorB based on controller command timing delaps between them.

- High amperate loading that creates motor failures. (burns up the load resistor in motor)

Is there a need to program encoder resets when I want want to turn and follow my planned path of operation to get highest accuracy?

I do not think I am up to writing my own "PID controlling" program to access
the motor controller directly and get what I have been told is the greatest accuracy,
so with the RobotC use, I hope can do what I need to do?

Looking forward to getting better control of the drive motors and increasing the robots accuracy in distance traveled and speed control on the field.

Phew ... thanks in advance for checking out my question and guiding me in this process.

Deep_Blue

Mon Jan 24, 2011 6:46 pm
Rookie

Joined: Wed Feb 24, 2010 11:43 pm
Posts: 34
Re: Motor Controls
Hi

Briefly (without all the details)

nMotorPIDSpeedCtrl - no
nMotorEncoder[] - yes
nMotorRunState[] - yes
nSyncedMotors - no
nSyncedMotors - no
nSyncedTurnRatio - no

You've probably read in the other thread that the PID speed control only seems to work if the controller gets to initialize the controller.

I believe (but have not tested) that the nMotorEncoderTarget[] array works with the tetrix motors.

I would reset the encoder to zero each time, if it was me..

the section of manual you quoted from relates to the standard LEGO NXT motors...

If you've got high ampere ratings that are burning up the motors, then you need to look at a mechanical fix.

If you don't want to write your own PID, but you want the most accurate distance stops, slow down as you are approaching the target.

Just some ideas... hope that helps!

Tue Jan 25, 2011 5:13 pm
Rookie

Joined: Mon Jan 24, 2011 2:40 pm
Posts: 2
Re: Motor Controls
Thanks for the information....

alanlevezu said,

..."You've probably read in the other thread that the PID speed control only seems to work if the controller gets to initialize the controller."...Can you tell me what steps, insures that controller gets initialized?

Is this the known download issue that sometimes occurs?

Does RobotC create a software PID or does it "communicate with the on controller PID" and use the cmotor controller's internal PID - because it seems that the bus delay does come into play when RobotC is in control. Correct?

I have a situation where drive motors running at 100 % for 10 seconds after Logitech Control is stopped still move under power for a few seconds - but at 50% power when drive motors are stopped by Logitech Control they stop in just a fraction of a second. A fast stop. Can this be a delay type issue with commands to start and stop some how delayed or queued?

I was not clear if RobotC uses a "write and read" on the I2C bus to the controller and these commands timings are then subject to a 25 ms delay which is the standard communication pause when communicating? All of this is because I am trying to understand where the inaccuracy comes from in the motor control?

Briefly

moving forward right motor 2 turns
then left motor 1 turn

is not the same location on X and Y axis as

move forward left motor 1 turn
then right motor 2 turns

so bus or programming delays produce different results. Timing does matter.

IF the controller could start both motors at same time a straight line could "produced with best possible accuracy".

What could help in the environment?

Deep_Blue

Tue Jan 25, 2011 6:51 pm
Rookie

Joined: Wed Feb 24, 2010 11:43 pm
Posts: 34
Re: Motor Controls
 Quote:..."You've probably read in the other thread that the PID speed control only seems to work if the controller gets to initialize the controller."...Can you tell me what steps, insures that controller gets initialized? Is this the known download issue that sometimes occurs?

From experimentation, the PID appears to be located in the controller.

Also from experimentation - the only way to guarantee the Tetrix controller PID is working is:
1. NXT off, 12v Off
2. 12v On
3. NXT On
4. Start program

It appears that the PID in the controller stops being active whenever the 12V is cycled
It appears that when this happens, the controller does not let the NXT know, and thus the NXT does not re-initialize the PID.

debugging your "situation" is impossible without seeing your actual code...

I have no clue on the I2C bus comm stuff. (sorry)

Wed Jan 26, 2011 12:54 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 4 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

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.