View unanswered posts | View active topics It is currently Sat Aug 02, 2014 6:01 am






Reply to topic  [ 8 posts ] 
response problem 
Author Message
Rookie

Joined: Thu Mar 13, 2014 2:39 pm
Posts: 5
Post response problem
my club and i have been building two robots for a science fair and we come across a problem we've never seen before.
what is we fire up the program like usual(plug in a controller, press f5 and anyone who messes robotc knows the rest)and nothing happens then i try a timed run, which works but i can't get the controller to make the robot run.
if i need to give info let me


Sun Mar 16, 2014 5:40 pm
Profile
Moderator
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 198
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Post Re: response problem
Yes, we will need more information:

Could you show us your program?
What is your robot supposed to do?
What is your environment(Inside/outside, any radio devices, etc.)?
Is the program downloading successfully?
Are your brick and computer running the latest software?

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot


Sun Mar 16, 2014 9:40 pm
Profile
Rookie

Joined: Thu Mar 13, 2014 2:39 pm
Posts: 5
Post Re: response problem
robot 1 programming:
Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     touch,          sensorTouch)
#pragma config(Sensor, S3,     light,          sensorLightActive)
#pragma config(Sensor, S4,     sonar,          sensorSONAR)
#pragma config(Motor,  mtr_S1_C1_1,     RightWheel,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     LeftWheel,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     RightTrack,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     LeftTrack,     tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C3_1,    Pancam,               tServoStandard)
#pragma config(Servo,  srvo_S1_C3_2,    Tiltcam,              tServoStandard)
#pragma config(Servo,  srvo_S1_C3_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"  //Include file to "handle" the Bluetooth messages.




void initializeRobot()
{

  return;
}



task main()
{
  initializeRobot();

  waitForStart();   // wait for start of tele-op phase

  while (true)
  {
     int threshold;
    getJoystickSettings(joystick);
    if(abs(joystick.joy1_y1)>threshold)
    {
       motor[RightWheel]=joystick.joy1_y1;
       motor[RightTrack]=joystick.joy1_y1;
    }
    else
    {
       motor[RightWheel]=0;
       motor[RightTrack]=0;
    }
    if(abs(joystick.joy1_y2)>threshold)
    {
       motor[LeftWheel]=joystick.joy1_y2;
       motor[LeftTrack]=joystick.joy1_y2;
    }
    else
    {
       motor[LeftWheel]=0;
       motor[LeftTrack]=0;
    }
  }
}

robot 2 programming:(note not my work a friend helped me)
Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     LeftFront,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     RightFront,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     LeftBack,      tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     RightBack,     tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C3_1,    servo1,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_2,    servo2,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"  //Include file to "handle" the Bluetooth messages.




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;
}
#define JOYSTICK_DEADBAND           15
// Returns an angle that is within -179 to 180 degrees
float FixDirection (float Angle)
{ // FixDirection
   float NewAngle;

   if (Angle > 180.0)
      NewAngle = Angle - 360.0;
   else if (Angle < -180.0)
      NewAngle = Angle + 360.0;
   else
      NewAngle = Angle;
   return NewAngle;
} // end FixDirection

float getMagnitude()
{
   float TempMagnitude;

   TempMagnitude = sqrt((int)pow(joystick.joy1_y1* 100.0/128.0, 2)+(int)pow(joystick.joy1_x1* 100.0/128.0, 2));
   if (TempMagnitude > 100.0) TempMagnitude = 100.0;
   //use logarithmic scaling to provide more sensitivity at slow speeds
   TempMagnitude = pow(TempMagnitude, 2)/pow(100, 2) * 100.0;
   return TempMagnitude;
}

float getDirection()
{
   float D = radiansToDegrees(atan2(joystick.joy1_y1* 100.0/128.0, -joystick.joy1_x1* 100.0/128.0));
   return FixDirection(D-45);
}

float getSpin()
{
   float S = joystick.joy1_x2*(100.0/128.0);
   return S;
}

