mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 01:50:46 +02:00
Moved getDataPackage functionality to rtde_client
This commit is contained in:
committed by
Tristan Schnell
parent
ac28aa43c6
commit
62146a49ae
@@ -84,12 +84,11 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Reads the pipeline to fetch the next data package.
|
* \brief Reads the pipeline to fetch the next data package.
|
||||||
*
|
*
|
||||||
* \param data_package Pointer to set to the next data package
|
|
||||||
* \param timeout Time to wait if no data package is currently in the queue
|
* \param timeout Time to wait if no data package is currently in the queue
|
||||||
*
|
*
|
||||||
* \returns True, if a package was fetched successfully
|
* \returns Unique ptr to the package, if a package was fetched successfully, nullptr otherwise
|
||||||
*/
|
*/
|
||||||
bool getDataPackage(std::unique_ptr<comm::URPackage<PackageHeader>>& data_package, std::chrono::milliseconds timeout);
|
std::unique_ptr<rtde_interface::DataPackage> getDataPackage(std::chrono::milliseconds timeout);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Getter for the frequency the robot will publish RTDE data packages with.
|
* \brief Getter for the frequency the robot will publish RTDE data packages with.
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ public:
|
|||||||
* \brief Access function to receive the latest data package sent from the robot through RTDE
|
* \brief Access function to receive the latest data package sent from the robot through RTDE
|
||||||
* interface.
|
* interface.
|
||||||
*
|
*
|
||||||
* \returns The latest data package on success, a nullptr if no package can be found inside the
|
* \returns The latest data package on success, a nullptr if no package can be found inside a preconfigured time
|
||||||
* interface's cycle time. See the private parameter #rtde_frequency_
|
* window.
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<rtde_interface::DataPackage> getDataPackage();
|
std::unique_ptr<rtde_interface::DataPackage> getDataPackage();
|
||||||
|
|
||||||
|
|||||||
@@ -146,10 +146,19 @@ std::vector<std::string> RTDEClient::readRecipe(const std::string& recipe_file)
|
|||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTDEClient::getDataPackage(std::unique_ptr<comm::URPackage<PackageHeader>>& data_package,
|
std::unique_ptr<rtde_interface::DataPackage> RTDEClient::getDataPackage(std::chrono::milliseconds timeout)
|
||||||
std::chrono::milliseconds timeout)
|
|
||||||
{
|
{
|
||||||
return pipeline_.getLatestProduct(data_package, timeout);
|
std::unique_ptr<comm::URPackage<rtde_interface::PackageHeader>> urpackage;
|
||||||
|
if (pipeline_.getLatestProduct(urpackage, timeout))
|
||||||
|
{
|
||||||
|
rtde_interface::DataPackage* tmp = dynamic_cast<rtde_interface::DataPackage*>(urpackage.get());
|
||||||
|
if (tmp != nullptr)
|
||||||
|
{
|
||||||
|
urpackage.release();
|
||||||
|
return std::unique_ptr<rtde_interface::DataPackage>(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return std::unique_ptr<rtde_interface::DataPackage>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RTDEClient::getIP() const
|
std::string RTDEClient::getIP() const
|
||||||
|
|||||||
@@ -126,20 +126,9 @@ ur_driver::UrDriver::UrDriver(const std::string& robot_ip, const std::string& sc
|
|||||||
|
|
||||||
std::unique_ptr<rtde_interface::DataPackage> ur_driver::UrDriver::getDataPackage()
|
std::unique_ptr<rtde_interface::DataPackage> ur_driver::UrDriver::getDataPackage()
|
||||||
{
|
{
|
||||||
// TODO: This goes into the rtde_client
|
|
||||||
std::unique_ptr<comm::URPackage<rtde_interface::PackageHeader>> urpackage;
|
|
||||||
std::chrono::milliseconds timeout(100); // We deliberately have a quite large timeout here, as the robot itself
|
std::chrono::milliseconds timeout(100); // We deliberately have a quite large timeout here, as the robot itself
|
||||||
// should command the control loop's timing.
|
// should command the control loop's timing.
|
||||||
if (rtde_client_->getDataPackage(urpackage, timeout))
|
return rtde_client_->getDataPackage(timeout);
|
||||||
{
|
|
||||||
rtde_interface::DataPackage* tmp = dynamic_cast<rtde_interface::DataPackage*>(urpackage.get());
|
|
||||||
if (tmp != nullptr)
|
|
||||||
{
|
|
||||||
urpackage.release();
|
|
||||||
return std::unique_ptr<rtde_interface::DataPackage>(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrDriver::writeJointCommand(const vector6d_t& values)
|
bool UrDriver::writeJointCommand(const vector6d_t& values)
|
||||||
|
|||||||
Reference in New Issue
Block a user