Revision 4e9221c4 src/server/server.cpp
src/server/server.cpp | ||
---|---|---|
98 | 98 |
float loop_delay = 1000.0 / MOTION_UPDATERATE; |
99 | 99 |
boost::system_time timeout = get_system_time() + posix_time::milliseconds(loop_delay); |
100 | 100 |
|
101 |
//wait for incoming joint data: |
|
102 |
while (middleware->ok()){ |
|
103 |
//mw tick |
|
104 |
middleware->tick(); |
|
105 |
|
|
106 |
unsigned int incoming_data_count = joint_interface->get_and_clear_incoming_position_count(); |
|
107 |
if (incoming_data_count == 0){ |
|
108 |
incoming_data_count_invalid++; |
|
109 |
if (incoming_data_count_invalid >= MOTION_UPDATERATE){ |
|
110 |
printf("> waiting for joint data...\n"); |
|
111 |
incoming_data_count_invalid = 0; |
|
112 |
} |
|
113 |
}else{ |
|
114 |
//fine, joint data is arriving, exit waiting loop |
|
115 |
break; |
|
116 |
} |
|
117 |
|
|
118 |
thread::sleep(timeout); |
|
119 |
timeout = get_system_time() + posix_time::milliseconds(loop_delay); |
|
120 |
} |
|
121 |
|
|
122 |
//fine, data is arriving, activate and run control loop: |
|
101 | 123 |
while (middleware->ok()){ |
102 | 124 |
//mw tick |
103 | 125 |
middleware->tick(); |
Also available in: Unified diff