Skip to content

Commit

Permalink
Renaming and verifying regression tests
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
  • Loading branch information
aaronchongth committed Dec 24, 2024
1 parent 0ffad09 commit 0e9d183
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/docker/minimal-nav1-bringup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN mkdir -p /tb3 && cd /tb3 \
&& curl -sL https://github.com/ros-navigation/navigation2/archive/refs/heads/master.tar.gz -o navigation2.tar.gz \
&& mkdir -p /tb3/navigation2 && tar zxf navigation2.tar.gz -C /tb3/navigation2 --strip-components=1 && rm navigation2.tar.gz

ENV TURTLEBOT3_MODEL burger
ENV TURTLEBOT3_MODEL=burger

RUN rm -rf \
/var/lib/apt/lists \
Expand Down
4 changes: 2 additions & 2 deletions .github/docker/minimal-nav2-bringup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ RUN mkdir -p /tb3 && cd /tb3 \
&& curl -sL https://github.com/ROBOTIS-GIT/turtlebot3_simulations/archive/refs/heads/master.tar.gz -o turtlebot3_simulations.tar.gz \
&& mkdir -p /tb3/turtlebot3_simulations && tar zxf turtlebot3_simulations.tar.gz -C /tb3/turtlebot3_simulations --strip-components=1 && rm turtlebot3_simulations.tar.gz

ENV RMW_IMPLEMENTATION rmw_cyclonedds_cpp
ENV GAZEBO_MODEL_PATH "$GAZEBO_MODEL_PATH:/tb3/turtlebot3_simulations/turtlebot3_gazebo/models"
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV GAZEBO_MODEL_PATH="$GAZEBO_MODEL_PATH:/tb3/turtlebot3_simulations/turtlebot3_gazebo/models"

RUN rm -rf \
/var/lib/apt/lists \
Expand Down
2 changes: 1 addition & 1 deletion .github/docker/minimal-ros1-sim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM docker.io/ros:$ROS_DISTRO-ros-base

RUN apt update && apt install -y ros-$ROS_DISTRO-turtlebot3-gazebo ros-$ROS_DISTRO-gazebo-ros-pkgs

ENV TURTLEBOT3_MODEL burger
ENV TURTLEBOT3_MODEL=burger

RUN rm -rf \
/var/lib/apt/lists \
Expand Down
2 changes: 1 addition & 1 deletion .github/docker/minimal-zenoh-bridge-ros1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN mkdir -p /zenoh-bridge && cd /zenoh-bridge \
RUN cd /zenoh-bridge \
&& wget -O turtlebot3_1_client_zenoh_config.json5 https://raw.githubusercontent.com/open-rmf/free_fleet/refs/heads/$FREE_FLEET_BRANCH/free_fleet_examples/config/zenoh/turtlebot3_1_client_zenoh_config.json5

ENV RMW_IMPLEMENTATION rmw_cyclonedds_cpp
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

RUN rm -rf \
/var/lib/apt/lists \
Expand Down
2 changes: 1 addition & 1 deletion .github/docker/minimal-zenoh-bridge-ros2dds/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN mkdir -p /zenoh-bridge && cd /zenoh-bridge \
RUN cd /zenoh-bridge \
&& wget -O turtlebot3_1_zenoh_bridge_ros2dds_client_config.json5 https://raw.githubusercontent.com/open-rmf/free_fleet/refs/heads/$FREE_FLEET_BRANCH/free_fleet_examples/config/zenoh/turtlebot3_1_zenoh_bridge_ros2dds_client_config.json5

ENV RMW_IMPLEMENTATION rmw_cyclonedds_cpp
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

