Skip to content

Commit

Permalink
[PID] Update documentation to reflect ROS 2 usage of time (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
roncapat authored Dec 2, 2023
1 parent fb1dd27 commit 6efef0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/control_toolbox/pid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ namespace control_toolbox
pid.initPid(6.0, 1.0, 2.0, 0.3, -0.3);
double position_desi_ = 0.5;
...
ros::Time last_time = ros::Time::now();
rclcpp::Time last_time = get_clock()->now();
while (true) {
ros::Time time = ros::Time::now();
double effort = pid.updatePid(position_desi_ - currentPosition(), time - last_time);
rclcpp::Time time = get_clock()->now();
double effort = pid.computeCommand(position_desi_ - currentPosition(), (time - last_time).nanoseconds());
last_time = time;
}
\endverbatim
Expand Down

0 comments on commit 6efef0b

Please sign in to comment.