From 9fe15847035ebe72991dbbe90143cb0a4177d122 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 16:01:28 +0100 Subject: [PATCH 01/16] markdown feladatok --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e26e034fc..255b93458 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,7 @@ The figure below illustrates this behavior using an example. 1. As the joystick remains at a positive value, the reference speed is incremented again. 1. However, it reaches the speed limit so in the next step it is not incremented even though the joystick still has a positive value. 1. Later, the joystick is set to a negative position for one time unit, making the reference speed to decrease as well. + +# Modification +_MIT2_ +~~2023.03.20.~~ \ No newline at end of file From 3eb56fa7f6c4e3fecf00ad39da125b24ab833a84 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 16:25:01 +0100 Subject: [PATCH 02/16] Create maven.yml --- .github/workflows/maven.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 000000000..f7367e0d4 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,35 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Maven + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml + + # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive + - name: Update dependency graph + uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 From 17ec8de808b772ee7e52cf26c3247d0e28c3b2ea Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 16:36:34 +0100 Subject: [PATCH 03/16] emergency break implemented --- .../train/controller/TrainControllerImpl.java | 6 ++ .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + .../compile/default-compile/createdFiles.lst | 3 + .../compile/default-compile/inputFiles.lst | 3 + .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + .../default-testCompile/createdFiles.lst | 1 + .../default-testCompile/inputFiles.lst | 1 + ...u.bme.mit.train.sensor.TrainSensorTest.xml | 64 ++++++++++++++++++ ...u.bme.mit.train.sensor.TrainSensorTest.txt | 4 ++ .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + .../default-testCompile/createdFiles.lst | 1 + .../default-testCompile/inputFiles.lst | 1 + ...u.bme.mit.train.system.TrainSystemTest.xml | 65 +++++++++++++++++++ ...u.bme.mit.train.system.TrainSystemTest.txt | 4 ++ .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + 19 files changed, 161 insertions(+) create mode 100644 train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst create mode 100644 train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml create mode 100644 train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt create mode 100644 train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst create mode 100644 train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml create mode 100644 train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt create mode 100644 train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 06649d278..6c7282163 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -46,4 +46,10 @@ public void setJoystickPosition(int joystickPosition) { this.step = joystickPosition; } + private void emergency_break() { + if (referenceSpeed > 0) { + referenceSpeed = 0; + } + } + } diff --git a/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..7f5a1ef4a --- /dev/null +++ b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/controller/TrainControllerImpl.class diff --git a/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..b13b01cc3 --- /dev/null +++ b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/base/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java diff --git a/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..248759f35 --- /dev/null +++ b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,3 @@ +hu/bme/mit/train/interfaces/TrainController.class +hu/bme/mit/train/interfaces/TrainSensor.class +hu/bme/mit/train/interfaces/TrainUser.class diff --git a/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..ca4e03d48 --- /dev/null +++ b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,3 @@ +/home/cloud/base/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainUser.java +/home/cloud/base/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java +/home/cloud/base/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..5c6a37510 --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/sensor/TrainSensorImpl.class diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..a99815748 --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/base/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 000000000..0ad3f3de4 --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/sensor/TrainSensorTest.class diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 000000000..e2a796968 --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/base/train-sensor/src/test/java/hu/bme/mit/train/sensor/TrainSensorTest.java diff --git a/train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml b/train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml new file mode 100644 index 000000000..87387657c --- /dev/null +++ b/train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt b/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt new file mode 100644 index 000000000..509be48b5 --- /dev/null +++ b/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: hu.bme.mit.train.sensor.TrainSensorTest +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.186 sec diff --git a/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..104d0eff5 --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/system/TrainSystem.class diff --git a/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..a872c23b6 --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/base/train-system/src/main/java/hu/bme/mit/train/system/TrainSystem.java diff --git a/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 000000000..f347beb05 --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/system/TrainSystemTest.class diff --git a/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 000000000..656c56f34 --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/base/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java diff --git a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml new file mode 100644 index 000000000..7509ebd63 --- /dev/null +++ b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt new file mode 100644 index 000000000..2967ca4ec --- /dev/null +++ b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: hu.bme.mit.train.system.TrainSystemTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.141 sec diff --git a/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..f84f69174 --- /dev/null +++ b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/user/TrainUserImpl.class diff --git a/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..8cd6208d2 --- /dev/null +++ b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/base/train-user/src/main/java/hu/bme/mit/train/user/TrainUserImpl.java From 49d9f259005609e0aa6c0b4941f7977a94e9b1d5 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:08:09 +0100 Subject: [PATCH 04/16] TrainControllerImpl 9. sor speedlimit = 100 --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 6c7282163..9fa57068e 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimit = 0; + private int speedLimit = 100; @Override public void followSpeed() { From 61cb45390572ad1b23591031209c5b08cf5fec85 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:09:06 +0100 Subject: [PATCH 05/16] TrainControllerImpl 8. sor speedLimit= 50 --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 9fa57068e..3cf6843bf 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimit = 100; + private int speedLimit = 50; @Override public void followSpeed() { From 0ad92aea90fd107d76a9a68d869c1e959925ddf0 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:11:30 +0100 Subject: [PATCH 06/16] 40 --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 3cf6843bf..76bbc0728 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimit = 50; + private int speedLimit = 40; @Override public void followSpeed() { From b2ff9e00de481e9b8ed1d2a6e3a2140a37e0668a Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:15:07 +0100 Subject: [PATCH 07/16] speedLimit 200 A --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 9fa57068e..8e478573c 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimit = 100; + private int speedLimit = 200; @Override public void followSpeed() { From c03b96e3f65046eb51bf464eca256ba93245f8b6 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:15:44 +0100 Subject: [PATCH 08/16] speedLimit 1 B --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 76bbc0728..d9f71aa8c 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimit = 40; + private int speedLimit = 1; @Override public void followSpeed() { From 30e4003f0b39d469b56b17a3dd5d89be2204e469 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:21:07 +0100 Subject: [PATCH 09/16] 200 --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index d9f71aa8c..8e478573c 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimit = 1; + private int speedLimit = 200; @Override public void followSpeed() { From e3262be273b3c87badcb62e8dd659f4c37f0acc7 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:30:58 +0100 Subject: [PATCH 10/16] =?UTF-8?q?ford=C3=ADt=C3=A1si=20hiba?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java b/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java index 4a640d1dd..20a981fa0 100644 --- a/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java +++ b/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java @@ -6,7 +6,7 @@ public class TrainSensorImpl implements TrainSensor { - private TrainController controller; + private TrainController controller private TrainUser user; private int speedLimit = 5; From 8738f441c94f3643e919c47cda9af2233a2b117d Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:35:57 +0100 Subject: [PATCH 11/16] hiba don --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 8e478573c..dcbe7d23d 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimit = 200; + private int speedLimitss = 200; @Override public void followSpeed() { From b6d690a6b788072de222b88a8ba3386bfe769c33 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:43:07 +0100 Subject: [PATCH 12/16] test added, compilation error fixed --- .../hu/bme/mit/train/sensor/TrainSensorImpl.java | 2 +- .../hu/bme/mit/train/system/TrainSystemTest.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java b/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java index 20a981fa0..4a640d1dd 100644 --- a/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java +++ b/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java @@ -6,7 +6,7 @@ public class TrainSensorImpl implements TrainSensor { - private TrainController controller + private TrainController controller; private TrainUser user; private int speedLimit = 5; diff --git a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java index 04ae3dac0..f1e06d192 100644 --- a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java +++ b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java @@ -50,5 +50,20 @@ public void OverridingJoystickPositionToNegative_SetsReferenceSpeedToZero() { Assert.assertEquals(0, controller.getReferenceSpeed()); } + @Test + public void OverridingJoystickPosition_IncreasesReferenceSpeed() { + sensor.overrideSpeedLimit(20); + + Assert.assertEquals(0, controller.getReferenceSpeed()); + + user.overrideJoystickPosition(5); + + controller.followSpeed(); + Assert.assertEquals(5, controller.getReferenceSpeed()); + controller.followSpeed(); + Assert.assertEquals(20, controller.getReferenceSpeed()); + controller.followSpeed(); + Assert.assertEquals(20, controller.getReferenceSpeed()); + } } From 81fddd4fdd98e7dc8a7181775cbff558d9a7a317 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:49:58 +0100 Subject: [PATCH 13/16] comment --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index dcbe7d23d..8e478573c 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -6,7 +6,7 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; - private int speedLimitss = 200; + private int speedLimit = 200; @Override public void followSpeed() { From 845960c9c017c634191cfc00a3796d92c5ea538d Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:52:44 +0100 Subject: [PATCH 14/16] teszt neve javitva --- .../src/test/java/hu/bme/mit/train/system/TrainSystemTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java index f1e06d192..8c59d37d5 100644 --- a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java +++ b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java @@ -51,7 +51,7 @@ public void OverridingJoystickPositionToNegative_SetsReferenceSpeedToZero() { } @Test - public void OverridingJoystickPosition_IncreasesReferenceSpeed() { + public void OverridingJoystickPosition_IncreasesReferenceSpeed20() { sensor.overrideSpeedLimit(20); Assert.assertEquals(0, controller.getReferenceSpeed()); From 8e996b5cedbdeb9fc6c8826dd3095d9d1b4979f6 Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:56:58 +0100 Subject: [PATCH 15/16] =?UTF-8?q?teszt=20jav=C3=ADtva?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hu/bme/mit/train/system/TrainSystemTest.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java index 8c59d37d5..e4c9b3b98 100644 --- a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java +++ b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java @@ -51,19 +51,14 @@ public void OverridingJoystickPositionToNegative_SetsReferenceSpeedToZero() { } @Test - public void OverridingJoystickPosition_IncreasesReferenceSpeed20() { - sensor.overrideSpeedLimit(20); - - Assert.assertEquals(0, controller.getReferenceSpeed()); - - user.overrideJoystickPosition(5); - + public void OverridingJoystickPositionToNegative_SetsReferenceSpeedToZeroVersionTwo() { + user.overrideJoystickPosition(10); controller.followSpeed(); - Assert.assertEquals(5, controller.getReferenceSpeed()); + user.overrideJoystickPosition(10); controller.followSpeed(); - Assert.assertEquals(20, controller.getReferenceSpeed()); + user.overrideJoystickPosition(-20); controller.followSpeed(); - Assert.assertEquals(20, controller.getReferenceSpeed()); + Assert.assertEquals(0, controller.getReferenceSpeed()); } } From 1b761ae8d65ea41da2dfc489afaee664d3ac848a Mon Sep 17 00:00:00 2001 From: elb-bme <79838492+elb-bme@users.noreply.github.com> Date: Sat, 3 Jun 2023 16:10:48 +0200 Subject: [PATCH 16/16] periodic change of reference speed update interval --- .../mit/train/controller/TrainControllerImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 8e478573c..b58ac5195 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -7,6 +7,8 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; private int speedLimit = 200; + private long lastUpdateTime; + private long updateInterval = 1000; @Override public void followSpeed() { @@ -43,7 +45,8 @@ private void enforceSpeedLimit() { @Override public void setJoystickPosition(int joystickPosition) { - this.step = joystickPosition; + this.step = joystickPosition; + updateReferenceSpeed(); } private void emergency_break() { @@ -51,5 +54,13 @@ private void emergency_break() { referenceSpeed = 0; } } + + private void updateReferenceSpeed() { + long currentTime = System.currentTimeMillis(); + if (currentTime - lastUpdateTime >= updateInterval) { + followSpeed(); + lastUpdateTime = currentTime; + } + } }