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

Add sample rosbag and launch file for testing the transformer node in Humble #37

Open
wants to merge 23 commits into
base: humble-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
78ab386
Working on a republisher node test using a rosbag to harcode data on…
IrinaTerebiznik Dec 13, 2024
3eb6cec
publisher test works when running rosbag from cmd yet not from launch…
IrinaTerebiznik Dec 17, 2024
a603e78
Trying to fix launch file error, unsuccessfully
IrinaTerebiznik Dec 17, 2024
2c8308b
Added a gitignore file
IrinaTerebiznik Dec 18, 2024
43133c5
sample_data.launch.xml file raise an exception in launch, still fixin…
IrinaTerebiznik Dec 18, 2024
c44ebe1
rosbag test on Humble working properly
IrinaTerebiznik Dec 18, 2024
b827a28
corrected colcon sentence as it was missing an 'l' in install
IrinaTerebiznik Dec 18, 2024
e28955a
Deleted irrelevant files
IrinaTerebiznik Dec 18, 2024
2cd3bfe
Deleted irrelevant files to keep PR clean
IrinaTerebiznik Dec 19, 2024
78ae56e
Revert "Deleted irrelevant files to keep PR clean"
IrinaTerebiznik Dec 20, 2024
589fde8
Revert "Deleted irrelevant files" commit
IrinaTerebiznik Dec 20, 2024
6e3567a
uploading .gitignore
IrinaTerebiznik Dec 20, 2024
de75798
uploading .gitignore for the second time
IrinaTerebiznik Dec 20, 2024
be1f41f
Only commiting relevant files
IrinaTerebiznik Dec 20, 2024
4cf19b0
Made local branch unfollow upstream
IrinaTerebiznik Dec 20, 2024
00ace01
updated gitignore to ignore build folders
IrinaTerebiznik Dec 20, 2024
b7458f0
test pushing hopefully on local branch
IrinaTerebiznik Dec 20, 2024
19f7b87
Modified gitignore and added relevant files to test the republisher n…
IrinaTerebiznik Dec 23, 2024
d1b5b42
Deleted .history folder as it was not used
IrinaTerebiznik Dec 23, 2024
6169dc2
Deleted build,log and install files
IrinaTerebiznik Dec 23, 2024
dd035ee
Update .gitignore and removed extra line
IrinaTerebiznik Dec 23, 2024
7acfac4
Corrected the README instructions on what topic to echo
IrinaTerebiznik Dec 23, 2024
b8c5b61
Updated READMEs, i added a first step to build a docker before runnin…
IrinaTerebiznik Dec 26, 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
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
# Launch files
*build/
*devel/
*install/
*log/

# Python files
__pycache__/
*.pyc
*.pyo
*.pyd

# Git history
*.history/

# VS files
.vscode/
.idea/
*.swp

# Dependencies
venv/
*.egg-info/
*.eggs/
pip-log.txt
2 changes: 1 addition & 1 deletion inorbit_republisher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ You can run the commands below for building and running the republisher inside a
docker run -ti --rm \
--workdir /root/ros2_ws/ \
-v .:/root/ros2_ws/src/inorbit_republisher \
osrf/ros:foxy-desktop
osrf/ros:humble-desktop
```

### Build
Expand Down
6 changes: 6 additions & 0 deletions inorbit_republisher/launch/sample_data.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<launch>
<node name="inorbit_republisher" pkg="inorbit_republisher" exec="republisher">
<param name="config" value="/root/ros2_ws/src/inorbit_republisher/test/sample_data/config.yaml" />
</node>
<executable cmd="ros2 bag play ros2_ws/src/inorbit_republisher/test/sample_data/hardcodedRosbag/rosbag2_2024_12_13-19_33_34_0.db3 -l" output="screen" />
</launch>
65 changes: 65 additions & 0 deletions inorbit_republisher/test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Sample data for testing

A very simple ``rosbag`` with hardcoded data for smoke testing the transformer node.

```bash
$root@7c94d2cf9659:~# ros2 bag info ros2_ws/src/inorbit_republisher/test/sample_data/hardcodedRosbag/rosbag2_2024_12_13-19_33_34_0.db3

