예제 #1
0
bool Super_Dumb_Script::load_constructor_files()
{
	search_path = file_directory + file_constructor_pattern;
	find_handle = FindFirstFile(search_path.c_str(), &find_data);

	if(find_handle == INVALID_HANDLE_VALUE)
	{
		return FALSE;
	}

	do 
	{
		std::string file_path = file_directory + find_data.cFileName;
		std::ifstream in(file_path.c_str());
		if(in)
		{
			variable_map temp_variable = load_variables(file_path);
			if(temp_variable.size() > 0)
			{
				storage.insert(std::pair<std::string, variable_map*>(find_data.cFileName, new variable_map(temp_variable)));
			}
		}
	} while (FindNextFile(find_handle, &find_data) > 0);

	if(GetLastError() != ERROR_NO_MORE_FILES)
	{
		return FALSE;
	}

	return TRUE;
}
예제 #2
0
BOOL Cvariable::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
  load_variables(	m_hWnd, 1, 0, localvars);
  ((CButton *) GetDlgItem(IDC_VTYPE))->SetCheck(1);
  RefreshVarpicker();
	return TRUE;
}
예제 #3
0
double
carmen_librlpid_compute_effort(double current_curvature, double desired_curvature, double delta_t)
{
	static bool first_time = true;
	static rl_data data;

	if(first_time)
	{
		data.params = read_parameters("rlpid_params.txt");
		data.pv = initializate_variables(&data); // Step 1
		first_time = false;
	}else // So começa a rodar a partir da segunda iteração
	{

	calculate_error_old(desired_curvature, current_curvature, &data); // Step 6 ==> CALCULA ERRO
	update_neetwork_hidden_unit_phi_future(&data);// ==> UPDATE PHI
	data.future_critic_value = update_critic_value_future(&data); //Step 7 ==> UPDATE V
	calculate_td_error(&data); //Step 8 ==> CALCULA ERRO TD
	load_variables(&data);
	weights_update(&data); //Step 9 ==> UPDATE PESOS
	center_vector_update(&data); //Step 10 ==> UPDATE CENTRO
	width_scalar_update(&data); //Step 10 ==> UPDATE WIDTH SCALAR
	}

	//imprime_os_pesos_agora++;
	load_variables(&data);
	calculate_error_old(desired_curvature, current_curvature, &data); // Step 2 ==> CALCULA ERRO
	external_reinforcement_signal(&data); //Step 3 ==> RECOMPENSA
	update_neetwork_hidden_unit_phi(&data);// ==> UPDATE PHI
	update_recomended_pid_output(&data); //Step 4 ==> UPDATE K`
	data.variables.critic_value = update_critic_value_output(&data);	//Step 4 ==> UPDATE V

	update_pid_params(&data); //Step 5 ==> UPDATE K
	update_plant_input_u(current_curvature, desired_curvature, delta_t, &data); //Step 5 ==> UPDATE U
	store_variables(&data);

	printf("u%lf e %f  kp %f ki %f  kd %f\n", data.variables.U[0], data.variables.error[0], data.variables.pid_params[0], data.variables.pid_params[1], data.variables.pid_params[2]);

	return data.variables.U[0];//carmen_clamp(-100.0, (U[0]), 100.0);
}
예제 #4
0
bool Super_Dumb_Script::load_variable_files()
{
	search_path = file_directory + file_variable_pattern;
	find_handle = FindFirstFile(search_path.c_str(), &find_data);

	if(find_handle == INVALID_HANDLE_VALUE)
	{
		return FALSE;
	}

	do 
	{
		std::string file_path = file_directory + find_data.cFileName;
		std::ifstream in(file_path.c_str());
		if(in)
		{
			//going to need checks to account for already loaded files so that the variable map is updated rather than being skipped
			variable_map temp_variable = load_variables(file_path);
			if(temp_variable.size() > 0)
			{
				file_map::const_iterator search_result = storage.find(find_data.cFileName);
				if(search_result != storage.end())
				{
					storage.erase(search_result);
					storage.insert(std::pair<std::string, variable_map*>(find_data.cFileName, new variable_map(temp_variable)));
				}
				else
				{
					storage.insert(std::pair<std::string, variable_map*>(find_data.cFileName, new variable_map(temp_variable)));
				}
			}
		}
	} while (FindNextFile(find_handle, &find_data) > 0);

	if(GetLastError() != ERROR_NO_MORE_FILES)
	{
		return FALSE;
	}

	return TRUE;
}
예제 #5
0
파일: nas_cgiutil.c 프로젝트: jhbsz/LC4
INPUT* CGI_INIT()
{
	cgi = cgi_init();
    setup(cgi);
    load_variables(cgi);
    struct cgi_var *var;

    INPUT *tmp, *head = NULL;

    for (var = cgi->variables; var; var = var->next) {
        tmp = (INPUT*)__ax_malloc(sizeof(INPUT));
        strcpy(tmp->name, var->name);
        strcpy(tmp->val, var->value);
        tmp->next = head;
        head = tmp;
    }
    tmp = head;

    destroy(cgi);

    return head;
}