Skip to content

Commit c41da4b

Browse files
authored
ros_control: make motor_start_time_ an std::optional (#515)
2 parents 887daef + 9c04fae commit c41da4b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bitbots_lowlevel/bitbots_ros_control/include/bitbots_ros_control/wolfgang_hardware_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class WolfgangHardwareInterface {
3333
std::vector<std::vector<bitbots_ros_control::HardwareInterface *>> interfaces_;
3434
DynamixelServoHardwareInterface servo_interface_;
3535
rclcpp::Publisher<bitbots_msgs::msg::Audio>::SharedPtr speak_pub_;
36-
rclcpp::Time motor_start_time_;
36+
std::optional<rclcpp::Time> motor_start_time_;
3737
bool motor_first_write_{false};
3838

3939
// prevent unnecessary error when power is turned on

bitbots_lowlevel/bitbots_ros_control/src/wolfgang_hardware_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void WolfgangHardwareInterface::write(const rclcpp::Time &t, const rclcpp::Durat
304304
motor_start_time_ = t + rclcpp::Duration::from_seconds(nh_->get_parameter("servos.start_delay").as_double());
305305
motor_first_write_ = true;
306306
}
307-
if (t > motor_start_time_) {
307+
if (motor_start_time_ && t > motor_start_time_) {
308308
if (motor_first_write_) {
309309
servo_interface_.writeROMRAM(false);
310310
motor_first_write_ = false;

0 commit comments

Comments
 (0)