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

Prepare v2.0.1 #163

Merged
merged 54 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e915d9a
Joined DCS to RU using slot
gabryelreyes Jul 12, 2024
bcbf5a0
Ignore tmp directory
gabryelreyes Jul 16, 2024
40237b5
Updated all worlds using the ZumoComSystem
gabryelreyes Jul 16, 2024
2fb54ae
Merge pull request #137 from BlueAndi/feature/join_dcs
gabryelreyes Jul 17, 2024
e00a7cb
Enable Python linting
gabryelreyes Jul 15, 2024
c93a53f
Fixed pylint findings
gabryelreyes Jul 15, 2024
f88f454
Fixed Motor Calibration by going to the correct state
gabryelreyes Jul 23, 2024
9374349
Merge pull request #139 from BlueAndi/bugfix/lineFollowerMotorCalib
gabryelreyes Jul 23, 2024
c71f8e0
Conditional use of 3D mesh for Zumo32U4 Models
gabryelreyes Jul 24, 2024
0c1ea31
Conditional use of mesh in ZumoComSystem
gabryelreyes Jul 24, 2024
d34f085
Platoon uses performance mode due to high number of robots
gabryelreyes Jul 24, 2024
cd4f128
Merge pull request #140 from BlueAndi/feature/3D_models
gabryelreyes Jul 25, 2024
2ac1e26
Removed explicit init of dataclass.
gabryelreyes Jul 26, 2024
cee6747
Merge pull request #136 from BlueAndi/feature/python_lint
gabryelreyes Jul 26, 2024
78816cd
ZumoComSystem is placed in the middle of the Zumo32U4.
gabryelreyes Aug 1, 2024
3fc706f
Added compass to ZumoComSystem
gabryelreyes Aug 1, 2024
6a06ea4
Merge pull request #141 from BlueAndi/feature/compass
jkerpe Aug 2, 2024
e621a1f
Separated obstacle into own class
gabryelreyes Aug 2, 2024
6bc1dd1
Merge pull request #143 from BlueAndi/improve_supervisor
jkerpe Aug 2, 2024
3eec036
Improved Pip caching and setup in the CI
gabryelreyes Aug 5, 2024
e28aaff
Pull requests are already checked on pushed commit
gabryelreyes Aug 5, 2024
8aa973f
Merge pull request #144 from BlueAndi/ci/improvement
gabryelreyes Aug 5, 2024
436d392
Added util to convert encoders and millimeters per second
gabryelreyes Aug 16, 2024
8784e9f
Applications send a receive speeds in mm/s instead of steps/s
gabryelreyes Aug 16, 2024
9570fe8
Moved utils from source to header file to aid compiler optimization
gabryelreyes Aug 16, 2024
87a8f48
Merge pull request #146 from BlueAndi/dev/speed_units
gabryelreyes Aug 16, 2024
7b4a767
Apply speeds to the differential drive according to Turtle SMP message
gabryelreyes Aug 19, 2024
6f167f7
Improved angular speed in linear speed calculation
gabryelreyes Aug 20, 2024
1df025c
Calculation of the robot angular speed from the linear speed left and…
BlueAndi Aug 20, 2024
8a411e4
Use int32_t number to avoid integer overflow.
BlueAndi Aug 20, 2024
718b03c
Merge pull request #150 from BlueAndi/bugfix/diffDriveAngularSpeed
gabryelreyes Aug 21, 2024
3ac917b
Revert wrong calculations
Aug 21, 2024
40b6bcc
Sync with release
Aug 21, 2024
d90bfc9
Add --cwd <dir> option for setting working directory.
nhjschulz Aug 29, 2024
4e82857
Merge pull request #151 from BlueAndi/dev/norbert
nhjschulz Aug 29, 2024
216343d
Fix #152 Wrong motor reset on direction change.
nhjschulz Aug 30, 2024
383da2f
Merge pull request #153 from BlueAndi/dev/norbert
nhjschulz Aug 30, 2024
7dc4260
Fix #152 Wrong motor reset on direction change.
nhjschulz Aug 30, 2024
bd17b73
Removed unnecessary method
gabryelreyes Sep 2, 2024
a29caea
Renamed channels and structures to simplify interface to DCS
gabryelreyes Sep 2, 2024
a932aa4
Use DrivingState to set the robot speeds
gabryelreyes Sep 2, 2024
96c2f8f
Fixed function name
gabryelreyes Sep 2, 2024
ad602c4
Fixed review findings
gabryelreyes Sep 3, 2024
76b72a2
Merge pull request #149 from BlueAndi/feature/app_turtle
gabryelreyes Sep 3, 2024
9f22942
Added script to convert hex to bin file for OTA updates
gabryelreyes Sep 18, 2024
3d5f7df
Added missing documentation
gabryelreyes Sep 26, 2024
11c51ee
Merge pull request #157 from BlueAndi/feature/OTA
BlueAndi Sep 26, 2024
551d9ab
User can specify the type that holds the sum of the Moving Average to…
gabryelreyes Sep 28, 2024
9ece128
Added missing decorator
gabryelreyes Sep 30, 2024
36628c5
Merge pull request #159 from BlueAndi/feature/movavg_types
gabryelreyes Sep 30, 2024
363148b
Fixed review findings
gabryelreyes Oct 18, 2024
fa27e05
WEBOTS_HOME was not correct set for linux and MacOS.
BlueAndi Oct 15, 2024
417ab82
Backslashes not allowed in python f-string.
BlueAndi Oct 20, 2024
d06dcbc
Merge branch 'main' into release/v2.0.x
BlueAndi Oct 20, 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
130 changes: 58 additions & 72 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ name: main
on:
push:
branches: [ '**' ]
pull_request:
branches: [ main ]
release:
# A release, pre-release, or draft of a release is published.
types: [ published ]
Expand All @@ -23,6 +21,20 @@ jobs:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "The name of the branch is ${{ github.ref }} and the repository is ${{ github.repository }}."

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install dependencies
run: |
pip install -r .github/workflows/requirements.txt

