NXC: what means "actual", "speed", and "actual speed"?

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

NXC: what means "actual", "speed", and "actual speed"?

Post by HaWe »

hi,
I'm not sure about that topic but using the forum's search I get no valid matches...

my question:
what means "actual speed" and what kind of values does this function exactly produce?
char MotorActualSpeed ( byte output ) [inline]
Get motor actual speed.

Get the actual speed value of the specified output.
speed in this context surely is rotation speed and rotation speed is measured by rounds per minute or degrees per 100 millisecond or whatever,
and "actual" means "real" or "in fact" or "indeed".

Surely, what the funtions is returning is of course anything but what the name of the function "MotorActualSpeed " or the description "Get motor actual speed" connotes - but what is it exactly ? :roll:
linusa
Posts: 228
Joined: 16 Oct 2010, 11:44
Location: Aachen, Germany
Contact:

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by linusa »

The value of MotorActualSpeed is only valid when OUT_MODE_REGULATED is used, in conjunction with OUT_REGMODE_SPEED -- i.e., when "speed regulation" / "power control" is enabled. During this mode, MotorPower() is the setpoint of the controller, and MotorActualSpeed() is the power level the firmware currently sets to the motor output.

"Speed" is misleading, as it is an abitrary "PWM power level" in percent, from 1 - 100*. While there exists a relation from "Power" to degrees per second, this relation doesn't hold during regulation. I never call anything that you can set to the motor outputs in the NXT firmware "speed", even if it happens to work approximately when no regulation is used. It's an abitrary, non-linear variable that one shouldn't try to interpret physically.

When angular speed is needed, one has to measure it by oneself.

During regulation, MotorPower() is the desired power, while MotorActualSpeed() is the power the motor is actually running at -- hence the "actual" I guess.

As soon as the regulation can't keep up with what MotorPower() would like it to, MotorActualSpeed() is 100 and MotorOverload() is true. Some years ago, the status of this overload bit wasn't reset, so it would stay true once the motor was only in overload mode once, until reset again.

___
*Check whether the range can go to -1 to -100 as well (for reverse direction), or if it always stays positive. I forgot.
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by HaWe »

thank you, but I didn't understood everything, except that it is sort of intermediate PWM in some cases when special motor functions are used.

As it is PWM, I would strongly recommend to rename the function and to revise the description !

e.g., MotorActualPWM
or sth like that.
linusa
Posts: 228
Joined: 16 Oct 2010, 11:44
Location: Aachen, Germany
Contact:

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by linusa »

Found the official source inside the NXT executable file specification -- a document I still recommend to read, even though it's already a bit dusty, as its the ORIGINAL documentation of the NXT firmware. http://cache.lego.com/upload/contentTem ... B2A1F6.pdf , page 49.
ACTUAL_SPEED (Interactive Motors Only)
Data type: SBYTE
Access: Read-only
Legal value range: [-100, 100]
This property returns the actual percentage of full power that the NXT firmware is applying to the output
currently. This value can vary from the SPEED set-point when the internal auto-regulation code of the
NXT firmware responds to drag on the output axle.
The problem with this one, as ever so often: LEGO screwed up the naming already. When you choose another name, the naming is inconsistent, and other people from different backgrounds don't know what exactly you're talking about. I remember I called the TachoLimit property "AngleLimit" in version 1.00 of our toolbox, but after careful evaluation of hundreds of students, we changed it back to TachoLimit to be conform with the firmware, even though "tacho" doesn't make much sense IMO.
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by afanofosc »

MotorActualSpeed is called MotorActualSpeed because it returns the value stored in the ActualSpeed field in the Output module's IOMap structure. It will not be renamed.

http://bricxcc.sourceforge.net/nbc/nxcd ... 76b14.html

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by HaWe »

Actual speed field.

Contains the actual power level (-100 to 100).
but anyway, that's misleading and weird!
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by mightor »

Doc,

I suggest you mail [email protected] and lodge a complaint there. Address it to the Mindstorms software development team. Make sure you tell them to forward it to David C (not going to give you his full name, he'd kill me) and make sure you mention my name, too.

- Xander

*runs off laughing* (I like to pull pranks on David)
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by afanofosc »

If I were confused by the value returned by MotorActualSpeed I would read the docs to learn what it actually returns and then if its name bothered me I would write something like this:

Code: Select all

#define MotorActualPower MotorActualSpeed
and then I would use MotorActualPower in my code whenever I wanted to find out the actual power level used by the firmware when it regulates the motors.

I will try to improve the documentation for the MotorActualSpeed function to remove any doubt about what it returns.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by HaWe »

I don't see why I should contact lego.
Lego may write hotchpotch what Lego wants,
but we are programming in nxC and have the EFW (thank God - aahm: John)
so we may call it in the EFW like we - aahm, sry: John - wants, in a more scientific way, even including all the module stuff. Why not rename it, too?

If you, John, won't, it's your decision, ok, I can only make suggestions for improvement, if you want improvement or not - it's your decision.
IMO, the child must grow up.


Language determines thought (Benjamin Lee Whorf).
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC: what means "actual", "speed", and "actual speed"?

Post by mightor »

Now you should now as a scientist that consistent nomenclature is super important. I highly doubt John will sacrifice backwards compatibility.

Use the suggestion John made, #define is your friend!

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests