Skip to content

Commit 0277d84

Browse files
Miekale embedded structure (#6)
* updating arch * Adding embedded directory, changing src -> autonomy * repairing actions * merging to main * actions updates * fix: naming convention * Fix code style issues with Autopep8 * Fix code style issues with clang_format --------- Co-authored-by: WATonomousAdmin <admin@watonomous.ca>
1 parent d072076 commit 0277d84

File tree

98 files changed

+306
-330
lines changed

Some content is hidden

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

98 files changed

+306
-330
lines changed

.github/templates/check_src_changes/action.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,68 @@ runs:
1212
with:
1313
fetch-depth: 0
1414

15-
- name: Find changed files outside of src directory
16-
id: changed-files-outside-src
15+
- name: Find changed files outside of development folders
16+
id: changed-files-outside-development
1717
uses: tj-actions/changed-files@v42
1818
with:
19-
files: '!src/**'
19+
files: |
20+
!autonomy/**
21+
!embedded/**
2022
21-
- name: Find changed files inside src/wato_msgs folder
23+
- name: Find changed files inside autonomy/wato_msgs folder
2224
id: changed-files-wato-msgs
2325
uses: tj-actions/changed-files@v42
2426
with:
25-
files: src/wato_msgs/**
27+
files: autonomy/wato_msgs/**
2628

27-
- name: Find changed files inside src/controller folder
29+
- name: Find changed files inside autonomy/controller folder
2830
id: changed-files-controller
2931
uses: tj-actions/changed-files@v42
3032
with:
31-
files: src/controller/**
33+
files: autonomy/controller/**
3234

33-
- name: Get changed files inside src/interfacing folder
35+
- name: Get changed files inside autonomy/interfacing folder
3436
id: changed-files-interfacing
3537
uses: tj-actions/changed-files@v42
3638
with:
37-
files: src/interfacing/**
39+
files: autonomy/interfacing/**
3840

39-
- name: Get changed files inside src/perception folder
41+
- name: Get changed files inside autonomy/perception folder
4042
id: changed-files-perception
4143
uses: tj-actions/changed-files@v42
4244
with:
43-
files: src/perception/**
45+
files: autonomy/perception/**
4446

45-
- name: Get changed files inside src/samples folder
47+
- name: Get changed files inside autonomy/samples folder
4648
id: changed-files-samples
4749
uses: tj-actions/changed-files@v42
4850
with:
49-
files: src/samples/**
51+
files: autonomy/samples/**
5052

51-
- name: Get changed files inside src/simulation folder
53+
- name: Get changed files inside autonomy/simulation folder
5254
id: changed-files-simulation
5355
uses: tj-actions/changed-files@v42
5456
with:
55-
files: src/simulation/**
57+
files: autonomy/simulation/**
58+
59+
- name: Find changed files inside embedded folder
60+
id: changed-files-embedded
61+
uses: tj-actions/changed-files@v42
62+
with:
63+
files: embedded/**
5664

5765
- name: Create list of changed modules
5866
id: output-changes
5967
env:
6068
INFRASTRUCTURE_CHANGED: >
6169
${{ steps.changed-files-wato-msgs.outputs.any_changed == 'true'
62-
|| steps.changed-files-outside-src.outputs.any_changed == 'true' }}
70+
|| steps.changed-files-outside-development.outputs.any_changed == 'true' }}
6371
CONTROLLER_CHANGED: ${{ steps.changed-files-controller.outputs.any_changed }}
6472
INTERFACING_CHANGED: ${{ steps.changed-files-interfacing.outputs.any_changed }}
6573
PERCEPTION_CHANGED: ${{ steps.changed-files-perception.outputs.any_changed }}
6674
SAMPLES_CHANGED: ${{ steps.changed-files-samples.outputs.any_changed }}
6775
SIMULATION_CHANGED: ${{ steps.changed-files-simulation.outputs.any_changed }}
76+
EMBEDDED_CHANGED: ${{ steps.changed-files-embedded.outputs.any_changed }}
6877

6978
run: ${{ github.action_path }}/check_src_changes.sh
7079
shell: bash

.github/templates/check_src_changes/check_src_changes.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,27 @@ if [ $SIMULATION_CHANGED == 'true' ]; then
3434
echo "Detected simulation changes"
3535
MODIFIED_MODULES+="simulation "
3636
fi
37+
# Embedded
38+
if [ $EMBEDDED_CHANGED == 'true' ]; then
39+
echo "::notice:: Detected infrastructure changes"
40+
MODIFIED_MODULES+="embedded"
41+
fi
3742

3843
# Infrastructure
3944
if [ $INFRASTRUCTURE_CHANGED == 'true' ]; then
4045
echo "::notice:: Detected infrastructure changes"
41-
MODIFIED_MODULES="infrastructure"
46+
MODIFIED_MODULES+="infrastructure"
47+
fi
48+
49+
# Embedded
50+
if [ $EMBEDDED_CHANGED == 'true' ]; then
51+
echo "::notice:: Detected infrastructure changes"
52+
MODIFIED_MODULES="embedded"
4253
else
4354
echo "::notice:: MODIFIED_MODULES are $MODIFIED_MODULES"
4455
fi
4556

57+
58+
4659
# Output lis
4760
echo "modified_modules=$MODIFIED_MODULES" >> $GITHUB_OUTPUT

.github/templates/docker_context/docker_context.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,38 @@ json_objects=()
1313

1414
# Check for infrastructure changes
1515
TEST_ALL=false
16-
MODIFIED_MODULES="infrastructure"
16+
1717
if [[ $MODIFIED_MODULES = "infrastructure" ]]; then
1818
TEST_ALL=true
1919
echo Testing all "$MODULES_DIR"
2020
fi
2121

2222
# Loop through each module
2323
while read -r module; do
24+
2425
# Retrieve docker compose service names
2526
services=$(docker compose -f "$module" --profile deploy --profile develop config --services)
2627
module_out=$(basename $(echo "$module" | sed -n 's/modules\/docker-compose\.\(.*\)\.yaml/\1/p'))
28+
2729
# Skip simulation module
28-
if [[ 'simulation' = $module_out ]]; then
30+
# TODO: Add custom handling for embedded testing
31+
if [[ 'simulation' = $module_out || 'embedded' = $module_out ]]; then
2932
continue
3033
fi
34+
3135
# Only work with modules that are modified
3236
if [[ $MODIFIED_MODULES != *$module_out* && $TEST_ALL = "false" ]]; then
3337
continue
3438
fi
39+
3540
# Loop through each service
3641
while read -r service_out; do
3742
# Temporarily skip perception services that have too large image size
3843
# if [[ "$service_out" == "lane_detection" ]] || \
3944
# [[ "$service_out" == "camera_object_detection" ]] || \
4045
# continue
4146
# fi
42-
# Construct JSON object for each service with module and service name
47+
4348
# TODO: Expose whole profile object to env
4449
dockerfile=$(docker compose -f "$module" --profile deploy --profile develop config | yq ".services.$service_out.build.dockerfile")
4550
json_object=$(jq -nc --arg module_out "$module_out" --arg service_out "$service_out" --arg dockerfile "$dockerfile" \
@@ -49,6 +54,7 @@ while read -r module; do
4954

5055
done <<< "$services"
5156
done <<< "$modules"
57+
5258
# Convert the array of JSON objects to a single JSON array
5359
json_services=$(jq -nc '[( $ARGS.positional[] | fromjson )]' --args -- ${json_objects[*]})
5460

.github/workflows/linting_auto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Python
2727
uses: actions/setup-python@v1
2828
with:
29-
python-version: 3.9.21
29+
python-version: 3.9.22
3030

3131
- name: Install Python dependencies
3232
run: pip install autopep8 clang-format

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ humanoid
1616
├── modules
1717
│ └── docker-compose.samples.yaml
1818
├── scripts
19-
├── src
19+
├── autonomy
2020
│ ├── perception
2121
│ ├── wato_msgs
2222
│ │ └── sample_msgs
@@ -34,6 +34,10 @@ humanoid
3434
│ ├── controller
3535
│ ├── interfacing
3636
│ ├── simulation
37+
├── embedded
38+
│ ├── ESP32
39+
│ ├── STM32
40+
│ ├── torque-testing
3741
└── watod
3842
```
3943
## Documentation
@@ -43,7 +47,7 @@ Before developing please read these documents.
4347

4448
1. [Documentation Structure of Repo](docs/README.md)
4549
2. [WATO Infrastructure Development Docs](https://github.com/WATonomous/wato_monorepo/tree/main/docs/dev/)
46-
3. [ROS Node/Core Structure Docs](src/samples/README.md)
50+
3. [ROS Node/Core Structure Docs](autonomy/samples/README.md)
4751

4852
## Dependencies:
4953
- Ubuntu >= 22.04, Windows (WSL), and MacOS.
File renamed without changes.
File renamed without changes.

src/samples/cpp/aggregator/include/aggregator_core.hpp renamed to autonomy/samples/cpp/aggregator/include/aggregator_core.hpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33

44
#include "rclcpp/rclcpp.hpp"
55

6-
#include "sample_msgs/msg/unfiltered.hpp"
76
#include "sample_msgs/msg/filtered_array.hpp"
7+
#include "sample_msgs/msg/unfiltered.hpp"
88

9-
namespace samples
10-
{
9+
namespace samples {
1110

1211
/**
1312
* Implementation of the internal logic used by the Aggregator Node to
1413
* calculate the operating frequency of topics.
1514
*/
16-
class AggregatorCore
17-
{
15+
class AggregatorCore {
1816
public:
1917
/**
2018
* Aggregator constructor.
@@ -44,16 +42,14 @@ class AggregatorCore
4442
*
4543
* @param msg
4644
*/
47-
void add_raw_msg(
48-
const sample_msgs::msg::Unfiltered::SharedPtr msg);
45+
void add_raw_msg(const sample_msgs::msg::Unfiltered::SharedPtr msg);
4946
/**
5047
* Used to keep track of latest timestamp and number of messages received
5148
* over the "filtered" topic. Should be called before filtered_frequency().
5249
*
5350
* @param msg
5451
*/
55-
void add_filtered_msg(
56-
const sample_msgs::msg::FilteredArray::SharedPtr msg);
52+
void add_filtered_msg(const sample_msgs::msg::FilteredArray::SharedPtr msg);
5753

5854
private:
5955
// Number of message received on "unfiltered" and "filtered" topics.
@@ -70,6 +66,6 @@ class AggregatorCore
7066
int64_t latest_filtered_time_;
7167
};
7268

73-
} // namespace samples
69+
} // namespace samples
7470

