Skip to content

Commit

Permalink
Merge in origin/master and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Carter committed Feb 8, 2024
2 parents d01d1d6 + 7d9a2a6 commit 9ce0034
Show file tree
Hide file tree
Showing 36 changed files with 447 additions and 390 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
`Insert description`

## Fixes
Issue Number: `number`
Closes: `number`

## Checklist
- [ ] Update CHANGELOG.md
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/galactic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

env:
HOME: /root
# Coupled with our use of the test_log crate this should give us good CI output on failure
RUST_LOG: debug

jobs:
galactic:
Expand All @@ -22,6 +24,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Verify rust version
run: source /root/.cargo/env; rustc --version
- name: Lint
run: source /root/.cargo/env; cargo fmt --all -- --check
- name: Build Main Lib
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/humble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

env:
HOME: /root
# Coupled with our use of the test_log crate this should give us good CI output on failure
RUST_LOG: debug

jobs:
humble:
Expand All @@ -22,6 +24,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Verify rust version
run: source /root/.cargo/env; rustc --version
- name: Lint
run: source /root/.cargo/env; cargo fmt --all -- --check
- name: Build Main Lib
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/iron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Iron

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
HOME: /root
# Coupled with our use of the test_log crate this should give us good CI output on failure
RUST_LOG: debug

jobs:
humble:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container: carter12s/roslibrust-ci-iron:latest
timeout-minutes: 20
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Lint
run: source /root/.cargo/env; cargo fmt --all -- --check
- name: Build Main Lib
run: source /root/.cargo/env; cargo build
# This step is required to confirm feature combinations work, the main workspace build does all features
- name: Build Proc Macro
run: source /root/.cargo/env; cargo build -p roslibrust_codegen_macro
- name: Unit Tests
run: source /root/.cargo/env; cargo test
- name: Start rosbridge
run: source /opt/ros/iron/setup.bash; ros2 launch rosbridge_server rosbridge_websocket_launch.xml & disown; ros2 run rosapi rosapi_node & sleep 1
- name: Integration Tests
run: source /root/.cargo/env; cargo test --features ros2_test -- --test-threads 1
4 changes: 4 additions & 0 deletions .github/workflows/noetic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
env:
HOME: /root
ROS_PACKAGE_PATH: /opt/ros/noetic/share
# Coupled with our use of the test_log crate this should give us good CI output on failure
RUST_LOG: debug

jobs:
noetic:
Expand All @@ -23,6 +25,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Verify rust version
run: source /root/.cargo/env; rustc --version
- name: Lint
run: source /root/.cargo/env; cargo fmt --all -- --check
- name: Build Main Lib
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/noetic_gencpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

env:
HOME: /root
# Coupled with our use of the test_log crate this should give us good CI output on failure
RUST_LOG: debug

jobs:
noetic_gencpp:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The function interface for top level generation functions in `roslibrust_codegen` have been changed to include the list of dependent
filesystem paths that should trigger re-running code generation. Note: new files added to the search paths will not be automatically detected.
- [Breaking Change] Codegen now generates fixed sized arrays as arrays [T; N] instead of Vec<T>
- Removed `find_and_generate_ros_messages_relative_to_manifest_dir!` this proc_macro was changing the current working directory of the compilation job resulting in a variety of strange compilation behaviors. Build.rs scripts are recommended for use cases requiring fine grained control of message generation.
- The function interface for top level generation functions in `roslibrust_codegen` have been changed to include the list of dependent filesystem paths that should trigger re-running code generation. Note: new files added to the search paths will not be automatically detected.
- Refactor the `ros1::node` module into separate smaller pieces. This should be invisible externally (and no changes to examples were required).

## 0.8.0 - October 4th, 2023

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[![Noetic](https://github.com/Carter12s/roslibrust/actions/workflows/noetic.yml/badge.svg)](https://github.com/Carter12s/roslibrust/actions/workflows/noetic.yml)
[![Galactic](https://github.com/Carter12s/roslibrust/actions/workflows/galactic.yml/badge.svg)](https://github.com/Carter12s/roslibrust/actions/workflows/galactic.yml)
[![Humble](https://github.com/Carter12s/roslibrust/actions/workflows/humble.yml/badge.svg)](https://github.com/Carter12s/roslibrust/actions/workflows/humble.yml)
[![Iron](https://github.com/Carter12s/roslibrust/actions/workflows/iron.yml/badge.svg)](https://github.com/Carter12s/roslibrust/actions/workflows/iron.yml)
[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This package aims to provide a convenient intermediary between ROS1's rosbridge and Rust similar to roslibpy and roslibjs.
Expand Down
5 changes: 0 additions & 5 deletions docker/galactic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ LABEL maintainer="Carter Schultz <[email protected]>"
# Required by github CI for submodule support
RUN apt update && apt install -y git

# Adapted from https://github.com/JoaquinGimenez1/docker-noetic-rosbridge/blob/main/Dockerfile
RUN apt update && apt install -y ros-galactic-rosbridge-suite

# Curl required to install rust, build-essential required to build quote & proc-macro2
RUN apt update && apt install -y --fix-missing curl build-essential
# Install latest stable rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Update Cargo Registry
# See this for why we do it so wierd https://github.com/rust-lang/cargo/issues/3377
RUN /root/.cargo/bin/cargo install lazy_static; exit 0

WORKDIR /
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
Expand Down
5 changes: 0 additions & 5 deletions docker/humble/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ LABEL maintainer="Carter Schultz <[email protected]>"
# Required by github CI for submodule support
RUN apt update && apt install -y git

# Adapted from https://github.com/JoaquinGimenez1/docker-noetic-rosbridge/blob/main/Dockerfile
RUN apt update && apt install -y ros-humble-rosbridge-suite

# Curl required to install rust, build-essential required to build quote & proc-macro2
RUN apt update && apt install -y --fix-missing curl build-essential
# Install latest stable rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Update Cargo Registry
# See this for why we do it so wierd https://github.com/rust-lang/cargo/issues/3377
RUN /root/.cargo/bin/cargo install lazy_static; exit 0

WORKDIR /
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
Expand Down
10 changes: 5 additions & 5 deletions docker/humble/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Galactic CI Docker Image
Produces a docker image including both galactic rosbridge and needed rust.
# Humble CI Docker Image
Produces a docker image including both humble rosbridge and needed rust.

# Building / Publishing (currently only carter has access, need to fix)
- docker build -t carter12s/roslibrust-ci-galactic:latest .
- docker build -t carter12s/roslibrust-ci-humble:latest .
- Maybe needed: docker login
- docker push carter12s/roslibrust-ci-galactic:latest
- docker push carter12s/roslibrust-ci-humble:latest

For debug:
docker run -it carter12s/roslibrust-ci-galactic /bin/bash
docker run -it carter12s/roslibrust-ci-humble /bin/bash
17 changes: 17 additions & 0 deletions docker/iron/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ros:iron-ros-core
LABEL maintainer="Carter Schultz <[email protected]>"

# Required by github CI for submodule support
RUN apt update && apt install -y git

RUN apt update && apt install -y ros-iron-rosbridge-suite

# Curl required to install rust, build-essential required to build quote & proc-macro2
RUN apt update && apt install -y --fix-missing curl build-essential
# Install latest stable rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

WORKDIR /
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
10 changes: 10 additions & 0 deletions docker/iron/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Iron CI Docker Image
Produces a docker image including both iron rosbridge and needed rust.

# Building / Publishing (currently only carter has access, need to fix)
- docker build -t carter12s/roslibrust-ci-iron:latest .
- Maybe needed: docker login
- docker push carter12s/roslibrust-ci-iron:latest

For debug:
docker run -it carter12s/roslibrust-ci-iron /bin/bash
2 changes: 2 additions & 0 deletions docker/iron/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec "$@"
7 changes: 7 additions & 0 deletions docker/iron_compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.9"
services:
rosbridge:
image: carter12s/roslibrust-ci-iron:latest
ports:
- "9090:9090"
command: bash -c "source /opt/ros/humble/setup.bash; ros2 launch rosbridge_server rosbridge_websocket_launch.xml & disown; ros2 run rosapi rosapi_node --ros-args --log-level debug"
4 changes: 0 additions & 4 deletions docker/noetic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ RUN apt update && apt install -y --fix-missing curl build-essential
# Install latest stable rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Update Cargo Registry
# See this for why we do it so wierd https://github.com/rust-lang/cargo/issues/3377
RUN /root/.cargo/bin/cargo install lazy_static; exit 0

WORKDIR /
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
Expand Down
4 changes: 0 additions & 4 deletions docker/noetic_cpp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ RUN apt update && apt install -y ros-noetic-ros-base
# Install latest stable rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Update Cargo Registry
# See this for why we do it so weird https://github.com/rust-lang/cargo/issues/3377
RUN /root/.cargo/bin/cargo install lazy_static; exit 0

WORKDIR /
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
Expand Down
4 changes: 2 additions & 2 deletions roslibrust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ serde-big-array = "0.5"

[features]
default = []
# Provides a rosapi rust interface
rosapi = []
# Note: all does not include running_bridge as that is only intended for CI
all = []
# Provides a rosapi rust interface
rosapi = []
# Intended for use with tests, includes tests that rely on a locally running rosbridge
running_bridge = []
# For use with integration tests, indicating we are testing integration with a ros1 bridge
Expand Down
4 changes: 2 additions & 2 deletions roslibrust/examples/native_ros1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#[cfg(feature = "ros1")]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
use roslibrust::NodeHandle;
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
use roslibrust::ros1::NodeHandle;

simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Debug)
Expand Down
4 changes: 2 additions & 2 deletions roslibrust/examples/ros1_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ roslibrust_codegen_macro::find_and_generate_ros_messages!("assets/ros1_common_in

#[cfg(feature = "ros1")]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
use roslibrust::NodeHandle;
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
use roslibrust::ros1::NodeHandle;

simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Debug)
Expand Down
4 changes: 2 additions & 2 deletions roslibrust/examples/ros1_talker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ roslibrust_codegen_macro::find_and_generate_ros_messages!("assets/ros1_common_in

#[cfg(feature = "ros1")]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
use roslibrust::NodeHandle;
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
use roslibrust::ros1::NodeHandle;

simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Debug)
Expand Down
33 changes: 30 additions & 3 deletions roslibrust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,33 @@ pub use rosbridge::*;
pub mod rosapi;

#[cfg(feature = "ros1")]
mod ros1;
#[cfg(feature = "ros1")]
pub use ros1::*;
pub mod ros1;

/// For now starting with a central error type, may break this up more in future
#[derive(thiserror::Error, Debug)]
pub enum RosLibRustError {
#[error("Not currently connected to ros master / bridge")]
Disconnected,
// TODO we probably want to eliminate tungstenite from this and hide our
// underlying websocket implementation from the API
// currently we "technically" break the API when we change tungstenite verisons
#[error("Websocket communication error: {0}")]
CommFailure(#[from] tokio_tungstenite::tungstenite::Error),
#[error("Operation timed out: {0}")]
Timeout(#[from] tokio::time::error::Elapsed),
#[error("Failed to parse message from JSON: {0}")]
InvalidMessage(#[from] serde_json::Error),
#[error("Rosbridge server reported an error: {0}")]
ServerError(String),
#[error("Name does not meet ROS requirements: {0}")]
InvalidName(String),
// Generic catch-all error type for not-yet-handled errors
// TODO ultimately this type will be removed from API of library
#[error(transparent)]
Unexpected(#[from] anyhow::Error),
}

/// Generic result type used as standard throughout library.
/// Note: many functions which currently return this will be updated to provide specific error
/// types in the future instead of the generic error here.
pub type RosLibRustResult<T> = Result<T, RosLibRustError>;
3 changes: 2 additions & 1 deletion roslibrust/src/ros1/master_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ impl MasterClient {
self.client_uri.clone().into(),
],
)?;
log::trace!("Posting {body:?} to register publisher");
self.post(body).await
}

Expand Down Expand Up @@ -360,7 +361,7 @@ impl MasterClient {
#[cfg(test)]
mod test {

use crate::{MasterClient, RosMasterError};
use super::{MasterClient, RosMasterError};

const TEST_NODE_ID: &str = "/native_ros1_test";

Expand Down
6 changes: 2 additions & 4 deletions roslibrust/src/ros1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
mod master_client;
pub use master_client::*;

/// [xmlrpc_server] module contains the xmlrpc server that a node must host
mod xmlrpc_server;
pub(crate) use xmlrpc_server::*;

mod names;

/// [node] module contains the central Node and NodeHandle APIs
mod node;
pub use node::*;

mod publisher;
pub use publisher::Publisher;
mod subscriber;
pub use subscriber::Subscriber;
mod tcpros;
Loading

0 comments on commit 9ce0034

Please sign in to comment.