File tree Expand file tree Collapse file tree 3 files changed +82
-199
lines changed
include/ur_client_library Expand file tree Collapse file tree 3 files changed +82
-199
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ class ExampleRobotWrapper
2323 void startRTDECommununication (const bool consume_data = false );
2424 void startConsumingRTDEData ();
2525 void stopConsumingRTDEData ();
26+ bool readDataPackage (std::unique_ptr<rtde_interface::DataPackage>& data_pkg);
2627
2728 bool waitForProgramRunning (int milliseconds = 100 );
2829 bool waitForProgramNotRunning (int milliseconds = 100 );
Original file line number Diff line number Diff line change @@ -101,6 +101,23 @@ void ExampleRobotWrapper::stopConsumingRTDEData()
101101 rtde_consumer_thread_.join ();
102102}
103103
104+ bool ExampleRobotWrapper::readDataPackage (std::unique_ptr<rtde_interface::DataPackage>& data_pkg)
105+ {
106+ if (consume_rtde_packages_ == true )
107+ {
108+ URCL_LOG_ERROR (" Unable to read packages while consuming, this should not happen!" );
109+ return false ;
110+ }
111+ std::lock_guard<std::mutex> lk (read_package_mutex_);
112+ data_pkg = ur_driver_->getDataPackage ();
113+ if (data_pkg == nullptr )
114+ {
115+ URCL_LOG_ERROR (" Timed out waiting for a new package from the robot" );
116+ return false ;
117+ }
118+ return true ;
119+ }
120+
104121bool ExampleRobotWrapper::waitForProgramRunning (int milliseconds)
105122{
106123 std::unique_lock<std::mutex> lk (program_running_mutex_);
You can’t perform that action at this time.
0 commit comments