///////////////////////////////////////////////////////////////////////////////////////////////////////// Tele-Operation Mode Code Template//// This file contains a template for simplified creation of an tele-op program for an FTC// competition.//// You need to customize two functions with code unique to your specific robot.///////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////// initializeRobot//// Prior to the start of tele-op mode, you may want to perform some initialization on your robot// and the variables within your program.//// In most cases, you may not have to add any code to this function and it will remain "empty".///////////////////////////////////////////////////////////////////////////////////////////////////////

void initializeRobot(){ // Place code here to sinitialize servos to starting positions. // Sensors are automatically configured and setup by ROBOTC. They may need a brief time to stabilize.

return;}

///////////////////////////////////////////////////////////////////////////////////////////////////////s// Main Task//// The following is the main code for the tele-op robot operation. Customize as appropriate for// your specific robot.//// Game controller / joystick information is sent periodically (about every 50 milliseconds) from// the FMS (Field Management System) to the robot. Most tele-op programs will follow the following// logic:// 1. Loop forever repeating the following actions:// 2. Get the latest game controller / joystick settings that have been received from the PC.// 3. Perform appropriate actions based on the joystick + buttons settings. This is usually a// simple action:// * Joystick values are usually directly translated into power levels for a motor or// position of a servo.// * Buttons are usually used to start/stop a motor or cause a servo to move to a specific// position.// 4. Repeat the loop.//// Your program needs to continuously loop because you need to continuously respond to changes in// the game controller settings.//// At the end of the tele-op period, the FMS will autonmatically abort (stop) execution of the program.///////////////////////////////////////////////////////////////////////////////////////////////////////

task main(){ initializeRobot();

// wait for start of tele-op phase

while (true) { getJoystickSettings(joystick); motor[motorA]=joystick.joy1_y2 * 100 / 127;//motor a moves with the second y toggle stick (leftside) motor[motorB]=joystick.joy1_y2 * 100 / 127;//motor b moves with the second y toggle stick as well(robot will go left or right)(lefttside)}

{ getJoystickSettings(joystick); motor[motorC]=joystick.joy1_y1 * 100/ 127; //motor c moves with the first y toggle stick(robot will go left or right)(rightside) motor[motorD]=joystick.joy1_y1 * 100 / 127;// motor D moves with the first y toggle stick if both sticks are moved at the same time they'll go in a uniform direction (rightside)}//this is the function for driving

while (true) getJoystickSettings(joystick); if(joy1Btn(4)==1)//button four controls the drill { motor[drillMotor]=100;//THIS IS THE CODE FOR THE DriLl } else {motor[drillMotor]=0;//drill remains off

}//this is the code for the dual fingers (servos will go 67 counts){ getJoystickSettings(joystick);//button 1 to close if(joy2Btn(1)==1) {

Looks like you have a very complex motor setup. I thought there is a limit of eight Tetrix motors specified in the FTC game rules. I think you are exceeding that limit. Also, you can chain 4 motor controllers on one sensor port. That will free up some sensor ports for sensors. Like Ryan said, you need to try a simpler setup first. Once it's working, then you build up the complexity from there. Also check your motor wiring. If the wiring is wrong and does not match the pragmas, that could be the cause. I recommend hooking up only two motor controllers in one chain and make tank drive work before adding any other motor controllers.

Fri Oct 18, 2013 4:37 pm

ferretman

Rookie

Joined: Fri Oct 11, 2013 4:05 pmPosts: 7

Re: WHAT'S WRONG WITH THIS PROGRAM HELP HALP (CRIES)

Thank you for the input, so how would I go about simplifying? Do I simply make motor A work for two motors on the left and B work for two motors on the right? Also, would the placement of brackets be the source of the issue?

Sat Oct 19, 2013 12:01 am

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: WHAT'S WRONG WITH THIS PROGRAM HELP HALP (CRIES)

For example, simplify your code to the following and make sure both motor A and B works first before adding anything else.

///////////////////////////////////////////////////////////////////////////////////////////////////////// Tele-Operation Mode Code Template//// This file contains a template for simplified creation of an tele-op program for an FTC// competition.//// You need to customize two functions with code unique to your specific robot.///////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////// initializeRobot//// Prior to the start of tele-op mode, you may want to perform some initialization on your robot// and the variables within your program.//// In most cases, you may not have to add any code to this function and it will remain "empty".///////////////////////////////////////////////////////////////////////////////////////////////////////

void initializeRobot(){ // Place code here to sinitialize servos to starting positions. // Sensors are automatically configured and setup by ROBOTC. They may need a brief time to stabilize.

return;}

///////////////////////////////////////////////////////////////////////////////////////////////////////s// Main Task//// The following is the main code for the tele-op robot operation. Customize as appropriate for// your specific robot.//// Game controller / joystick information is sent periodically (about every 50 milliseconds) from// the FMS (Field Management System) to the robot. Most tele-op programs will follow the following// logic:// 1. Loop forever repeating the following actions:// 2. Get the latest game controller / joystick settings that have been received from the PC.// 3. Perform appropriate actions based on the joystick + buttons settings. This is usually a// simple action:// * Joystick values are usually directly translated into power levels for a motor or// position of a servo.// * Buttons are usually used to start/stop a motor or cause a servo to move to a specific// position.// 4. Repeat the loop.//// Your program needs to continuously loop because you need to continuously respond to changes in// the game controller settings.//// At the end of the tele-op period, the FMS will autonmatically abort (stop) execution of the program.///////////////////////////////////////////////////////////////////////////////////////////////////////

task main(){ initializeRobot();

// wait for start of tele-op phase

while (true) { getJoystickSettings(joystick); motor[motorA]=joystick.joy1_y2 * 100 / 127;//motor a moves with the second y toggle stick (leftside) motor[motorB]=joystick.joy1_y2 * 100 / 127;//motor b moves with the second y toggle stick as well(robot will go left or right)(lefttside) }}

Sat Oct 19, 2013 7:20 am

ferretman

Rookie

Joined: Fri Oct 11, 2013 4:05 pmPosts: 7

Re: WHAT'S WRONG WITH THIS PROGRAM HELP HALP (CRIES)

oh ok thank you, I'll get back to you on the results

Sat Oct 19, 2013 9:35 am

ferretman

Rookie

Joined: Fri Oct 11, 2013 4:05 pmPosts: 7

Re: WHAT'S WRONG WITH THIS PROGRAM HELP HALP (CRIES)

Thanks for the help guys the program is now working 100%. It turned out that the brackets were locking the other segment of the code off. lololololololololol

Mon Oct 21, 2013 4:42 pm

woosoo707

Rookie

Joined: Wed Nov 06, 2013 5:18 amPosts: 1

Re: WHAT'S WRONG WITH THIS PROGRAM HELP HALP (CRIES)

Like Ryan said, you need to try a simpler setup first. Once it's working, then you build up the complexity from there. Also check your motor wiring. If the wiring is wrong and does not match the pragmas, that could be the cause. I recommend hooking up only two motor controllers in one chain and make tank drive work before adding any other motor controllers.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum