diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac14b49..7234fa4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,6 +11,8 @@ on: - "examples/**" - "Cargo.*" - ".github/**" + schedule: + - cron: '0 1 * * *' # Able to call by other workflow workflow_call: # Able to call on GitHub @@ -52,10 +54,13 @@ jobs: - name: Run cargo check run: | cargo check --all --tests + - name: Check code format + run: | + cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" - name: Run cargo clippy run: | cargo clippy --version - cargo clippy --all-targets -- -W warnings -D warnings + cargo clippy --all-targets --all-features -- -W warnings -D warnings - name: Create Documentation run: | cargo doc --no-deps --all-features diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1fc2a64..d3723a6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,32 +25,10 @@ jobs: steps: - uses: actions/checkout@v4 - # README - we later need the download_url output of the upload step - - name: Upload README to release - uses: svenstaro/upload-release-action@v2 - id: upload_readme + - name: 'Create Release' + uses: softprops/action-gh-release@v2 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: README.md - tag: ${{ github.ref }} - - - name: Gets latest created release info - id: latest_release_info - uses: joutvhu/get-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Collect all artifacts - uses: anotherdaniel/quevee@v0.4.1 - id: quevee_manifest - with: - release_url: ${{ steps.latest_release_info.outputs.html_url }} - artifacts_readme: ${{ steps.upload_readme.outputs.browser_download_url }} - - - name: Upload manifest to release - uses: svenstaro/upload-release-action@v2 - id: upload_quality_manifest - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ steps.quevee_manifest.outputs.manifest_file }} - tag: ${{ github.ref }} + generate_release_notes: true + files: | + README.md + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/autoware.rs b/src/autoware.rs index ee1409a..6cf2d20 100644 --- a/src/autoware.rs +++ b/src/autoware.rs @@ -1,6 +1,7 @@ -use crate::bridge::sensor_bridge::SensorType; use std::collections::HashMap; +use crate::bridge::sensor_bridge::SensorType; + #[derive(Default, Clone)] pub struct Autoware { pub _ros2: bool, diff --git a/src/bridge/actor_bridge.rs b/src/bridge/actor_bridge.rs index 28ac941..2bbc1a5 100644 --- a/src/bridge/actor_bridge.rs +++ b/src/bridge/actor_bridge.rs @@ -1,3 +1,8 @@ +use std::sync::Arc; + +use carla::client::{Actor, ActorKind}; +use zenoh::Session; + use super::{ other_bridge::OtherActorBridge, sensor_bridge::{SensorBridge, SensorType}, @@ -6,9 +11,6 @@ use super::{ vehicle_bridge::VehicleBridge, }; use crate::{autoware::Autoware, error::Result}; -use carla::client::{Actor, ActorKind}; -use std::sync::Arc; -use zenoh::Session; #[derive(Debug)] pub enum BridgeType { diff --git a/src/bridge/other_bridge.rs b/src/bridge/other_bridge.rs index 81881ac..d6951a0 100644 --- a/src/bridge/other_bridge.rs +++ b/src/bridge/other_bridge.rs @@ -1,9 +1,11 @@ -use super::actor_bridge::ActorBridge; -use crate::error::Result; -use carla::client::Actor; use std::sync::Arc; + +use carla::client::Actor; use zenoh::Session; +use super::actor_bridge::ActorBridge; +use crate::error::Result; + pub struct OtherActorBridge { _actor: Actor, } diff --git a/src/bridge/sensor_bridge.rs b/src/bridge/sensor_bridge.rs index 4839a04..ddb66ee 100644 --- a/src/bridge/sensor_bridge.rs +++ b/src/bridge/sensor_bridge.rs @@ -1,10 +1,14 @@ -use super::actor_bridge::{ActorBridge, BridgeType}; -use crate::{ - autoware::Autoware, - error::{BridgeError, Result}, - types::{GnssService, GnssStatus, PointFieldType}, - utils, +use std::{ + convert::Infallible, + mem, + str::FromStr, + sync::{ + mpsc::{self, Receiver, Sender}, + Arc, + }, + thread, }; + use carla::{ client::{ActorBase, Sensor}, geom::Location, @@ -18,19 +22,17 @@ use carla::{ }; use cdr::{CdrLe, Infinite}; use nalgebra::{coordinates::XYZ, UnitQuaternion}; -use std::{ - convert::Infallible, - mem, - str::FromStr, - sync::{ - mpsc::{self, Receiver, Sender}, - Arc, - }, - thread, -}; use zenoh::{Session, Wait}; use zenoh_ros_type::{geometry_msgs, sensor_msgs, std_msgs}; +use super::actor_bridge::{ActorBridge, BridgeType}; +use crate::{ + autoware::Autoware, + error::{BridgeError, Result}, + types::{GnssService, GnssStatus, PointFieldType}, + utils, +}; + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum SensorType { CameraRgb, diff --git a/src/bridge/trafficlight_bridge.rs b/src/bridge/trafficlight_bridge.rs index 9e4b915..dd96117 100644 --- a/src/bridge/trafficlight_bridge.rs +++ b/src/bridge/trafficlight_bridge.rs @@ -1,9 +1,11 @@ -use super::actor_bridge::ActorBridge; -use crate::error::Result; -use carla::client::TrafficLight; use std::sync::Arc; + +use carla::client::TrafficLight; use zenoh::Session; +use super::actor_bridge::ActorBridge; +use crate::error::Result; + pub struct TrafficLightBridge { _actor: TrafficLight, } diff --git a/src/bridge/trafficsign_bridge.rs b/src/bridge/trafficsign_bridge.rs index 5c1b9de..892826b 100644 --- a/src/bridge/trafficsign_bridge.rs +++ b/src/bridge/trafficsign_bridge.rs @@ -1,9 +1,11 @@ -use super::actor_bridge::ActorBridge; -use crate::error::Result; -use carla::client::TrafficSign; use std::sync::Arc; + +use carla::client::TrafficSign; use zenoh::Session; +use super::actor_bridge::ActorBridge; +use crate::error::Result; + pub struct TrafficSignBridge { _actor: TrafficSign, } diff --git a/src/bridge/vehicle_bridge.rs b/src/bridge/vehicle_bridge.rs index 35368a4..76fa57b 100644 --- a/src/bridge/vehicle_bridge.rs +++ b/src/bridge/vehicle_bridge.rs @@ -1,9 +1,5 @@ -use super::actor_bridge::{ActorBridge, BridgeType}; -use crate::{ - autoware::Autoware, - error::{BridgeError, Result}, - utils, -}; +use std::sync::{atomic::Ordering, Arc}; + use arc_swap::ArcSwap; use atomic_float::AtomicF32; use carla::{ @@ -11,7 +7,6 @@ use carla::{ rpc::{VehicleAckermannControl, VehicleWheelLocation}, }; use cdr::{CdrLe, Infinite}; -use std::sync::{atomic::Ordering, Arc}; use zenoh::{ pubsub::{Publisher, Subscriber}, Session, Wait, @@ -27,6 +22,13 @@ use zenoh_ros_type::{ tier4_control_msgs::{gate_mode_data, GateMode}, }; +use super::actor_bridge::{ActorBridge, BridgeType}; +use crate::{ + autoware::Autoware, + error::{BridgeError, Result}, + utils, +}; + pub struct VehicleBridge<'a> { vehicle_name: String, actor: Vehicle, diff --git a/src/clock.rs b/src/clock.rs index 388a402..04e2605 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -1,12 +1,14 @@ -use crate::error::Result; -use cdr::{CdrLe, Infinite}; use std::{ sync::Arc, time::{SystemTime, UNIX_EPOCH}, }; + +use cdr::{CdrLe, Infinite}; use zenoh::{pubsub::Publisher, Session, Wait}; use zenoh_ros_type::{builtin_interfaces, rosgraph_msgs}; +use crate::error::Result; + pub struct SimulatorClock<'a> { publisher_clock: Publisher<'a>, } diff --git a/src/main.rs b/src/main.rs index ed9fe24..f783749 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,13 @@ mod error; mod types; mod utils; +use std::{ + collections::{HashMap, HashSet}, + sync::Arc, + thread, + time::Duration, +}; + use bridge::actor_bridge::{ActorBridge, BridgeType}; use carla::{ client::{ActorBase, Client}, @@ -14,12 +21,6 @@ use clap::{Parser, ValueEnum}; use clock::SimulatorClock; use error::{BridgeError, Result}; use serde_json::json; -use std::{ - collections::{HashMap, HashSet}, - sync::Arc, - thread, - time::Duration, -}; use zenoh::{Config, Wait}; // The default interval between ticks diff --git a/src/utils.rs b/src/utils.rs index 03030e6..a0b192e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,5 @@ use std::time::{SystemTime, UNIX_EPOCH}; + use zenoh_ros_type::{builtin_interfaces, std_msgs}; pub fn is_bigendian() -> bool {