steer_target = -steer_target * STEER_CORRECTION if car_speed > MIN_CAR_SPEED_TO_STEER: can_interface.run(steer_target) prints_can = "CAN DATA:\n" prints_can += f" Motor speed: {motor_rpm} RPM\n" prints_can += f" Car speed: {car_speed:.2f} m/s\n" steer_actual = can_interface.steering_sensor car_speed = can_interface.car_speed motor_rpm = can_interface.motor_rpm steer_target_last = steer_target # TODO put prints in a thread os.system("clear") print(prints_input, prints_controller, prints_can, f"Total time: {(time()-time_start)*1000:>5.0f}") if SHOW_IMG: cv2.imshow("frame", cv2.resize(img, (640, 480))) if cv2.waitKey(1) == ord('q'): break if SHOW_VIEWER: viewer.run( [car_pos, [0, 0, 0, math.radians(steer_target)]], predicted_path, blue, yellow, middle_points, blue_all, yellow_all, fov_points) except KeyboardInterrupt: print("Keyboard interruption") exit()
# -*- coding: utf-8 -*- import viewer viewer.run("odemis")
# -*- coding: utf-8 -*- import viewer viewer.run("delphi")
(0,1,2,AUSTIN), (3,2,1,AUSTIN), \ (0,4,1,SALMON), (1,4,5,SALMON), \ (2,3,7,SALMON), (2,7,6,SALMON)] cube1 = wireframe.Wireframe(cube_nodes, cube_faces) cube1.rotate_y(0.785398) cube1.rotate_x(-0.523599) cube_nodes = [(x,y,z) for x in (CENTER_X+100, CENTER_X+200) \ for y in (CENTER_Y-50, CENTER_Y+50) \ for z in (-50, 50)] cube_faces = [(0,2,6,SEA), (0,6,4,SEA), \ (7,3,1,SEA), (1,5,7,SEA), \ (4,6,7,LIME), (7,5,4,LIME), \ (0,1,2,LIME), (3,2,1,LIME), \ (0,4,1,OLIVE), (1,4,5,OLIVE), \ (2,3,7,OLIVE), (2,7,6,OLIVE)] cube2 = wireframe.Wireframe(cube_nodes, cube_faces) print("Created cubes!\n") print("Creating viewer...") viewer = viewer.Viewer(WIDTH, HEIGHT) viewer.add_wireframe(cube1) viewer.add_wireframe(cube2) print("Created viewer!\n") print("Running...") viewer.run() print("Done!")