LinQedInLoginController::LinQedInLoginController():model(new LinQedInLogin()), view(new LinQedInLoginView())
{
    //inizializzo il controllore
    initController();
}
LinQedInLoginController::LinQedInLoginController(LinQedInLogin* m, LinQedInLoginView* v):model(m),view(v)
{
    //inizializzo il controllore
    initController();
}
示例#3
0
void hbl2350::onTimer(const ros::TimerEvent& e)
{
	if(initialised)
	{
		if(!idle)
		{
			if(deadman_active && cmd_vel_active)
			{
				if((ros::Time::now() - last_deadman_received) > max_time_diff )
				{
					ROS_WARN_THROTTLE(1,"shutting down due to deadman");
					deadman_active = false;
					velocity_ch1 = velocity_ch2 = 0;
				}

				if(( ros::Time::now() - last_twist_received_ch1) > max_time_diff)
				{
					ROS_WARN_THROTTLE(1,"Shutting down due to out of date cmd_vel on ch1");
					velocity_ch1 = velocity_ch2 = 0;
					cmd_vel_active = false;
				}

				if(( ros::Time::now() - last_twist_received_ch2) > max_time_diff)
				{
					ROS_WARN_THROTTLE(1,"Shutting down due to out of date cmd_vel on ch2");
					velocity_ch1 = velocity_ch2 = 0;
					cmd_vel_active = false;
				}

				if(ros::Time::now() - last_serial_msg > max_time_diff)
				{
					ROS_WARN("Lost connection to RoboTeq - shutting down");
					velocity_ch1 = velocity_ch2 = 0;
					initialised = false;
				}

				if(deadman_active && cmd_vel_active && initialised)
				{
					int out_ch1 = (velocity_ch1*velocity_max)/max_rpm,
						out_ch2 = (velocity_ch2*velocity_max)/max_rpm;

					if(out_ch1 < - velocity_max)
						out_ch1 = -velocity_max;
					else if(out_ch1 > velocity_max)
						out_ch1 = velocity_max;

					if(out_ch2 < - velocity_max)
						out_ch2 = -velocity_max;
					else if(out_ch2 > velocity_max)
						out_ch2 = velocity_max;

					transmit(3,"!G",1,out_ch1);
					transmit(3,"!G",2,out_ch2);
				}
			}
			else
			{
				transmit(3,"!G",1,0);
				transmit(3,"!G",2,0);
				idle = true;
			}
		}
		else
		{
			if(ros::Time::now() - last_serial_msg < max_time_diff)
				idle = false;
		}
	}
	else
	{
		if(online)
		{
			initController();
		}
		else
		{
			ROS_WARN_THROTTLE(1,"Controller not online");
			transmit(1,"?FID");
		}
	}
}