75-
#endif // AGGREGATOR_CORE_HPP_
71+
#endif // AGGREGATOR_CORE_HPP_

src/samples/cpp/aggregator/include/aggregator_node.hpp renamed to autonomy/samples/cpp/aggregator/include/aggregator_node.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33

44
#include "rclcpp/rclcpp.hpp"
55

6-
#include "sample_msgs/msg/unfiltered.hpp"
76
#include "sample_msgs/msg/filtered_array.hpp"
7+
#include "sample_msgs/msg/unfiltered.hpp"
88

99
#include "aggregator_core.hpp"
1010

1111
/**
1212
* Implementation of a ROS2 node that listens to the "unfiltered" and "filtered"
1313
* topics and echoes the operating frequency of the topic to the console.
1414
*/
15-
class AggregatorNode : public rclcpp::Node
16-
{
15+
class AggregatorNode : public rclcpp::Node {
1716
public:
1817
// Configure pubsub nodes to keep last 20 messages.
1918
// https://docs.ros.org/en/foxy/Concepts/About-Quality-of-Service-Settings.html
@@ -26,31 +25,32 @@ class AggregatorNode : public rclcpp::Node
2625

2726
private:
2827
/**
29-
* A ROS2 subscription node callback used to unpack raw data from the "unfiltered"
30-
* topic and echo the operating frequency of the topic to the console.
28+
* A ROS2 subscription node callback used to unpack raw data from the
29+
* "unfiltered" topic and echo the operating frequency of the topic to the
30+
* console.
3131
*
3232
* @param msg a raw message from the "unfiltered" topic
3333
*/
34-
void unfiltered_callback(
35-
const sample_msgs::msg::Unfiltered::SharedPtr msg);
34+
void unfiltered_callback(const sample_msgs::msg::Unfiltered::SharedPtr msg);
3635

3736
/**
3837
* A ROS2 subscription node callback used to unpack processed data from the
39-
* "filtered" topic and echo the operating frequency of the topic to the console.
38+
* "filtered" topic and echo the operating frequency of the topic to the
39+
* console.
4040
*
4141
* @param msg a processed message from the "filtered" topic
4242
*/
43-
void filtered_callback(
44-
const sample_msgs::msg::FilteredArray::SharedPtr msg);
43+
void filtered_callback(const sample_msgs::msg::FilteredArray::SharedPtr msg);
4544

4645
// ROS2 subscriber listening to the unfiltered topic.
4746
rclcpp::Subscription<sample_msgs::msg::Unfiltered>::SharedPtr raw_sub_;
4847

4948
// ROS2 subscriber listening to the filtered topic.
50-
rclcpp::Subscription<sample_msgs::msg::FilteredArray>::SharedPtr filtered_sub_;
49+
rclcpp::Subscription<sample_msgs::msg::FilteredArray>::SharedPtr
50+
filtered_sub_;
5151

5252
// Object containing methods to determine the operating frequency on topics.
5353
samples::AggregatorCore aggregator_;
5454
};
5555

56-
#endif // AGGREGATOR_NODE_HPP_
56+
#endif // AGGREGATOR_NODE_HPP_

src/samples/cpp/aggregator/launch/aggregator.launch.py renamed to autonomy/samples/cpp/aggregator/launch/aggregator.launch.py

File renamed without changes.

0 commit comments

Comments
 (0)