Skip to content

Commit 765babc

Browse files
authored
Merge pull request #164 from cogip/155-work-on-strategy-2025
Work on strategy 2025
2 parents 6f85c12 + d646659 commit 765babc

File tree

102 files changed

+3531
-1073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3531
-1073
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ py.typed
44
*.pyi
55
*.egg-info
66
.vscode
7+
!raspios/overlay-rootfs/root/.vscode
78
dist
89
tests
910
*.tree.dot

cogip/cpp/drivers/ydlidar_g2/YDLidar.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ void YDLidar::updateSharedMemory() {
289289
data_write_lock_->finishWriting();
290290
data_write_lock_->postUpdate();
291291
}
292-
293292
auto loop_end_time = std::chrono::steady_clock::now();
294293
auto elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(loop_end_time - loop_start_time);
295294
if (elapsed_time < std::chrono::milliseconds(refresh_interval_)) {
@@ -412,7 +411,7 @@ inline bool printVersionInfo(const device_info_t& info) {
412411
<< " - Serial: ";
413412

414413
for (int i = 0; i < 16; i++) {
415-
std::cout << std::hex << (info.serialnum[i] & 0xff);
414+
std::cout << std::hex << (info.serialnum[i] & 0xff) << std::dec;
416415
}
417416

418417
std::cout << std::endl;

cogip/cpp/drivers/ydlidar_g2/YDLidarDriver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ result_t YDlidarDriver::parseResponseHeader(
714714
}
715715
if (csc != csr) {
716716
std::cerr << "Stamp checksum error c[0x" << std::hex << static_cast<int>(csc)
717-
<< "] != r[0x" << static_cast<int>(csr) << "]" << std::endl;
717+
<< "] != r[0x" << static_cast<int>(csr) << "]" << std::dec << std::endl;
718718
}
719719
else {
720720
stamp_package_t sp;

cogip/models/actuators.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ActuatorBase(BaseModel):
3232
class PositionalActuatorEnum(IntEnum):
3333
"""Enum defining positional actuators IDs"""
3434

35-
UNDEFINED = 0
35+
MOTOR_LIFT = 0
3636

3737

3838
class PositionalActuatorCommand(BaseModel):
@@ -47,6 +47,20 @@ class PositionalActuatorCommand(BaseModel):
4747
title="Position Command",
4848
description="Current positional actuator position command",
4949
)
50+
speed: int = Field(
51+
100,
52+
ge=1,
53+
le=100,
54+
title="Speed",
55+
description="Speed",
56+
)
57+
timeout: int = Field(
58+
2000,
59+
ge=100,
60+
le=5000,
61+
title="Timeout",
62+
description="Timeout",
63+
)
5064

5165
@field_validator("kind", mode="before")
5266
@classmethod
@@ -77,6 +91,8 @@ def pb_copy(self, message: PB_PositionalActuatorCommand) -> None:
7791
"""Copy values to Protobuf message"""
7892
message.id = self.id
7993
message.command = self.command
94+
message.speed = self.speed
95+
message.timeout = self.timeout
8096

8197

8298
class PositionalActuator(ActuatorBase, PositionalActuatorCommand):
@@ -119,4 +135,6 @@ class BoolSensor(BaseModel):
119135

120136

121137
# Actuator limits
122-
actuator_limits: dict[IntEnum, tuple[int, int]] = {}
138+
actuator_limits: dict[IntEnum, tuple[int, int]] = {
139+
PositionalActuatorEnum.MOTOR_LIFT: (0, 150),
140+
}

cogip/models/artifacts.py

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from enum import IntEnum, auto
22

3-
from .models import Pose
3+
from .models import Pose, Vertex
44

55

66
class ConstructionAreaID(IntEnum):
@@ -9,9 +9,13 @@ class ConstructionAreaID(IntEnum):
99
"""
1010

1111
LocalBottomSmall = auto()
12-
LocalBottomLarge = auto()
12+
LocalBottomLarge1 = auto()
13+
LocalBottomLarge2 = auto()
14+
LocalBottomLarge3 = auto()
1315
OppositeBottomSmall = auto()
14-
OppositeCenterLarge = auto()
16+
OppositeSideLarge1 = auto()
17+
OppositeSideLarge2 = auto()
18+
OppositeSideLarge3 = auto()
1519

1620

1721
class ConstructionArea(Pose):
@@ -21,9 +25,9 @@ class ConstructionArea(Pose):
2125
"""
2226

2327
id: ConstructionAreaID
24-
length: float = 450
25-
width: float
26-
free_slots: float
28+
length: float
29+
width: float = 450
30+
tribune_level: int = 0
2731
enabled: bool = True
2832

2933

@@ -33,8 +37,7 @@ class ConstructionAreaSmall(ConstructionArea):
3337
Coordinates indicate the center of the tribune.
3438
"""
3539

36-
width: float = 150
37-
free_slots: int = 1
40+
length: float = 150
3841

3942

4043
class ConstructionAreaLarge(ConstructionArea):
@@ -43,16 +46,19 @@ class ConstructionAreaLarge(ConstructionArea):
4346
Coordinates indicate the center of the tribune.
4447
"""
4548

46-
width: float = 450
47-
free_slots: int = 3
49+
length: float = 450
4850

4951

5052
# Default positions for blue camp
5153
construction_area_positions: dict[ConstructionAreaID, Pose] = {
52-
ConstructionAreaID.LocalBottomSmall: Pose(x=-925, y=-725, O=180),
53-
ConstructionAreaID.LocalBottomLarge: Pose(x=-755, y=-275, O=180),
54-
ConstructionAreaID.OppositeBottomSmall: Pose(x=-925, y=1275, O=180),
55-
ConstructionAreaID.OppositeCenterLarge: Pose(x=-125, y=1275, O=90),
54+
ConstructionAreaID.LocalBottomSmall: Pose(x=-925, y=-725, O=0),
55+
ConstructionAreaID.LocalBottomLarge1: Pose(x=-925, y=-265, O=0),
56+
ConstructionAreaID.LocalBottomLarge2: Pose(x=-775, y=-265, O=0),
57+
ConstructionAreaID.LocalBottomLarge3: Pose(x=-625, y=-265, O=0),
58+
ConstructionAreaID.OppositeBottomSmall: Pose(x=-925, y=1275, O=0),
59+
ConstructionAreaID.OppositeSideLarge1: Pose(x=-125, y=1425, O=-90),
60+
ConstructionAreaID.OppositeSideLarge2: Pose(x=-125, y=1275, O=-90),
61+
ConstructionAreaID.OppositeSideLarge3: Pose(x=-125, y=1155, O=-90),
5662
}
5763

5864

@@ -63,6 +69,7 @@ class TribuneID(IntEnum):
6369

6470
LocalCenter = auto()
6571
LocalTop = auto()
72+
LocalTopTraining = auto()
6673
LocalBottom = auto()
6774
LocalTopSide = auto()
6875
LocalBottomSide = auto()
@@ -92,14 +99,42 @@ class Tribune(Pose):
9299

93100
# Default positions for blue camp
94101
tribune_positions: dict[TribuneID, Pose] = {
95-
TribuneID.LocalCenter: Pose(x=-50, y=-400, O=0),
96-
TribuneID.LocalTop: Pose(x=725, y=-675, O=0),
97-
TribuneID.LocalTopSide: Pose(x=325, y=-1425, O=-90),
98-
TribuneID.LocalBottomSide: Pose(x=-600, y=-1425, O=-90),
99-
TribuneID.LocalBottom: Pose(x=-750, y=-725, O=180),
100-
TribuneID.OppositeCenter: Pose(x=-50, y=400, O=0),
101-
# TribuneID.OppositeTop: Pose(x=725, y=675, O=0), # Included in a fixed obstacle
102-
TribuneID.OppositeTopSide: Pose(x=325, y=1425, O=90),
103-
TribuneID.OppositeBottomSide: Pose(x=-600, y=1425, O=90),
104-
TribuneID.OppositeBottom: Pose(x=-750, y=725, O=180),
102+
TribuneID.LocalCenter: Pose(x=-50, y=-400, O=180),
103+
TribuneID.LocalTop: Pose(x=725, y=-675, O=180),
104+
TribuneID.LocalTopTraining: Pose(x=-50, y=-1100, O=180),
105+
TribuneID.LocalTopSide: Pose(x=325, y=-1425, O=90),
106+
TribuneID.LocalBottomSide: Pose(x=-600, y=-1425, O=90),
107+
TribuneID.LocalBottom: Pose(x=-750, y=-725, O=0),
108+
TribuneID.OppositeCenter: Pose(x=-50, y=400, O=180),
109+
# TribuneID.OppositeTop: Pose(x=725, y=675, O=180), # Included in a fixed obstacle
110+
TribuneID.OppositeTopSide: Pose(x=325, y=1425, O=-90),
111+
TribuneID.OppositeBottomSide: Pose(x=-600, y=1425, O=-90),
112+
TribuneID.OppositeBottom: Pose(x=-750, y=725, O=0),
105113
}
114+
115+
116+
class FixedObstacleID(IntEnum):
117+
"""
118+
Enum to identify fixed obstacles.
119+
"""
120+
121+
Ramp = auto()
122+
Scene = auto()
123+
PitArea = auto()
124+
PamiStartArea = auto()
125+
Pami5Path = auto()
126+
OpponentRamp = auto()
127+
OpponentScene = auto()
128+
OpponentPitArea = auto()
129+
Backstage = auto()
130+
131+
132+
class FixedObstacle(Vertex):
133+
"""
134+
Model for fixed obstacles.
135+
"""
136+
137+
id: FixedObstacleID
138+
length: float
139+
width: float
140+
enabled: bool = True

cogip/models/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class PathPose(Pose):
120120
bypass_anti_blocking: send pose_reached if robot is blocked
121121
timeout_ms: max time is milliseconds to reach the pose, the robot stops if timeout is reached, 0 for no timeout
122122
bypass_final_orientation: do not set orientation pose order
123+
is_intermediate: whether this pose is an intermediate pose in a path
123124
"""
124125

125126
max_speed_linear: int = 66
@@ -128,6 +129,7 @@ class PathPose(Pose):
128129
bypass_anti_blocking: bool = False
129130
timeout_ms: int = 0
130131
bypass_final_orientation: bool = False
132+
is_intermediate: bool = False
131133

132134
@property
133135
def pose(self) -> Pose:
@@ -149,6 +151,7 @@ def copy_pb(self, pb_path_pose: PB_PathPose) -> None:
149151
pb_path_pose.bypass_anti_blocking = self.bypass_anti_blocking
150152
pb_path_pose.timeout_ms = self.timeout_ms
151153
pb_path_pose.bypass_final_orientation = self.bypass_final_orientation
154+
pb_path_pose.is_intermediate = self.is_intermediate
152155

153156

154157
class DynObstacleRect(BaseModel):

cogip/protobuf/PB_Actuators.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../submodules/mcu-firmware/platforms/pf-robot-actuators/PB_Actuators.proto
1+
../../submodules/mcu-firmware/lib/actuator/PB_Actuators.proto

cogip/protobuf/PB_Actuators_pb2.py

Lines changed: 19 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)