View unanswered posts | View active topics It is currently Wed Jul 30, 2014 10:08 pm






Reply to topic  [ 10 posts ] 
What is going on? 
Author Message
Rookie
User avatar

Joined: Thu Dec 05, 2013 12:57 pm
Posts: 8
Location: Las Vegas
Post What is going on?
I have no ides whats going on. My Nxt Connects, but then i compile it and then I lose connection. I don't know how to fix it. I don't think anything in my code could do it, but maybe.
Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Hubs,  S2, HTMotor,  HTMotor,  none,     none)
#pragma config(Hubs,  S3, HTMotor,  HTMotor,  none,     none)
#pragma config(Hubs,  S4, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     ,               sensorI2CMuxController)
#pragma config(Sensor, S3,     ,               sensorI2CMuxController)
#pragma config(Sensor, S4,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     motorF,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     motorG,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_1,     motorD,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_2,     motorE,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S2_C2_1,     motorH,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C2_2,     motorI,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S3_C1_1,     motorH,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S3_C1_2,     motorI,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S3_C2_1,     motorH,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S3_C2_2,     motorI,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_1,     motorH,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_2,     motorH,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S4_C2_1,     motorI,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C2_2,     motorQ,        tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{

while(true)
    {
        getJoystickSettings(joystick);
        motor[motorD] = joystick.joy1_y1;
        motor[motorE] = joystick.joy1_y2; //Motor E is Reversed

        getJoystickSettings(joystick);
         {if(abs(joystick.joy2_y1) > 10){
         {
        motor[motorF] = joystick.joy2_y1/1.75;
        motor[motorG] = joystick.joy2_y1/1.75; //Motor G is reversed
      }
      }else{
           motor[motorF] = 0;
           motor[motorG] = 0;
      }}}
            {if(abs(joystick.joy2_y2) > 10){
        motor[motorH] = joystick.joy2_y2/1.75;
        motor[motorI] = joystick.joy2_y2/1.75; //Motor I is reversed
      }
        else{
           motor[motorH] = 0;
           motor[motorI] = 0;
        }}}


If you could give me any idea as to whats wrong , or how to fix it.


Thu Jan 23, 2014 1:00 pm
Profile WWW
Novice

Joined: Sat Aug 31, 2013 9:15 am
Posts: 97
Post Re: What is going on?
Are you connecting using USB or Bluetooth? Because that makes a big difference on the kinds of problems you could be encountering.

_________________
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 Jan 23, 2014 6:57 pm
Profile
Rookie
User avatar

Joined: Thu Dec 05, 2013 12:57 pm
Posts: 8
Location: Las Vegas
Post Re: What is going on?
BurningLights wrote:
Are you connecting using USB or Bluetooth? Because that makes a big difference on the kinds of problems you could be encountering.

I've tried both, neither are working. :?


Mon Jan 27, 2014 12:56 pm
Profile WWW
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 558
Post Re: What is going on?
Out of curiosity, what happens when you replace the #pragmas at the top with a version that follows the alphabetic naming system properly (motors H and I are assigned to multiple chains/ports)?

Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Hubs,  S2, HTMotor,  HTMotor,  none,     none)
#pragma config(Hubs,  S3, HTMotor,  HTMotor,  none,     none)
#pragma config(Hubs,  S4, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     ,               sensorI2CMuxController)
#pragma config(Sensor, S3,     ,               sensorI2CMuxController)
#pragma config(Sensor, S4,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     motorF,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     motorG,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_1,     motorD,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_2,     motorE,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S2_C2_1,     motorH,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C2_2,     motorI,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S3_C1_1,     motorJ,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S3_C1_2,     motorK,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S3_C2_1,     motorL,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S3_C2_2,     motorM,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_1,     motorN,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_2,     motorO,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S4_C2_1,     motorP,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C2_2,     motorQ,        tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//


Besides that, I don't see anything in particular that could be causing a disconnect issue. However, there is another potential coding issue that I've come across:

Code:
#include "JoystickDriver.c"

task main()
{

   while(true)
   {
      getJoystickSettings(joystick);
      motor[motorD] = joystick.joy1_y1;
      motor[motorE] = joystick.joy1_y2; //Motor E is Reversed

      getJoystickSettings(joystick);
      {
         if(abs(joystick.joy2_y1) > 10)
         {
            {
               motor[motorF] = joystick.joy2_y1/1.75;
               motor[motorG] = joystick.joy2_y1/1.75; //Motor G is reversed
            }
         }
         else
         {
            motor[motorF] = 0;
            motor[motorG] = 0;
         }
      }
   }
   
   {
      if(abs(joystick.joy2_y2) > 10)
      {
         motor[motorH] = joystick.joy2_y2/1.75;
         motor[motorI] = joystick.joy2_y2/1.75; //Motor I is reversed
      }
      else
      {
         motor[motorH] = 0;
         motor[motorI] = 0;
      }
   }
}


There is a misplaced closing brace } after the first 'else' statement that is encapsulating your infinite while loop. You will either need to remove both it and the opening brace directly after the second 'getJoystickSettings();' command, or move the closing brace to the end of the program in order to 'encapsulate' both sets of if/else statements inside of the while loop.

_________________
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


Mon Jan 27, 2014 1:22 pm
Profile
Novice

Joined: Sat Aug 31, 2013 9:15 am
Posts: 97
Post Re: What is going on?
So, just to be clear, you're navigating in the menus to Robot>NXT Brick>Communication Link Setup, ROBOTC is finding your NXT, and you're successfully connect to it? Then, when you go to download a program, it tells you that you are not connected to an NXT?

