Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, port, should_log):
"carState": Service(8021, True),
# 8022 is reserved for sshd
"carControl": Service(8023, True),
"waveModel":Service(8024,True)
}

# manager -- base process to manage starting and stopping of all others
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
model = messaging.sub_sock(context, service_list['model'].port)
health = messaging.sub_sock(context, service_list['health'].port)

waveModel = messaging.sub_sock(context, service_list['waveModel'].port)

# connects to can and sendcan
CI = CarInterface()
VP = CI.getVehicleParams()
Expand Down Expand Up @@ -144,6 +146,12 @@ def controlsd_thread(gctx, rate=100): #rate in Hz

prof.checkpoint("Buttons")

wave_model_data = messaging.recv_sock(waveModel)
if wave_model_data is not None:
if ( wave_model_data.path.prob == 0.743 ):
AM.add("waveModelSending",enabled)


# *** health checking logic ***
hh = messaging.recv_sock(health)
if hh is not None:
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/controls/lib/alertmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class AlertManager(object):
"wrongCarMode": alert("Comma Unavailable","Main Switch Off", ET.NO_ENTRY, None, "chimeDouble", .4, 0., 3.),
"outOfSpace": alert("Comma Unavailable","Out of Space", ET.NO_ENTRY, None, "chimeDouble", .4, 0., 3.),
"ethicalDilemma": alert("Take Control Immediately","Ethical Dilemma Detected", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
"waveModelSending": alert("Wave Model Working", "Alls Good", ET.WARNING, "steerRequired", "chimeRepeated",1., 2.,3.),
"startup": alert("Always Keep Hands on Wheel","Be Ready to Take Over Any Time", ET.NO_ENTRY, None, None, 0., 0., 15.),
}
def __init__(self):
Expand All @@ -82,7 +83,7 @@ def add(self, alert_type, enabled = True):
if not enabled and this_alert.alert_type > ET.NO_ENTRY:
this_alert = alert("Comma Unavailable" if this_alert.alert_text_1 != "" else "", this_alert.alert_text_2, ET.NO_ENTRY, None, "chimeDouble", .4, 0., 3.)

# ignore no entries if we are enabled
# ignore no entries if we are enabled
if enabled and this_alert.alert_type < ET.WARNING:
return

Expand Down Expand Up @@ -126,4 +127,3 @@ def process_alerts(self, cur_time):
self.activealerts = []

return alert_text_1, alert_text_2, visual_alert, audible_alert

5 changes: 3 additions & 2 deletions selfdrive/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"boardd": ("boardd", ["./boardd"]), # switch to c++ boardd
"ui": ("ui", ["./ui"]),
"visiond": ("visiond", ["./visiond"]),
"sensord": ("sensord", ["./sensord"]), }
"sensord": ("sensord", ["./sensord"]),
"wavevisiond":"selfdrive.wavevisiond.wavevisiond" }

running = {}

Expand All @@ -45,7 +46,7 @@
# processes to end with SIGINT instead of SIGTERM
interrupt_processes = ['loggerd']

car_started_processes = ['controlsd', 'loggerd', 'sensord', 'radard', 'calibrationd', 'visiond']
car_started_processes = ['controlsd', 'loggerd', 'sensord', 'radard', 'calibrationd', 'visiond','wavevisiond']


# ****************** process management functions ******************
Expand Down
Empty file.
47 changes: 47 additions & 0 deletions selfdrive/wavevisiond/wavevisiond.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import zmq
import sys
import selfdrive.messaging as messaging
from common.services import service_list
import numpy as np
from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper

import time

def wavevisiond_thread(gctx,rate=100):
print('line 10')
set_realtime_priority(1)
print('line 12')
context = zmq.Context()
print('line 14')
waveModel = messaging.pub_sock(context, service_list['waveModel'].port)
print('line 16')

while True:
print('line 19')
msg = messaging.new_message()
print('line 21')
msg.init('model')
print('line 23')
msg.path.points=[1.0,5.0,4.0,4.0,5.0]
msg.path.prob = 0.743
msg.path.std = 0.2
print('line 27')

msg.leftLane.points = [5.0, 4.0, 3.0, 2.0, 1.0 ]
msg.leftLane.prob = 0.987
msg.leftLane.std = 0.1
print('line 32')

waveModel.send(msg.to_bytes())
print('line 35')
time.sleep(6)
print('line 37')


def main(gctx=None):
print('line 41')
wavevisiond_thread(gctx, 100)

if __name__ == "__main__":
print('sys version', sys.version)
main()