Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SignalReceiver PR #88

Open
wants to merge 153 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 135 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
34991e3
Changed project settings to include SignalReceiver
Nov 21, 2023
4cf9b2e
Copied over RemoteControl files.
Nov 21, 2023
684716c
Added SMP and MQTT TL Color ID channels to list.
Nov 21, 2023
f043367
SMP TL Colors CH is now called in constructor.
Nov 21, 2023
cbe6bb4
Implemented the Handshake ID system.
Nov 21, 2023
10effac
Remove unused methods and constants.
Nov 24, 2023
057e798
Publishing robot coordinates periodically.
Nov 27, 2023
9bc67f9
Merge branch 'main' into SignalReceiver
gabryelreyes Nov 28, 2023
e284151
Moved dependencies to platformio.ini
gabryelreyes Nov 28, 2023
a785703
PAssed App instance to SMP server
gabryelreyes Nov 28, 2023
429598a
Added Doxygen for SignalReceiver
gabryelreyes Nov 28, 2023
169c492
Added SignalReceiver to CI
gabryelreyes Nov 28, 2023
192f488
Fixed doxygen findings.
Nov 28, 2023
eeed4d2
Removed unused return type of createPackage.
Nov 28, 2023
f69ad02
Fixed more doxygen findings.
Nov 28, 2023
41f8ffb
Fixed setup issues, robot now reacts to color IDs.
Nov 29, 2023
401cc2f
Moved package creation in the intern callback.
Nov 30, 2023
4ba9a5d
Merge branch 'main' into SignalReceiver
Dec 4, 2023
9adeb08
Signaling GreenLED on succesful initialization.
Dec 4, 2023
a1c738c
Running tests on Target, commenting Odometry funct
Dec 5, 2023
b45437c
Merge branch 'main' into SignalReceiver
Dec 5, 2023
aa439af
Commented out unused timer used for Odom.
Dec 5, 2023
46cb7cc
Uncommented Odometry for testing.
Dec 7, 2023
9439a79
Uncommented Odometry for testing.
Dec 7, 2023
5f1ec47
Removed unused Line sensor define.
Dec 7, 2023
adfd08c
DCS now handles trigger area recognition.
Dec 19, 2023
846bd12
DCS now processes orientation as well.
Dec 21, 2023
4d3a248
Moved IE attributes to Participants.h
Dec 21, 2023
320be7b
Implemented basic Queuer.
Dec 21, 2023
53ee475
Fixed doxygen findings.
Dec 21, 2023
7a07e4f
Fixed more doxygen findings.
Dec 21, 2023
a71e9b0
Fixed more doxygen findings.
Dec 21, 2023
dfc5a44
Merge branch 'SignalReceiver' of https://github.com/BlueAndi/DroidCon…
Dec 21, 2023
e272fa9
Fixed more doxygen findings.
Dec 21, 2023
a8e6284
Fixed more Doxygen findings.
Dec 21, 2023
7b203fc
Using abs val instead of trigger area.
Jan 4, 2024
c463652
Merge branch 'main' into SignalReceiver
Jan 4, 2024
d6fc99c
Fixed doxygen findings.
Jan 4, 2024
5737031
Using abs val instead of trigger area.
Jan 4, 2024
5a16582
Merge branch 'SignalReceiver' of https://github.com/BlueAndi/DroidCon…
Jan 4, 2024
0127943
Using abs val instead of trigger area.
Jan 4, 2024
666ae95
Merged with main.
Jan 4, 2024
f1fb42b
Merge branch 'SignalReceiver' of https://github.com/BlueAndi/DroidCon…
Jan 4, 2024
5c6205b
Fix
Jan 4, 2024
1cc4b81
Removed interval value processing.
Jan 5, 2024
36fb510
Moved isMovingTowards logging in Queuer.process()
Jan 5, 2024
f44728c
Removed interval value attributes and processing methods.
Jan 5, 2024
d8a3462
Queuer::process() has boolean return type.
Jan 5, 2024
9d4970e
Removed unused lines in App.
Jan 5, 2024
a56711b
Fixing pull issues.
Jan 16, 2024
64134c5
Changed names and replaced queue with list of arrays.
Jan 16, 2024
a8f282d
Fixed doxygen findings (1)
Jan 16, 2024
5a478a5
Fixed doxygen findings (2)
Jan 16, 2024
0ef0c5d
Fixed doxygen findings (3)
Jan 16, 2024
5157691
Fixed clang-tidy findings.
Jan 16, 2024
f6c451b
Fixed clang-tidy findings.
Jan 16, 2024
b56a880
SignalReceiver class diagram.
Jan 17, 2024
0cf8bdd
SignalReceiver sequence diagram.
Jan 17, 2024
130172f
RU+DCS+IE sequence diagram.
Jan 17, 2024
7763ec9
Global variables in App are now private.
Jan 17, 2024
6b6536f
Global array of IEs is now private.
Jan 17, 2024
c772a3c
Renamed a few methods to better suit their purpose.
Jan 17, 2024
d0f7398
Fixed check (Test) finding.
Jan 17, 2024
2681183
Improvements to traffic handling.
Jan 26, 2024
99fb016
Removed extra HAL logs.
Jan 29, 2024
5e6ea6b
Merge branch 'main' into SignalReceiver
Jan 29, 2024
ca05341
Decreased robot-IE distance threshhold for listening.
Jan 31, 2024
3695f90
Removed unused logs.
Jan 31, 2024
de47dab
Changed the config files for target uploads.
Jan 31, 2024
90ab117
Merge branch 'main' into SignalReceiver
Jan 31, 2024
41ef8b2
Fixed doxygen finding.
Jan 31, 2024
19f94a1
Removed unnecessary setting change.
Feb 1, 2024
4c9dfc9
Removed unnecesary workspace settings.
Feb 1, 2024
0564403
Copied over the config from main branch.
Feb 1, 2024
968851d
Copied configurations from main.
Feb 1, 2024
79a4b0f
Resolved copyright notices.
Feb 1, 2024
517b59e
Re-resolved config file.
Feb 1, 2024
b206f6e
Re-resolved config file.
Feb 1, 2024
b5d3b43
Added missing line ending in config file.
Feb 1, 2024
1ed9596
Undid auto-formatted library file in RemoteControl.
Feb 1, 2024
6803aa2
Undid auto-formatted space in IBoard.
Feb 1, 2024
979e4aa
I am the author of SignalReceiver.
Feb 1, 2024
6649ac2
Resolved auto-format in platform.ini file.
Feb 1, 2024
03a7864
SignalReceiver is ignored in all other apps.
Feb 1, 2024
7cfd23e
Added SMP callbacks to be used with RU ConvoyLeader.
Feb 2, 2024
b113fb9
Initializing the new SMP server and channels.
Feb 2, 2024
c38d8a0
Setting up periodic processing.
Feb 2, 2024
6547f40
Copied over States from ConvoyLeader.
Feb 2, 2024
f48f9b4
Updated App.h to fit with the changes made above. (System init is wor…
Feb 2, 2024
9b2712f
Limiting speed to 1000. It's a magic nr. for now :)
Feb 2, 2024
25a5771
Improvement to isMovingTowards() function.
Feb 2, 2024
5a03085
App now processes robot coordinates and IE positions.
Feb 2, 2024
95691c0
Processing traffic only when robot is driving.
Feb 2, 2024
6cb58db
Removed unused TxSMP method.
Feb 6, 2024
aa780b7
Processing traffic is a periodic task now.
Feb 6, 2024
de31d61
Limiting the motor speed to 1000 steps.
Feb 6, 2024
e9add19
Added methods to process the received color.
Feb 6, 2024
36dfe47
Fixed finding.
Feb 6, 2024
180c752
Moved traffic processing into a private function.
Feb 6, 2024
8ab2f3c
Fixed documentation path.
Feb 6, 2024
9834b50
Wrong comment fixed.
Feb 7, 2024
8de31f0
Removed out/doc exports and folder.
Feb 7, 2024
6121f04
Fixed magic number, renamed variable.
Feb 7, 2024
254f9d9
Fixed TrafficElement constructor string initialization.
Feb 7, 2024
a6ed74a
STATUS_IDLE is 0U.
Feb 7, 2024
7bab54a
Resolved constructor issues.
Feb 7, 2024
10aab44
Resolved doxygen note.
Feb 7, 2024
fc96888
Fixed CoordinateHandler description.
Feb 7, 2024
0652411
Removed commented code.
Feb 7, 2024
691de0c
Improved distance calculation.
Feb 7, 2024
7517a29
Resolved doxygen-styled comments inside code.
Feb 7, 2024
4fd3545
Removed empty lines inbetween includes.
Feb 7, 2024
6bacf91
Added variables to App constructor.
Feb 7, 2024
d483f55
Removed non-standard Doxygen documentation.
Feb 7, 2024
2885b0c
Fixed class and constructor descriptions.
Feb 7, 2024
5397d87
Fixed doxygen finding.
Feb 7, 2024
76e4233
Deleted .vscode/settings.json
paulgrammy Feb 7, 2024
02d2325
Removed empty line in config file.
Feb 7, 2024
6c7a158
Merge branch 'SignalReceiver' of https://github.com/BlueAndi/DroidCon…
Feb 7, 2024
44f9c34
Fixed convoy follower copyright diff.
Feb 7, 2024
6356ecf
Fixed external file LateralController (1).
Feb 7, 2024
4a59a7e
Renormalized Line Endings
Feb 7, 2024
d499855
Revert "Renormalized Line Endings"
Feb 7, 2024
2b4e5e0
Fixed line endings in SignalReceiver
gabryelreyes Feb 7, 2024
1389de4
Merge branch 'main' into SignalReceiver
gabryelreyes Feb 7, 2024
683f99b
Merge branch 'LineEndings' into SignalReceiver
gabryelreyes Feb 7, 2024
39796be
Removed wrong/old config file
gabryelreyes Feb 7, 2024
28b29bf
Removed debug message
gabryelreyes Feb 7, 2024
c28eea7
Added missing line
gabryelreyes Feb 7, 2024
ede2809
Fixed doxygen-like comment inside of code.
Feb 7, 2024
43f846b
Added U to 0s in SMP enums.
Feb 7, 2024
6b38696
Fixed more descriptions.
Feb 7, 2024
76940b4
Removed double init.
Feb 7, 2024
c229f48
Fixed getInstance function description.
Feb 7, 2024
20f477a
Traffic handler construcor and deconstructor are private.
Feb 7, 2024
c14c6a5
Fixed constructor initialization.
Feb 7, 2024
17b5eef
Fixed include signs.
Feb 7, 2024
3623ff0
Updated function description.
Feb 7, 2024
f2ddc68
Removed unused boolean variable.
Feb 8, 2024
7598a47
Removed unused String.
Feb 8, 2024
a5bb495
Removed unused const char.
Feb 8, 2024
5783da1
Removed unused smp channel.
Feb 8, 2024
608364d
Updated class diagram to fit new architecture.
Feb 8, 2024
e50c9a8
Fixing odometry smp callback.
Feb 12, 2024
f87f8f5
Deleted unused SMP channel.
Feb 12, 2024
739d386
Removed doxygen flag.
Feb 12, 2024
1353f1c
Merge branch 'main' into SignalReceiver
Feb 12, 2024
5d32476
Updated the smp channel to be compatible with ConvoyLeader.
Feb 15, 2024
b5ff250
Robot shall barely move between RedtoGreen.
Feb 16, 2024
f036e41
Removed repeated line.
Mar 1, 2024
974fab7
Removed illogical if statement.
Mar 1, 2024
86c0fe6
Removed magic number.
Mar 1, 2024
e2d239a
Removed magic number.
Mar 1, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
needs: intro
strategy:
matrix:
environment: ["ConvoyLeaderTarget", "ConvoyFollowerTarget", "RemoteControlTarget"]
environment: ["ConvoyLeaderTarget", "ConvoyFollowerTarget", "RemoteControlTarget", "SignalReceiverTarget"]

# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
needs: intro
strategy:
matrix:
environment: ["ConvoyLeaderTarget", "ConvoyFollowerTarget", "RemoteControlTarget", "Test"]
environment: ["ConvoyLeaderTarget", "ConvoyFollowerTarget", "RemoteControlTarget", "SignalReceiverTarget", "Test"]

steps:
- name: Checkout repository
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
needs: intro
strategy:
matrix:
environment: ["ConvoyLeaderTarget", "ConvoyFollowerTarget", "ConvoyLeaderSim", "ConvoyFollowerSim", "RemoteControlTarget", "RemoteControlSim"]
environment: ["ConvoyLeaderTarget", "ConvoyFollowerTarget", "ConvoyLeaderSim", "ConvoyFollowerSim", "RemoteControlTarget", "RemoteControlSim", "SignalReceiverTarget", "SignalReceiverSim"]

steps:
- name: Checkout repository
Expand Down
167 changes: 167 additions & 0 deletions doc/architecture/uml/LogicalView/SignalReceiver/Application.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
@startuml SignalReceiverApplication

title SignalReceiver app

package "Application" as appLayer {

class App {
- bool gIsListening
- Color clr
- Color oldClr
+ setup() : void
+ loop() : void
+ sendCurrentColor() : void
+ App_odometryChannelCallback(const uint8_t* payload, const uint8_t payloadSize, void* userData) : void
+ trafficLightColorsCallback(const String& payload) : void
+ settingsCallback(const String& payload) : void
}

note left of App::gIsListening
Once conditions are fullfilled, gIsListening is set as true and
the robot receives the relevant color ID through SMP/USB.
end note

note left of App::App_odometryChannelCallback
Receives and deserializes odometry information from RadonUlzer.
end note

note left of App::trafficLightColorsCallback
Receives and deserializes MQTT signals.
* Type: {"COLOR": ID}
end note

note left of App::settingsCallback
Receives and deserializes MQTT signals
with settings of IEs present in the system.
* Type: {"FROM": , "TOWARDS": , "EX": , "EY": }
end note

class "TrafficElement" as te
{
-String m_nameElement
-int32_t m_orientation
-int32_t m_entryX
-int32_t m_entryY
-int32_t m_distance
-int32_t m_previousDistance
-String m_topicName
-uint8_t m_trafficStatus
+setIEName(String name) : void
+getIEName() : String
+setRequiredOrientation(int32_t requiredOrientation) : void
+getRequiredOrientation() : int32_t
+setEntryValues(int32_t entryX, int32_t entryY) : void
+getEntryX() : int32_t
+getEntryY() : int32_t
+setDistance(int32_t currentDistance) : void
+getDistance() : int32_t
+setPreviousDistance(int32_t previousDistance) : void
+getPreviousDistance() : int32_t
+setTopicName(String topic) : void
+getTopicName() : String
+setStatus(uint8_t status) : void
+getStatus() : uint8_t
+isEmpty() : bool
}

note bottom of te
* The TrafficElement class contains methods to save
incoming relevant settings from IEs.
* It is used by TrafficHandler to create a list of
all present IEs in the system.
end note

class "TrafficHandler" as th
{
-uint8_t MAX_ELEMENTS
-uint8_t NR_OF_ELEMENTS
-String lockedOnto
-TrafficElement listOfElements[10]
+process() : bool
+setNewInfrastructureElement() : bool
+checkLockIn() : bool
+isNear() : bool
+getTargetName() : String
}

note top of th
* Adds new IEs to the list once it receives relevant settings.
* Processes this list and outputs a status between the robot and each IE.
* Important statuses are checked using checkLockIn() and isNear()
end note

note left of th::setNewInfrastructureElement()
Various parameters are passed through in order to add
the IE to the list.
end note

class "CoordinateHandler" as ch
{
-enum CurrentStatus
-CurrentStatus m_currentStatus
-int32_t m_distance
-int32_t m_oldDistance
-int32_t m_currentX
-int32_t m_currentY
-int32_t m_currentOrientation
+setCurrentCoordinates(int32_t xPos, int32_t yPos) : void
+getCurrentXCoord() : int32_t
+getCurrentYCorrd() : int32_t
+setCurrentOrientation() : void
+getCurrentOrientation() : int32_t
+getCurrentDistance() : int32_t
+getOldDistance() : int32_t
+process(const String& ieName, int32_t ieOrientation, int32_t distanceToIE, int32_t previousDistanceToIE) : bool
+calculateDistance(int32_t xPos, int32_t yPos) : int32_t
+getStatus() : uint8_t
-isMovingTowards(int32_t currentDistance, int32_t previousDistance) : bool
-checkOrientation(int32_t orientationIE) : bool
}

note bottom of ch
Processes and compares the coordinates of the robot (current)
with the ones of each enlisted IE.
end note
}

package "Service" as serviceLayer {
class SettingsHandler {
- String m_robotName
- String m_wifiSSID
- String m_wifiPassword
- String m_mqttBrokerAddress
- uint16_t m_mqttPort
- String m_apSSID
- String m_apPassword
- String m_webServerUser
- String m_webServerPassword
- uint8_t m_platoonPlatoonId
- uint8_t m_platoonVehicleId
- FileHandler m_fileHandler
+ getInstance() : SettingsHandler
+ loadConfigurationFile(const String& filename) : bool
+ saveConfigurationFile(const String& filename) : bool
+ getRobotName() : const String&
+ setRobotName(const String& robotName) : void
+ getWiFiSSID() : const String&
+ setWiFiSSID(const String& wifiSSID) : void
+ getWiFiPassword() : const String&
+ setWiFiPassword(const String& wifiPassword) : void
+ getMqttBrokerAddress() : const String&
+ getMqttPort() : uint16_t
+ getApSSID() : const String&
+ getApPassword() : const String&
+ getWebServerUser() : const String&
+ getWebServerPassword() : const String&
+ getPlatoonPlatoonId() : uint8_t
+ getPLatoonVehicleId() : uint8_t
}
}

App ---o th
App --o ch
App ----> SettingsHandler : <<use>>
th "1" --> "0...10" te : <<use>>
th --o ch

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
@startuml

title SignalReceiver Sequence

actor Infrastructure_Element
actor RadonUlzer
participant App
participant Settings
participant TrafficElements
participant TrafficHandler
participant CoordinateHandler

group Setup
App -> App : setup()

App -> Settings: getMqttConfig()
return success

Infrastructure_Element -> App: settings through MQTT
App -> TrafficHandler: setNewInfrastructureElement()
TrafficHandler -> TrafficElements: isEmpty()
return if true, add it to list of IEs
end

group Loop
Infrastructure_Element -> Infrastructure_Element: runs through states
RadonUlzer -> RadonUlzer: follows the line
RadonUlzer -> App : <<SMP/USB>> Receive Odometry info (X,Y and Orientation)
App -> CoordinateHandler: setCurrentOrientation(), setCurrentCoordinates()
App -> TrafficHandler : TrafficHandler::process()
note right: < processing for each IE in the list

group TrafficHandler::process()
TrafficHandler -> TrafficHandler: setPreviousDistance()

TrafficHandler -> CoordinateHandler: setDistance(calculateDistance())
return distance

TrafficHandler -> CoordinateHandler: CoordinateHandler::process() with given distances

group CoordinateHandler::process()

hnote over CoordinateHandler: STATUS_IDLE
CoordinateHandler -> CoordinateHandler: isMovingTowards() is true \n then

hnote over CoordinateHandler: STATUS_TOWARDS
CoordinateHandler -> CoordinateHandler: checkOrientation() is true \n then

hnote over CoordinateHandler: STATUS_LOCKED_IN
CoordinateHandler -> CoordinateHandler: distance < 200 is true \n then

hnote over CoordinateHandler: STATUS_NEAR
hnote over CoordinateHandler: else STATUS_PASSED
end
end

TrafficHandler -> CoordinateHandler: setStatus(STATUS)

group Subscription
App -> TrafficHandler: checkLockIn()
note left: is getStatus() == LOCKED_IN || NEAR ?
return if true, subscribe to IE's MQTT topic

Infrastructure_Element -> App: <<MQTT>>Incoming color: \n receive and deserialize message, save it in Color clr

group Listening
App -> TrafficHandler: isNear()
note left: is getStatus() == NEAR ?
return if true, then gIsListening is true

App -> App: if (oldClr != clr) then
App -> RadonUlzer: sendColor()
App -> App: oldClr = clr
else gIsListening = false
end
else unsubscribe from IE
end
end

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@startuml

title Sequence

note right #Aqua
Info:
Tx - transmit
Rx - receive
SMP - SerialMuxProt/USB connection
MQTT - Mosquitto broker
end note

participant RadonUlzer as RU
note right of RU
running EndlessRun
end note

participant DroidControlShip as DCS
note right of DCS
running SignalReceiver
end note

participant InfrastructureElements as IE
note right of IE
running SmartTrafficLight
end note

== Setup ==

RU --> RU: Init Board + SMP
RU --> RU: Run Calibration
DCS --> DCS: Init Board + MQTT Broker
IE --> IE: Init Board + MQTT Broker
IE --> IE: wait 5s
IE --> IE: send settings: \n name \n orientation \n entry x \n entry y
IE --> DCS: TxMQTT Settings
DCS --> DCS: settingsCallback()
DCS --> DCS: Create list of IEs, each member with: \n name \n orientation \n entry x \n entry y

== Loop ==

RU -> RU: follows the line

hnote over RU : sending x,y coordinates and orientation
RU -> DCS: TxSMP Odometry (x,y,orientation)
DCS -> DCS: RxSMP Odometry

group TrafficHandler::process()

group CoordinateHandler::process()
hnote over DCS: \nSTATUS_IDLE\n
group isMovingTowards = true
hnote over DCS: \nSTATUS_TOWARDS\n
group checkOrientation = true
hnote over DCS: \nSTATUS_LOCKED_IN\n

group is robot close?
hnote over DCS: \nSTATUS_NEAR\n
else return process() as false, STATUS_LOCKED_IN
end
else return process() as false, STATUS_TOWARDS
end
else return process() as false, STATUS_PASSED
end
end
end

hnote over DCS: if status is LOCKED_IN, subscribe to the IE the robot is locked onto

IE -> DCS: TxMQTT trafficLightColors \n periodically publishing relevant color
DCS -> DCS: RxMQTT trafficLightColorsCallback\n deserialize

hnote over DCS: if status is NEAR, send last relevant color to RadonUlzer
DCS -> RU: TxSMP sendColor()

@enduml
Loading
Loading