Skip to content

Commit 200df92

Browse files
ApehaengerClemensElflein
authored andcommitted
Add ROBOT_PLATFORM YardForce_V4
1 parent 15ed97b commit 200df92

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
mkdir artifacts
4343
cp ./out/openmower-yardforce.bin ./artifacts
4444
cp ./out/openmower-yardforce.elf ./artifacts
45+
cp ./out/openmower-yardforce-v4.bin ./artifacts
46+
cp ./out/openmower-yardforce-v4.elf ./artifacts
4547
cp ./out/openmower-worx.bin ./artifacts
4648
cp ./out/openmower-worx.elf ./artifacts
4749
cp ./out/openmower-lyfco-e1600.bin ./artifacts

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ COPY . /project
2222
WORKDIR /project
2323
RUN mkdir build
2424
RUN cd build && cmake .. --preset=Release -DROBOT_PLATFORM=YardForce -BYardForce && cd YardForce && make -j$(nproc)
25+
RUN cd build && cmake .. --preset=Release -DROBOT_PLATFORM=YardForce_V4 -BYardForce_V4 && cd YardForce_V4 && make -j$(nproc)
2526
RUN cd build && cmake .. --preset=Release -DROBOT_PLATFORM=Worx -BWorx && cd Worx && make -j$(nproc)
2627
RUN cd build && cmake .. --preset=Release -DROBOT_PLATFORM=Lyfco_E1600 -BLyfco_E1600 && cd Lyfco_E1600 && make -j$(nproc)
2728
RUN cd build && cmake .. --preset=Release -DROBOT_PLATFORM=Sabo -BSabo && cd Sabo && make -j$(nproc)
@@ -39,6 +40,9 @@ COPY --from=builder /project/build/flash-info.html /flash-info.html
3940
COPY --from=builder /project/build/YardForce/openmower.bin /openmower-yardforce.bin
4041
COPY --from=builder /project/build/YardForce/openmower.elf /openmower-yardforce.elf
4142

43+
COPY --from=builder /project/build/YardForce_V4/openmower.bin /openmower-yardforce-v4.bin
44+
COPY --from=builder /project/build/YardForce_V4/openmower.elf /openmower-yardforce-v4.elf
45+
4246
COPY --from=builder /project/build/Worx/openmower.bin /openmower-worx.bin
4347
COPY --from=builder /project/build/Worx/openmower.elf /openmower-worx.elf
4448

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#ifndef YARDFORCE_V4_ROBOT_HPP
2+
#define YARDFORCE_V4_ROBOT_HPP
3+
4+
#include <drivers/charger/bq_2576/bq_2576.hpp>
5+
6+
#include "robot.hpp"
7+
8+
class YardForce_V4Robot : public MowerRobot {
9+
public:
10+
void InitPlatform() override;
11+
bool IsHardwareSupported() override;
12+
13+
UARTDriver* GPS_GetUartPort() override {
14+
#ifndef STM32_UART_USE_USART6
15+
#error STM32_SERIAL_USE_UART6 must be enabled for the YardForce build to work
16+
#endif
17+
return &UARTD6;
18+
}
19+
20+
float Power_GetDefaultBatteryFullVoltage() override {
21+
return 7.0f * 4.2f;
22+
}
23+
24+
float Power_GetDefaultBatteryEmptyVoltage() override {
25+
return 7.0f * 3.3f;
26+
}
27+
28+
float Power_GetDefaultChargeCurrent() override {
29+
return 0.5;
30+
}
31+
32+
float Power_GetAbsoluteMinVoltage() override {
33+
// 3.3V min, 7s pack
34+
return 7.0f * 3.0;
35+
}
36+
37+
private:
38+
BQ2576 charger_{};
39+
};
40+
41+
#endif // YARDFORCE_V4_ROBOT_HPP

robots/src/robot.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "../include/worx_robot.hpp"
88
#include "../include/xbot_robot.hpp"
99
#include "../include/yardforce_robot.hpp"
10+
#include "../include/yardforce_v4_robot.hpp"
1011

1112
#define EXPAND(x) x
1213
#define ROBOT_CLASS_NAME(platform) platform##Robot

robots/src/yardforce_v4_robot.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "../include/yardforce_v4_robot.hpp"
2+
3+
#include <services.hpp>
4+
5+
void YardForce_V4Robot::InitPlatform() {
6+
InitMotors();
7+
charger_.setI2C(&I2CD1);
8+
power_service.SetDriver(&charger_);
9+
}
10+
11+
bool YardForce_V4Robot::IsHardwareSupported() {
12+
// Accept YardForce 1.x.x boards
13+
if (strncmp("hw-openmower-yardforce", carrier_board_info.board_id, sizeof(carrier_board_info.board_id)) == 0 &&
14+
carrier_board_info.version_major == 1) {
15+
return true;
16+
}
17+
18+
// Accept early testing boards
19+
if (strncmp("hw-xbot-devkit", carrier_board_info.board_id, sizeof(carrier_board_info.board_id)) == 0) {
20+
return true;
21+
}
22+
23+
return false;
24+
}

0 commit comments

Comments
 (0)