View unanswered posts | View active topics It is currently Sat Nov 22, 2014 6:28 am






Reply to topic  [ 9 posts ] 
Jerkiness when executing a turn with sync'd motors 
Author Message
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3289
Location: Rotterdam, The Netherlands
Post Jerkiness when executing a turn with sync'd motors
Hey there,

When I am using code like this:
Code:
nSyncedMotors = synchBC;
nSyncedTurnRatio = - 100;
motor[motorB] = 30;

The motors run really jerky and the bot shakes about a little, really annoying. However, when I turn like this
Code:
nSyncedMotors = synchNone;
motor[motorB] = 30;
motor[motorC] = -30;

it's a smooth ride. The batteries are fine, they're as fresh as anything. Is there something I can tweak with the synch'd motors to make it run a little smoother?

I am using v1.30B4.

Regards,
Xander "full of questions" Soldaat.

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat May 31, 2008 4:19 pm
Profile WWW
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post 
I can copy that!
And I take the view, yet with 1.05 this hasn't been that distinctive :?

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sun Jun 01, 2008 4:01 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3289
Location: Rotterdam, The Netherlands
Post 
Thanks for testing the problem, Ford. Yeah, I hadn't noticed it at all with the 1.05 std and enhanced. At first I thought it was something with the motors or the batteries. I am glad it is neither but sad that it's the FW.

Where can we submit bugs for the beta?

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Jun 01, 2008 4:10 am
Profile WWW
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post 
maybe here:
http://www.education.rec.ri.cmu.edu/too ... w_page.php
(first you have to register)

But till I'm 100% sure that it's a bug, I always am posting it here. The developers are supposed to read them all... :?

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sun Jun 01, 2008 4:19 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3289
Location: Rotterdam, The Netherlands
Post 
Did some more testing and you can reduce the jerkiness by changing the nPidUpdateInterval parameter.
Code:
  nSyncedMotors = synchBC;  // Motor ‘C’ is slaved to motor ‘B’
  nPidUpdateInterval = 15;

The default value is apparently 25ms and that doesn't seem to be small enough. However, when you make it <= 15 it is a LOT smoother.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Jun 01, 2008 4:19 am
Profile WWW
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post 
Moreover, this motor controlling parameter seems to belong to another hidden background task.

I think in RobotC, there are much too many system parameters and background tasks - to crown it all, mostly undocumented.
And over and above that the compiler produces "code optimization" which sometimes is faulty and was not strictly necessary. (Let the programmers optimize their codes by themselves! It's their responsibilty!))

If a background task is needed, it's also the responsibility of the programmer, not of the compiler!

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sun Jun 01, 2008 5:26 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3289
Location: Rotterdam, The Netherlands
Post 
I agree to a degree. However, you must not forget the target audience of this product. It is used a lot in education and you can't expect a 12-15 year old to be able to do all those things (yet). I agree with the documentation part, though. I would love to know some of the more nitty gritty details of how the FW does certain things, like the PID control of the motors, for example.

In the end it's a trade-off, both for the manufacturer and the developer. Power and control vs ease of use :) I think RobotC does it quite well and I am quite happy with it so far. In fact the only "problem" I have now is that my robot reacts too quickly to certain events. It is something I didn't have to deal with when using NXC. I think it something I can live with, though :)

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Jun 01, 2008 5:37 am
Profile WWW
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post 
I doubt if a 12-15 year old child needs those built-in system features like nPidUpdateInterval or nMotorPIDSpeedCtrl.

And I hope that you won't misunderstand me:

I wish RobotC to be easy to use, but in a straight and direct way, just like C with it's macros and libraries.
For example, in every C language there is the basic command and key word set,
and besides this, there are "basic expansions" like
- a stdio.h with a console for input and output,
- a math.h or math.lib with exp and sin and atan and tanh,
- as well as some "advanced, more complex libraries" like a sort library with a quicksort

all these are made to make programming easier. I really appreciate those expansions also at RobotC, above all, where C has got no definitions or interfaces (e.g., for motor or sensor control). But don't let a compiler use hidden function parameters or start hidden background tasks which cause sort of "own existences".

Above all, RobotC should be C - and not a language of "fantasy and imagination".

Just remember KISS: Keep It Simple and Stupid - as far as possible:
- and not in spite of, but just because of didactic reasons 8)

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sun Jun 01, 2008 6:02 am
Profile
Rookie

Joined: Thu Jan 10, 2008 12:44 am
Posts: 3
Location: Deep Creek Lake, MD USA
Post Visibility is key!
I have to agree with Ford here.

I like compilers to make my programming life easier, but as an experienced programmer I NEED to know what's hapenning in the background.

The example of C libraries is great.

When a student that I'm mentoring asks "How does the robot do that?" it's important for me to answer inteligently and accurately. If I don't know the answer I need to be able to say "Let's go look at the library and find out".

If I just have to guess at what's hapenning, then I'm doing two things....

1) I'm potentially providing the student incorrect information.
2) I'm missing the opportunity to pass on the knowledge accumulated by the person who wrote the "hidden" library in the first place.

Just my 2c worth.

_________________
Phil Malone
FRC and FLL coach.
Potential FTC coach.


Thu Jun 05, 2008 1:50 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



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