app.title = 'GAP AND SPEED VISUALIZATION' app.config['suppress_callback_exceptions'] = True app.css.config.serve_locally = True app.scripts.config.serve_locally = True # Boostrap CSS file (local) @app.server.route('/static/<path:path>') def static_file(path): static_folder = os.path.join(os.getcwd(), 'static') return send_from_directory(static_folder, path) # Global variables and initialization # Open panda device (comma ai) and clear the buffer panda_port = get_panda_id('ford_f150', 'send') PANDA = Panda(panda_port) PANDA.can_clear(0xFFFF) PANDA.set_safety_mode(Panda.SAFETY_ALLOUTPUT) # Send request to broadcast leddar messages dat = '0301000000000000' PANDA.can_send(0x740, dat.decode('hex'), 1) # DBC files: car and leddar base_path = dirname(abspath(__file__)) leddar = join(base_path, 'dbc_files/leddar_vu_8_segments.dbc') car = join(base_path, 'dbc_files/ford_f150_2017.dbc') CAR_DBC = cantools.database.load_file(car) LEDDAR_DBC = cantools.database.load_file(leddar) CAN_VARIABLES = [] PROPS_VIS = visualization_props()
plt.ylabel('gap (m)') plt.subplot(2, 1, 2) plt.plot(df['time_rel'], df['axle_torque_ch_0_V']) plt.plot(df['time_rel'], df['axle_torque_ch_1_V']) plt.ylabel('torque voltages') plt.xlabel('time (sec)') plt.legend() plt.show() if __name__ == "__main__": # Read dbc files and loaded into the can_logger_function base_path = dirname(abspath(__file__)) leddar = join(base_path, 'dbc_files/leddar_vu_8_segments.dbc') car = join(base_path, 'dbc_files/ford_fusion_2011.dbc') leddar_dbc = cantools.database.load_file(leddar) car_dbc = cantools.database.load_file(car) # Get the panda port that is used to recv data: it must have GPS panda_port = get_panda_id('ford_fusion', 'recv') device = get_nidaqmx_dev_name() can_logger(car_dbc=car_dbc, leddar_dbc=leddar_dbc, sample_time=0.2, port=panda_port, filename='fusion_preliminary_test', ni_device=device)
# Create the app and assign excepctions app = dash.Dash() app.title = 'SPEED CONTROL AND VISUALIZATION' app.config['suppress_callback_exceptions']=True app.css.config.serve_locally = True app.scripts.config.serve_locally = True # Boostrap CSS file (local) @app.server.route('/static/<path:path>') def static_file(path): static_folder = os.path.join(os.getcwd(), 'static') return send_from_directory(static_folder, path) # Global variables and initialization # Open panda device (comma ai) and clear the buffer panda_port = get_panda_id('mazda_cx9', 'send') PANDA = Panda(panda_port) PANDA.can_clear(0xFFFF) PANDA.set_safety_mode(Panda.SAFETY_ALLOUTPUT) # Send request to broadcast leddar messages dat = '0301000000000000' PANDA.can_send(0x740, dat.decode('hex'), 1) # DBC files: car and leddar base_path = dirname(abspath(__file__)) leddar = join(base_path,'dbc_files/leddar_vu_8_segments.dbc') car = join(base_path,'dbc_files/mazda_cx9_2016.dbc') CAR_DBC = cantools.database.load_file(car) LEDDAR_DBC = cantools.database.load_file(leddar) SPEED = 0 PEDAL_MODEL = PM('mazda_cx9')
# Print and plot results in the screen plt.figure() plt.subplot(2,1,1) plt.plot(df['time_rel'], df['gap_m']) plt.ylabel('gap (m)') plt.subplot(2,1,2) plt.plot(df['time_rel'], df['axle_torque_ch_0_V']) plt.plot(df['time_rel'], df['axle_torque_ch_1_V']) plt.ylabel('torque voltages') plt.xlabel('time (sec)') plt.legend() plt.show() if __name__ == "__main__": # Read dbc files and loaded into the can_logger_function base_path = dirname(abspath(__file__)) leddar = join(base_path,'dbc_files/leddar_vu_8_segments.dbc') car = join(base_path,'dbc_files/mazda_cx9_2016.dbc') leddar_dbc = cantools.database.load_file(leddar) car_dbc = cantools.database.load_file(car) # Get the panda port that is used to recv data: it must have GPS panda_port = get_panda_id('mazda_cx9', 'recv') device = get_nidaqmx_dev_name() can_logger(car_dbc = car_dbc, leddar_dbc = leddar_dbc, sample_time = 0.2, port = panda_port, filename = 'mazda_cx9_preliminary_test', ni_device = device)
# Print and plot results in the screen plt.figure() plt.subplot(2,1,1) plt.plot(df['time_rel'], df['gap_m']) plt.ylabel('gap (m)') plt.subplot(2,1,2) plt.plot(df['time_rel'], df['axle_torque_ch_0_V']) plt.plot(df['time_rel'], df['axle_torque_ch_1_V']) plt.ylabel('torque voltages') plt.xlabel('time (sec)') plt.legend() plt.show() if __name__ == "__main__": # Read dbc files and loaded into the can_logger_function base_path = dirname(abspath(__file__)) leddar = join(base_path,'dbc_files/leddar_vu_8_segments.dbc') car = join(base_path,'dbc_files/ford_f150_2017.dbc') leddar_dbc = cantools.database.load_file(leddar) car_dbc = cantools.database.load_file(car) # Get the panda port that is used to recv data: it must have GPS panda_port = get_panda_id('ford_f150', 'recv') device = get_nidaqmx_dev_name() can_logger(car_dbc = car_dbc, leddar_dbc = leddar_dbc, sample_time = 0.2, port = panda_port, filename = 'f150_preliminary_test', ni_device = device)
app.title = 'GAP AND SPEED CONTROL AND VISUALIZATION' app.config['suppress_callback_exceptions'] = True app.css.config.serve_locally = True app.scripts.config.serve_locally = True # Boostrap CSS file (local) @app.server.route('/static/<path:path>') def static_file(path): static_folder = os.path.join(os.getcwd(), 'static') return send_from_directory(static_folder, path) # Global variables and initialization # Open panda device (comma ai) and clear the buffer panda_port = get_panda_id('ford_fusion', 'send') PANDA = Panda(panda_port) PANDA.can_clear(0xFFFF) PANDA.set_safety_mode(Panda.SAFETY_ALLOUTPUT) # Send request to broadcast leddar messages dat = '0301000000000000' PANDA.can_send(0x740, dat.decode('hex'), 1) # DBC files: car and leddar base_path = dirname(abspath(__file__)) leddar = join(base_path, 'dbc_files/leddar_vu_8_segments.dbc') car = join(base_path, 'dbc_files/ford_fusion_2011.dbc') CAR_DBC = cantools.database.load_file(car) LEDDAR_DBC = cantools.database.load_file(leddar) CAN_VARIABLES = [] PEDAL_MODEL = PM('ford_fusion')