Debugger Stream

We are working on the satellite mapping activity in the Aerospace class and we have everything paired and working correctly, but we can not get any data to load in the debug stream menu. Any help you can offer?

Do you have some code to share? How are you sending items to the debug stream?

Are you running the debugger? Are you using a USB A-A cable or VexNet keys?

Here’s the code provided by PLTW. The cortex and joystick are paired with vexnet keys. Then I have the joystick connected to the computer with a USB to serial cable, programming module and RJ14 6-pin cable.

#pragma config(Sensor, dgtl1, trackend, sensorTouch)
#pragma config(Sensor, dgtl2, sonar, sensorSONAR_inch)
#pragma config(Sensor, dgtl4, quad, sensorQuadEncoder)
#pragma config(Motor, port2, drive, tmotorServoContinuousRotation, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

/*
Project Title: Activity 4.2.8b Satellite Flight ROBOTC Program
Team Members: AE Curriculum Team
Date: TBA
Section: TBA

Task Description:
Operates a robot to gather elevation data.

Pseudocode:
Wait 2 seconds before program task start to allow time to be clear of the satellite after powering on the Cortex
Wait until joystick 6U button pushed.
Start a motor to traverse bar.
while the touch sensor isn’t pressed signifying that the satellite has not reach the end of the frame …
Wait for the target number of encoder counts to elapse and monitor that satellite has not reach the end of the frame.
(2.75 in. dia, therefore 360 counts / 3.14 (2.75 in.) = 41.69 counts/in.)
(3 in. travel = 125 counts)
Output wheel encoder and sonar data data in streaming window for export into excel
stop the motor
*/

task main()
{
wait1Msec(2000); // Robot waits for 2000 milliseconds before executing program
SensorValue[quad]=0; // Set optical shaft encoder quadrature count to zero
int targetCount = 1;

while(vexRT[Btn6U] == 0)  //Satellite waits until the button is pressed before moving on
{
}

startMotor(drive, -64);  //Turn on the motor in reverse at 64

while(SensorValue[trackend] == 0) //While the final button isn’t pressed…
{

while(abs(SensorValue[quad]) < targetCount && SensorValue[trackend] == 0)//Wait for the encoder count to reach the target polling point (125 counts or 3 inches of travel) and satellite has not reached end of the path
{
}
writeDebugStreamLine("%d \t %d", SensorValue(quad), SensorValue(sonar));  //...and then write optical shaft encoder and sonar values to the debug stream
targetCount = targetCount + 125; // Sensor data is written every 125 counts or 3 inches of travel

}

stopMotor(drive); //Stop the motor

} // End task main

And yes, running the debugger, and the debug stream window is open. But no data…

I assume you pressed button 6 up to start this whole thing.

Then make sure the button value is 0 for the button sensor trackend. Use the sensors debugger window.

Next make sure the quad is registering while you drive the motor. If it is not, the while loop will never exit.

You could also switch from startMotor(drive, -64); to using more direct controls like motor[drive] = -64; But that should not make much of a difference

Ok I’ve been running it tethered for the last few minutes, and it looks like I’m not getting any values from my quad is not registering. Looking at the code, can you tell why that might be?

Ok, now I just realized my sonar isn’t registering either…I’m getting values initially when I download the program, until I start the program. Then my values just sit frozen and don’t move at all.

In the debugger control window is the refresh set to continuous?

(and I assume you hit start)

Are you sure you plugged in the quad encoders in digital 4 and 5 ports?

Hello, I am in Mrs. Gregory’s class and working on this assignment. The encoder is plugged in correctly and the refresh tab on the debugger window is st to refresh and the problem still persists.

If you could replicate the project and programming to help with understanding the problems that would be great. Here is the file program.
4.2.8.b.A SatelliteFlightROBOTC.docx (61.2 KB)
4.2.8a.A SatelliteRobotConstPRINTVERSION.pdf (864 KB)

Check the sensors tab in the debugger and make sure the quad encoder is counting in the correct direction. If it is not then you may have to swap the two encoder cables (port4 and port5 swap).

Can you twirl a shaft in the quad encoder while in the debugger? Make sure that quad encoder works first outside of the program running. I bet it is the quad encoder not returning values.

Sometimes there is a huge amount of dust inside the encoder preventing it from reading properly. You can unscrew the red cover to check it out. Or a wire inside the quad is busted which is not very helpful to you. Do this after the initial twirl test.

We have replaced the encoder, motor, sonar sensor, micro-controller, and the cortex twice and they all work independently and together. They also work when a hardwired connection is made between the computer and the cortex, but when we try it remotely it crashes the program.

Are your Vexnet keys paired? USB A-A cable between the joystick and cortex. Turn em on and wait for the lights to green.

Are your Vexnet keys on the latest Vexnet key firmware (not the cortex firmware, not the joystick firmware, but yes, the Vexnet keys now have firmware too)


http://link.vex.com/downloads/VEXnet-Key-2p0-Update

We will try that