Skip to content
Draft
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
7 changes: 1 addition & 6 deletions Services_Documentation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,7 @@ It also hosts the site design files necessary to draw the Web App.
6) Vehicle
-Input 1: Receives data in a JSON format from the Pilot service
-Input 2: Receives data in a JSON format from the Teleop service
-Function: This process sets up a server that connects to a CARLA simulator and communicates with it to control a self-driving car. Carla is an open-source simulator for autonomous driving research. It is used to simulate the robot’s behavior in a virtual environment.
-Output 1: Sends the data to a server running an instance of CARLA. The data sent will properly represent a segment inside the simulation.
-Output 2: Sends the data to a server running an instance of CARLA. The data sent will properly represent a segment inside the simulation.
-Q1: Is this process exclusively used to send data to the CARLA simulator, and nothing else regarding the driving of the robot?
-Q2: Where is the CARLA simulation hosted?
-Q3: What do the video streams created in the server do exactly?
-Q1: What do the video streams created in the server do exactly?

7) ROS Node
-Input 1: Receives data in a JSON format from the Pilot service
Expand Down
64 changes: 0 additions & 64 deletions docker-compose.carla.yml

This file was deleted.

27 changes: 0 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '2'
volumes:
volume_zerotier_config:
volume_wireguard_config:
volume_ftpd_config:
volume_mongodb_config:
volume_mongodb_data:
Expand All @@ -22,20 +21,6 @@ services:
- CAP_SYS_RAWIO
volumes:
- volume_zerotier_config:/var/lib/zerotier-one:rw
wireguard:
cpuset: '0'
image: masipcat/wireguard-go
container_name: wireguard
restart: always
network_mode: host
devices:
- '/dev/net/tun'
cap_add:
- SYS_ADMIN
- NET_ADMIN
- CAP_SYS_RAWIO
volumes:
- volume_wireguard_config:/etc/wireguard:rw
httpd:
cpuset: '0'
build:
Expand All @@ -61,18 +46,6 @@ services:
volumes:
- volume_ftpd_config:/etc/pureftpd:rw
- volume_byodr_sessions:/home/ftpuser:rw
rosnode:
cpuset: '0'
build:
context: .
dockerfile: rosnode/Dockerfile
restart: always
command: ['python3', 'app.py', '--name', 'rosnode']
network_mode: host
stop_signal: SIGKILL
volumes:
- volume_byodr_sockets:/byodr:rw
- volume_byodr_config:/config:ro
mongodb:
cpuset: '0'
build:
Expand Down
7 changes: 2 additions & 5 deletions pilot/pilot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def __init__(self, event, processor, relay, config_dir=os.getcwd(), hz=100):
self.ipc_server = None
self.ipc_chatter = None
self.teleop = None
self.ros = None
self.vehicle = None
self.inference = None
self._init(relay)
Expand Down Expand Up @@ -101,7 +100,7 @@ def finish(self):

def step(self):
teleop = self.teleop()
commands = (teleop, self.ros(), self.vehicle(), self.inference())
commands = (teleop, self.vehicle(), self.inference())
pilot = self._processor.next_action(*commands)
# print(pilot)
self._monitor.step(pilot, teleop)
Expand All @@ -127,19 +126,17 @@ def main():
application = PilotApplication(quit_event, processor=CommandProcessor(route_store), relay=_relay, config_dir=args.config)

teleop = json_collector(url="ipc:///byodr/teleop.sock", topic=b"aav/teleop/input", event=quit_event)
ros = json_collector(url="ipc:///byodr/ros.sock", topic=b"aav/ros/input", hwm=10, pop=True, event=quit_event)
vehicle = json_collector(url="ipc:///byodr/vehicle.sock", topic=b"aav/vehicle/state", event=quit_event)
inference = json_collector(url="ipc:///byodr/inference.sock", topic=b"aav/inference/state", event=quit_event)
ipc_chatter = json_collector(url="ipc:///byodr/teleop_c.sock", topic=b"aav/teleop/chatter", pop=True, event=quit_event)

