Skip to content
Open
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/cameras.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 1.0
cameras:
map_0/vehicle_0/camera_0:
name: front_center
camera_matrix:
- - 294.53932068591484
- 0.0
- 309.40712721751646
- - 0.0
- 296.5367154664796
- 228.72814869651435
- - 0.0
- 0.0
- 1.0
distortion_parameters:
- -0.22642034632167934
- 0.032424830545866784
- -0.0030997885368560392
- 0.00026050478624311846
- 0.0
width: 640
height: 480
frame_rate: 30
6 changes: 6 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/citizens.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 1.0
citizens:
map_0/duckie_0: ~
map_0/duckie_1: ~
map_0/duckie_2: ~
map_0/duckie_3: ~
150 changes: 150 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/frames.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
version: 1.0
frames:
map_0:
relative_to: ~
pose:
x: 0.0
y: 0.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
map_0/tile_0_0:
relative_to: ~
unit: tiles
pose:
x: 0.0
y: 0.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 4.71238898038469
map_0/tile_0_1:
relative_to: ~
unit: tiles
pose:
x: 0.0
y: 1.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
map_0/tile_0_2:
relative_to: ~
unit: tiles
pose:
x: 0.0
y: 2.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 3.14159265359
map_0/tile_1_0:
relative_to: ~
unit: tiles
pose:
x: 1.0
y: 0.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 4.71238898038469
map_0/tile_1_1:
relative_to: ~
unit: tiles
pose:
x: 1.0
y: 1.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
map_0/tile_1_2:
relative_to: ~
unit: tiles
pose:
x: 1.0
y: 2.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 4.71238898038469
map_0/tile_2_0:
relative_to: ~
unit: tiles
pose:
x: 2.0
y: 0.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
map_0/tile_2_1:
relative_to: ~
unit: tiles
pose:
x: 2.0
y: 1.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
map_0/tile_2_2:
relative_to: ~
unit: tiles
pose:
x: 2.0
y: 2.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 1.5707963267948966
map_0/vehicle_0:
relative_to: ~
pose:
x: 0.88
y: 0.185
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
map_0/duckie_0:
relative_to: ~
unit: tiles
pose:
x: 1.0
y: 1.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
map_0/duckie_1:
relative_to: ~
unit: tiles
pose:
x: 1.0
y: 1.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 1.5706806282723
map_0/duckie_2:
relative_to: ~
unit: tiles
pose:
x: 1.0
y: 1.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 3.14159265359
map_0/duckie_3:
relative_to: ~
unit: tiles
pose:
x: 1.0
y: 1.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 4.71238898038469
30 changes: 30 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/lights.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 1.0
lights:
map_0/vehicle_0/light_0:
name: front_left
type: spot
intensity: 0.6
range: 2.0
angle: 0.0
color: "#ffffff"
map_0/vehicle_0/light_1:
name: front_right
type: spot
intensity: 0.6
range: 2.0
angle: 0.0
color: "#ffffff"
map_0/vehicle_0/light_2:
name: back_left
type: spot
intensity: 0.6
range: 2.0
angle: 0.0
color: "#f00000"
map_0/vehicle_0/light_3:
name: back_right
type: spot
intensity: 0.6
range: 2.0
angle: 0.0
color: "#f00000"
8 changes: 8 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 1.0
main:
cameras: !include "cameras.yaml"
citizens: !include "citizens.yaml"
frames: !include "frames.yaml"
tiles: !include "tiles.yaml"
tile_maps: !include "tile_maps.yaml"
vehicles: !include "vehicles.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 1.0
renderer_assignments:
renderer_0:
entities:
- map_0/vehicle_0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1.0
renderer_mode:
"*":
interactive: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1.0
rendering_configuration:
map_0/vehicle_0/camera_0:
lens_distortion: true
hdr: false
anti_aliasing: true
shadows: true
14 changes: 14 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/scripts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 1.0
scripts:
map_0/duckie_0:
scripts:
- straight_line_script
map_0/duckie_1:
scripts:
- straight_line_script
map_0/duckie_2:
scripts:
- straight_line_script
map_0/duckie_3:
scripts:
- straight_line_script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Loop with pedestrians scripts."""
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""Run in circle script."""

import math

from packages.duckiematrix_engine.entities.matrix_entity import (
MatrixEntityBehavior,
)


class RunInCircleScript(MatrixEntityBehavior):
"""Run in circle script."""

_radius: float
_speed: float
_time: float

def __init__(
self,
matrix_key: str,
world_key: str | None,
radius: float = 0.2,
speed: float = 0.5,
) -> None:
"""Initialize run in circle script."""
super().__init__(matrix_key, world_key)
self._radius = radius
self._speed = speed
self._time = 0

def update(self, delta_time: float) -> None:
"""Update."""
self._time += delta_time
if self.state:
angle = self._speed * self._time
value = math.sin(angle)
self.state.x = self.state.initial_pose["x"] + self._radius * value
value = math.cos(angle)
self.state.y = self.state.initial_pose["y"] + self._radius * value
self.state.yaw = math.pi - angle
self.state.commit()
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""Straight line script."""

import numpy as np

from packages.duckiematrix_engine.entities.matrix_entity import (
MatrixEntityBehavior,
)


class StraightLineScript(MatrixEntityBehavior):
"""Straight line script."""

_distance: float
_distance_on_leg: float
_speed: float

def __init__(
self,
matrix_key: str,
world_key: str | None,
distance: float = 1.5,
speed: float = 0.1,
) -> None:
"""Initialize straight line script."""
super().__init__(matrix_key, world_key)
self._distance = distance
self._distance_on_leg = 0
self._speed = speed

def update(self, delta_time: float) -> None:
"""Update."""
if self.state:
distance = self._speed * delta_time
self.state.x -= distance * np.sin(self.state.yaw)
self.state.y += distance * np.cos(self.state.yaw)
self._distance_on_leg += distance
if self._distance_on_leg > self._distance:
self.state.yaw += np.deg2rad(180)
self._distance_on_leg = 0
self.state.commit()
6 changes: 6 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/tile_maps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 1.0
tile_maps:
map_0:
tile_size:
x: 0.585
y: 0.585
20 changes: 20 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/tiles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 1.0
tiles:
map_0/tile_0_0:
type: curve
map_0/tile_0_1:
type: straight
map_0/tile_0_2:
type: curve
map_0/tile_1_0:
type: straight
map_0/tile_1_1:
type: floor
map_0/tile_1_2:
type: straight
map_0/tile_2_0:
type: curve
map_0/tile_2_1:
type: straight
map_0/tile_2_2:
type: curve
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1.0
time_of_flights:
map_0/vehicle_0/tof_front_center:
name: front_center
angle: 0.4363
maximum_distance: 1.2
frequency: 15
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 1.0
vehicle_dynamics:
map_0/vehicle_0:
commands_delay: 0.0
motor_constant_right: 27.0
motor_constant_left: 27.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1.0
vehicle_tags:
map_0/vehicle_0/tag:
name: top
size: 0.08
id: 403
family: 36h11
6 changes: 6 additions & 0 deletions assets/duckiematrix/map/loop_with_pedestrians/vehicles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 1.0
vehicles:
map_0/vehicle_0:
configuration: DB21M
id: ~
color: ~
Loading
Loading