GithubHelp home page GithubHelp logo

Timeline of events about morse HOT 5 CLOSED

morse-simulator avatar morse-simulator commented on July 26, 2024
Timeline of events

from morse.

Comments (5)

PierrickKoch avatar PierrickKoch commented on July 26, 2024

One way to achieve it:

  • allow the user to specify in a builder script a class or function that will be called by the game engine in the main loop, with access to the MORSE internals (to be define -> which internals) and the amont of seconds since the start.

from morse.

lesire avatar lesire commented on July 26, 2024

I've started looking at implementing such events by using the testing framework, but I have faced some issues and have had no time to work again on it for a while... The idea was that an event is a guard (just as in a test) with an effect. I put here some code I tried some weeks ago (but I can't remeber what was the issue with it):

class TestBloque:
    def __init__(self, pos=[110, -38], th=5):
        self.morse = pymorse.Morse("localhost", 4000)
        self.gps = self.morse.stream('GPS')
        self.pos_bloque = pos
        self.pos_threshold = th
        self.gps.subscribe(self.event_at_pos)

    def event_at_pos(self, data):
        dist = math.sqrt( math.pow(data['x'] - self.pos_bloque[0], 2) 
                          + math.pow(data['y'] - self.pos_bloque[1], 2))
        if (dist < self.pos_threshold) :
            print("Send event 'bloque'")
            send_event("bloque", "/super_nav/ctrl/in")
            self.gps.unsubscribe(self.event_at_pos)

TestBloque(pos=[114, -42], th=2)

If going this way for managing (timed) events seems a good solution for everyone, I can work again on it in January, and then propose an events API on top on testing.

from morse.

severin-lemaignan avatar severin-lemaignan commented on July 26, 2024

To be honest, it is not very clear to me... Besides, I do not see the "timed" aspect...?

from morse.

lesire avatar lesire commented on July 26, 2024

I used the testing API and subscribed a new "test" for the GPS component. This test is actually an event: when the GPS position is close to 'pos', it sends the "bloque" string on a Yarp port (external to MORSE).
I think extending it to have a condition like "when time is close to 't'", and an effect like "add a cube in the scene at (x,y,z)" would not be too complicated!

from morse.

adegroote avatar adegroote commented on July 26, 2024

Superseed by #387

from morse.

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.