application.teleop = lambda: teleop.get()
application.ros = lambda: ros.get()
application.vehicle = lambda: vehicle.get()
application.inference = lambda: inference.get()
application.ipc_chatter = lambda: ipc_chatter.get()
application.publisher = JSONPublisher(url="ipc:///byodr/pilot.sock", topic="aav/pilot/output")
application.ipc_server = LocalIPCServer(url="ipc:///byodr/pilot_c.sock", name="pilot", event=quit_event)
threads = [teleop, ros, vehicle, inference, ipc_chatter, application.ipc_server, threading.Thread(target=application.run)]
threads = [teleop, vehicle, inference, ipc_chatter, application.ipc_server, threading.Thread(target=application.run)]
if quit_event.is_set():
return 0

Expand Down
23 changes: 5 additions & 18 deletions pilot/pilot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,25 +842,13 @@ def _cache_safe(self, key, func, *arguments):
finally:
self._cache[key] = 1

def _process_ros(self, c_ros):
# It could be a collection of ros commands.
ros_messages = [] if c_ros is None else c_ros if (isinstance(c_ros, tuple) or isinstance(c_ros, list)) else [c_ros]
for _msg in ros_messages:
if "pilot.driver.set" in _msg:
self._cache_safe("ros switch driver", lambda: self._driver.switch_ctl(_msg.get("pilot.driver.set")))
if "pilot.maximum.speed" in _msg:
self._cache_safe("ros set cruise speed", lambda: self._driver.set_cruise_speed(_msg.get("pilot.maximum.speed")))

def _process(self, c_teleop, c_ros, c_inference):
def _process(self, c_teleop, c_inference):
# r_action = None if c_external is None else c_external.get('action', None)
# if r_action == 'resume':
# self._cache_safe('external api call', lambda: self._driver.switch_ctl('driver_mode.inference.dnn'))

self._driver.process_navigation(c_teleop, c_inference)

# Continue with ros instructions which take precedence over a route.
self._process_ros(c_ros)

# Zero out max speed on any intervention as a safety rule for ap and to detect faulty controllers.
# With the left button this behavior can be overridden to allow for steer corrections.
c_teleop = {} if c_teleop is None else c_teleop
Expand Down Expand Up @@ -889,21 +877,20 @@ def _process(self, c_teleop, c_ros, c_inference):
elif c_teleop.get("arrow_down", 0) == 1:
self._cache_safe("decrease cruise speed", lambda: self._driver.decrease_cruise_speed())

def _unpack_commands(self, teleop, ros, vehicle, inference):
def _unpack_commands(self, teleop, vehicle, inference):
_ts = timestamp()
# Check if the incoming data is within the patience time limit.
# print("Received teleop data:", teleop)

teleop = teleop if teleop is not None else None
vehicle = vehicle if vehicle is not None and (_ts - vehicle.get("time", 0) < self._patience_micro) else None
inference = inference if inference is not None and (_ts - inference.get("time", 0) < self._patience_micro) else None
# ROS commands are processed each time as specified in your existing logic.
return teleop, ros, vehicle, inference
return teleop, vehicle, inference

def next_action(self, *args):
teleop, ros, vehicle, inference = self._unpack_commands(*args)
teleop, vehicle, inference = self._unpack_commands(*args)
# Handle instructions first.
self._process(teleop, ros, inference)
self._process(teleop, inference)
# What to do on message timeout depends on which driver is active.
_ctl = self._driver.get_driver_ctl()
# Switch off autopilot on internal errors.
Expand Down
2 changes: 0 additions & 2 deletions pilot/pilot/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ def test_create_and_setup(tmpdir):
publisher = CollectPublisher()
ipc_server = CollectServer()
teleop = QueueReceiver()
ros = QueueReceiver()
vehicle = QueueReceiver()
ipc_chatter = QueueReceiver()
route_store = ReloadableDataSource(FileSystemRouteDataSource(directory=directory, load_instructions=True))
app = PilotApplication(CommandProcessor(route_store), config_dir=directory)
app.publisher = publisher
app.ipc_server = ipc_server
app.teleop = lambda: teleop.get_latest()
app.ros = lambda: ros.get_latest()
app.vehicle = lambda: vehicle.get_latest()
app.inference = lambda: None
app.ipc_chatter = lambda: ipc_chatter.get_latest()
Expand Down
17 changes: 0 additions & 17 deletions rosnode/Dockerfile

This file was deleted.

139 changes: 0 additions & 139 deletions rosnode/app.py

This file was deleted.

Loading