Changeset 139 in flair-src
- Timestamp:
- Feb 14, 2017, 5:02:06 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/CircleFollower/uav/src/CircleFollower.cpp
r136 r139 42 42 Uav* uav=GetUav(); 43 43 44 45 46 47 48 44 VrpnClient* vrpnclient=new VrpnClient("vrpn", uav->GetDefaultVrpnAddress(),80); 45 uavVrpn = new MetaVrpnObject(uav->ObjectName()); 46 getFrameworkManager()->AddDeviceToLog(uavVrpn); 47 uav->GetAhrs()->YawPlot()->AddCurve(uavVrpn->State()->Element(2),DataPlot::Green); 48 vrpnclient->Start(); 49 49 50 50 startCircle=new PushButton(GetButtonsLayout()->NewRow(),"start_circle"); -
trunk/lib/FlairCore/src/Thread.cpp
r133 r139 78 78 bool Thread::IsSuspended(void) const { return pimpl_->IsSuspended(); } 79 79 80 bool Thread::IsRunning(void) const { return pimpl_->isRunning; } 81 80 82 void Thread::Resume(void) { pimpl_->Resume(); } 81 83 -
trunk/lib/FlairCore/src/Thread.h
r15 r139 176 176 */ 177 177 bool IsSuspended(void) const; 178 179 /*! 180 * \brief Is the thread running? 181 * 182 * \return true if thread is running (call to Start). A suspended thread is running. 183 * 184 */ 185 bool IsRunning(void) const; 178 186 179 187 /*! -
trunk/lib/FlairCore/src/unexported/Thread_impl.h
r15 r139 49 49 int WaitUpdate(const flair::core::IODevice *device); 50 50 bool period_set; 51 bool isRunning; 51 52 52 53 private: … … 58 59 uint64_t cpt; 59 60 flair::core::Time period; 60 bool isRunning;61 61 bool tobestopped; 62 62 bool is_suspended; -
trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp
r136 r139 215 215 } 216 216 } else {//!UseXbee() 217 if(connection->connected()==vrpn_true && !isConnected) { 218 isConnected=true; 219 Printf("VRPN connected\n"); 220 } 221 if(connection->connected()==vrpn_false && isConnected) { 222 isConnected=false; 223 Printf("VRPN disconnected\n"); 224 } 225 226 //timeout in mainloop is not well handled if not connected... 227 if(isConnected) { 228 //this is when trackables callbacks are called: 229 if(connection->mainloop(&timeout)!=0) { 230 self->Warn("connection dropped\n"); 231 } 232 //printf("%lld\n",GetTime()/(1000*1000)); 233 mutex->GetMutex(); 234 for (unsigned int i = 0; i < trackables.size(); i++) 235 trackables.at(i)->mainloop(); 236 mutex->ReleaseMutex(); 237 } else { 238 connection->mainloop(); 239 self->SleepMS(10); 240 } 217 if(connection->connected()==vrpn_true && !isConnected) { 218 isConnected=true; 219 Printf("VRPN connected\n"); 220 } 221 if(connection->connected()==vrpn_false && isConnected) { 222 isConnected=false; 223 Printf("VRPN disconnected\n"); 224 } 225 //timeout in mainloop is not well handled if not connected... 226 if(isConnected) { 227 //this is when trackables callbacks are called: 228 if(connection->mainloop(&timeout)!=0) { 229 self->Warn("connection dropped\n"); 230 } 231 //printf("%lld\n",GetTime()/(1000*1000)); 232 mutex->GetMutex(); 233 for (unsigned int i = 0; i < trackables.size(); i++) 234 trackables.at(i)->mainloop(); 235 mutex->ReleaseMutex(); 236 } else { 237 connection->mainloop(); 238 self->SleepMS(10); 239 } 241 240 } 242 241 } -
trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
r135 r139 56 56 } 57 57 58 if (parent->UseXbee()) {59 parent->pimpl_->AddTrackable(this, id);60 tracker = NULL;61 } else {62 parent->pimpl_->AddTrackable(self);63 tracker = new vrpn_Tracker_Remote(name.c_str(), parent->pimpl_->connection);64 tracker->register_change_handler(this, handle_pos);65 tracker->shutup = true;66 }67 68 58 // state 69 59 cvmatrix_descriptor *desc = new cvmatrix_descriptor(7, 1); … … 91 81 z_plot = new DataPlot1D(plot_tab->LastRowLastCol(), "z", -2, 0); 92 82 z_plot->AddCurve(output->Element(6)); 83 84 if(parent->IsRunning()) { 85 self->Warn("adding VrpnObject on running VrpnClient can crash\n"); 86 } 87 88 if (parent->UseXbee()) { 89 tracker = NULL; 90 parent->pimpl_->AddTrackable(this, id); 91 } else { 92 tracker = new vrpn_Tracker_Remote(name.c_str(), parent->pimpl_->connection); 93 tracker->register_change_handler(this, handle_pos); 94 tracker->shutup = true; 95 parent->pimpl_->AddTrackable(self); 96 } 93 97 } 94 98 … … 106 110 } 107 111 108 void VrpnObject_impl::mainloop(void) { tracker->mainloop(); } 112 void VrpnObject_impl::mainloop(void) { 113 tracker->mainloop(); 114 } 109 115 110 116 bool VrpnObject_impl::IsTracked(unsigned int timeout_ms) {
Note:
See TracChangeset
for help on using the changeset viewer.