NXC: RotateMotorEx issue

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
Posts: 2500
Joined: 04 Nov 2014, 19:00

NXC: RotateMotorEx issue

Post by HaWe » 11 May 2011, 07:57

there are some issues using
in our German forum.
To turn a vehicle (tribot etc) on the spot my suggestion was for 360° of each single motor axle (B, C)
RotateMotorEx(OUT_BC, 50, 360, -100, true, true); // robot turns clockwise
RotateMotorEx(OUT_BC, -50, -360, -100, true, true); // robot turns counterclockwise
But I've been told that I should be wrong.
Am I really?

what actally means
turnpct = 0? 0% synched=no sync = both motors running independently? or 2nd motor stands still?
turnpct = +/- 100? +100=100% exact sync? -100= 100% negative synched (inverse) rotation?
turnpct = +/- 50? half amount of rotation of the 2nd motor related to the 1st one?
It's not very well ducumented...

Posts: 67
Joined: 12 Oct 2010, 17:44

Re: NXC: RotateMotorEx issue

Post by rghansen » 11 May 2011, 13:42

Although I'm no expert, I spent a fair bit of time trying to figure out what the turnpct means in RotateMotorEx without much luck. I finally gave up on it completely when I found out that even with values of 100 or -100, it couldn't keep the motors in sync.

But at least just found out that there is a German language Mindstorms forum called mindstormsforum.de, correct?

Thanks for the info.

Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: RotateMotorEx issue

Post by HaWe » 11 May 2011, 19:14

Maybe some other experts around here know something specific about the RotateMotorEx percent-sync-ratio and my TO question?

it seemes to work the following way, but this would be REALLY WEIRD AND ODD:

Code: Select all

RotateMotorEx(OUT_AB, 60, 360, -100, true, true);
RotateMotorEx(OUT_AB, 60, 360, 100, true, true);
for 1 motor into 1 direction and the 2nd one into the other direction it should be turnpct = -100 in both cases because both wheels are running with 100% inverted synchronization = -100% either if 1st motor is fwd or rev.
With turnpct = +100% both wheels should be turning 100% into the same direction.

Or does it work this way nevertheless? What are the right definitions like?

RobotC is making it more clearly using a master motor and a slave motor!

Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: RotateMotorEx issue

Post by HaWe » 15 May 2011, 10:19

no one who knows something about the turnpct definition used by rotatemotorex?

Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN

Re: NXC: RotateMotorEx issue

Post by afanofosc » 15 May 2011, 20:14

I searched for "turn" in the NXC help online and found this:

http://bricxcc.sourceforge.net/nbc/nxcd ... 445c4ad3fe

That's all there is to say about this parameter. The firmware does not handle non-zero turn percentages perfectly.

John Hansen
Multi-platform LEGO MINDSTORMS programming

Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: RotateMotorEx issue

Post by HaWe » 15 May 2011, 20:41

Code: Select all

turn ratio
There are only three valid combinations of left and right motors for use with TurnRatioField: OUT_AB, OUT_BC, and OUT_AC. In each of these three options the first motor listed is considered to be the left motor and the second motor is the right motor, regardless of the physical configuration of the robot. Negative turn ratio values shift power toward the left motor while positive values shift power toward the right motor. An absolute value of 50 usually results in one motor stopping. An absolute value of 100 usually results in two motors turning in opposite directions at equal power. 
thank you John!
I hope you've recovered well from the floods! :)

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests