Git Product home page Git Product logo

safe_drive's Introduction

safe_drive: Formally Specified Rust Bindings for ROS2

safe_drive is a Rust bindings for ROS2. This library provides formal specifications and tested the specifications by using a model checker. Therefore, you can clearly understand how the scheduler work and the safeness of it.

Specifications

Some algorithms we adopted are formally specified and tested the safeness by using TLA+. Original ROS2's executor (rclcpp) suffers from starvation. In contrast, the starvation freedom of our executor has been validated by not only dynamic analysis but also formal verification.

See specifications.

We specified and tested as follows.

  • Single Threaded Callback Execution
    • Deadlock freedom
    • Starvation freedom
  • Scheduling Core Algorithm
    • Validate the insertion algorithm
    • Termination
  • Initialize Once
    • Deadlock freedom
    • Termination
    • Initialization is performed just once

Documents

Supporting ROS2

  • Humble
  • Galactic (EOL)

Supporting DDS

  • CycloneDDS
  • FastDDS

Progress

  • Zero copy
  • Custom memory allocator
  • Topic (Pub/Sub)
  • Service (Client/Server)
  • Asynchronous programming (async/await)
  • Callback based programming
  • Logging
  • Signal handling
  • Parameter
  • Timer
  • Action (service + topic)
  • Rust code generation from .msg and .srv files
  • Formal Specification
    • Single threaded callback based executer
    • Scheduling Core Algorithm
    • Initializer performed just once

safe_drive's People

Contributors

kazuki0824 avatar kuchitake avatar sarukiti avatar sei0o avatar takanotaiga avatar yasuharu519 avatar ytakano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

safe_drive's Issues

remap issue for node names and namespaces

Hello,

Node definition is:

/// Node of ROS2.
pub struct Node {
    node: rcl::rcl_node_t,
    name: String,
    namespace: Option<String>,
    init_param_server: InitOnce,
    pub(crate) context: Arc<Context>,
}

if the user remap the name this will not be taken into account: isn't better to remove name and namespace and replace them with methods to get the node name with rcl_node_get_name and rcl_node_get_namespace ?

[question]: Send not implemented for TakenMsg

Hello,

one question, if we try in async code to use several publisher we are facing an issue with Send/Sync markers for TakenMsg

sample code:

let logger = Logger::new("async task");
let mut subscriber1 = node.create_subscriber::<std_msgs::msg::String>("topic1", None)?;
let mut subscriber2 = node.create_subscriber::<std_msgs::msg::String>("topic2", None)?;
loop {
         let msg1 = subscriber1.recv().await?;
         let msg2 = subscriber2.recv().await?;
         pr_info!(logger, "{}", msg1.data);
         pr_info!(logger, "{}", msg2.data);
}

error:

has type `TakenMsg<std_msgs::msg::String>` which is not `Send`

is this expected ?

Seq size check N vs size

Hello,

There's no safe way to assign data to a message containing a Seq

Example: DiagnosticArray

#[repr(C)]
#[derive(Debug)]
pub struct DiagnosticArray {
    pub header: std_msgs::msg::Header,
    pub status: DiagnosticStatusSeq<0>,
}

As status is an unlimited sized we cannot assign a DiagnosticStatusSeq<4> to it for example.
The only way:

let mut diagnostics = DiagnosticArray::new().unwrap();
let status = DiagnosticStatusSeq::<5>::new(4).unwrap();
unsafe { diagnostics.status = std::mem::transmute(status)};

Another remark:

impl<const N: usize> DiagnosticArraySeq<N> {
    /// Create a sequence of.
    /// `N` represents the maximum number of elements.
    /// If `N` is `0`, the sequence is unlimited.
    pub fn new(size: usize) -> Option<Self> {
        if N != 0 && size >= N {
            // the size exceeds in the maximum number
            return None;
        }

isn't size check must be > instead of >=, this gives a strange API : XXSeq::<N>::new(N-1) ??

Thanks

logging level issue

Trying to play with ros2 logging level looks like the severity is not taken into account

$ ros2 run subscribers subscribers --ros-args --log-level error
[INFO] [1694627456.794940537] [topic2]: received: Hello, Universe!
[INFO] [1694627457.044055614] [topic1]: received: Hello, World! 

I checked the code and for me it looks fine, but may be I missed something

OS: Ubuntu
ROS_DISTRO: humble

panic with ctrl-c when tokio is used

ros2 run client client

^C[INFO] [1693555075.459597255] [safe_drive]: Received signal: 2
[ERROR] [1693555075.459645810] [client]: error: Signaled
Error: Signaled
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe_drive-0.2.1/src/context.rs:213:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
[ros2run]: Aborted

same panic occurs even if we use tokio::signal::ctrl_c(): example

tokio::select! {
       _ = tokio::signal::ctrl_c() => {},                                                                                                                                                                               
       _ = task1 => {},                                                                                                                                                                                                 
};

in the first case may be it's ok, but second one I would expect dropping to be fine

  • ROS_DISTRO: humble
  • OS: Ubuntu 22.04.3 LTS

--ros-args --params-file not taken into account

Hello,

when we use

ros2 run my_node my_node  --ros-args --params-file params.yaml

The yaml file is not loaded

Looks like when node is created the rcl_arguments_get_param_overrides is not called ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.