View unanswered posts | View active topics It is currently Thu Oct 23, 2014 6:29 am






Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Problems with Remote Control 
Author Message
Rookie

Joined: Tue Jan 03, 2012 2:32 pm
Posts: 10
Post Problems with Remote Control
Hi, we are a first year FTC team and really struggling with the remote control. We followed all the directions exactly and couldn't get it to work. We finally we able to get it to work when we downloaded the joystickdriver.c file to the robot. It was still very shaky but at least it worked. We were happy to have it at least moving.

Then when we started working on the magnetic sensor which we could also not get to work our remote control stopped working. We went back through all of our steps again. Uninstalled/reinstalled everything cleared everything out and still no luck. I've searched the forums and tried everything and nothing seems to work.

The FTC examples all appear to use RobotC 2. We have RobotC 3 not sure if that makes a big difference. Our NXT isn't a specific FTC brick (if there is such a thing). We just used one from previous years FLL competition.

We've tried firmware upgrades.
Changing the "18" to "19" in the max size line of code in the joystick driver file.
downloaded other code libraries.

We are able to compile/download programs with blue tooth so I don't think blue tooth is the problem.
Simple programs work where we just roll forward so I know the motors work.

Sorry for the novel, it's our first year at this and the first year anyone in South Dakota has even participated as far as we know. We don't have anyone in our area that has any experience with this. The kids and myself are getting very frustrated. The competition is 6 weeks away and we really don't have anything yet. Any help/advise/tips or anything else that could help us out would be great.

Thanks.
Scott


Wed Jan 04, 2012 10:56 am
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Problems with Remote Control
Can you post some tele-op code which is not working? This would help us help you. Please use the forum Code tags.

Also, are you testing using the ROBOTC IDE or the FCS? If you are using the ROBOTC IDE, do you have the FTC Joystick Debug Window open when testing?
There are a lot of things that could explain your issue, but we need more details to narrow it down.


Wed Jan 04, 2012 12:37 pm
Profile
Rookie

Joined: Tue Jan 03, 2012 2:32 pm
Posts: 10
Post Re: Problems with Remote Control
We are testing with the robotc IDE. We have the joystick debug window up and we can see the controls moving around and they are synched up with what we are doing. When I put break points in the code to check the values returned from the joystick, they are always 0. We single step through the code while holding both joysticks at full forward and the values returned are 0.

The code is on another computer so I don't have access to it right now. I can try to post later. It's just the standard code from the FTC tutorial that we are using. The basics are ...

I'm not sure what you mean by tele-op code.

Code:
threshold = 15

While true {
    If joystick.y1 > threshold
       move left motor
    else
       stop left motor

    If joystick.y2 > threshold
       move right motor
    else
       stop right motor
}



Thanks.
Scott


Wed Jan 04, 2012 12:50 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Problems with Remote Control
I think it would help to post your full code (everything, including the pragmas) once you get access to it.

Some other thoughts in the mean time... are you using the competition template? Which joystick debug window are you using, the standard one or the FTC one? Which joystick are you using? I assume the newer ones with the colored buttons. If so, have you made sure that the mode button is not on and that the switch on the back is set to the 'D' position?


Wed Jan 04, 2012 1:01 pm
Profile
Rookie

Joined: Tue Jan 03, 2012 2:32 pm
Posts: 10
Post Re: Problems with Remote Control
I confirmed that the mode button is off and that the back switch is set to D. It is a brand new control with color buttons.

I'm not sure what the competition template is. It might be something we are using and don't know it. Could you explain what I need to look for?

We are using the FTC remote control debug window

Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Sensor, S1,     ,                    sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, openLoop)
#pragma config(Servo,  srvo_S1_C2_1,    servo1,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_2,    servo2,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c" //Joystick is included in this program

task main()
{
  int threshold = 15; //to avoid unnecessary movement

  while(true) //infinite loop
  {
    getJoystickSettings(joystick); //retrieves data from the joystick

    if(abs(joystick.joy1_y1) > threshold)
    {
      motor[motorD] = joystick.joy1_y1; //y1 controller moves motorD
    }
    else
    {
      motor[motorD] = 0;
    }

    if(abs(joystick.joy1_y2) > threshold)
    {
      motor[motorE] = joystick.joy1_y2; //y2 controller moves motorE
    }
    else
    {
      motor[motorE] = 0;
    }
   }
}


Wed Jan 04, 2012 2:40 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Problems with Remote Control
Add some debugging lines to your code and see if the program actually received joystick activities. If it does, then the problem is with the drive system not the input system. In that case, you need to check the wiring of motor D and E to make sure motor D and E are connected to a motor controller that is connected directly to the NXT sensor port S1 (not indirectly through daily chaining). Also note if the red power LED of the motor controller is lit (that it has power) and make sure the motors are securely connected to the motor controller.
Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Sensor, S1,     ,                    sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, openLoop)
#pragma config(Servo,  srvo_S1_C2_1,    servo1,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_2,    servo2,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c" //Joystick is included in this program

task main()
{
  int threshold = 15; //to avoid unnecessary movement

  while(true) //infinite loop
  {
    getJoystickSettings(joystick); //retrieves data from the joystick

    if(abs(joystick.joy1_y1) > threshold)
    {
      motor[motorD] = joystick.joy1_y1; //y1 controller moves motorD
      nxtDisplayTextLine(3, "L=%d", joystick.joy1_y1);
    }
    else
    {
      motor[motorD] = 0;
    }

    if(abs(joystick.joy1_y2) > threshold)
    {
      motor[motorE] = joystick.joy1_y2; //y2 controller moves motorE
      nxtDisplayTextLine(4, "R=%d", joystick.joy1_y2);
    }
    else
    {
      motor[motorE] = 0;
    }
   }
}


