View unanswered posts | View active topics It is currently Tue Jul 29, 2014 4:19 am






Reply to topic  [ 8 posts ] 
Debugger Error 
Author Message
Rookie

Joined: Sat Oct 25, 2008 3:04 pm
Posts: 5
Post Debugger Error
When I open up the debugger in RobotC, an error message pops up over the Global Variables window that says "An invalid arguement was encountered." and then a Runtime Error window pops up and I am forced to close the application.

Can anyone help me with this or should I just uninstall RobotC and then re-install?


Sun Feb 15, 2009 5:46 pm
Profile
Novice

Joined: Thu Oct 09, 2008 7:58 pm
Posts: 79
Post Re: Debugger Error
Uh...Code please. :D.


Sun Feb 15, 2009 7:23 pm
Profile
Rookie

Joined: Sat Oct 25, 2008 3:04 pm
Posts: 5
Post Re: Debugger Error
Well that's the thing, I didn't have this problem earlier. I was trying to get a compass sensor working for my team's autonomous program (which I still can't get, so if anyone wants to help me on that too, much appreciated :D ), and then the error message came out of nowhere.

I don't feel that the code is the problem, but if it helps, here:

Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S2,     Compass1,            sensorI2CHiTechnicCompass)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_1,     motorF,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_2,     motorG,        tmotorNormal, PIDControl)

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

#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S2,     Compass1,            sensorI2CHiTechnicCompass)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_1,     motorF,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_2,     motorG,        tmotorNormal, PIDControl)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                           Autonomous Mode Code Template
//
// This file contains a template for simplified creation of an autonomous program for an FTC
// competition.
//
// You need to customize two functions with code unique to your specific robot.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

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


/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                                    initializeRobot
//
// Prior to the start of autonomous mode, you may want to perform some initialization on your robot.
// Things that might be performed during initialization include:
//   1. Move motors and servos to a preset position.
//   2. Some sensor types take a short while to reach stable values during which time it is best that
//      robot is not moving. For example, gyro sensor needs a few seconds to obtain the background
//      "bias" value.
//
// In many cases, you may not have to add any code to this function and it will remain "empty".
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

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;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                                         Main Task
//
// The following is the main code for the autonomous robot operation. Customize as appropriate for
// your specific robot.
//
// The types of things you might do during the autonomous phase (for the 2008-9 FTC competition)
// are:
//
//   1. Have the robot follow a line on the game field until it reaches one of the puck storage
//      areas.
//   2. Load pucks into the robot from the storage bin.
//   3. Stop the robot and wait for autonomous phase to end.
//
// This simple template does nothing except play a periodic tone every few seconds.
//
// At the end of the autonomous period, the FMS will autonmatically abort (stop) execution of the program.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

