diff --git a/control_data_collecting_tool/scripts/data_collecting_base_node.py b/control_data_collecting_tool/scripts/data_collecting_base_node.py index be77ca798..885e6d7a4 100644 --- a/control_data_collecting_tool/scripts/data_collecting_base_node.py +++ b/control_data_collecting_tool/scripts/data_collecting_base_node.py @@ -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 @@ -169,4 +169,3 @@ def subscribe_operation_mode(self, msg): def subscribe_control_mode(self, msg): self._present_control_mode_ = msg.mode - diff --git a/control_data_collecting_tool/scripts/data_collecting_data_counter.py b/control_data_collecting_tool/scripts/data_collecting_data_counter.py index f4cec0705..6c4415460 100755 --- a/control_data_collecting_tool/scripts/data_collecting_data_counter.py +++ b/control_data_collecting_tool/scripts/data_collecting_data_counter.py @@ -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 diff --git a/control_data_collecting_tool/scripts/data_collecting_rosbag_record.py b/control_data_collecting_tool/scripts/data_collecting_rosbag_record.py index cac88e696..ac29dbc41 100755 --- a/control_data_collecting_tool/scripts/data_collecting_rosbag_record.py +++ b/control_data_collecting_tool/scripts/data_collecting_rosbag_record.py @@ -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, @@ -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