Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
251 commits
Select commit Hold shift + click to select a range
0ea7022
ooops
Mar 3, 2025
360ef06
add svea_localization,modifying to ros2 in progress
Mar 22, 2025
cf824d9
2025/03/24 Meeting update
Mar 24, 2025
1b7f8f6
2025/03/24 Meeting update
Mar 24, 2025
e76035e
Added rmw-zenoh in dockerfile, added svea_example
Apr 10, 2025
d5ba0c7
General updates to util scripts and svea_core
kaarmu Apr 10, 2025
54289ac
2025/04/16 Meeting Update
Apr 16, 2025
7ecd314
20250428 update
Apr 28, 2025
5598423
update to interface design pattern
kaarmu Apr 30, 2025
ce0ed94
cosmetic changes
kaarmu May 1, 2025
5de4d10
cosmetic changes
kaarmu May 1, 2025
8c491e9
minor clean-up
kaarmu May 1, 2025
11eeed9
Fundamental changes.
kaarmu May 2, 2025
1f8bbf7
ignore pycache
May 2, 2025
04f9c09
ignore pycache
May 2, 2025
fb497b1
git ignore pycache
May 2, 2025
328755b
update gitignore
May 2, 2025
4b0286b
More work on simulator
kaarmu May 3, 2025
c4f6426
Changes to setup scripts
kaarmu May 3, 2025
d574325
try (unsuccessfully, but without crash) to run pure_pursuit in simula…
kaarmu May 3, 2025
5aedd0d
add publishers and subscribers
kaarmu May 3, 2025
c56a41e
progressing on simulation, still not working
kaarmu May 4, 2025
24b9acb
minor structural changes to rosonic
kaarmu May 6, 2025
217dc92
05/12/2025 meeting update
May 12, 2025
914c44e
update on 05/12/2025
May 12, 2025
5a67854
Confirmed that symlink works
kaarmu May 13, 2025
2b88bc9
fix some bugs in rosnoic.Subscriber, fix issue about odometry from si…
May 14, 2025
ecbaf1d
Simulation and simulated lidar workes, 3d model display in vizulization
May 25, 2025
9585fc8
Teleop control in simulation with teleop_twist_keyboard added
May 27, 2025
e5b7de7
typo fixed
May 27, 2025
5981df3
add micro-ros agent in docker
Jun 26, 2025
7f3be22
fixed typo in config
nilskiefer Jul 1, 2025
119c7b5
Update config.sh
lnch223 Jul 1, 2025
b4fa233
Update Dockerfile
lnch223 Jul 1, 2025
95664e3
Update Dockerfile
lnch223 Jul 1, 2025
e34f9a7
mac compatibility
nilskiefer Jul 1, 2025
776b857
adjusted perms to resemble linux more
nilskiefer Jul 1, 2025
9a9eae6
Merge pull request #2 from nilskiefer/fix-for-mac
lnch223 Jul 2, 2025
8ef5826
fixed if statement typo
nilskiefer Jul 2, 2025
1a13035
Update run
lnch223 Jul 16, 2025
1cbf046
Merge pull request #3 from nilskiefer/fixed-typo
liammcintyre15 Jul 17, 2025
8b92c94
added mpc control and example, but still in working progress
Jul 18, 2025
25280bf
add mpc (in progress), clean up
Jul 18, 2025
cfb98e9
Merge remote-tracking branch 'refs/remotes/origin/main'
Jul 18, 2025
739744d
Added mocap4ros2_qualisys dep import to build process
nilskiefer Jul 18, 2025
7ef560e
Merge pull request #4 from nilskiefer/feature/docker-mocap-dep-import
nilskiefer Jul 18, 2025
ded82cb
Added comment describing how to import qualisys module
nilskiefer Jul 18, 2025
f756136
remove svea_msgs
Jul 18, 2025
a707947
Merge remote-tracking branch 'refs/remotes/origin/main'
Jul 18, 2025
01b7a7d
teleop example bug fixed
Jul 18, 2025
f95f266
actuation interface to low-level reverse fixed
Jul 18, 2025
4f22427
added complete build for arm64 (mac)
nilskiefer Jul 21, 2025
3fd88dc
added missing is_darwin check for mac causing redundant error
nilskiefer Jul 21, 2025
2cf1997
moved reused function to top
nilskiefer Jul 21, 2025
3f76096
test version 1.0 update
Jul 22, 2025
1775e8c
tuning pure pursuit
Jul 22, 2025
5731903
minor update on localization parameters
Annika-wyt Jul 22, 2025
71aa699
transform updated/
Jul 22, 2025
ed429ad
update
Jul 22, 2025
fd34546
added missing pip dep for mocap
nilskiefer Jul 22, 2025
4ed06c8
update localiztion params, and launch file
Jul 23, 2025
bc2b7b5
mpc goal position complete
Jul 25, 2025
9579d95
mpc path tracking complete
Jul 25, 2025
f6498d4
update rosonic
kaarmu Aug 4, 2025
1c56426
fix rosonic bug with nameless resources
kaarmu Aug 5, 2025
146db9c
marker placer complete
Aug 5, 2025
b1bf097
pure_pursuit goal display update
Aug 5, 2025
9278f8e
Planned Path and Past Path can be displayed with ShowPath in util, ex…
Aug 8, 2025
b72d3f8
add path.py for ShowPath
Aug 8, 2025
b7aa899
Multi example in progress, unified svea core launch file in progress
Aug 11, 2025
3475a3d
map server launch file add missing map_path
Aug 12, 2025
4a6f21b
mpc delete missing arg
Aug 12, 2025
392cd10
multi model displacement with namespace in foxglove fixed
Aug 13, 2025
5db0cd0
update readme
Aug 13, 2025
3afea11
add docs
Aug 15, 2025
689cbbe
added tutorials doc
Aug 19, 2025
ae8b5a0
docs updated
Aug 20, 2025
c793f13
update email for document
Aug 26, 2025
3cfdd34
teleop debug
Aug 27, 2025
b007d80
localization test
nilskiefer Aug 27, 2025
a0fa786
udpate lidar.xml and amcl localize.xml to fix AMCL
Annika-wyt Aug 29, 2025
199c690
localization update still have issues
Annika-wyt Sep 1, 2025
69e2c1c
test publish initpose
Sep 2, 2025
9fd7024
Merge remote-tracking branch 'refs/remotes/origin/main'
Sep 2, 2025
a1bdba7
psl map update
Sep 12, 2025
16b2cb4
trypo in launch file
Sep 13, 2025
94397f1
AMCL fixed
Sep 29, 2025
03e1d72
Merge upstream (KTH-SML/svea) into fork (KTH-SML/svea_jazzy) in prepa…
kaarmu Sep 30, 2025
5c3bbdd
Clean up requirements.txt by removing unused packages and ensuring ne…
kaarmu Sep 30, 2025
9c431ce
Update README.md for clarity and accuracy; fix typos and remove outda…
kaarmu Sep 30, 2025
c261b1b
Update copyright year in LICENSE file to 2025
kaarmu Sep 30, 2025
06719ec
Remove kitware-archive.sh script as it is no longer needed
kaarmu Sep 30, 2025
d55d620
Add configuration files to disable Fast-DDS SHM transport for UDPv4
kaarmu Sep 30, 2025
26b80c5
Remove remote_ros function and associated script to simplify entrypoint
kaarmu Sep 30, 2025
3b4ac0a
Refactor is_darwin function and its usage for clarity in main function
kaarmu Sep 30, 2025
6889534
Rename foxglove/MPC Navigation.json
kaarmu Sep 30, 2025
1ea11f8
Update package.xml and setup.py files for svea_core, svea_examples, a…
kaarmu Sep 30, 2025
17abd4d
Remove obsolete test files for copyright, flake8, and PEP257 checks i…
kaarmu Sep 30, 2025
a45c5da
Update package dependencies in svea_core and svea_localization for im…
kaarmu Sep 30, 2025
6cacd3a
svea_example setup.py typo fixed
Sep 30, 2025
433ab78
encoder and imu high level calibrater
Oct 10, 2025
ca36b80
typo fixed
Oct 10, 2025
8b4f9ac
add to svea_launch
Oct 10, 2025
46832dd
minor fixs
Oct 15, 2025
c6a22ce
Refactor return statement for relative name handling
kaarmu Oct 16, 2025
10cbd8c
update
Oct 16, 2025
d16a267
Add __rosonic_started__ attribute and related methods for resource st…
kaarmu Oct 17, 2025
41a02d9
Refactor LocalizationInterface to improve odometry transformation and…
kaarmu Oct 17, 2025
f26f091
Fix type hinting for resource methods
kaarmu Oct 20, 2025
8ba6a0b
Add future annotations import to rosonic.py
kaarmu Oct 20, 2025
2b928b6
Refactor assertion methods to use self
kaarmu Oct 20, 2025
679798b
Fix method calls for owner registration checks
kaarmu Oct 20, 2025
0097fed
Fix owner check in _is_registered method
kaarmu Oct 20, 2025
7424094
Fix assertion call for topic startup check
kaarmu Oct 20, 2025
9cccc3a
Fix assertion call for topic startup check
kaarmu Oct 20, 2025
8e67980
Turning updategit statusgit status Something THAT WORKSgit statusgit …
Annika-wyt Oct 21, 2025
2e6d21f
Pure Pursuit works
Annika-wyt Oct 21, 2025
cd45094
vscode ssh update
kaarmu Oct 23, 2025
4b698a4
filter fixed
kaarmu Oct 23, 2025
86723c3
lidar stamp filter created
Oct 23, 2025
a93337b
add lidar filter
Oct 23, 2025
40cb55b
delete old timestamper
Oct 23, 2025
a86249a
lidar filter added
Oct 23, 2025
9bb9b15
typo fixed
Oct 23, 2025
5cf7e74
sync amcl yaml
Oct 23, 2025
c514a2b
minor fix
Oct 23, 2025
5def8a1
add Time import for lidar timer
Oct 23, 2025
03f9122
tx2 floor2 works
kaarmu Oct 23, 2025
68e62af
update docker build
kaarmu Oct 23, 2025
a4a2a4a
tx2 tested floor2 version
kaarmu Oct 24, 2025
fa6fc8d
Merge remote-tracking branch 'refs/remotes/origin/main' into main
kaarmu Oct 24, 2025
c4a550e
Migration to ROS 2 (#55)
kaarmu Sep 30, 2025
4048015
ooops
Mar 3, 2025
b6e4d62
add svea_localization,modifying to ros2 in progress
Mar 22, 2025
a8912a2
2025/03/24 Meeting update
Mar 24, 2025
b6edc55
Added rmw-zenoh in dockerfile, added svea_example
Apr 10, 2025
292ccc3
General updates to util scripts and svea_core
kaarmu Apr 10, 2025
5eba1de
2025/04/16 Meeting Update
Apr 16, 2025
7e04bea
20250428 update
Apr 28, 2025
06d7265
update to interface design pattern
kaarmu Apr 30, 2025
feb3942
cosmetic changes
kaarmu May 1, 2025
04f8811
minor clean-up
kaarmu May 1, 2025
fc0a5e5
Fundamental changes.
kaarmu May 2, 2025
9530146
More work on simulator
kaarmu May 3, 2025
b7d27b4
try (unsuccessfully, but without crash) to run pure_pursuit in simula…
kaarmu May 3, 2025
25374c1
add publishers and subscribers
kaarmu May 3, 2025
6b1c307
progressing on simulation, still not working
kaarmu May 4, 2025
63ecaea
minor structural changes to rosonic
kaarmu May 6, 2025
4a4c8ce
05/12/2025 meeting update
May 12, 2025
c7c760f
update on 05/12/2025
May 12, 2025
98e499e
Confirmed that symlink works
kaarmu May 13, 2025
7e69fbf
fix some bugs in rosnoic.Subscriber, fix issue about odometry from si…
May 14, 2025
23cea86
Simulation and simulated lidar workes, 3d model display in vizulization
May 25, 2025
13c9db2
Teleop control in simulation with teleop_twist_keyboard added
May 27, 2025
5c81b86
add micro-ros agent in docker
Jun 26, 2025
cb17e15
added mpc control and example, but still in working progress
Jul 18, 2025
e883e03
add mpc (in progress), clean up
Jul 18, 2025
9c8cf4b
fixed typo in config
nilskiefer Jul 1, 2025
b2b202d
mac compatibility
nilskiefer Jul 1, 2025
ec4846a
adjusted perms to resemble linux more
nilskiefer Jul 1, 2025
8018fe5
Update run
lnch223 Jul 16, 2025
4926f6a
fixed if statement typo
nilskiefer Jul 2, 2025
a7cdb4c
remove svea_msgs
Jul 18, 2025
d77a48e
Added mocap4ros2_qualisys dep import to build process
nilskiefer Jul 18, 2025
ba8900f
teleop example bug fixed
Jul 18, 2025
3cfe16c
actuation interface to low-level reverse fixed
Jul 18, 2025
9cdc989
added missing is_darwin check for mac causing redundant error
nilskiefer Jul 21, 2025
3b897b5
moved reused function to top
nilskiefer Jul 21, 2025
add23fe
test version 1.0 update
Jul 22, 2025
1cc2ae4
tuning pure pursuit
Jul 22, 2025
94527d2
minor update on localization parameters
Annika-wyt Jul 22, 2025
95538e7
update
Jul 22, 2025
6596846
update localiztion params, and launch file
Jul 23, 2025
1397ed2
mpc goal position complete
Jul 25, 2025
a5486db
mpc path tracking complete
Jul 25, 2025
695fd06
update rosonic
kaarmu Aug 4, 2025
aa6fe4c
fix rosonic bug with nameless resources
kaarmu Aug 5, 2025
4763e81
marker placer complete
Aug 5, 2025
0c69fa6
pure_pursuit goal display update
Aug 5, 2025
1e3fec8
Planned Path and Past Path can be displayed with ShowPath in util, ex…
Aug 8, 2025
d760f62
Multi example in progress, unified svea core launch file in progress
Aug 11, 2025
83d9cbb
map server launch file add missing map_path
Aug 12, 2025
ac36676
mpc delete missing arg
Aug 12, 2025
33697c2
multi model displacement with namespace in foxglove fixed
Aug 13, 2025
fdad386
update readme
Aug 13, 2025
150cbd4
add docs
Aug 15, 2025
63904b3
added tutorials doc
Aug 19, 2025
b273a4d
docs updated
Aug 20, 2025
8481da9
update email for document
Aug 26, 2025
20c98e3
teleop debug
Aug 27, 2025
ddd8257
localization test
nilskiefer Aug 27, 2025
0d088e5
test publish initpose
Sep 2, 2025
f540a01
udpate lidar.xml and amcl localize.xml to fix AMCL
Annika-wyt Aug 29, 2025
88b2948
localization update still have issues
Annika-wyt Sep 1, 2025
a0d7a07
psl map update
Sep 12, 2025
b8a9c99
trypo in launch file
Sep 13, 2025
caf0e95
AMCL fixed
Sep 29, 2025
73b145b
Clean up requirements.txt by removing unused packages and ensuring ne…
kaarmu Sep 30, 2025
11be864
Update README.md for clarity and accuracy; fix typos and remove outda…
kaarmu Sep 30, 2025
1490236
Add configuration files to disable Fast-DDS SHM transport for UDPv4
kaarmu Sep 30, 2025
31d8977
Remove remote_ros function and associated script to simplify entrypoint
kaarmu Sep 30, 2025
2667bcd
Refactor is_darwin function and its usage for clarity in main function
kaarmu Sep 30, 2025
e2fdef6
Update package.xml and setup.py files for svea_core, svea_examples, a…
kaarmu Sep 30, 2025
cb93068
svea_example setup.py typo fixed
Sep 30, 2025
0e0d30d
encoder and imu high level calibrater
Oct 10, 2025
10c32a5
minor fixs
Oct 15, 2025
26028c3
update
Oct 16, 2025
95af413
Add __rosonic_started__ attribute and related methods for resource st…
kaarmu Oct 17, 2025
513c621
Refactor LocalizationInterface to improve odometry transformation and…
kaarmu Oct 17, 2025
e1c020b
Add future annotations import to rosonic.py
kaarmu Oct 20, 2025
c35b585
Refactor assertion methods to use self
kaarmu Oct 20, 2025
381e854
Fix assertion call for topic startup check
kaarmu Oct 20, 2025
1d65922
Fix assertion call for topic startup check
kaarmu Oct 20, 2025
f4fa82e
Turning updategit statusgit status Something THAT WORKSgit statusgit …
Annika-wyt Oct 21, 2025
7af6bcb
Pure Pursuit works
Annika-wyt Oct 21, 2025
4030220
vscode ssh update
kaarmu Oct 23, 2025
226c9a1
filter fixed
kaarmu Oct 23, 2025
697225f
sync amcl yaml
Oct 23, 2025
a6d99ba
minor fix
Oct 23, 2025
2cfcd4b
tx2 floor2 works
kaarmu Oct 23, 2025
7830854
update docker build
kaarmu Oct 23, 2025
9430a47
fix my rebase f-up
Oct 24, 2025
7c7fd11
Merge remote-tracking branch 'upstream/main'
Oct 24, 2025
bc4be09
add traffic lights
kaarmu Oct 30, 2025
60da494
Enhance Resource class to support lazy-evaluated names, add namespace…
kaarmu Oct 30, 2025
4533900
fix some bugs/inprecise naming after previous commit
kaarmu Oct 30, 2025
23d2337
Update requirements and refactor marker and path utilities
kaarmu Oct 30, 2025
b57fd71
Refactor traffic light visualization logic and update marker utility
kaarmu Oct 30, 2025
d831c79
move interfaces from svea_core/utils to svea_core/interfaces
kaarmu Nov 3, 2025
0761caa
Check parameter existence before declaration
kaarmu Nov 4, 2025
aececf6
fix marker topics not namespaced by default
kaarmu Nov 5, 2025
65064b7
merge
Nov 5, 2025
3aaf389
localization patch
Nov 6, 2025
dbeabc8
Update launch system to support multi-agent scenarios
kaarmu Nov 6, 2025
decac4c
Enhance lidar_timer to use dynamic parameters for frame and topic con…
kaarmu Nov 6, 2025
83a4f0e
Test multi-agent floor2
kaarmu Nov 6, 2025
bbf3377
docker image pushed
kaarmu Nov 7, 2025
7a3b6f4
disable zenoh multicast
kaarmu Nov 11, 2025
722f73c
fix amcl no namespace
kaarmu Nov 11, 2025
d6fc686
disable timestamp check
kaarmu Nov 12, 2025
9bd23d4
Add conditional to build-and-push job in workflow
kaarmu Nov 12, 2025
80e95d7
update floor2 example
Nov 19, 2025
241ba4e
remove unused code
Jan 19, 2026
fcc1f22
merge to el2435
Jan 19, 2026
cf36328
Revert "merge to el2435"
Jan 19, 2026
faf9864
merge el2425
Jan 19, 2026
ff49968
Revert "merge el2425"
Jan 19, 2026
e167bab
Merge remote-tracking branch 'el2425/main'
Jan 19, 2026
5c39c04
dockerfile.base fix
Jan 19, 2026
b608bfa
util/config.sh fix
Jan 23, 2026
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
1 change: 1 addition & 0 deletions .github/workflows/update-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ permissions:
jobs:

build-and-push:
if: ${{ github.repository == 'KTH-SML/svea' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get update -y

# This is for any added ROS packages
COPY src ./src
COPY requirements.txt ./
COPY entrypoint requirements.txt ./
RUN rosdep install \
--rosdistro $ROSDISTRO \
--from-paths src \
Expand Down
10 changes: 8 additions & 2 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ RUN mkdir -p /var/run/sshd
# Bash reminder:
# username="${creds%%:*}" # remove everything after the first ':'
# password="${creds#*:}" # remove everything before the first ':'
RUN echo "root:${USER_CREDENTIALS#*:}" | chpasswd
RUN echo "${USER_CREDENTIALS%%:*}:${USER_CREDENTIALS#*:}" | chpasswd

# SSH config: allow root + password login (keep pubkey auth on too)
RUN sed -ri 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
Expand Down Expand Up @@ -99,6 +99,12 @@ RUN if [ -f src/mocap4ros2_qualisys/dependency_repos.repos ]; then \
vcs import src < src/mocap4ros2_qualisys/dependency_repos.repos; \
fi

# Zenoh
RUN echo "deb [trusted=yes] https://download.eclipse.org/zenoh/debian-repo/ /" | tee -a /etc/apt/sources.list > /dev/null && \
apt update -y && \
apt install --no-install-recommends -y zenoh-bridge-ros2dds && \
rm -rf /var/lib/apt/lists/*

# Install dependencies via rosdep and pip
RUN apt-get update -y && \
rosdep update \
Expand Down Expand Up @@ -141,4 +147,4 @@ RUN chmod +x ./entrypoint

ENTRYPOINT ["./entrypoint"]

CMD ["bash"]
CMD ["bash"]
2 changes: 1 addition & 1 deletion entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ if [ "$MICROROS_DISABLE_SHM" = "1" ] ; then
fi

# To build anything that has been added by volume...
colcon build --symlink-install
colcon build --symlink-install || true

exec "$@"
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# You can read more here: https://pip.pypa.io/en/stable/reference/requirements-file-format/#requirements-file-format

numpy
matplotlib
matplotlib # deprecated
pillow

# This is for MPC
casadi==3.6.7
Expand Down
13 changes: 13 additions & 0 deletions src/el2425/launch/traffic_light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<launch>
<arg name="name" default="light_a"/>
<arg name="alpha" default="1.0"/>
<arg name="pos_x" default="0.0"/>
<arg name="pos_y" default="0.0"/>

<node name="$(var name)" pkg="el2425" exec="traffic_light.py" output="screen">
<param name="alpha" value="$(var alpha)"/>
<param name="pos_x" value="$(var pos_x)"/>
<param name="pos_y" value="$(var pos_y)"/>
</node>
</launch>
16 changes: 16 additions & 0 deletions src/el2425/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>el2425</name>
<version>0.0.0</version>
<description>The el2425 package</description>
<maintainer email="kajarf@kth.se">Kaj Munhoz Arfvidsson</maintainer>
<license>TODO: License declaration</license>

<depend>svea_core</depend>
<depend>rclpy</depend>

<export>
<build_type>ament_python</build_type>
</export>
</package>
Empty file added src/el2425/resource/el2425
Empty file.
107 changes: 107 additions & 0 deletions src/el2425/scripts/traffic_light.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#! /usr/bin/env python3

# imports
import random

from rclpy.clock import Clock, Duration
from std_msgs.msg import String, Float32

from svea_core import rosonic as rx
from svea_core.interfaces import ShowMarker

class traffic_light(rx.Node):

## Constants

GREEN_TIME = 5. # [s]
YELLOW_TIME = 2. # [s]
RED_TIME = 5. # [s]

# dictionary for states
TRANSITIONS = {
'Rd': 'YG', # Red -> Yellow-Green
'YG': 'Gr', # Yellow-Green -> Green
'Gr': 'YR', # Green -> Yellow-Red
'YR': 'Rd', # Yellow-Red -> Red
}

## Parameters

rate = rx.Parameter(10)
alpha = rx.Parameter(1.0)

pos_x = rx.Parameter(0.0)
pos_y = rx.Parameter(0.0)

## Publishers

state_pub = rx.Publisher(String, '~/state')
time_pub = rx.Publisher(Float32, '~/time_left')

## Interfaces

marker = ShowMarker()

## Methods

def on_startup(self):

assert 0 <= self.alpha <= min(self.RED_TIME, self.GREEN_TIME)

self.switch('Rd') # initial state is red
self._loop_tmr = self.create_timer(1.0 / self.rate, self.loop)

def loop(self):

now = Clock().now()

# calculate time remaining for current state
time_left = (self._time0 + self._delta - now).nanoseconds / 1e9

# if time has elapsed, then switch to next state
if time_left <= 0:
self.switch()

# publish current state and time remaining
msg = String()
msg.data = self._state
self.state_pub.publish(msg)

msg = Float32()
msg.data = time_left
self.time_pub.publish(msg)

# visualization for the lights
self.visualize_traffic_lights()

def switch(self, to=None):
"""
Change the traffic light to the next state
"""
self._state = (to if to is not None else
self.TRANSITIONS[self._state])

delta = (self.RED_TIME if self._state == 'Rd' else
self.GREEN_TIME if self._state == 'Gr' else
self.YELLOW_TIME)
if self._state in ('Rd', 'Gr'):
delta += random.uniform(-self.alpha, +self.alpha)

# delta determines how long each state lasts
self._delta = Duration(seconds=delta)

self._time0 = Clock().now()

def visualize_traffic_lights(self):
"""Publish the positions of traffic lights for visualization in RViz."""

color = ('red' if self._state == 'Rd' else
'green' if self._state == 'Gr' else
'yellow' if self._state in ('YG', 'YR') else
'black')

self.marker.place([self.pos_x, self.pos_y, 1.0], color=color)

if __name__ == '__main__':

traffic_light.main()
27 changes: 27 additions & 0 deletions src/el2425/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
from glob import glob
import xml.etree.ElementTree as ET
from setuptools import find_packages, setup

package = ET.parse('package.xml').getroot()
name = package.find('name').text

setup(
name=name,
version='0.0.0',
packages=find_packages(include=[name, f"{name}.*"]),
data_files=[
('share/ament_index/resource_index/packages', [f'resource/{name}']),
(f'share/{name}', ['package.xml']),
(f'share/{name}/launch', glob('launch/*.xml')),
(f'lib/{name}', glob('scripts/*.py')),
(os.path.join('share', name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*'))),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer=package.find('maintainer').text,
maintainer_email=package.find('maintainer').get('email'),
description=package.find('description').text,
license=package.find('license').text,
tests_require=['pytest'],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 6 additions & 5 deletions src/svea_core/launch/map_and_foxglove.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?xml version="1.0"?>
<launch>
<!-- Launch file arguments -->
<!-- Arguments BEGIN -->

<arg name="map" default="floor2"/>
<arg name="map_path" default="$(find-pkg-share svea_core)/maps/$(var map).yaml"/>
<arg name="map_file" default="$(find-pkg-share svea_core)/maps/$(var map).yaml"/>
<arg name="use_foxglove" default="true"/>
<let name="use_foxglove" value="$(eval '\'$(var use_foxglove)\' == \'true\'')"/>

<!-- Arguments END -->

<!-- Start map server -->
<!-- more info about nav2_map_server:https://answers.ros.org/question/398095/-->
<node name="map_server" pkg="nav2_map_server" exec="map_server" output="screen">
<param name="yaml_filename" value="$(var map_path)" />
<param name="yaml_filename" value="$(var map_file)" />
<param name="use_sim_time" value="false" />
<param name="topic_name" value="map" />
</node>

<node name="lifecycle_manager" pkg="nav2_lifecycle_manager" exec="lifecycle_manager" output="screen">
<param name="node_names" value="['map_server']" />
<param name="autostart" value="true" />
Expand Down
40 changes: 31 additions & 9 deletions src/svea_core/launch/simulation.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
<launch>
<!-- Arguments BEGIN -->

<arg name="name" default="self"/>
<arg name="map" default="floor2"/>
<arg name="obstacle_map" default="$(var map)_obstacles"/>
<arg name="state" default="[-7.4, -15.3, 0.9, 0.0]" />
<arg name="is_sim" default="true"/>
<arg name="initial_pose_x" default="0.0" />
<arg name="initial_pose_y" default="0.0" />
<arg name="initial_pose_a" default="0.0" />

<!-- Frames -->
<arg name="map_frame" default="map"/>
<arg name="odom_frame" default="$(var name)/odom"/>
<arg name="base_frame" default="$(var name)/base_link"/>

<!-- Arguments END -->

<group>

<push-ros-namespace namespace="$(var name)"/>

<node name="sim_svea" pkg="svea_core" exec="sim_svea.py" output="screen">
<param name="initial_pose_x" value="$(var initial_pose_x)"/>
<param name="initial_pose_y" value="$(var initial_pose_y)"/>
<param name="initial_pose_a" value="$(var initial_pose_a)"/>
<param name="map_frame" value="$(var map_frame)"/>
<param name="odom_frame" value="$(var odom_frame)"/>
<param name="base_frame" value="$(var base_frame)"/>
</node>

<node name="sim_lidar" pkg="svea_core" exec="sim_lidar.py" output="screen">
<param from="$(find-pkg-share svea_core)/params/$(var obstacle_map).yaml"/>
<param name="laser_frame" value="$(var name)/laser" />
</node>

<node name="sim_svea" pkg="svea_core" exec="sim_svea.py" output="screen">
<param name="state" value="$(var state)" />
</node>
</group>

<node name="sim_lidar" pkg="svea_core" exec="sim_lidar.py" output="screen">
<param from="$(find-pkg-share svea_core)/params/$(var obstacle_map).yaml"/>
</node>

</launch>
76 changes: 76 additions & 0 deletions src/svea_core/launch/svea.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0"?>
<launch>

<!-- Arguments BEGIN -->

<arg name="name" default="self"/>
<arg name="is_sim" default="true"/>
<arg name="is_indoor" default="true"/>
<arg name="initial_pose_x" default="0.0"/>
<arg name="initial_pose_y" default="0.0"/>
<arg name="initial_pose_a" default="0.0"/> <!-- Yaw Angle -->

<arg name="use_zenoh" default="false"/>

<arg name="use_urdf" default="$(var is_sim)"/>

<arg name="map" default="floor2"/>
<arg name="map_file" default="$(find-pkg-share svea_core)/maps/$(var map).yaml"/>

<!-- Arguments END -->

<!-- Localization -->
<include file="$(find-pkg-share svea_localization)/launch/localization.xml">
<arg name="name" value="$(var name)"/>
<arg name="is_sim" value="$(var is_sim)"/>
<arg name="is_indoor" value="$(var is_indoor)"/>
<arg name="initial_pose_x" value="$(var initial_pose_x)" />
<arg name="initial_pose_y" value="$(var initial_pose_y)" />
<arg name="initial_pose_a" value="$(var initial_pose_a)" />
</include>

<!-- If-Else Group -->
<group if="$(var is_sim)">
<!-- Simulation -->
<include file="$(find-pkg-share svea_core)/launch/simulation.xml">
<arg name="name" value="$(var name)"/>
<arg name="map" value="$(var map)" />
<arg name="initial_pose_x" value="$(var initial_pose_x)" />
<arg name="initial_pose_y" value="$(var initial_pose_y)" />
<arg name="initial_pose_a" value="$(var initial_pose_a)" />
</include>
</group>
<group unless="$(var is_sim)">
<!-- Low-Level Interface -->
<executable cmd="$(find-pkg-share svea_core)/util/start_micro_ros.sh" output="screen"/>

<!--LLI Fixers-->
<node pkg="svea_core" exec="encoder_filter.py" name="encoder_filter" output="screen">
<param name="frame_id" value="$(var name)/wheel_encoder"/>
</node>

<node pkg="svea_core" exec="imu_bias_remover.py" name="imu_bias_remover" output="screen">
<param name="frame_id" value="$(var name)/imu"/>
</node>

<node pkg="svea_core" exec="lidar_timer.py" name="lidar_timer" output="screen">
<param name="target_frame" value="$(var name)/base_link"/>
<param name="source_frame" value="$(var name)/odom"/>
<param name="from_topic" value="$(var name)/scan"/>
<param name="to_topic" value="$(var name)/scan/filtered"/>
</node>
</group>

<!-- Load Visualization Model -->
<include if="$(var use_urdf)" file="$(find-pkg-share svea_core)/launch/visualization.xml">
<arg name="name" value="$(var name)"/>
</include>

<!-- Zenoh -->
<let name="zenoh_cmd" value="zenoh-bridge-ros2dds -c $(find-pkg-share svea_core)/params/zenoh.json5 --ros-args"/>
<let name="zenoh_cmd" value="$(var zenoh_cmd) --remap /fleet/$(var name)/state:=/$(var name)/odometry/local"/>
<!-- <executable if="$(var use_zenoh)" cmd="$(var zenoh_cmd)" output="screen"/> -->
<let name="zenoh_config" value="$(find-pkg-share svea_core)/params/zenoh.json5"/>
<executable if="$(var use_zenoh)" cmd="zenoh-bridge-ros2dds -c $(var zenoh_config)" output="screen"/>

</launch>
Loading