task main()
{
  int nCompassHeading;

  initializeRobot();

  waitForStart(); // Wait for the beginning of autonomous phase.

  ///////////
  // START //
  ///////////

  //MOVE FORWARD
  motor[motorD] = 5;
  motor[motorE] = -5;

  wait1Msec(1900);

  motor[motorD] = 1;
  motor[motorE] = -1;

  wait1Msec(750);

  motor[motorD] = 0;
  motor[motorE] = 0;

  wait1Msec(1000);

  //TURN RIGHT
  nCompassHeading = SensorValue[Compass1];
  if(nCompassHeading != 180)
  {
   motor[motorD] = 5;
   motor[motorE] = 5;
  }

  //MOVE FORWARD
  motor[motorD] = 5;
  motor[motorE] = -5;

  wait1Msec(2400);

  motor[motorD] = 0;
  motor[motorE] = 0;

  wait1Msec(1000);

  //TURN LEFT (FACING DUMP)
  nCompassHeading = SensorValue[Compass1];
  if(nCompassHeading != 90)
  {
  motor[motorD] = -5;
  motor[motorE] = -5;
  }

  //APPROACH DUMP
  motor[motorD] = 5;
  motor[motorE] = -5;

  wait1Msec(750);

  motor[motorD] = 0;
  motor[motorE] = 0;

  wait1Msec(100);

  //RAISE ACTUATOR (PUCKS FALL IN)
  nMotorEncoder[motorF] = 0;
  nMotorEncoder[motorG] = 0;

  nMotorEncoderTarget[motorF] = 220;
  nMotorEncoderTarget[motorG] = 220;

  motor[motorF] = -100;
  motor[motorG] = 100;

  wait1Msec(1500);

  //DEPART DUMP (ALLOWS ACTUATOR TO MOVE FREELY)
  motor[motorD] = -5;
  motor[motorE] = 5;

  wait1Msec(750);

  motor[motorD] = 0;
  motor[motorE] = 0;

  wait1Msec(100);

  //LOWER ACTUATOR
  nMotorEncoder[motorF] = 0;
  nMotorEncoder[motorG] = 0;

  nMotorEncoderTarget[motorF] = 220;
  nMotorEncoderTarget[motorG] = 220;

  motor[motorF] = 100;
  motor[motorG] = -100;

  wait1Msec(2500);

  //TURN LEFT
  nCompassHeading = SensorValue[Compass1];
  if(nCompassHeading != 0)
  {
  motor[motorD] = -5;
  motor[motorE] = -5;
  }

  //MOVE FORWARD
  motor[motorD] = 5;
  motor[motorE] = -5;

  wait1Msec(1500);

  //TURN LEFT
  nCompassHeading = SensorValue[Compass1];
  if(nCompassHeading != 270)
  {
   motor[motorD] = -5;
   motor[motorE] = -5;
  }

  //MOVE FORWARD
  motor[motorD] = 5;
  motor[motorE] = -5;

  wait1Msec(1300);

  //RAISE ACTUATOR
  nMotorEncoder[motorF] = 0;
  nMotorEncoder[motorG] = 0;

  nMotorEncoderTarget[motorF] = 720;
  nMotorEncoderTarget[motorG] = 720;

  motor[motorF] = -100;
  motor[motorG] = 100;

  wait1Msec(1500);

  //LOWER ACTUATOR
  nMotorEncoder[motorF] = 0;
  nMotorEncoder[motorG] = 0;

  nMotorEncoderTarget[motorF] = 720;
  nMotorEncoderTarget[motorG] = 720;

  motor[motorF] = 100;
  motor[motorG] = -100;

  wait1Msec(1500);

  /////////
  // END //
  /////////

  while (true)
  {

  }
}


Sun Feb 15, 2009 9:16 pm
Profile
Novice

Joined: Tue Jan 13, 2009 5:22 pm
Posts: 72
Location: USA, Pennsylvania
Post Re: Debugger Error
I actually made a compass program that were using the joystick but can be broken apart to make a autonomous program.
Remember to change the degrees to your own.
The motors are very magnetic so keep them away from the compass.
Sorry for the huge amount of code but you may use it yourself and have some use for it.
Code:
/*The progam I have made uses the Lego motors but may be changed to anything.
To better understand the program this is a piece of code that I'm going to give comments.

   if(myCompassValue > 35 && myCompassValue < 45) //if the compass value is inbetween those nr stop motors
   {
     motor[motorB] = 0;
     motor[motorC] = 0;
   }
   else if(myCompassValue >= 45 && myCompassValue < 223)// if the compass value is in any of those "bars" the robot is going to run to left to get to the position.
   {
     motor[motorB] = 18;
     motor[motorC] = -18;
   }
   else// if the compass is outside of those nrs turn to right to get to position.
   {
     motor[motorB] = -18;
     motor[motorC] = 18;
   }

*/

#pragma config(Sensor, S1,     touch,               sensorTouch)
#pragma config(Sensor, S4,     compass,             sensorI2CHiTechnicCompass)
#pragma config(Motor,  motorB,          rM,            tmotorNormal, PIDControl)
#pragma config(Motor,  motorC,          lM,            tmotorNormal, PIDControl)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "joystickdriver.c"

