Hi,
I built my TriPod. i hav attached two light-sensors on the front and I want it to follow a circuit. The inner part is black, the outer part is white.
i use the mutex-variable and the precedes command.
Now, on some event i want the motors to rotate in opposite directions at the same time using "RotateMotor". I find that when the progam goes to "mutex-mode" the "precedes"-command does not do anything".
I did make separate tasks for rotation because i didn't know whether I could use "precedes" to call the RotateMotor-command directly.
So, is there a way to use "RotateMotor" simultaneously in opposite directions using RotateMotor.
Kind Regards,
Merijn
Rotate 2 motors in opposite direction with RotateMotor
-
- Posts: 8
- Joined: 27 Jun 2012, 13:43
-
- Posts: 220
- Joined: 23 Jan 2012, 17:07
- Location: Round Rock, TX
Re: Rotate 2 motors in opposite direction with RotateMotor
"Precedes" is a command related to task control. You do not use it to invoke a command like RotateMotor.
If you use RotateMotorEx you can specify a "turn angle" of 100 (or -100) that will cause the 2 motors to turn in opposite directions.
If you use RotateMotorEx you can specify a "turn angle" of 100 (or -100) that will cause the 2 motors to turn in opposite directions.
McSummation aka James
http://www.mcsummation.com/Mindstorms/
http://www.mcsummation.com/Mindstorms/
Re: Rotate 2 motors in opposite direction with RotateMotor
Also, if you are applying the mutex to motor control, you may be preventing both motors from working at the same time.
Always best to post your code on the forum with an explanation of what it is supposed to do, otherwise all you are going to get are general comments.
Always best to post your code on the forum with an explanation of what it is supposed to do, otherwise all you are going to get are general comments.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
-
- Posts: 100
- Joined: 27 Dec 2010, 19:10
Re: Rotate 2 motors in opposite direction with RotateMotor
Several thoughts on your project. I agree with the previous post - if you can post your code,
it is much easier to offer suggestions. Also, if you have or can post a picture or video of your
circuit, either here, youtube, Flickr, or ??, that would help me understand better what you want
your code to do. That said, I'll jump in and offer some suggestions that might help. The smooth
line follower (proportional) at <http://nxtprograms.com/NXT2/line_follower/steps.html> may
be a good starting point. It is in NXT-G, but is easily translated to NXC. Although this program only
uses 1 light sensor, not 2, it may still provide some ideas. Also, I'm now building dancing robots for
Brickfair, and expect to have this code complete in a few days? week? This code has the robot
make 90 deg and 180 deg turns with one motor turning fwd and one bkwd. If this might help, I
can post just these sections of code now. Also, my line follower code at
<Board index ‹ LEGO MINDSTORMS ‹ Mindstorms Projects < Kemmel - Combining Line Following and Formula 1>
may help, but without seeing your circuit, I can't predict if it will help or confuse.
it is much easier to offer suggestions. Also, if you have or can post a picture or video of your
circuit, either here, youtube, Flickr, or ??, that would help me understand better what you want
your code to do. That said, I'll jump in and offer some suggestions that might help. The smooth
line follower (proportional) at <http://nxtprograms.com/NXT2/line_follower/steps.html> may
be a good starting point. It is in NXT-G, but is easily translated to NXC. Although this program only
uses 1 light sensor, not 2, it may still provide some ideas. Also, I'm now building dancing robots for
Brickfair, and expect to have this code complete in a few days? week? This code has the robot
make 90 deg and 180 deg turns with one motor turning fwd and one bkwd. If this might help, I
can post just these sections of code now. Also, my line follower code at
<Board index ‹ LEGO MINDSTORMS ‹ Mindstorms Projects < Kemmel - Combining Line Following and Formula 1>
may help, but without seeing your circuit, I can't predict if it will help or confuse.
Who is online
Users browsing this forum: No registered users and 1 guest