mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-09-30 19:33:42 +08:00
Running pre-commit in CI (#1590)
* Running pre-commit in CI * fix dockerfile syntax * dont run on submodule repo folders * Fix some import errors in ci * more stuff * That should be the last one
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
import pygame
|
||||
import pygame # pylint: disable=import-error
|
||||
|
||||
# Define some colors
|
||||
BLACK = ( 0, 0, 0)
|
||||
@@ -17,21 +17,21 @@ class TextPrint:
|
||||
textBitmap = self.font.render(textString, True, BLACK)
|
||||
screen.blit(textBitmap, [self.x, self.y])
|
||||
self.y += self.line_height
|
||||
|
||||
|
||||
def reset(self):
|
||||
self.x = 10
|
||||
self.y = 10
|
||||
self.line_height = 15
|
||||
|
||||
|
||||
def indent(self):
|
||||
self.x += 10
|
||||
|
||||
|
||||
def unindent(self):
|
||||
self.x -= 10
|
||||
|
||||
|
||||
|
||||
pygame.init()
|
||||
|
||||
|
||||
# Set the width and height of the screen [width,height]
|
||||
size = [500, 700]
|
||||
screen = pygame.display.set_mode(size)
|
||||
@@ -46,7 +46,7 @@ clock = pygame.time.Clock()
|
||||
|
||||
# Initialize the joysticks
|
||||
pygame.joystick.init()
|
||||
|
||||
|
||||
# Get ready to print
|
||||
textPrint = TextPrint()
|
||||
|
||||
@@ -56,14 +56,14 @@ while done==False:
|
||||
for event in pygame.event.get(): # User did something
|
||||
if event.type == pygame.QUIT: # If user clicked close
|
||||
done=True # Flag that we are done so we exit this loop
|
||||
|
||||
|
||||
# Possible joystick actions: JOYAXISMOTION JOYBALLMOTION JOYBUTTONDOWN JOYBUTTONUP JOYHATMOTION
|
||||
if event.type == pygame.JOYBUTTONDOWN:
|
||||
print("Joystick button pressed.")
|
||||
if event.type == pygame.JOYBUTTONUP:
|
||||
print("Joystick button released.")
|
||||
|
||||
|
||||
|
||||
|
||||
# DRAWING STEP
|
||||
# First, clear the screen to white. Don't put other drawing commands
|
||||
# above this, or they will be erased with this command.
|
||||
@@ -75,29 +75,29 @@ while done==False:
|
||||
|
||||
textPrint.printf(screen, "Number of joysticks: {}".format(joystick_count) )
|
||||
textPrint.indent()
|
||||
|
||||
|
||||
# For each joystick:
|
||||
joystick = pygame.joystick.Joystick(0)
|
||||
joystick.init()
|
||||
|
||||
|
||||
textPrint.printf(screen, "Joystick {}".format(0) )
|
||||
textPrint.indent()
|
||||
|
||||
|
||||
# Get the name from the OS for the controller/joystick
|
||||
name = joystick.get_name()
|
||||
textPrint.printf(screen, "Joystick name: {}".format(name) )
|
||||
|
||||
|
||||
# Usually axis run in pairs, up/down for one, and left/right for
|
||||
# the other.
|
||||
axes = joystick.get_numaxes()
|
||||
textPrint.printf(screen, "Number of axes: {}".format(axes) )
|
||||
textPrint.indent()
|
||||
|
||||
|
||||
for i in range( axes ):
|
||||
axis = joystick.get_axis( i )
|
||||
textPrint.printf(screen, "Axis {} value: {:>6.3f}".format(i, axis) )
|
||||
textPrint.unindent()
|
||||
|
||||
|
||||
buttons = joystick.get_numbuttons()
|
||||
textPrint.printf(screen, "Number of buttons: {}".format(buttons) )
|
||||
textPrint.indent()
|
||||
@@ -110,15 +110,15 @@ while done==False:
|
||||
|
||||
textPrint.unindent()
|
||||
|
||||
|
||||
|
||||
# ALL CODE TO DRAW SHOULD GO ABOVE THIS COMMENT
|
||||
|
||||
|
||||
# Go ahead and update the screen with what we've drawn.
|
||||
pygame.display.flip()
|
||||
|
||||
# Limit to 20 frames per second
|
||||
clock.tick(20)
|
||||
|
||||
|
||||
# Close the window and quit.
|
||||
# If you forget this line, the program will 'hang'
|
||||
# on exit if running from IDLE.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
### this process needs pygame and can't run on the EON ###
|
||||
|
||||
import pygame
|
||||
import pygame # pylint: disable=import-error
|
||||
import cereal.messaging as messaging
|
||||
|
||||
def joystick_thread():
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
import cv2 # pylint: disable=import-error
|
||||
|
||||
def rot_matrix(roll, pitch, yaw):
|
||||
cr, sr = np.cos(roll), np.sin(roll)
|
||||
@@ -27,4 +27,3 @@ def draw_pose(img, pose, loc, W=160, H=320, xyoffset=(0,0), faceprob=0):
|
||||
else:
|
||||
color = (64,64,64)
|
||||
cv2.circle(img, tr, 7, color=color)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import argparse
|
||||
import pygame
|
||||
import pygame # pylint: disable=import-error
|
||||
import numpy as np
|
||||
import cv2
|
||||
import cv2 # pylint: disable=import-error
|
||||
|
||||
from cereal import log
|
||||
import cereal.messaging as messaging
|
||||
|
||||
@@ -6,9 +6,9 @@ os.environ['BASEDIR'] = BASEDIR
|
||||
SCALE = float(os.getenv("SCALE", 1.0))
|
||||
|
||||
import argparse
|
||||
import pygame
|
||||
import pygame # pylint: disable=import-error
|
||||
import numpy as np
|
||||
import cv2
|
||||
import cv2 # pylint: disable=import-error
|
||||
import sys
|
||||
import cereal.messaging as messaging
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any, Dict, Tuple
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pygame
|
||||
import pygame # pylint: disable=import-error
|
||||
|
||||
from selfdrive.config import RADAR_TO_CAMERA
|
||||
from selfdrive.config import UIParams as UP
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Question: Can a human drive from this data?
|
||||
|
||||
import os
|
||||
import cv2
|
||||
import cv2 # pylint: disable=import-error
|
||||
import numpy as np
|
||||
import cereal.messaging as messaging
|
||||
from common.window import Window
|
||||
@@ -49,5 +49,3 @@ if __name__ == "__main__":
|
||||
flags=cv2.WARP_INVERSE_MAP | cv2.INTER_CUBIC)
|
||||
|
||||
win.draw(imgw)
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import sys
|
||||
|
||||
os.environ["OMP_NUM_THREADS"] = "1"
|
||||
|
||||
import cv2
|
||||
import cv2 # pylint: disable=import-error
|
||||
import numpy as np
|
||||
import pygame
|
||||
import pygame # pylint: disable=import-error
|
||||
|
||||
from common.basedir import BASEDIR
|
||||
from common.transformations.camera import FULL_FRAME_SIZE, eon_intrinsics
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
import cereal.messaging as messaging
|
||||
from opendbc.can.packer import CANPacker
|
||||
from selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp # pylint: disable=no-name-in-module
|
||||
from selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp # pylint: disable=no-name-in-module,import-error
|
||||
from selfdrive.car.honda.values import FINGERPRINTS, CAR
|
||||
from selfdrive.car import crc8_pedal
|
||||
import math
|
||||
|
||||
@@ -18,7 +18,7 @@ webcam_intrinsics = np.array([
|
||||
cam_id = 2
|
||||
|
||||
if __name__ == "__main__":
|
||||
import cv2
|
||||
import cv2 # pylint: disable=import-error
|
||||
|
||||
trans_webcam_to_eon_front = np.dot(eon_dcam_intrinsics,np.linalg.inv(webcam_intrinsics))
|
||||
|
||||
@@ -32,4 +32,4 @@ if __name__ == "__main__":
|
||||
img = cv2.warpPerspective(img, trans_webcam_to_eon_front, (1152,864), borderMode=cv2.BORDER_CONSTANT, borderValue=0)
|
||||
img = img[:,-864//2:,:]
|
||||
cv2.imshow('preview', img)
|
||||
cv2.waitKey(10)
|
||||
cv2.waitKey(10)
|
||||
|
||||
@@ -23,7 +23,7 @@ webcam_intrinsics = np.array([
|
||||
[ 0., 0., 1.]])
|
||||
|
||||
if __name__ == "__main__":
|
||||
import cv2
|
||||
import cv2 # pylint: disable=import-error
|
||||
trans_webcam_to_eon_rear = np.dot(eon_intrinsics,np.linalg.inv(webcam_intrinsics))
|
||||
trans_webcam_to_eon_front = np.dot(eon_dcam_intrinsics,np.linalg.inv(webcam_intrinsics))
|
||||
print("trans_webcam_to_eon_rear:\n", trans_webcam_to_eon_rear)
|
||||
@@ -41,5 +41,3 @@ if __name__ == "__main__":
|
||||
print(img.shape, end='\r')
|
||||
cv2.imshow('preview', img)
|
||||
cv2.waitKey(10)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user