Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 23, 2024
1 parent 8b76f11 commit 6ca20b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.

from autoware_adapi_v1_msgs.msg import OperationModeState
from geometry_msgs.msg import AccelWithCovarianceStamped
from autoware_vehicle_msgs.msg import ControlModeReport
from geometry_msgs.msg import AccelWithCovarianceStamped
from nav_msgs.msg import Odometry
import numpy as np
from rcl_interfaces.msg import ParameterDescriptor
Expand Down Expand Up @@ -169,4 +169,3 @@ def subscribe_operation_mode(self, msg):

def subscribe_control_mode(self, msg):
self._present_control_mode_ = msg.mode

Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def timer_callback_counter(self):
self._present_kinematic_state is not None
and self._present_acceleration is not None
and self.present_operation_mode_ == 3
and self._present_control_mode_ == 1
and self._present_control_mode_ == 1
):
# calculate steer
angular_z = self._present_kinematic_state.twist.twist.angular.z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(self):
self.subscribe_operation_mode,
10,
)

self._present_control_mode_ = None
self.control_mode_subscription_ = self.create_subscription(
ControlModeReport,
Expand All @@ -162,18 +162,32 @@ def subscribe_control_mode(self, msg):

def record_message(self):
# Start subscribing to topics and recording if the operation mode is 3(LOCAL) and control mode is 1(AUTONOMOUS)
if self.present_operation_mode_ == 3 and self._present_control_mode_ == 1 and not self.subscribed and not self.recording:
if (
self.present_operation_mode_ == 3
and self._present_control_mode_ == 1
and not self.subscribed
and not self.recording
):
self.writer.create_writer()
self.writer.subscribe_topics()
self.subscribed = True

# Start recording if topics are subscribed and the operation mode is 3(LOCAL)
if self.present_operation_mode_ == 3 and self._present_control_mode_ == 1 and self.subscribed and not self.recording:
if (
self.present_operation_mode_ == 3
and self._present_control_mode_ == 1
and self.subscribed
and not self.recording
):
self.writer.start_record()
self.recording = True

# Stop recording if the operation mode changes from 3(LOCAL)
if (self.present_operation_mode_ != 3 or self._present_control_mode_ != 1) and self.subscribed and self.recording:
# Stop recording if the operation mode changes from 3(LOCAL)
if (
(self.present_operation_mode_ != 3 or self._present_control_mode_ != 1)
and self.subscribed
and self.recording
):
self.writer.stop_record()
self.subscribed = False
self.recording = False
Expand Down

0 comments on commit 6ca20b3

Please sign in to comment.