View unanswered posts | View active topics It is currently Wed Jun 29, 2016 10:51 am

 Page 7 of 9 [ 133 posts ] Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next
 Print view Previous topic | Next topic
Endcoders better?
Author Message
Novice

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Re: Endcoders better?
before i change anything... i just tested the robot, starting out with it turned 90 degrees from the ir beacon. it would then turn left, see the beacon, and drive almost to it

But, when i test it to go to the right, it wont.

So it worked forward and left, but right is not.

Fri Apr 22, 2011 10:46 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
 Team2844 wrote:But, when i test it to go to the right, it wont.So it worked forward and left, but right is not.

You mean starting out by placing the robot so that the beacon is on the right side? When that happened what were the numbers of the screen?

Fri Apr 22, 2011 10:53 pm
Novice

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Re: Endcoders better?
the nxt screen for the new code

left side, 1.000 l = 20, r 100

moving toward middle, l get higher, r gets lower

middle, 2.000 l =70, r =70

moving toward the right, l get higher, r gets lower

right side, 3.000 l= 100, r =20

one second on the last thing you asked

Fri Apr 22, 2011 11:01 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
These numbers looked totally normal, the motors should be responding correctly to the beacon.... Why is it not working???

Fri Apr 22, 2011 11:07 pm
Novice

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Re: Endcoders better?
I tested it three times and these were the results.

First time. 2.33333
sencond time. 2.215
third time 3.00000
fourth time 4.50000 l 87, r-13

would it just be having trouble turning to the right?

Fri Apr 22, 2011 11:09 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
If the left motor was programmed to 87 and the right motor was at -13, it should turn right, shouldn't it?!! So what is the symptom now? Did it just stop? Or did it continue going straight ahead?
Hmm, normally the beacon should not be too far off to the left or right, correct? If so let's limit the turn power to -10, 10. Currently, it is turning too strong. The limit will give you a delta of 20 which is enough for course correction.
I am puzzled. If it is possible, can you post a picture of your robot? It may give me some clue that I would not think of.

Fri Apr 22, 2011 11:21 pm
Novice

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Re: Endcoders better?
Before I change anything.. the robot will keep moving forward even though the beacon is to the right. but when its going forward, it seems to have a very slight pull to the right, like its trying to turn, but something is not letting it.

Fri Apr 22, 2011 11:31 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
 Team2844 wrote:fourth time 4.50000 l 87, r-13

Wait, how can these numbers be possible? drivePower is limited to between -70 and 70. So in order for L to become 87, turnPower must be 17. But if that's the case, R should be 70 - 17 = 53. So it can't be -13. Can you post your DriveIRTask code along with the g_driveIRTarget, g_turnIRKp etc. This is simply impossible unless the code is not what I think it was.

Fri Apr 22, 2011 11:53 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
 Team2844 wrote:fourth time 4.50000 l 87, r-13

Wait, how can these numbers be possible? drivePower is limited to between -70 and 70. So in order for L to become 87, turnPower must be 17. But if that's the case, R should be 70 - 17 = 53. So it can't be -13. Can you post your DriveIRTask code along with the g_driveIRTarget, g_turnIRKp etc. This is simply impossible unless the code is not what I think it was.

Fri Apr 22, 2011 11:54 pm
Novice

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Re: Endcoders better?
Maybe i put something in wrong??

Sat Apr 23, 2011 12:08 am
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
Ok, I was wrong. It is possible to have those numbers. drivePower was 37 and turnPower was 50. So Left=37+50=87 and Right=37-50=-13. This means the turning power is way too strong. So Kp should be tuned much lower. I suggested setting g_turnIRKp lower but you didn't do that. I also suggested to limit turnPower to the range of -10 to 10. You didn't do that either. That's why I thought it wasn't possible to have a turnPower as high as 50. Please set g_turnIRKp to 10.0 and limit turnPower to the range -10.0 to 10.0. Now that would make the numbers behave more reasonably but it still doesn't explain why the robot doesn't turn right. Can you lift the robot off the ground so that the wheels are not touching anything. And face the robot such that the IR reading is approx. 2.9 (close to 3.0) and see how the wheels are turning. I am wondering if your motors are somehow too weak. By lifting it off the gound, it has no load and will be freely turning. If that behaves correctly. Then run it again on the ground and see what happens.

Sat Apr 23, 2011 12:50 am
Novice

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Re: Endcoders better?
Ok, where do you want me to turn the turn power down. In the TurnTask, or in DriveIRTask.

Without turning that down, but the kp to 10, I got these results. The robot is off the ground for these.

 Code: L       R      zone38     28    2.555     35    3.0    this happened 4 times.37     35    2.1238     28    2.5236     16    2.58

When I run the code, it will usually jump to the 3.0 zone, and totally skip the 2.6-2.9 range. or go to the 2.59 range and down.

I did get these weird numbers though three times. same exact area as the beacon was above.
 Code: L       R      zone86      0     6.3884     -16    7.0   83     -7     6.5

I know that it can turn right... I just ran the code to go to the trailer from the left side starting position, and it turns the 90 degrees to the right perfectly.

