Skip to content

Commit

Permalink
support humble and iron (#13)
Browse files Browse the repository at this point in the history
drop foxy and galactic

Signed-off-by: Teo Koon Peng <[email protected]>
  • Loading branch information
koonpeng authored Aug 3, 2023
1 parent 0fca6ee commit 5436a76
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
docker_image: ['ros:humble-ros-base']
docker_image: ['ros:humble-ros-base', 'ros:iron-ros-base']
container:
image: ${{ matrix.docker_image }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Supported Distros

`redf` currently supports galactic and humble.
`redf` currently supports humble and iron.

### Why use redf?

Expand Down
29 changes: 0 additions & 29 deletions src/cpp/header.hpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{%- endif %}

#include <string>
{% if distro == "foxy" -%}
#include <stdexcept>
{%- endif %}

namespace {{namespace}} {

Expand All @@ -41,21 +38,13 @@ public:
return rclcpp::QoS{history_depth};
{%- elif ep.qos is qos_preset -%}
{%- if ep.qos == "clock" -%}
{%- if distro == "foxy" -%}
throw std::runtime_error{"Clock QoS is not supported on foxy"};
{%- else -%}
return rclcpp::ClockQoS{rclcpp::KeepLast{history_depth}};
{%- endif -%}
{%- elif ep.qos == "parameter_events" -%}
return rclcpp::ParameterEventsQoS{rclcpp::KeepLast{history_depth}};
{%- elif ep.qos == "parameters" -%}
return rclcpp::ParametersQoS{rclcpp::KeepLast{history_depth}};
{%- elif ep.qos == "rosout" -%}
{%- if distro == "foxy" -%}
throw std::runtime_error("Rosout QoS is not supported on foxy");
{%- else -%}
return rclcpp::RosoutQoS{rclcpp::KeepLast{history_depth}};
{%- endif -%}
{%- elif ep.qos == "sensor_data" -%}
return rclcpp::SensorDataQoS{rclcpp::KeepLast{history_depth}};
{%- elif ep.qos == "services" -%}
Expand All @@ -66,23 +55,6 @@ public:
{%- else -%}
rclcpp::QoS qos{history_depth};

{%- if distro == "foxy" %}
{%- if ep.qos.reliability %}
qos.reliability(RMW_QOS_POLICY_RELIABILITY_{{ ep.qos.reliability | screaming_snake }});
{%- else %}
qos.reliability(RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT);
{%- endif %}
{%- if ep.qos.durability %}
qos.durability(RMW_QOS_POLICY_DURABILITY_{{ ep.qos.durability | screaming_snake }});
{%- else %}
qos.durability(RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT);
{%- endif %}
{%- if ep.qos.liveliness %}
qos.liveliness(RMW_QOS_POLICY_LIVELINESS_{{ ep.qos.liveliness | screaming_snake }});
{%- else %}
qos.liveliness(RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT);
{%- endif %}
{%- else %}
{%- if ep.qos.reliability %}
qos.reliability(rclcpp::ReliabilityPolicy::{{ ep.qos.reliability | pascal }});
{%- else %}
Expand All @@ -98,7 +70,6 @@ public:
{%- else %}
qos.liveliness(rclcpp::LivelinessPolicy::SystemDefault);
{%- endif %}
{%- endif -%}

{%- if ep.qos.deadline %}
qos.deadline(rclcpp::Duration{%- raw -%}{{%- endraw -%}{{ep.qos.deadline.secs}}, {{ep.qos.deadline.nanosecs}}{%- raw -%}}{%- endraw -%});
Expand Down
5 changes: 5 additions & 0 deletions src/cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use std::error::Error;
use std::path::Path;
use tera::Tera;

const SUPPORTED_DISTRO: &[&str] = &["humble", "iron"];

#[derive(Serialize)]
struct Context<'a> {
redf: &'a Redf,
Expand Down Expand Up @@ -55,6 +57,9 @@ pub fn generate(redf: &Redf, outdir: &Path) -> Result<(), Box<dyn Error>> {
Ok(val) => val,
Err(_) => panic!("Fail to detect ROS version, make sure ROS is sourced"),
};
if !SUPPORTED_DISTRO.contains(&distro.as_str()) {
println!("WARN: [${distro}] is not a supported ROS distro");
}

let ctx = tera::Context::from_serialize(Context {
redf,
Expand Down

0 comments on commit 5436a76

Please sign in to comment.