diff --git a/donkeycar/parts/pipe.py b/donkeycar/parts/pipe.py index 8bd0167f5..a8c618713 100644 --- a/donkeycar/parts/pipe.py +++ b/donkeycar/parts/pipe.py @@ -2,12 +2,7 @@ class Pipe: """ Just pipe all inputs to the output, so they can be renamed. """ - def __init__(self): - self.running = True - def run(self, *args): - if self.running: - return args - - def shutdown(self): - self.running = False + # seems to be a python bug that takes a single argument + # return makes it into two element tuple with empty last element. + return args if len(args) > 1 else args[0] diff --git a/donkeycar/templates/complete.py b/donkeycar/templates/complete.py index c8ba81b95..551821cd1 100644 --- a/donkeycar/templates/complete.py +++ b/donkeycar/templates/complete.py @@ -40,7 +40,7 @@ from donkeycar.parts.kinematics import Bicycle, InverseBicycle, BicycleUnnormalizeAngularVelocity from donkeycar.parts.explode import ExplodeDict from donkeycar.parts.transform import Lambda -from donkeycar.parts.logger import LoggerPart +from donkeycar.parts.pipe import Pipe from donkeycar.utils import * logger = logging.getLogger(__name__) @@ -132,6 +132,11 @@ def drive(cfg, model_path=None, use_joystick=False, model_type=None, has_input_controller = hasattr(cfg, "CONTROLLER_TYPE") and cfg.CONTROLLER_TYPE != "mock" ctr = add_user_controller(V, cfg, use_joystick) + # + # convert 'user/steering' to 'user/angle' to be backward compatible with deep learning data + # + V.add(Pipe(), inputs=['user/steering'], outputs=['user/angle']) + # # explode the buttons input map into individual output key/values in memory # @@ -387,7 +392,7 @@ def run(self, *components): # # collect model inference outputs # - outputs = ['pilot/steering', 'pilot/throttle'] + outputs = ['pilot/angle', 'pilot/throttle'] if cfg.TRAIN_LOCALIZER: outputs.append("pilot/loc") @@ -437,11 +442,10 @@ def run(self, *components): # based on the choice of user or autopilot drive mode # V.add(DriveMode(cfg.AI_THROTTLE_MULT), - inputs=['user/mode', 'user/steering', 'user/throttle', - 'pilot/steering', 'pilot/throttle'], + inputs=['user/mode', 'user/angle', 'user/throttle', + 'pilot/angle', 'pilot/throttle'], outputs=['steering', 'throttle']) - V.add(LoggerPart(['steering', 'throttle']), inputs=['steering', 'throttle']) if (cfg.CONTROLLER_TYPE != "pigpio_rc") and (cfg.CONTROLLER_TYPE != "MM1"): if isinstance(ctr, JoystickController): @@ -471,10 +475,10 @@ def run(self, *components): # add tub to save data # if cfg.USE_LIDAR: - inputs = ['cam/image_array', 'lidar/dist_array', 'user/steering', 'user/throttle', 'user/mode'] + inputs = ['cam/image_array', 'lidar/dist_array', 'user/angle', 'user/throttle', 'user/mode'] types = ['image_array', 'nparray','float', 'float', 'str'] else: - inputs=['cam/image_array','user/steering', 'user/throttle', 'user/mode'] + inputs=['cam/image_array','user/angle', 'user/throttle', 'user/mode'] types=['image_array','float', 'float','str'] if cfg.HAVE_ODOM: @@ -512,7 +516,7 @@ def run(self, *components): types += ['nparray'] if cfg.RECORD_DURING_AI: - inputs += ['pilot/steering', 'pilot/throttle'] + inputs += ['pilot/angle', 'pilot/throttle'] types += ['float', 'float'] if cfg.HAVE_PERFMON: