mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 01:50:46 +02:00
Resolve premature controller initialization (#213)
Squashed commits: * Avoid updating ros_control controllers on pipeline timeout * Revert "Avoid updating ros_control controllers on pipeline timeout" * Do not update controller_manager until RTPackets have been received * Mark handles as initialized after actually doing it rather than just before * Improve readability
This commit is contained in:
committed by
G.A. vd. Hoorn
parent
6161a7d88b
commit
2f1251c2eb
@@ -19,6 +19,7 @@ private:
|
|||||||
ros::NodeHandle nh_;
|
ros::NodeHandle nh_;
|
||||||
ros::Time lastUpdate_;
|
ros::Time lastUpdate_;
|
||||||
controller_manager::ControllerManager controller_;
|
controller_manager::ControllerManager controller_;
|
||||||
|
bool robot_state_received_;
|
||||||
|
|
||||||
// state interfaces
|
// state interfaces
|
||||||
JointInterface joint_interface_;
|
JointInterface joint_interface_;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
ROSController::ROSController(URCommander& commander, TrajectoryFollower& follower,
|
ROSController::ROSController(URCommander& commander, TrajectoryFollower& follower,
|
||||||
std::vector<std::string>& joint_names, double max_vel_change, std::string tcp_link)
|
std::vector<std::string>& joint_names, double max_vel_change, std::string tcp_link)
|
||||||
: controller_(this, nh_)
|
: controller_(this, nh_)
|
||||||
|
, robot_state_received_(false)
|
||||||
, joint_interface_(joint_names)
|
, joint_interface_(joint_names)
|
||||||
, wrench_interface_(tcp_link)
|
, wrench_interface_(tcp_link)
|
||||||
, position_interface_(follower, joint_interface_, joint_names)
|
, position_interface_(follower, joint_interface_, joint_names)
|
||||||
@@ -81,10 +82,15 @@ void ROSController::read(RTShared& packet)
|
|||||||
{
|
{
|
||||||
joint_interface_.update(packet);
|
joint_interface_.update(packet);
|
||||||
wrench_interface_.update(packet);
|
wrench_interface_.update(packet);
|
||||||
|
robot_state_received_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ROSController::update()
|
bool ROSController::update()
|
||||||
{
|
{
|
||||||
|
// don't run controllers if we haven't received robot state yet
|
||||||
|
if (!robot_state_received_)
|
||||||
|
return true;
|
||||||
|
|
||||||
auto time = ros::Time::now();
|
auto time = ros::Time::now();
|
||||||
auto diff = time - lastUpdate_;
|
auto diff = time - lastUpdate_;
|
||||||
lastUpdate_ = time;
|
lastUpdate_ = time;
|
||||||
|
|||||||
Reference in New Issue
Block a user