Comments (4)
@leonardocfor I came across this and thought I'd have a look at it. I can get updating to run with the following code. The text appears before the Successfully loaded plugin TEST
. This also sits in a file ./plugins/test.py
. I think as well you need to make sure the function init_plugin()
is configured properly. I copied this using the plugins that come with BlueSky to generate this MWE. Hope this helps.
""" BlueSky plugin template. The text you put here will be visible
in BlueSky as the description of your plugin. """
from bluesky import core, stack, traf #, settings, navdb, sim, scr, tools
### Initialization function of your plugin. Do not change the name of this
### function, as it is the way BlueSky recognises this file as a plugin.
def init_plugin():
''' Plugin initialisation function. '''
# Instantiate our example entity
test = Test()
# Configuration parameters
config = {
# The name of your plugin
'plugin_name': 'TEST',
# The type of this plugin. For now, only simulation plugins are possible.
'plugin_type': 'sim',
}
# init_plugin() should always return a configuration dict.
return config
class Test(core.Entity):
''' Example new entity object for BlueSky. '''
def __init__(self):
super().__init__()
self.update()
# Functions that need to be called periodically can be indicated to BlueSky
# with the timed_function decorator
@core.timed_function(name='test', dt=5)
def update(self):
"""Updating function"""
print("Updating ...")
from bluesky.
Hi @leonardocfor,
To add to @Ellislee1 's answer: Don't forget to instantiate your Test
class (typically in the init_plugin
function), and note that periodic functions are only triggered when the simulation is in Operate mode (so not in Hold, which is what you have when you start up BlueSky).
from bluesky.
Hi @Ellislee1 and @jooste,
Thank you for your prompt reply. I confirm that the update function is executed upon the class initialization. However, to your comment @jooste, how can I force the simulation to go to Operate mode? i.e. without having to send a command or else to kick off the simulation. I ask this because we need to allow constant checking of a remote API in the update function.
from bluesky.
You could do the following:
from bluesky import sim
def init_plugin():
...
sim.op()
from bluesky.
Related Issues (20)
- Unable to use `open` on Mac HOT 1
- Reading Cache HOT 3
- Scenario Files Not Working as Intended HOT 4
- ADDWPT not working HOT 9
- Adding text information to both waypoints and aircraft HOT 10
- Getting Time From Bluesky Sim HOT 2
- Running Multiple Simulations In Separate Intances of Bluesky HOT 4
- Add a reset for the autopilot? HOT 1
- Initialization as a python package issue HOT 2
- Switch performance model. HOT 1
- climb of the aircraft
- How to kill an orphaned BS node HOT 1
- QT Gui Fatal Error HOT 2
- Qt GUI scale issue HOT 9
- Is there any built- in function to calculate distance travel by the single aircraft? HOT 4
- Diferent results on same scenario HOT 6
- How to import flightradar 24 csv file into bluesky HOT 4
- How to simulate air traffic of your aerodrome in bluesky. Where is the source code of bluesky to read ? HOT 1
- Generating scenarios from real-time air traffic data OR from historic data such as from ASTERIX files HOT 2
- How to define holding pattern using command in bluesky.how to designate fix apart from waypoint using bluesky inside airspace ? HOT 2
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 bluesky.