5 from sensor_msgs.msg
import LaserScan
6 from drive_msgs.msg
import drive_param
10 from topics
import TOPIC_DRIVE_PARAMETERS, TOPIC_SCAN
14 ''' Abstract class for methods that are used both 15 during training and during driving. 18 def __init__(self, actions, laser_sample_count):
23 TOPIC_DRIVE_PARAMETERS, drive_param, queue_size=1)
27 if action_index < 0
or action_index >= len(self.
actions):
28 raise Exception(
"Invalid action: " + str(action_index))
30 angle, velocity = self.
actions[action_index]
31 message = drive_param()
33 message.velocity = velocity
34 self.drive_parameters_publisher.publish(message)
41 values = [v
if not math.isinf(v)
else 100
for v
in values]
45 device=device
if use_device
else None,
49 raise Exception(
"on_receive_laser_scan is not implemented.")
52 device = torch.device(
"cuda" if torch.cuda.is_available()
else "cpu")
drive_parameters_publisher
def on_receive_laser_scan(self, message)
def convert_laser_message_to_tensor(self, message, use_device=True)
def __init__(self, actions, laser_sample_count)
def perform_action(self, action_index)