// magnitude is 0 to 100, direction -179 to 180, spin is -100 to 100
void HolonomicDrive (float Magnitude, float Direction, float Spin)
{ // HolonomicDrive
   float AdjustedDirection;
   float cosD;
   float sinD;
   float SpeedLeftFrontRightBack;
   float SpeedRightFrontLeftBack;
   float SpinLeft;
   float SpinRight;
  float SpeedRightFront;
   float SpeedLeftFront;
   float SpeedRightBack;
   float SpeedLeftBack;


   if (abs(Spin) > JOYSTICK_DEADBAND)
   { //spin robot
      // calculate the amount of motor adjustment to spin robot
         SpinLeft = -Spin*Spin/abs(Spin);
         SpinRight = Spin*Spin/abs(Spin);
   } // end spin robot
   else
   {//don't spin robot
         SpinLeft = 0.0;
              SpinRight= 0.0;
   }//end don't spin robot

   if (Magnitude > JOYSTICK_DEADBAND)
   { // Move Robot
      AdjustedDirection = degreesToRadians(Direction);
      cosD = cos(AdjustedDirection);
      sinD = sin(AdjustedDirection);

      // Calculate motor speeds based on magnitude and direction
      SpeedLeftFrontRightBack = (sinD * Magnitude * sqrt(2.0));
      SpeedRightFrontLeftBack = (cosD * Magnitude  * sqrt(2.0));

      //Scaling the motor speeds if over 100
      if (abs(SpeedLeftFrontRightBack) > 100.0)
      {
         SpeedLeftFrontRightBack = SpeedLeftFrontRightBack / abs(SpeedLeftFrontRightBack) * 100.0;
         SpeedRightFrontLeftBack = SpeedRightFrontLeftBack / abs(SpeedLeftFrontRightBack) * 100.0;
      }
      if (abs(SpeedRightFrontLeftBack) > 100.0)
      {
         SpeedRightFrontLeftBack = SpeedRightFrontLeftBack / abs(SpeedRightFrontLeftBack) * 100.0;
         SpeedLeftFrontRightBack = SpeedLeftFrontRightBack / abs(SpeedRightFrontLeftBack) * 100.0;
      }
   } // end move robot
   else
   { // Stop Robot
      SpeedLeftFrontRightBack = 0.0;
      SpeedRightFrontLeftBack = 0.0;
   } // end Stop Robot


   SpeedLeftFront = SpeedLeftFrontRightBack+SpinLeft;
   SpeedRightFront = SpeedRightFrontLeftBack+SpinRight;
   SpeedLeftBack = SpeedRightFrontLeftBack+SpinLeft;
   SpeedRightBack = SpeedLeftFrontRightBack+SpinRight;

   if(abs(SpeedLeftFront) > 100)
           SpeedLeftFront = 100*SpeedLeftFront/abs(SpeedLeftFront);
   if(abs(SpeedRightFront) > 100)
           SpeedRightFront = 100*SpeedRightFront/abs(SpeedRightFront);
   if(abs(SpeedLeftBack) > 100)
           SpeedLeftBack = 100*SpeedLeftBack/abs(SpeedLeftBack);
   if(abs(SpeedRightBack) > 100)
           SpeedRightBack = 100*SpeedRightBack/abs(SpeedRightBack);

   //moving motors
   motor[LeftFront] = LeftFront;
   motor[RightFront] = RightFront;
   motor[LeftBack] = LeftBack;
   motor[RightBack] = RightBack;
} // end HolonomicDrive





task main()
{
  initializeRobot();

  waitForStart();   // wait for start of tele-op phase

  while (true)
  {
     HolonomicDrive(getMagnitude(), getDirection(), getSpin());

  }
}

both robots are supposed to be ground recon robots for police like for hostage situations or swat assaults. robot 1 is all terrain style with a tank drive and movable cameras via servos. And robot 2 is meant to have a omni directional drive with the same servo camera setup.
the work environment we in is a large class room in a office building but we meet on the weekends when no one is there so not radio devices other than cell phones and office phones.
and yes everything is up to date for the brick and the pc, and its the program downloading correctly from what i can tell and considering that we hooked the brick to the pc via cable, im at a loss as to what the problem is. No the servo programming isnt in there because i have very little experience with servos.


Last edited by JohnWatson on Mon Mar 17, 2014 6:17 pm, edited 1 time in total.

Added code tags for readability



Mon Mar 17, 2014 6:11 pm
Profile
Novice
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 98
Post Re: response problem
Could it be because waitForStart() has been added to your code? With waitForStart() in your code, you have to use the "Joystick Control - Competition" window, and use the radio buttons to select teleop running.

_________________
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 Mar 17, 2014 9:52 pm
Profile
Moderator
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 198
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Post Re: response problem
I'm with BurningLights. Your first robot code is simple enough that it seems like the only thing that could be going wrong is waitForStart(). The second code, though more complex, might then have the same error. Also, in the first code, "threshold" is never initialized. I don't think that affects anything here, but it could.

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot


Tue Mar 18, 2014 1:23 pm
Profile
Rookie

Joined: Thu Mar 13, 2014 2:39 pm
Posts: 5
Post Re: response problem
well here is what happened
i commented out "wait for start()", pressed F5 to download and compile, and the motors started running uncontrollably without me doing anything, so i "uncommented" wait for start() and same thing happens and yes i have the competition remote screen on.
everything is working fine except for the controllers, everyone else thinks the gamepads are but its kinda hard to believe that all 3 controllers stopped at the same time


Tue Mar 18, 2014 2:54 pm
Profile
Novice
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 98
Post Re: response problem
Is this running the first program or the second program? Because if it's the first program it seems like it's got to be the controllers. But, if it's the second program, then it could very well be some error in the code.

_________________
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 Mar 19, 2014 12:26 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 560
Post Re: response problem
Try running the code below; this should move your robot forward at half speed for 3 seconds (with all four motors being turned on), then stop the robot. If the motors continue to move past the 3 second mark, there may be a problem with the physical setup of your robot (wiring/controller setup).

Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     touch,          sensorTouch)
#pragma config(Sensor, S3,     light,          sensorLightActive)
#pragma config(Sensor, S4,     sonar,          sensorSONAR)
#pragma config(Motor,  mtr_S1_C1_1,     RightWheel,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     LeftWheel,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     RightTrack,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     LeftTrack,     tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C3_1,    Pancam,               tServoStandard)
#pragma config(Servo,  srvo_S1_C3_2,    Tiltcam,              tServoStandard)
#pragma config(Servo,  srvo_S1_C3_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
motor[RightWheel] = 50;
motor[LeftWheel] = 50;
motor[RightTrack] = 50;
motor[LeftTrack] = 50;
wait1Msec(3000);
motor[RightWheel] = 0;
motor[LeftWheel] = 0;
motor[RightTrack] = 0;
motor[LeftTrack] = 0;

while(true);
}

_________________
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


Wed Mar 19, 2014 1:29 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 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.