# Build all targets
build:
# The type of runner that the job will run on.
Expand All @@ -37,29 +49,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install PlatformIO
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt

- name: Compile ${{ matrix.environment }} firmware
run: platformio run --environment ${{ matrix.environment }}
Expand All @@ -77,29 +76,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install PlatformIO
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt

- name: Perform static checks on ${{ matrix.environment }}
run: platformio check --environment ${{ matrix.environment }} --fail-on-defect=medium --fail-on-defect=high
Expand All @@ -114,29 +100,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install PlatformIO
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt

- name: Run tests on native environment
run: platformio test --environment TestSim -vvv
Expand All @@ -154,29 +127,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install PlatformIO
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt

- name: Set up graphviz
uses: ts-graphviz/setup-graphviz@v2
Expand All @@ -189,4 +149,30 @@ jobs:

- name: Print doxygen warnings
if: ${{ failure() }}
run: cat ./doc/doxygen/doxygen_warnings.txt
run: cat ./doc/doxygen/doxygen_warnings.txt

# Lint Python code
lint:
# The type of runner that the job will run on.
runs-on: ubuntu-latest
needs: intro

# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install dependencies
run: |
pip install -r .github/workflows/requirements.txt

- name: Analysing the code with pylint
run: |
pylint ./webots/controllers/*/*.py
3 changes: 3 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
platformio==6.1.15
pylint==3.2.6
SerialMuxProt @ git+https://github.com/gabryelreyes/SerialMuxProt.git@10270033b0eb5e19cae39c35978745a778eb6acc#subdirectory=python/SerialMuxProt
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ lib/Webots
*.wbproj
webots/worlds/*.jpg
doc/doxygen/*/*
__pycache__
__pycache__
tmp/
43 changes: 43 additions & 0 deletions doc/architecture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,49 @@ The following applications are supported:

![differentialDrive](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/RadonUlzer/main/doc/architecture/uml/LogicalView/DifferentialDrive.plantuml)

Robot angular speed vs wheel linear speed\
$v [\frac{mm}{s}] = \frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2}$

* $v$: The linear speed of one wheel relative to the other $[\frac{mm}{s}]$.
* $w_r$: The robot's angular speed $[\frac{rad}{s}]$.
* $W$: The robot's wheel base $[mm]$.
* $v_L = -v_R$ by rotation about midpoint of the wheel axis.

