View unanswered posts | View active topics It is currently Mon Sep 21, 2020 3:20 am






Reply to topic  [ 7 posts ] 
Synchrounous Motor movement for EV3 
Author Message
Rookie

Joined: Thu Nov 20, 2014 1:10 pm
Posts: 3
Post Synchrounous Motor movement for EV3
Hi,

I am attempting to get a robot to move autonomously throughout a maze. I have gotten the program to work, but my turns are not accurate and it throws the entire program off. I found the syntax for the setMotorSyncEncoder and setMotorSyncTime but there were no parameters listed in the documentation. How do I implement these functions? Also, will these two functions make the motors moves synchronously?

such as the moveMotorTarget below , the parameters are given so i filled them in to pertain to my code. I have no clue what should go inside the parenthesis to make the functions above work.
moveMotorTarget (motorB, ROTATION_PER_90_DEGREES, MAX_MOTOR_SPEED);

Please Help!


Thu Nov 20, 2014 1:19 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Synchrounous Motor movement for EV3
They're not documented yet because we only added them in the last version. My apologies for that. You can sync two motors with this. An example:
Code:
#pragma config(Motor,  motorA,          LEFT,          tmotorEV3_Large, PIDControl, encoder)
#pragma config(Motor,  motorB,          RIGHT,         tmotorEV3_Large, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

// sync motor test
task main()
{
   setMotorSyncTime(LEFT, RIGHT, 0, 2000, 50);
   sleep(3000);
}

We included two test examples in the samples folder, which you can access via File->Open Sample Program. They reside in the "Miscellaneous" folder.

The prototypes for these functions are:
Code:
void setMotorSyncEncoder(tMotor nMotorOne, tMotor nMotorTwo, long nTurnRatio, long nEncoderCount, long nSignedPower);
void setMotorSyncTime(tMotor nMotorOne, tMotor nMotorTwo, long nTurnRatio, long nTimeMsec, long nSignedPower)


= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Nov 21, 2014 2:14 am
Profile WWW
Rookie

Joined: Thu Nov 20, 2014 1:10 pm
Posts: 3
Post Re: Synchrounous Motor movement for EV3
Thanks Xander! I have one more question. Will this help me to achieve a more precise turn? I need to get as close to 90 degrees as possible. What value should be used for nTurnRatio to make turns possible?


Fri Nov 21, 2014 8:16 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Synchrounous Motor movement for EV3
Well, the trouble with wheels is that they slip. If you want precise turns, you must use a gyro or compass :) That said, if your surface is not too slippery and your wheels are kept clean, it should be fairly OK.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Nov 21, 2014 8:21 am
Profile WWW
Rookie

Joined: Thu Nov 20, 2014 1:10 pm
Posts: 3
Post Re: Synchrounous Motor movement for EV3
Ok thank you Xander!


Fri Nov 21, 2014 11:03 am
Profile
Rookie

Joined: Wed Aug 06, 2014 10:24 pm
Posts: 9
Post Re: Synchrounous Motor movement for EV3
I tried using the suggested code:

Quote:
#pragma config(Motor, motorA, LEFT, tmotorEV3_Large, PIDControl, encoder)
#pragma config(Motor, motorB, RIGHT, tmotorEV3_Large, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

// sync motor test
task main()
{
setMotorSyncTime(LEFT, RIGHT, 0, 2000, 50);
sleep(3000);
}


This worked great using a physical robot, but it didn't work on the virtual world. Any suggestions?


Wed Jan 28, 2015 3:07 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Synchrounous Motor movement for EV3
You can split it up into two separate motor commands. You'll find that in the Virtual World that motors don't drift apart very much, if at all :)

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Jan 29, 2015 1:36 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 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.