View unanswered posts | View active topics It is currently Thu Sep 18, 2014 7:41 am






Reply to topic  [ 9 posts ] 
Tetrix Ranger Bot Arm and Gripper 
Author Message
Rookie

Joined: Sat May 24, 2014 8:44 pm
Posts: 8
Post Tetrix Ranger Bot Arm and Gripper
I am brand new to Tetrix. I have been trying for a week to get my Tetrix Ranger Bot to work. I was able to program the Ranger Bot to move. However, I cannot get the arm and gripper to move with my joystick. I am referring to this arm and gripper: http://www.tetrixrobotics.com/gettingst ... ion2_3.htm. The sample program on this page is the automated version. I want to use my joystick. Any help with be greatly appreciated! :?


Sat May 24, 2014 8:56 pm
Profile
Expert
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 104
Post Re: Tetrix Ranger Bot Arm and Gripper
What are you trying to use to make the arm and gripper move? Buttons? Thumbsticks? The D-pad? If you post the code you have so far, we'll be able to help you out a lot more easily.

_________________
Burning Lights Programming
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
Check out our team website at http://cof7468.weebly.com/.


Mon May 26, 2014 11:56 am
Profile
Rookie

Joined: Sat May 24, 2014 8:44 pm
Posts: 8
Post Re: Tetrix Ranger Bot Arm and Gripper
#pragma config(Hubs, S1, HTMotor, HTServo, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorTetrix, openLoop, reversed)
#pragma config(Servo, srvo_S1_C2_1, servo1, tServoNone)
#pragma config(Servo, srvo_S1_C2_2, servo2, tServoNone)
#pragma config(Servo, srvo_S1_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C2_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C2_6, servo6, tServoNone)

#include "JoystickDriver.c"

task main()
{
int threshold = 20; /* Int 'threshold' will allow us to ignore low */

while(true) // Infinite loop:

{
getJoystickSettings(joystick);

if(abs(joystick.joy1_y2) > threshold) // If the right analog stick's Y-axis readings are either above or below the threshold:
{
motor[motorD] = joystick.joy1_y2; // Motor D is assigned a power level equal to the right analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
motor[motorD] = 0; // Motor D is stopped with a power level of 0.
}

if(abs(joystick.joy1_y1) > threshold) // If the left analog stick's Y-axis readings are either above or below the threshold:
{
motor[motorE] = joystick.joy1_y1; // Motor E is assigned a power level equal to the left analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
motor[motorE] = 0; // Motor E is stopped with a power level of 0.
}

// BUTTONS TO CONTROL SERVO ARM
// Control arm via shoulder buttons, 1 and 4... 1=up, 4=down

int a = ServoValue[servo1];

if(joy1Btn(1) && a <= 245) // If Button 1 is pressed:
{
a = a + 5;
servo[servo1] = a; // Raise Servo 5 to position to 245.
}

if(joy1Btn(4) && a >=10) // If Button 4 is pressed:
{
a = a - 5; // Lower Servo 5 positions.
}
servo[servo1] = a;

wait1Msec (50);
}

//Buttons to control gripper
//This is the code that will not work

if(joy1Btn(2) && b <= 245) // If Button 2 is pressed:
{
b = b + 5;
servo[servo2] = a; // Open Servo 5 to position to 245.
}

if(joy1Btn(3) && a >=10) // If Button 3 is pressed:
{
b = b - 5; // Lower Servo 5 positions.
}
servo[servo2] = b;

wait1Msec (50);
}
}

//I would like to control servo2 (gripper) with buttons 2 and three, but I cannot get the gripper to work???


Mon May 26, 2014 5:32 pm
Profile
Expert
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 104
Post Re: Tetrix Ranger Bot Arm and Gripper
You have the arm and gripper code outside of your infinite loop. Move the closing brace for that loop down below your arm and gripper code to fix this.

_________________
Burning Lights Programming
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
Check out our team website at http://cof7468.weebly.com/.


Mon May 26, 2014 8:48 pm
Profile
Rookie

Joined: Sat May 24, 2014 8:44 pm
Posts: 8
Post Re: Tetrix Ranger Bot Arm and Gripper
Thanks a bunch! Just corrected the code and compiled the program! It works great! I knew it was something small like that!!!!!


Mon May 26, 2014 9:39 pm
Profile
Rookie

Joined: Sat May 24, 2014 8:44 pm
Posts: 8
Post Re: Tetrix Ranger Bot Arm and Gripper
How can I set the power level on motors d and e?


Wed May 28, 2014 11:16 am
Profile
Expert
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 104
Post Re: Tetrix Ranger Bot Arm and Gripper
bjoe777 wrote:
How can I set the power level on motors d and e?


It looks like you are in the code. Do the motors not work? If they don't, then it might be some kind of hardware problem.

_________________
Burning Lights Programming
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
Check out our team website at http://cof7468.weebly.com/.


Wed May 28, 2014 2:05 pm
Profile
Rookie

Joined: Sat May 24, 2014 8:44 pm
Posts: 8
Post Re: Tetrix Ranger Bot Arm and Gripper
Both motors work correctly. However, they are operating at 100%. I want to power both mothers (D,E) at 50%.


Wed May 28, 2014 3:42 pm
Profile
Expert
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 104
Post Re: Tetrix Ranger Bot Arm and Gripper
bjoe777 wrote:
Both motors work correctly. However, they are operating at 100%. I want to power both mothers (D,E) at 50%.


Ah, OK. The values for the joystick axes go from -128 to +127. If you multiply the values by 0.5 before assigning them to the motor powers, this will give you a range of -64 to +63, which is about what you want. Or, to be a little more precise, you can multiply it by 0.39, which will give you a range of -50 to +49.

_________________
Burning Lights Programming
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
Check out our team website at http://cof7468.weebly.com/.


Thu May 29, 2014 12:57 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 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.