add webcam to cameras (#1201)

This commit is contained in:
ZwX1616
2020-03-26 19:19:47 -07:00
committed by GitHub
parent 4e4bea8525
commit a95e61edf4
19 changed files with 604 additions and 85 deletions
+4 -1
View File
@@ -19,6 +19,7 @@ from selfdrive.car.honda.values import CruiseButtons
parser = argparse.ArgumentParser(description='Bridge between CARLA and openpilot.')
parser.add_argument('--autopilot', action='store_true')
parser.add_argument('--joystick', action='store_true')
parser.add_argument('--realmonitoring', action='store_true')
args = parser.parse_args()
pm = messaging.PubMaster(['frame', 'sensorEvents', 'can'])
@@ -68,6 +69,8 @@ def health_function():
rk.keep_time()
def fake_driver_monitoring():
if args.realmonitoring:
return
pm = messaging.PubMaster(['driverState'])
while 1:
dat = messaging.new_message('driverState')
@@ -198,7 +201,7 @@ def go(q):
vel = vehicle.get_velocity()
speed = math.sqrt(vel.x**2 + vel.y**2 + vel.z**2) * 3.6
can_function(pm, speed, fake_wheel.angle, rk.frame, cruise_button=cruise_button)
can_function(pm, speed, fake_wheel.angle, rk.frame, cruise_button=cruise_button, is_engaged=is_openpilot_engaged)
if rk.frame%1 == 0: # 20Hz?
throttle_op, brake_op, steer_torque_op = sendcan_function(sendcan)
+2 -1
View File
@@ -20,7 +20,7 @@ SR = 7.5
def angle_to_sangle(angle):
return - math.degrees(angle) * SR
def can_function(pm, speed, angle, idx, cruise_button=0):
def can_function(pm, speed, angle, idx, cruise_button=0, is_engaged=False):
msg = []
msg.append(packer.make_can_msg("ENGINE_DATA", 0, {"XMISSION_SPEED": speed}, idx))
msg.append(packer.make_can_msg("WHEEL_SPEEDS", 0,
@@ -50,6 +50,7 @@ def can_function(pm, speed, angle, idx, cruise_button=0):
msg.append(packer.make_can_msg("CRUISE_PARAMS", 0, {}, idx))
msg.append(packer.make_can_msg("CRUISE", 0, {}, idx))
msg.append(packer.make_can_msg("SCM_FEEDBACK", 0, {"MAIN_ON": 1}, idx))
msg.append(packer.make_can_msg("POWERTRAIN_DATA", 0, {"ACC_STATUS": int(is_engaged)}, idx))
#print(msg)
# cam bus