jQuery-Flight-Indicators icon indicating copy to clipboard operation
jQuery-Flight-Indicators copied to clipboard

calculation

Open ALA96 opened this issue 6 years ago • 0 comments

Excuse me Sir, I want to ask about this. What does these lines mean? How to get calculation for pitch and roll?

Thank you for your attention

// Update at 20Hz var increment = 0; setInterval(function() { // Attitude update attitude.setRoll(30Math.sin(increment/10)); attitude.setPitch(50Math.sin(increment/20));

// Heading update
heading.setHeading(increment);

// Private methods function _setRoll(roll){ placeholder.each(function(){ $(this).find('div.instrument.attitude div.roll').css('transform', 'rotate('+roll+'deg)'); }); }

	function _setPitch(pitch){
		// alert(pitch);
		if(pitch>constants.pitch_bound){pitch = constants.pitch_bound;}
		else if(pitch<-constants.pitch_bound){pitch = -constants.pitch_bound;}
		placeholder.each(function(){
			$(this).find('div.instrument.attitude div.roll div.pitch').css('top', pitch*0.7 + '%');
		});
	}

	function _setHeading(heading){
		placeholder.each(function(){
			$(this).find('div.instrument.heading div.heading').css('transform', 'rotate(' + -heading + 'deg)');
		});	
	}

ALA96 avatar May 10 '18 11:05 ALA96