Sat Apr 23, 2011 10:32 am
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
 Team2844 wrote:Ok, where do you want me to turn the turn power down. In the TurnTask, or in DriveIRTask.

DriveIRTask. That's what we are debugging. Try this and let me know if the robot can turn right to go to the beacon. Please report the following info because I wasn't quite clear on your previous account what had happened. For example, I would like to see the numbers as well as the effect on the robot:
 Code:IRValue  LeftPower  RightPower Describe what happened  2.5       38          28     Robot going straight ignoring the beacon

 Code:void DriveIRTask(){    if (g_driveIREnabled)    {        float driveErr = g_driveTarget - GetDriveDistance();        if (abs(driveErr) > g_driveTolerance)        {            //            // Simple proportional PID control.            // Limit the outpout to the range of -100 to 100 for drive            // and -50 to 50 for turn            //            int drivePower = BOUND((int)(g_driveKp*driveErr), -70, 70);            float turnErr = IRGetACDir(IRSeeker2) - 2.0;  //use zone 2 as the straight ahead zone            nxtDisplayTextLine(2, "IR=%f", IRGetACDir(IRSeeker2));            int turnPower = BOUND((int)(g_turnIRKp*turnErr), -10, 10);            nxtDisplayTextLine(6, "L=%d,R=%d",                      BOUND(drivePower + turnPower, -100, 100),                      BOUND(drivePower - turnPower, -100, 100));            motor[motorLeft] = BOUND(drivePower + turnPower, -100, 100);            motor[motorRight] = BOUND(drivePower - turnPower, -100, 100);        }        else        {            motor[motorLeft] = 0;            motor[motorRight] = 0;            g_driveIREnabled = false;        }   }}

Sat Apr 23, 2011 1:11 pm
Novice

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Re: Endcoders better?
With only me... i am not able to watch what it is saying the zone is until it stops the 56 inches. the zones are what it is when they finish.

 Code:Left of robotIRValue  LeftPower  RightPower   Describe what happened  3.0       36            16        Drifted left the 56 inches about 40 degrees  3.0       39            19        Drifted left the 56 inches about 45 degreesfront of robotIRValue  LeftPower  RightPower   Describe what happened  0.0       23            43        Drifted left the 56 inches about 65 degrees, ignoring the beacon  0.0       21            41        Drifted left the 56 inches about 70 degrees, ignoring the beaconRight of robotIRValue  LeftPower  RightPower   Describe what happened  3.0       38           18        Drifted left the 56 inches about 20 degrees  3.0       40           20        Drifted left 20 degrees over 24 inches, driving moderately straight the rest of the way.

With more than the -10,10 the robot will turn better to the left close to it, but again, had trouble turning right like it should with a load on it. Yet when you look at it trying to turn right without a load, you can see its trying to... is there anyway that I can give the left side just a little more power than the right side, even when its suppose to be going straight.

Also, say its turning left, is this code just giving less power to the left side, or is it allowing for the left side to go backward.. actting like a tank drive. My robot runs better when i turn it like that, other than just running one side and leaving the other low or off of power.

Sat Apr 23, 2011 1:59 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Endcoders better?
Team2844 wrote:
 Code:Left of robotIRValue  LeftPower  RightPower   Describe what happened  3.0       36            16        Drifted left the 56 inches about 40 degrees  3.0       39            19        Drifted left the 56 inches about 45 degreesfront of robotIRValue  LeftPower  RightPower   Describe what happened  0.0       23            43        Drifted left the 56 inches about 65 degrees, ignoring the beacon  0.0       21            41        Drifted left the 56 inches about 70 degrees, ignoring the beaconRight of robotIRValue  LeftPower  RightPower   Describe what happened  3.0       38           18        Drifted left the 56 inches about 20 degrees  3.0       40           20        Drifted left 20 degrees over 24 inches, driving moderately straight the rest of the way.

BTW, do you know you can see the LCD screen remotely? in the RobotC IDE, if you click the "Robot" menu, there is an item about debug window and you can pop open the remote LCD screen so you can see it on your laptop (don't have RobotC in front of me, so can't tell you exactly what the menu item is called).
Are you sure the data is right? On "Left of robot", the IR value should be below 2.0 but it's 3.0. Could be because you read the numbers at the end of the 56-inche run so by then the beacon was on the right instead even though it started on the left. A major concern is the IR value 0.0 when the beacon is in front. This means the sensor doesn't see the IR beacon at all. Can you make sure the way you mount the IR sensor that it has full 180-degree view to the front of the robot. I am worrying about something is blocking the IR signal at a certain angle. Also, make sure there is no shiny reflective surface that could reflect a false IR signal from the wrong angle. From the data "Right of robot", the data still said the robot should be turning right, I don't know why it is turning left. I guess if you are reading this data at the end of the 56-inch run, it could be the wrong data. I really need the data while it is turning left, not at the end when it's stopped. Misleading data could lead me into the wrong path.

Sat Apr 23, 2011 2:28 pm
Display posts from previous:  Sort by
 Page 7 of 9 [ 133 posts ] Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

#### Who is online

Users browsing this forum: No registered users and 1 guest

 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