closing.
[INFO] [1734553121.938063653] [rosbag2_storage]: Opened database 'ros2_ws/src/inorbit_republisher/test/sample_data/hardcodedRosbag/rosbag2_2024_12_13-19_33_34_0.db3' for READ_ONLY.

Files: ros2_ws/src/inorbit_republisher/test/sample_data/hardcodedRosbag/rosbag2_2024_12_13-19_33_34_0.db3
Bag size: 24.0 KiB
Storage id: sqlite3
Duration: 16.005861016s
Start: Dec 13 2024 19:45:00.085674077 (1734119100.085674077)
End: Dec 13 2024 19:45:16.091535093 (1734119116.091535093)
Messages: 34
Topic information: Topic: /my_magnetic_field | Type: sensor_msgs/msg/MagneticField | Count: 17 | Serialization Format: cdr
Topic: /my_temperature | Type: sensor_msgs/msg/Temperature | Count: 17 | Serialization Format: cdr

```

To validate the node works launch the sample by using the ``sample_data.launch.xml`` launch file and look at ``out`` topic: ``ros2 topic echo my_temperature``.
1. **Start ROS2 docker container (optional)**:
You can run the commands below for building and running the republisher inside a docker container.
```bash
docker run -ti --rm \
--workdir /root/ros2_ws/ \
-v .:/root/ros2_ws/src/inorbit_republisher \
osrf/ros:humble-desktop
```
2. **Build the Workspace**:
Ensure the workspace is built and the environment is sourced:
```bash
cd ~/ros2_ws
rosdep install --from-paths src -y --ignore-src
colcon build --packages-select inorbit_republisher --symlink-install
```
3. **Source and Run the Workspace**:
```bash
cd ros2_ws/src
colcon build --packages-select inorbit_republisher --symlink-install
source install/setup.bash
cd
ros2 launch inorbit_republisher sample_data.launch.xml
# On a different terminal windows
source /opt/ros/humble/setup.bash
ros2 topic echo inorbit/custom_data
data: my_magnetic_field_x=1.233536973711507
---
data: my_magnetic_field_y=6.557449696128689
---
data: my_magnetic_field_z=-1.6201375987982995
---
data: my_temperature=29.562268283427592
---
data: my_magnetic_field_x=-3.071746389301242
---
data: my_magnetic_field_y=6.080682955949868
---
data: my_magnetic_field_z=3.952488443512035
---
data: my_temperature=21.159168808582983
---
```
23 changes: 23 additions & 0 deletions inorbit_republisher/test/sample_data/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
republishers:
- topic: "/my_magnetic_field"
msg_type: "sensor_msgs/MagneticField"
mappings:
- field: "magnetic_field.x"
out:
topic: "/inorbit/custom_data"
key: "my_magnetic_field_x"
- field: "magnetic_field.y"
out:
topic: "/inorbit/custom_data"
key: "my_magnetic_field_y"
- field: "magnetic_field.z"
out:
topic: "/inorbit/custom_data"
key: "my_magnetic_field_z"
- topic: "/my_temperature"
msg_type: "sensor_msgs/Temperature"
mappings:
- field: "temperature"
out:
topic: "/inorbit/custom_data"
key: "my_temperature"
32 changes: 32 additions & 0 deletions inorbit_republisher/test/sample_data/hardcodedRosbag/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
rosbag2_bagfile_information:
version: 5
storage_identifier: sqlite3
duration:
nanoseconds: 16005861016
starting_time:
nanoseconds_since_epoch: 1734119100085674077
message_count: 34
topics_with_message_count:
- topic_metadata:
name: /my_temperature
type: sensor_msgs/msg/Temperature
serialization_format: cdr
offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false"
message_count: 17
- topic_metadata:
name: /my_magnetic_field
type: sensor_msgs/msg/MagneticField
serialization_format: cdr
offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false"
message_count: 17
compression_format: ""
compression_mode: ""
relative_file_paths:
- rosbag2_2024_12_13-19_33_34_0.db3
files:
- path: rosbag2_2024_12_13-19_33_34_0.db3
starting_time:
nanoseconds_since_epoch: 1734119100085674077
duration:
nanoseconds: 16005861016
message_count: 34
Binary file not shown.