コード例 #1
0
QVector<RoboticArmEvent> RobotControl::getEventList()
{
	Global * g = Global::instance();
	int N = g->getNumEvents();
	QVector<RoboticArmEvent> l(N);
	srand(g->getSeed());
	int t = 0;
	const int dt = g->getTimeBetweenEvents();
	const int dt_sd = g->getTimeBetweenEventsSD();
	const int amean = g->getMechAmp();
	const int a_sd  = g->getMechAmpSD();
	const int sp = g->getRbtSpeed();
	const int sp_sd = g->getRbtSpeedSD();
	const int nc = g->getMechCycles();
	const int nc_sd = g->getMechCyclesSD();
	for (int i = 0; i < N; i++)
	{
		t = t + getUniformRnd(dt, dt_sd);
		l[i].StartTime = t;
		l[i].Amplitude = getUniformRnd(amean, a_sd);
                if (l[i].Amplitude < 1) l[i].Amplitude = 1;
		l[i].Speed = getUniformRnd(sp, sp_sd);
                if (l[i].Speed < 1) l[i].Speed = 1;
                if (l[i].Speed > 100) l[i].Speed = 100;
		l[i].NCycles = getUniformRnd(nc, nc_sd);
                if (l[i].NCycles < 1) l[i].NCycles = 1;
	}
	return l;
}