FIRST Tech Challenge Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Beginning problems

I am trying to start controlling an FTC  prototype, and I have 3 problems in this moment:

1) With the Schematic Editor, I can shine a red light with the Lego Light (not the Color) Sensor over blue and red blocks of the Mindstorm manual test colors page, and get always the same readings (about 45 for blue, 65 for red, with the sensor about 1 cm above the page). However, from LabView, I can only turn on the light but I don’t get any reading at the indicator I wired to the Light block.  So, I can't use the reading to control the motors.

2) At the remote control editor, on the “Configure Robot Action”, I added a VI to make turns with the motors, to be executed by pressing button 1 of the joystick, which runs correctly from LabView, but it doesn’t work when using the “Run Program” and “Start Test” functions.

3) After generating code with the remote control editor, and deploying it from LabView screen to the NXT, I see in the screen of the brick the name I put to the program, it doesn’t do anything when I run it, but rather it presents the following message in 3 lines of the screen: “OFFLINE”, “NXT=8.558”,”BAT=0” (that number varies), but the Schematic Editor screen says that the battery is almost full.  However, I selected another program “DemoV2" (not created by me, it was already in the brick), and both Lego motors react, that means that the brick is working properly, but not with my program.  Why?

I would appreciate very much any help on this problems.

Good luck and lots of success with your robots,

Team 5430 (Virginia)

0 Kudos
Message 1 of 8
(5,735 Views)

Hey ngrookie,

To get information fed back to your front panel you will need to have the VI in Target for Computer Mode (this is explained a little more in the following image)nxt-targetoptions.png

If you are already running in the VI for computer target mode then it would be helpful to get a screenshot (or copy) of the VI you are using to do the sensor read so we can have a better idea what might be going on there.

I am not sure why you are seeing issues with the Remote control editor but if you could include a screenshot of both the configure robot action and run program screen that should give us a good starting point.

Please post back with your screenshots and any additional questions or information.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 8
(3,746 Views)

Hi,

Thank you, Kevin_F, for your reply.

Now I will try to provide more information about my problems.  First let me explain what I am trying to do at this moment.  I want to move the robot around with the joystick of the gamepad (so I can put it in front of a “Bowled Over” crate), and also, if I press its button, I want the robot to move straight until it stops at 1 cm from the crate.  At that moment, the light sensor should turn on, take the color reading, and move the robot backward while making a turn, to the right if the crate is red, to the left if the crate is blue.  But, I am in my job, and I only brought the light sensor from the school, not the ultrasonic sensor, so I am simulating it with a control.  This program (which I am sending to your email) works fine from LabView, except the color readings even if the light turns on with the program, but I get also a reaction there, even it is wrong, because if I write any number on the indicator (please see the numbers I wrote in the screen shots), it will always turn to a reading of 1 (one) after the light shines.

Now let me answer to your replies (# refer to my original questions):

 

1)  Yes, I have the VI targeted to the computer, as you can see in the first screenshot I am sending to you.

2) See the second and third screenshots.  With the joystick, the robot moves and turns fine, but when I press button 1, it only turns on the light, but the motors don’t move, even if the “distance” set by the control, is more than 1 cm.

3) OK, I am going to try tonight with the FCS installed as you told me.

Thanks again for your help, and I hope the files I am sending today will be useful for you so you can help me further.

ngrookie

0 Kudos
Message 3 of 8
(3,746 Views)

Hey ngrookie,

You should be able to attach your documents to this thread in the community (you may need to click the "Use advanced editor" in the upper right corner when you are writing your post. 

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 4 of 8
(3,746 Views)

Hi, Kevin_F,

Thanks once again for this tip.

Now I attached all the files I mentioned in my previous email.

Ngrookie

0 Kudos
Message 5 of 8
(3,746 Views)

Hey ngrookie,

The one thing I noticed with the LabVIEW code for the light sensor is that in your LabVIEW code you have placed the block for the Red Color Sensor and not the light sensor.  Based on what you described in your previous posts I thought you were setting it up to be connected to a light sensor.  I am not sure what you would see if you are using the read color sensor VI's on a port where a light sensor is plugged in but I could definitely believe that you might get the behavior you are seeing.

I am going to take a look at what might be going on with your other VI's this afternoon and try and replicate what you have here on my end.  The one thing I am curious about is if when you are pressing the button to run your VI if you move the joysticks do the motors still respond?  If so I think what might be happening is that you are still setting the motors every iteration of the loop to the values specified by joystick which might be overwriting the values you are setting in your code.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 6 of 8
(3,746 Views)

Hey ngrookie,

Have you made any progress on the issues you were seeing?  I wanted to clarify what I said earlier about needing the FCS software running.  If you robot is connected and you are running the program through the remote control editor than that will also work for controlling your robot with the joysticks.  If you are not connected to your computer however you need to have it set up with the FCS software so the NXT gets all the control and joystick info that it needs to drive.

For debugging the behavior you are seeing with nothing happening when the button is pressed I would start by testing with a simple VI (maybe one that just spins the motors in opposite directions) and if that works then keep adding code back in sections to see what is causing the issue you are seeing.  It would also be useful to see your main program loop for debugging this issue.

When I use generate code to call a SubVI when a button is pressed it creates a main control loop that looks like this:

encodertest.png

The VI that is called when the button is pushed is in its own separate loop below the main drive loop.  If you put code that controls the motors in the subVI it won't do much good because each time the main loop runs it just overwrites whatever values you set in the subVI.  I suspect this is the issue you are running into with your program.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 7 of 8
(3,746 Views)

Hi, Kevin_F:

I am sorry for my delay to answer to you, but I have been busy working with the FTC Robot (we have a field test event tomorrow) and at my job.

Now I am going to answer to your Nov. 16 post only, because I don't have time to answer the Nov. 18 post.  And I haven't been able to test the program with the FCS working as I told you before, because now I am having another problem, which is that sometimes LabView does not detect the Samantha module.  Between the moment when it works and when it doesn't, I am shutting down the robot (both main switch and NXT), and closing LabView, so I guess there is a problem with the sequence of steps I am following to turn off and the to turn on.

Well, regarding the color and light sensors, from the help screens of LabView I understood (but maybe I am wrong) that there are three options, which I numbered in the attached screen shot, that I got doing right click on the NXT sensor block: 1) The read light is to get the intensity or amount of the ambient light, which is not what I need;  2) With my red sensor, I was using the function from the schematic editor (see bottom of the file, that I am simulating here because I don't have the robot with me at this moment) to get consistent readings of the red and blue colors, the variation I wrote in the screen shot is due to the distance from the sensor to the color surface, but this is the command that is not working in my program; 3) This detector, which has 3 bulbs in the front, gives a specific number from 1 to 6 for each color, but I can't use this one because my sensor only has two bulbs.

Well, I hope that this information will clarify what sensor and command I am using and why.  Please let me know if I am making a mistake.

Regarding your question about the motors, they work fine from LabView, turning around the robot according to the "color" (that I am simulating with the virtual controller) but nothing happens with the gamepad button, I need to check that with the FCS as I mentioned before, maybe we will get some help tomorrow in the event.

Thanks again,

ngrookie

0 Kudos
Message 8 of 8
(3,746 Views)