NXC: set all motor cmds to invers

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

NXC: set all motor cmds to invers

Post by HaWe »

hi,
what's the command to set all motor commands to "invers" (because of mechanical issues):
"forward" turns the motor reverse but lets the counter increase
"reverse" turns the motor forward but lets the counter decrease

this with all commands: OnFwd, RotateMotor, RotateMotorEx,....
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: set all motor cmds to invers

Post by mattallen37 »

I don't think there is support for that. If you really need it, you can wrap all the functions in a similar syntax function where you can specify if you want to invert it. You can invert the numbers using very simple math (usually "*(-1)").
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: set all motor cmds to invers

Post by HaWe »

I bet there MUST be something like that. RobotC has got it, even the Tetrix Mux has got it.
Multiplying some values by -1 is just weird using odometry, PID control, fixed target control, a.s.o.
linusa
Posts: 228
Joined: 16 Oct 2010, 11:44
Location: Aachen, Germany
Contact:

Re: NXC: set all motor cmds to invers

Post by linusa »

doc-helmut wrote:I bet there MUST be something like that. RobotC has got it, even the Tetrix Mux has got it.
Multiplying some values by -1 is just weird using odometry, PID control, fixed target control, a.s.o.
Just to fix the space time continuum:

No, there is absolutely NO NEED to introduce something like that on a language, firmware, or API level. If you really need this feature, you HAVE TO do it yourself. Establish motor configurations. Abstract your software from the hardware.

If the need to have the feature you describe in NXC, then your software design is flawed. But that's no problem: You can simply fix it. Software construction is an iterative process.
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: set all motor cmds to invers

Post by HaWe »

linusa wrote:
doc-helmut wrote:I bet there MUST be something like that. RobotC has got it, even the Tetrix Mux has got it.
Multiplying some values by -1 is just weird using odometry, PID control, fixed target control, a.s.o.
Just to fix the space time continuum:

No, there is absolutely NO NEED to introduce something like that on a language, firmware, or API level. If you really need this feature, you HAVE TO do it yourself. Establish motor configurations. Abstract your software from the hardware.

If the need to have the feature you describe in NXC, then your software design is flawed. But that's no problem: You can simply fix it. Software construction is an iterative process.
please simply answer my question, I don't need platitudes like "there is no need for it in any language, your software design is flawed, do it yourself". Besides, you're simply wrong, it already HAS been established in RobotC and e.g. for the HT muxer.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: set all motor cmds to invers

Post by mattallen37 »

doc-helmut wrote:please simply answer my question, I don't need platitudes like "there is no need for it in any language, your software design is flawed, do it yourself". Besides, you're simply wrong, it already HAS been established in RobotC and e.g. for the HT muxer.
Helmut, I am totally with Linus on this. There is absolutely no reason you should need this feature.

The HT Tetrix Motor controller has that feature implemented as an extra feature, not to set the bar for the NXT. As far as ROBOTC supporting it, good for ROBOTC. Who cares, since you refuse to use it anyhow. Assuming you really need it in NXC, just do it yourself. If you truly can't do it with SW, you could hack a cable and do it with HW.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: set all motor cmds to invers

Post by HaWe »

I didn't ask for a workaround, but for a command, and not because I couldn't imagine any workaround, but because I was sure that there already existed something like this.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC: set all motor cmds to invers

Post by afanofosc »

RobotC supports this because it is based on the RCX virtual machine which included that feature. The NXT firmware does not have any support for a global motor direction inversion option. Since there isn't any support for this at the firmware level there isn't any support for it in the NXC API.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC: set all motor cmds to invers

Post by mightor »

I am locking this topic. This case is closed. John has made himself clear.

If you want this functionality, write it yourself.

- 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)
Locked

Who is online

Users browsing this forum: No registered users and 4 guests