_________________
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 Jan 27, 2014 1:24 pm
Profile
Rookie
User avatar

Joined: Thu Dec 05, 2013 12:57 pm
Posts: 8
Location: Las Vegas
Post Re: What is going on?
BurningLights wrote:
So, just to be clear, you're navigating in the menus to Robot>NXT Brick>Communication Link Setup, ROBOTC is finding your NXT, and you're successfully connect to it? Then, when you go to download a program, it tells you that you are not connected to an NXT?

Yes


Mon Jan 27, 2014 1:31 pm
Profile WWW
Rookie
User avatar

Joined: Thu Dec 05, 2013 12:57 pm
Posts: 8
Location: Las Vegas
Post Re: What is going on?
JohnWatson wrote:
Out of curiosity, what happens when you replace the #pragmas at the top with a version that follows the alphabetic naming system properly (motors H and I are assigned to multiple chains/ports)?

Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Hubs,  S2, HTMotor,  HTMotor,  none,     none)
#pragma config(Hubs,  S3, HTMotor,  HTMotor,  none,     none)
#pragma config(Hubs,  S4, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     ,               sensorI2CMuxController)
#pragma config(Sensor, S3,     ,               sensorI2CMuxController)
#pragma config(Sensor, S4,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     motorF,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     motorG,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_1,     motorD,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_2,     motorE,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S2_C2_1,     motorH,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C2_2,     motorI,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S3_C1_1,     motorJ,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S3_C1_2,     motorK,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S3_C2_1,     motorL,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S3_C2_2,     motorM,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_1,     motorN,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_2,     motorO,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S4_C2_1,     motorP,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C2_2,     motorQ,        tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//


Besides that, I don't see anything in particular that could be causing a disconnect issue. However, there is another potential coding issue that I've come across:

Code:
#include "JoystickDriver.c"

task main()
{

   while(true)
   {
      getJoystickSettings(joystick);
      motor[motorD] = joystick.joy1_y1;
      motor[motorE] = joystick.joy1_y2; //Motor E is Reversed

      getJoystickSettings(joystick);
      {
         if(abs(joystick.joy2_y1) > 10)
         {
            {
               motor[motorF] = joystick.joy2_y1/1.75;
               motor[motorG] = joystick.joy2_y1/1.75; //Motor G is reversed
            }
         }
         else
         {
            motor[motorF] = 0;
            motor[motorG] = 0;
         }
      }
   }
   
   {
      if(abs(joystick.joy2_y2) > 10)
      {
         motor[motorH] = joystick.joy2_y2/1.75;
         motor[motorI] = joystick.joy2_y2/1.75; //Motor I is reversed
      }
      else
      {
         motor[motorH] = 0;
         motor[motorI] = 0;
      }
   }
}


There is a misplaced closing brace } after the first 'else' statement that is encapsulating your infinite while loop. You will either need to remove both it and the opening brace directly after the second 'getJoystickSettings();' command, or move the closing brace to the end of the program in order to 'encapsulate' both sets of if/else statements inside of the while loop.


Changing the pragma didn't work, In fact none of my codes are working. I can connect to regular Nxt bots, but not my competition bot. Also, I changed the closing brace and it didn't change.


Mon Jan 27, 2014 1:33 pm
Profile WWW
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 558
Post Re: What is going on?
RobotDaddy wrote:

Changing the pragma didn't work, In fact none of my codes are working. I can connect to regular Nxt bots, but not my competition bot. Also, I changed the closing brace and it didn't change.


Ok, so this definitely seems like a connection issue and not a code issue, BurningLights has the correct thinking on this one. When you plug in and turn on your NXT brick, what does it appear as under the Windows Device Manager? Also, does it boot as normal (with the NXT boot sound/menu visible) or is it 'clicking' with a blank screen?

_________________
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


Mon Jan 27, 2014 1:51 pm
Profile
Rookie
User avatar

Joined: Thu Dec 05, 2013 12:57 pm
Posts: 8
Location: Las Vegas
Post Re: What is going on?
JohnWatson wrote:
Also, does it boot as normal (with the NXT boot sound/menu visible) or is it 'clicking' with a blank screen?

It boots up normal with a visible menu and a sound, but I try to run the code it freezes and starts to click. I have tried with multiple NXT's and the firmware is updated. :-( :?


Tue Jan 28, 2014 2:03 pm
Profile WWW
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: What is going on?
My experience with RobotC tells me that when the brick is clicking, it is hung waiting for something. When it's waiting for something, it seems it stops communicating that causes the laptop to "disconnect". A quick glance at the code doesn't reveal anything obviously wrong but I would recommend checking the configuration of the robot against your pragmas to make sure all the motors are connected as specified by the pragma. I can imagine that if the configuration doesn't match, RobotC may be waiting for a non-existing motor controller to respond. If you still can't find anything wrong, start with simpler code with only one set of motors and work up from there. For example:
Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     motorF,        tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     motorG,        tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
   while(true)
   {
      getJoystickSettings(joystick);
      if(abs(joystick.joy2_y1) > 10)
      {
               motor[motorF] = joystick.joy2_y1/1.75;
               motor[motorG] = joystick.joy2_y1/1.75; //Motor G is reversed
      }
      else
      {
            motor[motorF] = 0;
            motor[motorG] = 0;
      }
      wait1Msec(100);
  }
}


Tue Jan 28, 2014 6:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 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.