Git Product home page Git Product logo

Comments (5)

msebek avatar msebek commented on August 24, 2024

This will be implemented as part of the pub/sub system. Similar to ROS, I think we should allow threads to subscribe callbacks to string paths.

For example, the serial event handler will publish to "/
An over-excited logger can subscribe to "/" and get every single message possible.
The GUI pane for IMU can subscribe to "/sensors/IMU", or whatever the IMU serial reader writes to. Alternatively, for playback, a sensor log reader can publish to "/sensor/IMU", and no other component in the system would be the wiser. This allows us have cleanly-implemented playback

(side note: There are global clock concerns during replay. We'll get to that.)

I am not positive this is the best strategy. There isn't compile-time type-safety with this approach, e.g., nothing stops an IMUMessage from being published to "/sensors/GPS", which will cause the GPSListeners to explode or become very confused.

Interface

abstract class IMessage {
// no data members required...not sure I like this. 
}

class ImuMessage extends IMessage {
   float X_acceleration;
   float Y_acceleration;
}

void publish(String path, IMessage msg);

public interface IListener {
   // should we know what the message was that called us?
   //   for example, the everything-logger would want to know what message it is logging  
   public void messageCallback(IMessage msg)
}


void subscribe(String path, IListener callback);

@TrevorDecker thoughts?

from robobuggy.

msebek avatar msebek commented on August 24, 2024

oh! java can parametrize types! i'll update that soon.

ros deets: http://pharos.ece.utexas.edu/wiki/index.php/How_to_Publish_and_Subscribe_to_a_Custom_Topic_and_Message_using_ROSJava

from robobuggy.

msebek avatar msebek commented on August 24, 2024

Java type parameters don't do much in our case. Our flexibility comes from being able to subscribe to arbitrary message paths, and we can't do that as easily if we have compile-time checking.

Other Design thoughts?
@ihartwig @bstrysko @Ginto8 @kbrennan234 @ayeohmy

from robobuggy.

TrevorDecker avatar TrevorDecker commented on August 24, 2024

I vote we get version 0.1 kind of working and worry about type safety latter. Run time should be fine we will just have to test our code for full coverage, which is a good thing anyway.

from robobuggy.

msebek avatar msebek commented on August 24, 2024

commit 272e491 prototypes the pubsub that's helping with cleanup. This will soon be part of the replay mechanism.

from robobuggy.

Related Issues (20)

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.