task main()
{
  int myCompassValue;
  while(true)
  {
    myCompassValue = SensorValue[S4];
    getJoystickSettings(joystick);
    if(joy1Btn(4))
    {
      if(myCompassValue > 35 && myCompassValue < 45)
      {
        motor[motorB] = 0;
        motor[motorC] = 0;
      }
      else if(myCompassValue >= 45 && myCompassValue < 223)
      {
        motor[motorB] = 18;
        motor[motorC] = -18;
      }
      else
      {
        motor[motorB] = -18;
        motor[motorC] = 18;
      }
    }
    else if(joy1Btn(3))
    {
      if(myCompassValue > 116 && myCompassValue < 133)
      {
        motor[motorB] = 0;
        motor[motorC] = 0;
      }
      else if(myCompassValue >= 133 && myCompassValue < 315)
      {
        motor[motorB] = 18;
        motor[motorC] = -18;
      }
      else
      {
        motor[motorB] = -18;
        motor[motorC] = 18;
      }
    }
    else if(joy1Btn(2))
    {
      if(myCompassValue > 220 && myCompassValue < 237)
      {
        motor[motorB] = 0;
        motor[motorC] = 0;
      }
      else if(myCompassValue >= 237 || myCompassValue < 37)
      {
        motor[motorB] = 18;
        motor[motorC] = -18;
      }
      else
      {
        motor[motorB] = -18;
        motor[motorC] = 18;
      }
    }
    else if(joy1Btn(1))
    {
      if(myCompassValue > 318 && myCompassValue < 329)
      {
        motor[motorB] = 0;
        motor[motorC] = 0;
      }
      else if(myCompassValue >= 329 || myCompassValue < 122)
      {
        motor[motorB] = 18;
        motor[motorC] = -18;
      }
      else
      {
        motor[motorB] = -18;
        motor[motorC] = 18;
      }
    }
    else if(joy1Btn(5))
    {
      motor[motorB] = 25;
      motor[motorC] = 25;
    }
    else if(joy1Btn(6))
    {
      motor[motorB] = 50;
      motor[motorC] = 50;
    }
    else if(joy1Btn(7))
    {
      motor[motorB] = 75;
      motor[motorC] = 75;
    }
    else if(joy1Btn(8))
    {
      motor[motorB] = 100;
      motor[motorC] = 100;
    }
    else
    {
      motor[motorB] = 0;
      motor[motorC] = 0;
    }
  }
}

_________________
We need a Linux Version!


Sun Feb 15, 2009 9:49 pm
Profile WWW
Rookie

Joined: Sat Oct 25, 2008 3:04 pm
Posts: 5
Post Re: Debugger Error
Thanks for that. I'll be sure to try it out.

I'm still having trouble with the error message though.


Sun Feb 15, 2009 11:25 pm
Profile
Rookie

Joined: Tue Mar 18, 2008 7:11 pm
Posts: 22
Location: San Antonio, TX
Post Re: Debugger Error
Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S2,     Compass1,            sensorI2CHiTechnicCompass)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_1,     motorF,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_2,     motorG,        tmotorNormal, PIDControl)

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

#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S2,     Compass1,            sensorI2CHiTechnicCompass)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_1,     motorF,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_2,     motorG,        tmotorNormal, PIDControl)

...


It appears that you have doubled up on your #pragma statements. Delete the #pragma statements below the #include statement and see if the problem doesn't go away.

Sean


Mon Feb 16, 2009 1:55 pm
Profile
Rookie

Joined: Sat Oct 25, 2008 3:04 pm
Posts: 5
Post Re: Debugger Error
Well thank you for noticing that. That was actually my mistake copying and pasting the code onto my post. I honestly don't remember how that happened.

That being said, any other ideas?


Mon Feb 16, 2009 7:04 pm
Profile
Novice

Joined: Mon Oct 13, 2008 6:29 pm
Posts: 75
Location: Florida, USA
Post Re: Debugger Error
the compass is pretty innacurate unless their is a metal and motor less part of your robot that you can put competition legal magnetic sheilding on :mrgreen:

_________________
PHUHS Robotics
Team 516 FTW

Daytona Robofest Winning Alliance Captain
Daytona Robofest Inspire Award


Tue Feb 17, 2009 9:43 am
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.