Esempio n. 1
0
int main(

  int   argc, 
  char *argv[])

  {
  char **args, *command;

  mcn = argv[0];

  /* make sure certain environment variables are set */
  check_environment();

  /* determine if we're running poe or pdbx */
  command = get_real_command(argv[0]);

  /* add extra arguments if pbs job */

  if (is_pbs_job())
    {
    args = pbs_setup(command, argc, argv);

    run_command(command, args);
    }
  else if (is_interactive_ok())
    {
    run_command(command, argv);
    }
  else
    {
    refuse_interactive();
    }

  return (0);
  }
Esempio n. 2
0
int Basic(char *sql_file, char *log_file)
{
	if (check_environment(arbordir, arbordata, ds_database, dbms, arbordbu, \
				server_name) == FAILURE)
	{
		trc(ERROR,"Environment is not set up correctly. Exiting ...");
		exit(FAILURE);
	}

	if (open_log_sql(arbordata, sql_file) == FAILURE)
	{
		trc(ERROR,"Can not open sql log file %s in %s. Exiting ...");
		exit(FAILURE);
	}

	if (get_password(arbordir, arbor_password) == FAILURE)
	{
		trc(ERROR,"Can not read password file. Exiting ...");
		exit(FAILURE);
	}

	if (log_and_initialize(arbordbu, arbor_password, ds_database) == FAILURE)
	{
		trc(ERROR,"Can not log into database. Exiting ...");
		exit(FAILURE);
	}

	abp_set_date_format("MON DD YYYY");

	return 0;
}
Esempio n. 3
0
void main_planner (){
	//TODO: This function must be called in an infinite while loop. Remove the while(true) when integrated with rest of software
	
		getSensors();
        
        ///If all 3 sonar sensors are ready to be read from memory (flag byte for each sensor is 1)
        //If currently turning do not do anything
        //BEWARE between reading all flags as 1 and setting turning_flag to 1 and sending turning command, memory may update again! therefore disabling the turning_flag
        if (left_flag == 1 && right_flag == 1 && front_flag == 1){
            left_flag = right_flag = front_flag = 0;    //Reset flags to 0 so we start updating our globals again
            update_current_dist_to_wall();
			
			int index = check_environment();
			
			if ((state[index] == (MAX_COUNT/2)) && index >= 4 && index <= 7)
			{
				printf ("Entered state change segment, state: %d\n", index);
				temp_sc_front_dist = front/2;
				if(front<500)
					front_thresh = front;
				printf ("temp_front_dist: %d\n", temp_sc_front_dist);
				prev_cmd = curr_cmd;
				curr_cmd = SLOW;
				process_cmd(0);
			}
			if ((state[index] == (MAX_COUNT/2)) && index == 2)
			{
				printf ("Entered pre state 2\n");
				//temp_sc_front_dist = front;
				//if(front<500)
				//front_thresh = max(front-50,100);
				((front-50)<100)? front_thresh = 100 : ((front_thresh = front - 50),state[index] = 0);
				printf ("front thresh: %d\n", front_thresh);
				prev_cmd = curr_cmd;
				curr_cmd = SLOW;
				process_cmd(0);
			}
			//check if incremented stated has reached Possible_State_Change_Count
			//change front threshold to 100
			//go to new function
			//new function:
			//if that new state requires turning then get distance to front and devide by two and store it in global
			//
			
            if (state[index] >= MAX_COUNT){
				printf ("STATE:%d\n", index);
				track_sensors(index);
                Detect_Wall_Turn_Algo(index);
                process_cmd(index);
				check_drift(index);
			}
			return_from_drift(index);
		}
}//main_planner