View unanswered posts | View active topics It is currently Sat Jun 23, 2018 7:57 pm






Reply to topic  [ 5 posts ] 
Setting Individual Motors 
Author Message
Rookie

Joined: Wed Sep 30, 2015 4:19 pm
Posts: 2
Post Setting Individual Motors
Hey everyone! I am working with a class using Vex Cortex controllers and we are running into trouble with programming the motors. We have one motor running directly into the cortex and one connected with a motor controller. When we try to simply program the robot with the `forward` command, the motors run at a different power and it veers off. We tried setting each motor's power with the `setMotor` command, but it didn't work. We are rather new to the programming aspect of robotics, so I am sorry if this problem is simple. I would appreciate any help!


Wed Sep 30, 2015 4:25 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: Setting Individual Motors
Would you be able to post your code (including the #pragma statements at the top of the code) using the [code] tags for us to take a look at? We'll need this information to help debug what this problem could be.

Thank you in advance!

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.


Thu Oct 01, 2015 9:19 am
Profile
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Post Re: Setting Individual Motors
Any chance one has the high speed internal gear and the other does not?


Thu Oct 01, 2015 12:50 pm
Profile
Rookie

Joined: Wed Sep 30, 2015 4:19 pm
Posts: 2
Post Re: Setting Individual Motors
Here is the code:

Code:
#pragma config(Motor, port4, rightMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, leftMotor, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard
          !!*//

task main()
{
        setMotor(port4, 50);
        setMotor(port10, 100);
        forward(10, seconds, 100);
}


Our thinking was that we could set different motor speeds and that would balance them out and prevent the robot from veering, but they both just run at the same speed. We also began messing around with the Natural Language PLT commands. Either way, all of this is being done in the graphical interface.

None of our motors have the high speed internal gears.


Thu Oct 01, 2015 3:53 pm
Profile
Moderator
Moderator

Joined: Tue May 19, 2015 3:07 pm
Posts: 91
Post Re: Setting Individual Motors
Okay so the forward command runs the motors attached to the drive train at the same power. What you are effectively saying is
Run at different power values.
Then roughly 1 tenth thousand of a second later telling the motors to run at the same power for 10 seconds.

Code:
setMotor(port4, 50);
        setMotor(port10, 100);

This code happens and the motor is set BUT the next line of code happens almost immediately. Try adding a wait block after setting the power instead of the forward block
Code:
setMotor(port4, 50);
setMotor(port10, 100);
wait(10, seconds);


Sat Nov 07, 2015 7:38 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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.