View unanswered posts | View active topics It is currently Tue Oct 21, 2014 5:11 pm






Reply to topic  [ 5 posts ] 
Programming for Arm Motors 
Author Message
Rookie

Joined: Mon Jan 13, 2014 3:14 pm
Posts: 2
Post Programming for Arm Motors
My teams are struggling to figure out how to use robotc to lift their arm motors and keep them lifted in that position. They can lift the arms to their desired position, but as soon as they move to the next command (like move forward) the arms drop down and lose all power. I know these motors are able maintain their position, but I can't find any info on how to achieve this.

They are using robotc, and not the natural language functions. They customized their bots and have two arm motors and the default bot in natural language is only setup for one arm motor.

They are trying to create a program for the programming skills challenge for vexiq.

Thanks for you advice!


Mon Jan 13, 2014 3:19 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 592
Post Re: Programming for Arm Motors
We will need to see the code (using the [code] tags) to see what exactly could be causing this; it may be that a different command will need to be used to control the motors, or something else in the program is stopping the motor from doing what you would like it to.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Mon Jan 13, 2014 3:39 pm
Profile
Rookie

Joined: Mon Jan 13, 2014 3:14 pm
Posts: 2
Post Re: Programming for Arm Motors
I know they are missing something, but this is all new to me and I'm trying to learn with them.

This is what they have so far...

resetMotorEncoder(MotorArmL); //Take current position as zero.
resetMotorEncoder(MotorArmR); //Take current position as zero.
setServoTarget(MotorArmL, 400);
setServoTarget(MotorArmR, 400);
sleep(2000);

setMotorSpeed(MotorDriveL, 50); //Set the leftMotor (motor1) to half power (50)
setMotorSpeed(MotorDriveR, 50); //Set the rightMotor (motor6) to half power (50)
sleep(1000);

After they are done moving forward, they still want the arm raised, but it falls.


Mon Jan 13, 2014 3:57 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 592
Post Re: Programming for Arm Motors
Without seeing the rest of the code (with the task main() and everything else inside of it), I'm guessing the robot is hitting the end of the program. When this happens, ROBOTC automatically turns off all motors to prevent the robot from being uncontrollable.

To solve this, you will first need to stop any motors that you don't want moving (MotorDriveL and MotorDriveR, I'm guessing) by giving them a speed value of 0. After that, you can put what is known as an idle loop to keep the arm set a certain position:

Code:
setMotorSpeed(MotorDriveL, 50); //Set the leftMotor (motor1) to half power (50)
setMotorSpeed(MotorDriveR, 50); //Set the rightMotor (motor6) to half power (50)

sleep(1000);

setMotorSpeed(MotorDriveL, 0); //Set the leftMotor (motor1) to stopped (0)
setMotorSpeed(MotorDriveR, 0); //Set the rightMotor (motor6) to stopped (0)

repeat(forever)
{}



This will stop the drive motors and apply the same servo positional values to the MotorArmL and MotorArmR motors until the program is ended manually.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Mon Jan 13, 2014 4:21 pm
Profile
Rookie

Joined: Sun Feb 23, 2014 3:56 pm
Posts: 8
Post Re: Programming for Arm Motors
This post is a bit old, but I'll throw in my 2 cents anyway...

I think what you need is to set a global config. at the very beginning of your code to define the motor braking status.

"setMotorBrakeMode(rightLiftMotor, motorHold);"

If you set this value for all necessary motors it will remain in "motorHold" until told to do otherwise.

The three optional values are motorHold, motorBrake, motorCoast
Hold = motor will "servo" its position and actively try to hold its position and correct if necessary.
Brake = motor will resist movement but not self-correct back to the stopped position.
Coast = motor will move freely after stopping with only the drive resistance to slow motor.


Tue Mar 11, 2014 11:46 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 0 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.