View unanswered posts | View active topics It is currently Fri Oct 31, 2014 1:17 pm






Reply to topic  [ 7 posts ] 
Help I don't know what's wrong with my program 
Author Message
Rookie

Joined: Tue Jan 21, 2014 10:03 pm
Posts: 3
Post Help I don't know what's wrong with my program
#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Hubs, S2, HTMotor, none, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S2, , sensorI2CMuxController)
#pragma config(Motor, motorA, , tmotorNXT, openLoop)
#pragma config(Motor, motorB, , tmotorNXT, openLoop)
#pragma config(Motor, motorC, , tmotorNXT, openLoop)
#pragma config(Motor, mtr_S1_C1_1, LeftFlank, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, RightFlank, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_1, Hand, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_2, Arm, tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c"
task main(){
while (true){
getJoystickSettings(joystick);
if(joystick.joy1_y1 >> 30){
motor[LeftFlank] = 50;
}
if((joystick.joy1_y1 << 10)&&(joystick.joy1_y1 > -10)){
motor[LeftFlank] = 0;
}
if(joystick.joy1_y1 << -30){
motor[LeftFlank] = -50;
}
if(joystick.joy1_y2 >> 30){
motor[RightFlank] = 50;
}
if((joystick.joy1_y2 << 10)&&(joystick.joy1_y2 > -10)){
motor[RightFlank] = 0;
}
if(joystick.joy1_y2 << -30){
motor[RightFlank] = -50;
//this is a dividing line
if(joystick.joy2_y1 >> 30){
motor[Arm] = 35;
}
if((joystick.joy2_y1 << 10)&&(joystick.joy2_y1 > -10)){
motor[Arm] = 0;
}
if(joystick.joy2_y1 << -30){
motor[Arm] = -35;
}
if(joystick.joy2_y2 >> 30){
motor[Hand] = 35;
}
if((joystick.joy2_y2 << 10)&&(joystick.joy2_y2 > -10)){
motor[Hand] = 0;
}
if(joystick.joy2_y2 << -30){
motor[Hand] = -35;
}
}
}}


Tue Jan 21, 2014 10:08 pm
Profile
Expert
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 159
Post Re: Help I don't know what's wrong with my program
I'm afraid we don't know what's wrong either. A little description of what it's supposed to be doing and what it is actually doing would help though... :biggrin:

Edit: By the way, posting the code inside [_CODE] and [_/CODE] tags (without the underscores) would make the code a lot more readable for us. Also, it appears that you are using a lot of "<<" and ">>" when you should be using "<" and ">".

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


Tue Jan 21, 2014 10:38 pm
Profile
Rookie

Joined: Tue Jan 21, 2014 10:03 pm
Posts: 3
Post Re: Help I don't know what's wrong with my program
My apologies, first post. we had it set up as single">" "<" but altered it to see if it would help,we are attempting to compete in the ftc challenge "block party" the left and right flanks are the left and right driving wheels and the arm and hands are used for grabbing blocks, thank you for your input I truly appreciate it


Wed Jan 22, 2014 2:28 am
Profile
Expert
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 159
Post Re: Help I don't know what's wrong with my program
Happy to help! I am on a team that is competing in Block Party, too. So, how exactly is your code malfunctioning? In other words, what is it supposed to be doing that it is not doing? Does the drive not work? Or is it the arm and hands that aren't working? Or do they move, but they just don't move the way you want them to?

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


Wed Jan 22, 2014 1:24 pm
Profile
Rookie

Joined: Tue Jan 21, 2014 10:03 pm
Posts: 3
Post Re: Help I don't know what's wrong with my program
When we run the program the robot will just drive in circles and the arm and hand do not work and it continues to run in a circle even after the command to stop is given. We tested the motor and the tetrix controller and they both work


Wed Jan 22, 2014 4:28 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Help I don't know what's wrong with my program
If you run the following program on your robot, what does it do?
Code:
#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Hubs, S2, HTMotor, none, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S2, , sensorI2CMuxController)
#pragma config(Motor, motorA, , tmotorNXT, openLoop)
#pragma config(Motor, motorB, , tmotorNXT, openLoop)
#pragma config(Motor, motorC, , tmotorNXT, openLoop)
#pragma config(Motor, mtr_S1_C1_1, LeftFlank, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, RightFlank, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_1, Hand, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_2, Arm, tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
    motor[LeftFlank] = 30;
    motor[RightFlank]= 30;
    wait1Msec(1000);
    motor[LeftFlank] = 0;
    motor[RightFlank]= 0;
}


Thu Jan 23, 2014 2:34 am
Profile
Expert
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 159
Post Re: Help I don't know what's wrong with my program
Ajax2014 wrote:
When we run the program the robot will just drive in circles and the arm and hand do not work and it continues to run in a circle even after the command to stop is given. We tested the motor and the tetrix controller and they both work


I don't know what's happening with your drive. You should follow MHTS's instructions to help you track down that problem. However, I can tell you what is wrong with your arm and hand. Take a look at your code, which I have reformatted below with indents. Look carefully at what your arm and hand code is nested inside:
Code:
#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Hubs, S2, HTMotor, none, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S2, , sensorI2CMuxController)
#pragma config(Motor, motorA, , tmotorNXT, openLoop)
#pragma config(Motor, motorB, , tmotorNXT, openLoop)
#pragma config(Motor, motorC, , tmotorNXT, openLoop)
#pragma config(Motor, mtr_S1_C1_1, LeftFlank, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, RightFlank, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_1, Hand, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_2, Arm, tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c"
task main(){
   while (true){
      getJoystickSettings(joystick);
      if(joystick.joy1_y1 > 30)
      {
         motor[LeftFlank] = 50;
      }
      if((joystick.joy1_y1 < 10)&&(joystick.joy1_y1 > -10))
      {
         motor[LeftFlank] = 0;
      }
      if(joystick.joy1_y1 < -30)
      {
         motor[LeftFlank] = -50;
      }
      if(joystick.joy1_y2 > 30)
      {
         motor[RightFlank] = 50;
      }
      if((joystick.joy1_y2 < 10)&&(joystick.joy1_y2 > -10))
      {
         motor[RightFlank] = 0;
      }
      if(joystick.joy1_y2 < -30)
      {
         motor[RightFlank] = -50;
         //this is a dividing line
         if(joystick.joy2_y1 > 30)
         {
            motor[Arm] = 35;
         }
         if((joystick.joy2_y1 < 10)&&(joystick.joy2_y1 > -10))
         {
            motor[Arm] = 0;
         }
         if(joystick.joy2_y1 < -30)
         {
            motor[Arm] = -35;
         }
         if(joystick.joy2_y2 > 30)
         {
            motor[Hand] = 35;
         }
         if((joystick.joy2_y2 < 10)&&(joystick.joy2_y2 > -10))
         {
            motor[Hand] = 0;
         }
         if(joystick.joy2_y2 < -30)
         {
            motor[Hand] = -35;
         }
      }
   }
}

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


Thu Jan 23, 2014 11:28 am
Profile
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.