RUN rm -rf \
/var/lib/apt/lists \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
build-args: |
ROS_DISTRO=${{ matrix.ros_distribution }}
ZENOH_VERSION=1.0.1
FREE_FLEET_BRANCH=easy-full-control
FREE_FLEET_BRANCH=efc/ros1
tags: ghcr.io/${{ github.repository }}/minimal-zenoh-bridge-ros2dds:${{ matrix.ros_distribution }}-latest
context: .github/docker/minimal-zenoh-bridge-ros2dds

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ System dependencies,
sudo apt update && sudo apt install python3-pip ros-jazzy-rmw-cyclonedds-cpp
```

The dependencies `eclipse-zenoh` and `pycdr2` are available through `pip`. Users can choose to set up a virtual environment, or `--break-system-packages` by performing the installation directly.
The dependencies `eclipse-zenoh`, `pycdr2`, `rosbags` are available through `pip`. Users can choose to set up a virtual environment, or `--break-system-packages` by performing the installation directly.

```bash
pip3 install pip install eclipse-zenoh==1.0.1 pycdr2 --break-system-packages
pip3 install pip install eclipse-zenoh==1.1.0 pycdr2 rosbags --break-system-packages
```

Install `zenohd` from the [official guide](https://zenoh.io/docs/getting-started/installation/#ubuntu-or-any-debian).
Expand Down
2 changes: 2 additions & 0 deletions free_fleet_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ foreach(path ${traffic_editor_paths})
endforeach()

install(PROGRAMS
${PROJECT_NAME}/nav1_get_tf.py
# ${PROJECT_NAME}/nav1_send_move_base_simple_goal.py
${PROJECT_NAME}/nav2_cancel_all_goals.py
${PROJECT_NAME}/nav2_get_tf.py
${PROJECT_NAME}/nav2_send_navigate_to_pose.py
Expand Down
67 changes: 37 additions & 30 deletions free_fleet_examples/free_fleet_examples/nav1_get_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# https://github.com/eclipse-zenoh/zenoh-plugin-ros1/issues/131
# # https://github.com/eclipse-zenoh/zenoh-plugin-ros1/issues/131

import zenoh, time
from rosbags.typesys import Stores, get_types_from_msg, get_typestore
# import zenoh, time
# from rosbags.typesys import Stores, get_types_from_msg, get_typestore

TOPIC = '/tf'
# TYPE = 'std_msgs/msg/String'
TYPE = 'tf2_msgs/msg/TFMessage'
# TOPIC = '/tf'
# # TYPE = 'std_msgs/msg/String'
# TYPE = 'tf2_msgs/msg/TFMessage'

# Noetic TFMessage message definition, taken from:
# # Noetic TFMessage message definition, taken from:
# #
# https://github.com/ros/geometry2/blob/noetic-devel/tf2_msgs/msg/TFMessage.msg
TFMESSAGE_DEFINITION = """
geometry_msgs/TransformStamped[] transforms
"""
# TFMESSAGE_DEFINITION = """
# geometry_msgs/TransformStamped[] transforms
# """

def get_zenoh_name_of_ros1_topic(ros1_store, topic: str, msg_type: str) -> str:
# Get md5 and encode msg_type to construct zenoh topic
msg_type_split = msg_type.split('/')
msg_type_encoded = '/'.join([msg_type_split[0],msg_type_split[2]]).encode('utf-8').hex()
md5 = ros1_store.generate_msgdef(msg_type)[1]
zenoh_topic = '/'.join([msg_type_encoded, md5, topic[1:]])
# def get_zenoh_name_of_ros1_topic(ros1_store, topic: str, msg_type: str
# ) -> str:
# # Get md5 and encode msg_type to construct zenoh topic
# msg_type_split = msg_type.split('/')
# msg_type_encoded = \
# '/'.join([msg_type_split[0],msg_type_split[2]]).encode('utf-8').hex()
# md5 = ros1_store.generate_msgdef(msg_type)[1]
# zenoh_topic = '/'.join([msg_type_encoded, md5, topic[1:]])

return zenoh_topic
# return zenoh_topic


def listener(sample: zenoh.Sample):
msg = ros1_store.deserialize_ros1(sample.payload.to_bytes(), TYPE)
print(f'ROS1 msg: {msg}')
# def listener(sample: zenoh.Sample):
# msg = ros1_store.deserialize_ros1(sample.payload.to_bytes(), TYPE)
# print(f'ROS1 msg: {msg}')


if __name__ == "__main__":
session = zenoh.open(zenoh.Config())
ros1_store = get_typestore(Stores.ROS1_NOETIC)
# if __name__ == "__main__":
# session = zenoh.open(zenoh.Config())
# ros1_store = get_typestore(Stores.ROS1_NOETIC)

ros1_store.register(
get_types_from_msg(TFMESSAGE_DEFINITION, TYPE),
)
# ros1_store.register(
# get_types_from_msg(TFMESSAGE_DEFINITION, TYPE),
# )

zenoh_topic = get_zenoh_name_of_ros1_topic(ros1_store, topic=TOPIC, msg_type=TYPE)
print(f'ROS topic {TOPIC} is converted to Zenoh {zenoh_topic}')
sub = session.declare_subscriber(zenoh_topic, listener)
time.sleep(60)
# zenoh_topic = get_zenoh_name_of_ros1_topic(
# ros1_store,
# topic=TOPIC,
# msg_type=TYPE
# )
# print(f'ROS topic {TOPIC} is converted to Zenoh {zenoh_topic}')
# sub = session.declare_subscriber(zenoh_topic, listener)
# time.sleep(60)

This file was deleted.

0 comments on commit 0e9d183

Please sign in to comment.