67 int length =
sizeof(
int[2]);
70 SG_LOG( SG_IO, SG_ALERT,
"joyclient protocol is read only" );
73 SG_LOG( SG_IO, SG_DEBUG,
"Searching for data." );
74 if ( io->get_type() == sgFileType ) {
75 if ( io->read( (
char *)(& buf), length ) == length ) {
76 SG_LOG( SG_IO, SG_DEBUG,
"Success reading data." );
79 SG_LOG( SG_IO, SG_DEBUG,
"X = " << msg[0] <<
" Y = "
81 double aileron = ((double)msg[0] / 2048.0) - 1.0;
82 double elevator = ((double)msg[1] / 2048.0) - 1.0;
83 if ( fabs(aileron) < 0.05 ) {
86 if ( fabs(elevator) < 0.05 ) {
89 globals->get_controls()->set_aileron( aileron );
90 globals->get_controls()->set_elevator( -elevator );
93 while ( io->read( (
char *)(& buf), length ) == length ) {
94 SG_LOG( SG_IO, SG_DEBUG,
"Success reading data." );
97 SG_LOG( SG_IO, SG_DEBUG,
"X = " << msg[0] <<
" Y = "
99 double aileron = ((double)msg[0] / 2048.0) - 1.0;
100 double elevator = ((double)msg[1] / 2048.0) - 1.0;
101 if ( fabs(aileron) < 0.05 ) {
104 if ( fabs(elevator) < 0.05 ) {
107 globals->get_controls()->set_aileron( aileron );
108 globals->get_controls()->set_elevator( -elevator );