simple-hover.c

来自「UAV 自动驾驶的」· C语言 代码 · 共 58 行

C
58
字号
/** *  $Id: simple-hover.c,v 2.0 2002/09/22 02:07:30 tramm Exp $ * * C program that uses the controller library. * It doesn't do much, but demonstrates how simple a hovering * program can be. * * (c) Trammell Hudson */#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <controller/wrapper.h>int main( void ){	controller_reset( "localhost", 2002 );	controller_set( 0, 0, -5, 0 );	while( 1 )	{		double			north;		double			east;		double			down;		double			roll;		double			pitch;		double			yaw;		int			rc;		rc = controller_step(			&north,			&east,			&down,			&roll,			&pitch,			&yaw		);		if( rc == 0 )			continue;		if( rc < 0 )			break;		fprintf( stderr,			"(%2.3f,%2.3f,%2.3f,%2.3f)\r",			north,			east,			down,			yaw		);	}	fprintf( stderr, "\n" );	return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?