Comments (5)
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.
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.
To be honest, it is not very clear to me... Besides, I do not see the "timed" aspect...?
from morse.
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.
Superseed by #387
from morse.
Related Issues (20)
- KeyError when running scripts - Gyroscope
- Can't set a 2D nav goal using Rviz (starting from the navigation tutorial with PR2) HOT 2
- doc generation is failing with sphinx 1.7 HOT 1
- Broken Blender component selection HOT 2
- bin/morse_inspector has different python executable specified than other python scripts
- Morse telemeters output keep increasing HOT 1
- [Q&A] How to develop functionaltiy in MORSE?
- please release a new version of morse
- Morse is not working on Python 3.7 HOT 1
- Question about inheritance of SemanticCamera sensor HOT 2
- issue of morse run HOT 1
- Add Appveyor HOT 4
- Add link to latest Morse Windows installer
- Grasping problem of Human Avatar. KeyError: 'requested item "Near" does not exist'
- Error using hla in hybrid simulation
- use_internal_syncer in multi-node over socket protocol HOT 1
- package install on Ubuntu 20.04 not working HOT 7
- Question on default camera view
- Blender Version check reults in Index Error HOT 2
- Does not build with Sphinx 3.1: Theme error: An error happened in rendering the page morse. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from morse.