Wed Jan 04, 2012 4:04 pm
Profile
Rookie

Joined: Tue Jan 03, 2012 2:32 pm
Posts: 10
Post Re: Problems with Remote Control
When we run basic programs like ...

Code:
      motor[motorD] = 20;
      motor[motorE] = 20;


The robot moves so I'm pretty sure we have the motors connected properly. I will try adding the debugging code you mention below and let you know the results.

Thank you for the advice.
Scott


Wed Jan 04, 2012 4:21 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Problems with Remote Control
This is a guess & may sound a little crazy, but have you checked the radio button on the FTC Joystick Debug window to "Tele Op: Running"?
You could also try using the standard joystick debug window since it does not appear that you are using the FTC competition template.


Wed Jan 04, 2012 5:55 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Problems with Remote Control
l0jec wrote:
This is a guess & may sound a little crazy, but have you checked the radio button on the FTC Joystick Debug window to "Tele Op: Running"?
You could also try using the standard joystick debug window since it does not appear that you are using the FTC competition template.

Yeah, that would be my next recommendation if you prove the problem is with the input. Also if you are using the FTC game controller dialog instead of the standard one, you may need to select the radio buttons in sequence: Stop->TeleOp Ready->TeleOp running". Directly selecting "TeleOp running" may not work. I don't have RobotC in front of me so this is from my memory.


Wed Jan 04, 2012 6:10 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Problems with Remote Control
MHTS, your memory matches my own so it must be right. :D
I want to say that they changed the FTC Joystick Debug window in 3.x so that it will not send any data to the NXT unless the mode is set to Tele Op Running (in the past it seemed like the mode selection only affected the autonmous/tele-op running flags and did not affect if any other joystick state data was updated).


Wed Jan 04, 2012 6:21 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3225
Location: Rotterdam, The Netherlands
Post Re: Problems with Remote Control
l0jec wrote:
MHTS, your memory matches my own so it must be right.

Hah, do you have any idea how many people can swear they remember seeing Elvis...just the other day?

Or maybe he really is still alive....<cue dramatic music>

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Jan 05, 2012 2:58 am
Profile WWW
Rookie

Joined: Tue Jan 03, 2012 2:32 pm
Posts: 10
Post Re: Problems with Remote Control
OK, I've tried everything mentioned in the last few posts with no luck.

I inserted the debug code and the numbers are always 0. I checked the joystick settings and they match below (mode button off, back switch = D).

Tried the Tele-op steps from below. Tried several programs as the tele op program with no luck. Looked at both remote debug windows.

Any other ideas?

Are there any good tutorials on-line that use RobotC 3. The stuff that came with our kit just doesn't work at all and is in the older version. This thread is the first place I've heard of "competition templates". Any recommendations for site with more information on that?

Again thanks for tips everyone. The kids and I are all getting burned out on this remote control stuff and it would be nice to have it running for our meeting tonight.

Scott


Thu Jan 05, 2012 10:54 am
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Problems with Remote Control
At this point I'm out of ideas and would suggest more hands-on help. You could try posting some screenshots of ROBOTC with the debug windows up while you're testing, but I think we need to see what you're doing at this point. The code looks fine and there is nothing in the results of the troubleshooting steps which have shined enough light on the root cause.

Do you have Skype by chance?
Feel free to PM me with your contact info if you'd like to go down that path.


Thu Jan 05, 2012 11:50 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Problems with Remote Control
scottd wrote:
I inserted the debug code and the numbers are always 0.

When you said the numbers are always 0, I assume you were seeing the following lines on your LCD screen?
Code:
L=0
R=0

If so, did you really insert the following code? The reason I asked is because it is impossible to have 0 values. The tests against the threshold guarantee the joystick values are not zero before they are displayed. If the joystick values are zero, you will not see any lines on the LCD screen at all.
Code:
    if(abs(joystick.joy1_y1) > threshold)
    {
      motor[motorD] = joystick.joy1_y1; //y1 controller moves motorD
      nxtDisplayTextLine(3, "L=%d", joystick.joy1_y1);
    }
    else
    {
      motor[motorD] = 0;
    }

    if(abs(joystick.joy1_y2) > threshold)
    {
      motor[motorE] = joystick.joy1_y2; //y2 controller moves motorE
      nxtDisplayTextLine(4, "R=%d", joystick.joy1_y2);
    }
    else
    {
      motor[motorE] = 0;
    }

Also, are you connected to the NXT by Bluetooth, Samantha or USB wire? I assume you have successfully downloaded code through this connection? One of the reasons of reading zero joystick values could be loss of connection between your laptop and the NXT. But if you successfully downloaded code to the NXT prior to using the joystick then your connection should be fine.


Thu Jan 05, 2012 2:47 pm
Profile
Rookie

Joined: Tue Jan 03, 2012 2:32 pm
Posts: 10
Post Re: Problems with Remote Control
I didn't do it exactly as you stated. I did this instead....

Code:
    nxtDisplayTextLine(3, "L=%d", joystick.joy1_y1);
    if(abs(joystick.joy1_y1) > threshold)
    {
      motor[motorD] = joystick.joy1_y1; //y1 controller moves motorD
    }
    else
    {
      motor[motorD] = 0;
    }

    nxtDisplayTextLine(4, "R=%d", joystick.joy1_y2);
    if(abs(joystick.joy1_y2) > threshold)
    {
      motor[motorE] = joystick.joy1_y2; //y2 controller moves motorE
    }
    else
    {
      motor[motorE] = 0;
    }
   


You are correct. On this...


Code:
L=0
R=0


We are using bluetooth and the code successfully downloads and starts when I do compile and download then click start on the debug form.


Thu Jan 05, 2012 3:12 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ]  Go to page 1, 2  Next

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.