Skip to content

Commit fcd1f6b

Browse files
committed
forward value before publishing timestamp
1 parent 6f3740e commit fcd1f6b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

hardware_interface/src/hardware_interface/distributed_control_interface/command_forwarder.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,12 @@ void CommandForwarder::publish_value_on_timer()
136136

137137
void CommandForwarder::forward_command(const controller_manager_msgs::msg::InterfaceData & msg)
138138
{
139+
auto receive_time = evaluation_node_->now();
140+
//set value before publishing
141+
loaned_command_interface_ptr_->set_value(msg.data);
142+
139143
auto evaluation_msg = std::make_unique<controller_manager_msgs::msg::Evaluation>();
140-
evaluation_msg->receive_stamp = evaluation_node_->now();
144+
evaluation_msg->receive_stamp = receive_time;
141145
evaluation_msg->receive_time =
142146
static_cast<uint64_t>(evaluation_msg->receive_stamp.sec) * 1'000'000'000ULL +
143147
evaluation_msg->receive_stamp.nanosec;
@@ -146,8 +150,6 @@ void CommandForwarder::forward_command(const controller_manager_msgs::msg::Inter
146150
evaluation_msg->seq = msg.header.seq;
147151
// todo check for QoS to publish immediately and never block to be fast as possible
148152
evaluation_pub_->publish(std::move(evaluation_msg));
149-
150-
loaned_command_interface_ptr_->set_value(msg.data);
151153
}
152154

153155
} // namespace distributed_control

0 commit comments

Comments
 (0)