Linear speed left\
$v_L [\frac{mm}{s}] = -\frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2}$

Linear speed right\
$v_R [\frac{mm}{s}] = \frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2}$

Consider encoder steps per m\
$v [\frac{steps}{s}] = \frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2} \cdot \frac{ENC [\frac{steps}{m}]}{1000}$

* $v$: The linear speed of one wheel relative to the other $[\frac{steps}{s}]$.
* $w_r$: The robot's angular speed $[\frac{rad}{s}]$.
* $W$: The robot's wheel base $[mm]$.
* $ENC$: The number of encoder steps per m $[\frac{steps}{m}]$.

Linear speed left\
$v_L [\frac{steps}{s}] = -\frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2} \cdot \frac{ENC [\frac{steps}{m}]}{1000}$

Linear speed right\
$v_R [\frac{steps}{s}] = \frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2} \cdot \frac{ENC [\frac{steps}{m}]}{1000}$

Consider robot linear speed center\
gabryelreyes marked this conversation as resolved.
Show resolved Hide resolved

Linear speed left\
$v_L [\frac{steps}{s}] = \frac{v_{Linear}}{2} [\frac{steps}{s}] -\frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2} \cdot \frac{ENC [\frac{steps}{m}]}{1000}$

Linear speed right\
$v_R [\frac{steps}{s}] = \frac{v_{Linear}}{2} [\frac{steps}{s}] + \frac{w_r [\frac{rad}{s}] \cdot W [mm]}{2} \cdot \frac{ENC [\frac{steps}{m}]}{1000}$

Consider angular speed in mrad per s\
Linear speed left\
jkerpe marked this conversation as resolved.
Show resolved Hide resolved
$v_L [\frac{steps}{s}] = \frac{v_{Linear}}{2} [\frac{steps}{s}] -\frac{w_r [\frac{mrad}{s}] \cdot W [mm]}{2 \cdot 1000} \cdot \frac{ENC [\frac{steps}{m}]}{1000}$

Linear speed right\
$v_R [\frac{steps}{s}] = \frac{v_{Linear}}{2} [\frac{steps}{s}] + \frac{w_r [\frac{mrad}{s}] \cdot W [mm]}{2 \cdot 1000} \cdot \frac{ENC [\frac{steps}{m}]}{1000}$

#### Odometry

