ROBOTC.net forums
http://robotc.net/forums/

Help I don't know what's wrong with my program
http://robotc.net/forums/viewtopic.php?f=52&t=7765
Page 1 of 1

Author:  Ajax2014 [ Tue Jan 21, 2014 10:08 pm ]
Post subject:  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;
}
}
}}

Author:  BurningLights [ Tue Jan 21, 2014 10:38 pm ]
Post subject:  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 ">".

Author:  Ajax2014 [ Wed Jan 22, 2014 2:28 am ]
Post subject:  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

Author:  BurningLights [ Wed Jan 22, 2014 1:24 pm ]
Post subject:  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?

Author:  Ajax2014 [ Wed Jan 22, 2014 4:28 pm ]
Post subject:  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

Author:  MHTS [ Thu Jan 23, 2014 2:34 am ]
Post subject:  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;
}

Author:  BurningLights [ Thu Jan 23, 2014 11:28 am ]
Post subject:  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;
         }
      }
   }
}

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/