Send Data to Another Computer ROS Node

Hi, for now I have found a work around, for my application I can use it in another computer where I am not required to use realsense, however I would like to know how I can send data to different computer, I initiated with sending data into the same machine using the code. However, getting the following error message, is there a specific way on entering the IP address or any other requirement that needs to be taken care of before starting sending the message. Like do I need to install rosbridge and run it before sending the message.

Error
[roslibrust::rosbridge::client] Failed to reconnect: CommFailure(Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))

CODE


use log::*;
use roslibrust::ClientHandle;

roslibrust_codegen_macro::find_and_generate_ros_messages!("assets/ros1_common_interfaces/std_msgs");

/// This example creates a client, and publishes a message to the topic "talker"
/// Running this example at the same time as subscribe_and_log will have the two examples
/// pass messages between each other.
/// To run this example a rosbridge websocket server should be running at the deafult port (9090).
#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    simple_logger::SimpleLogger::new()
        .with_level(log::LevelFilter::Debug)
        .without_timestamps() // required for running wsl2
        .init()
        .unwrap();

    let client = ClientHandle::new("ws://localhost:9080").await?;
    let publisher = client.advertise::<std_msgs::Header>("talker").await?;

    loop {
        let msg = std_msgs::Header::default();
        info!("About to publish");
        publisher.publish(msg).await.unwrap();
        info!("Published msg...");
        tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
    }
}

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.