![odometry](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/RadonUlzer/main/doc/architecture/uml/LogicalView/Odometry.plantuml)
Expand Down
2 changes: 1 addition & 1 deletion doc/architecture/uml/LogicalView/Service.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ package "Service" as serviceLayer {
on the track.
end note

class MovAvg < T, length > <<service>>
class MovAvg < T, U, length > <<service>>

note top of MovAvg
Moving average filter which can be
Expand Down
3 changes: 1 addition & 2 deletions lib/APPCalib/src/MotorSpeedCalibrationState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ void MotorSpeedCalibrationState::finishCalibration(StateMachine& sm)
}
else
{
int32_t maxSpeed32 =
static_cast<int32_t>(maxSpeed) * 1000 / static_cast<int32_t>(RobotConstants::ENCODER_STEPS_PER_M);
int32_t maxSpeed32 = Util::stepsPerSecondToMillimetersPerSecond(maxSpeed);

LOG_INFO_VAL("Calibrated max. speed (steps/s): ", maxSpeed);
LOG_INFO_VAL("Calibrated max. speed (mm/s): ", maxSpeed32);
Expand Down
17 changes: 12 additions & 5 deletions lib/APPConvoyFollower/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <DifferentialDrive.h>
#include <Odometry.h>
#include <Logging.h>
#include <Util.h>

/******************************************************************************
* Compiler Switches
Expand Down Expand Up @@ -189,7 +190,8 @@ void App::handleRemoteCommand(const Command& cmd)
break;

case SMPChannelPayload::CmdId::CMD_ID_GET_MAX_SPEED:
rsp.maxMotorSpeed = Board::getInstance().getSettings().getMaxSpeed();
rsp.maxMotorSpeed =
Util::stepsPerSecondToMillimetersPerSecond(Board::getInstance().getSettings().getMaxSpeed());
break;

case SMPChannelPayload::CmdId::CMD_ID_SET_INIT_POS:
Expand Down Expand Up @@ -252,6 +254,9 @@ void App::reportVehicleData()
uint8_t averageCounts = 0U;
uint8_t leftCounts = 0U;
uint8_t rightCounts = 0U;
int16_t leftSpeed = speedometer.getLinearSpeedLeft();
int16_t rightSpeed = speedometer.getLinearSpeedRight();
int16_t centerSpeed = speedometer.getLinearSpeedCenter();

proximitySensors.read();
leftCounts = proximitySensors.countsFrontWithLeftLeds();
Expand All @@ -265,9 +270,9 @@ void App::reportVehicleData()
payload.xPos = xPos;
payload.yPos = yPos;
payload.orientation = odometry.getOrientation();
payload.left = speedometer.getLinearSpeedLeft();
payload.right = speedometer.getLinearSpeedRight();
payload.center = speedometer.getLinearSpeedCenter();
payload.left = Util::stepsPerSecondToMillimetersPerSecond(leftSpeed);
payload.right = Util::stepsPerSecondToMillimetersPerSecond(rightSpeed);
payload.center = Util::stepsPerSecondToMillimetersPerSecond(centerSpeed);
payload.proximity = static_cast<SMPChannelPayload::Range>(averageCounts);

/* Ignoring return value, as error handling is not available. */
Expand Down Expand Up @@ -359,7 +364,9 @@ void App_motorSpeedSetpointsChannelCallback(const uint8_t* payload, const uint8_
if ((nullptr != payload) && (SPEED_SETPOINT_CHANNEL_DLC == payloadSize))
{
const SpeedData* motorSpeedData = reinterpret_cast<const SpeedData*>(payload);
DrivingState::getInstance().setTargetSpeeds(motorSpeedData->left, motorSpeedData->right);
int16_t leftSpeed = Util::millimetersPerSecondToStepsPerSecond(motorSpeedData->left);
int16_t rightSpeed = Util::millimetersPerSecondToStepsPerSecond(motorSpeedData->right);
DrivingState::getInstance().setTargetSpeeds(leftSpeed, rightSpeed);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/APPConvoyFollower/src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class App
/**
* Moving average filter for proximity sensors.
*/
MovAvg<uint8_t, MOVAVG_PROXIMITY_SENSOR_NUM_MEASUREMENTS> m_movAvgProximitySensor;
MovAvg<uint8_t, uint16_t, MOVAVG_PROXIMITY_SENSOR_NUM_MEASUREMENTS> m_movAvgProximitySensor;

/**
* Report the current vehicle data.
Expand Down
14 changes: 7 additions & 7 deletions lib/APPConvoyFollower/src/SerialMuxChannels.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,16 @@ typedef struct _CommandResponse
/** Response Payload. */
union
{
int16_t maxMotorSpeed; /**< Max speed [steps/s]. */
int32_t maxMotorSpeed; /**< Max speed [mm/s]. */
};
} __attribute__((packed)) CommandResponse;

/** Struct of the "Speed" channel payload. */
typedef struct _SpeedData
{
int16_t left; /**< Left motor speed [steps/s] */
int16_t right; /**< Right motor speed [steps/s] */
int16_t center; /**< Center motor speed [steps/s] */
int32_t left; /**< Left motor speed [mm/s] */
int32_t right; /**< Right motor speed [mm/s] */
int32_t center; /**< Center motor speed [mm/s] */
} __attribute__((packed)) SpeedData;

/** Struct of the "Current Vehicle Data" channel payload. */
Expand All @@ -187,9 +187,9 @@ typedef struct _VehicleData
int32_t xPos; /**< X position [mm]. */
int32_t yPos; /**< Y position [mm]. */
int32_t orientation; /**< Orientation [mrad]. */
int16_t left; /**< Left motor speed [steps/s]. */
int16_t right; /**< Right motor speed [steps/s]. */
int16_t center; /**< Center speed [steps/s]. */
int32_t left; /**< Left motor speed [mm/s]. */
int32_t right; /**< Right motor speed [mm/s]. */
int32_t center; /**< Center speed [mm/s]. */
SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */
} __attribute__((packed)) VehicleData;

Expand Down
Loading