Anylogic: How to enable/disable path between nodes using a control - path

Refer to image.
The objective is to "enable/disable" the yellow path between experiment runs (purpose is to measure time savings if vehicles have the ability to use short-cut).
What is the easiest way to do this programmatically (i.e. not adding/removing the path manually).

If you have Material-handling transporters using the network, you can programmatically call one of these functions to prohibit usage:
If not, you will have to create the network programmatically upfront and either include/exclude the path accordingly.
One trick before going there: You can try to path.setBidirectional(false); to prohibt travelling against the drawn direction. But obviously, this only helps in some cases.
PS: You can also go all out and take full control of your network by agent-ifying it, see my full workshop here: https://www.benjamin-schumann.com/blog/2022/8/6/taking-control-of-your-network-agent-based-pathfinding

Related

Identify objects by its position open cv

I'm very new into Image Processing libraries. I been looking into OpenCV. But I have a question.
What sort of algorithms could I use if I want to identify few similar objects in a room.
Lets say 3 similar tables.
With a camera I sign an identity to each of those tables, after I move the camera
to a positon where the objects are out of sight, when pointing the camera back
to them, the system can properly identify those objects with the initial ID and trigger action based in each id.
I read about aruco makers, but i would like to try the idea without have to attach markers.
There's plenty of methods to choose from. You could use image features, color matching, shape matching, pattern matching ... and so on. It really depends on the specific use case and the environment. In any case you need something unique to distinguish the tables from each other. Using markers would be one way to artificially create uniqueness.
Maybe you wanna start reading here to get a feeling how one method works:
https://docs.opencv.org/3.4.1/dc/dc3/tutorial_py_matcher.html
Could you provide an example set of images of the scenario?

Trackbar in rqt ros

I am trying to interface ROS and open cv. I was able to threshold the video stream and display the output in rqt. Now I want to adjust the threshold range by creating a track bar in rqt. How could I implement it.
The best way in terms of integration and looks would be to create your own rqt plugin (tutorial). However you'd need to find some way to notify your node about any changes (e.g. via a service call).
Much easier and faster, and usually sufficient, is to re-use existing functionality. In this case, take a look at dynamic_reconfigure. This allows you to change parameters on the fly, you only need to define the configuration and register a callback in your code (tutorials). The GUI integrates into rqt.

Import/export or store/restore xShapes in LibreOffice/OpenOffice Draw via API

I want – as the title says – extract programmatically a shape from a Draw document through the api interface. Beside I want to import such a shape into a document as well.
I saw some predefined shapes in XML form and the document is stored as XML structure as well. Is there a known way to anybody out there to allow the storage and load of one shape?
What is this good for?
I want to, for example, enable the programmatic deletion of objects. But to enable the undo/redo functionalities I need to “store” the deleted shape. Beyond that this would allow me to add user-defined objects programmatically, e.g. arrow heads, UML structures or unicorns.
Thanks in advance for any ideas,
J
P.S.: I work with LibreOffice Version: 5.2.1.2 . Access the interface through C# (so java and C++ would do it as well) but any ideas are welcome.
I'm not entirely sure what you are trying to do, but here are some ideas:
Instead of deleting an XShape, you could use the dispatcher to Cut it. That will store it in the clipboard, so if it needs to be added back then the dispatcher can Paste it, as long as no other copy or cut was performed.
To create a shape, see the example at https://wiki.openoffice.org/wiki/Documentation/DevGuide/Drawings/Shapes. This code will look different depending on what kind of shape it is. It sounds like you are asking for one code listing that will programmatically create any type of shape, but I do not think it is that easy.
Instead of using the UNO API, you could programmatically modify the XML files, which may make it easier to store and work with any shape. Be sure to use an XML parsing library, not just regular expressions.

Temporary tiles cache for Mapserver

I was searching on Google and StackOverflow to see if anyone have solution for my problem, but didn't found anyone with same problems.
So, currently I'm running Debian machine with Mapserver installed on it. The server also run webserver for displaying map data over the browser. The generation of map is dynamic, based on layers definition in database I built mapfile in PHP and based on that generated PHP the map is shown to user. The data is defined in database and as a SHP files (both combined in single mapfile).
It is fully dynamic, what I mean with that is that user can enable/disable any of layers or click inside polygon (select some points on map) it color the selection (generate new mapfile based on selection and re-generate tiles).
So the execution of all that code from selecting some area to coloring selected items somtimes take too much time for good user experience.
For solution I'd like to use some kind of temporary tiles cache, that can be used for single user, and to be able to delete it's content when user select some items on map or enable/disable one of the layers.
P.S. I already did all the optimizations provided from Mapserver documentation.
Thanks for any help.
It sounds to me like your problem is not going to be helped by server-side caching. If all of the tiles depend on user selections, then you're going to be generating a bunch of new tiles every time there's an interaction.
I've been using MapCache to solve a similar problem, where I am rendering a tileset in response to a user query. But I've broken up my tiles into multiple logical layers, and I do the compositing on the browser side. This lets me cache, server-side, the tiles for various queries, and sped up performance immensely. I did seed the cache down to zoom level 12, and I needed to use the BerkeleyDB cache type to keep from running out of inodes.
I'm using Leaflet.js for the browser-side rendering, but you should also consider OpenLayers.
After looking at the source code, I have some other ideas.
It looks like you're drawing each layer the same way each time. Is that right? That is, the style and predicate of a particular layer never change. Each user sees the image for that layer the same way, if they have selected the layer. But the combination of layers you show does change, based on OpenLayers control? If that's the case, you don't need per-user caching on the server. Instead, use per-layer caching, and let the user's browser figure out the client side caching.
A quick technique for finding slow layers is to turn them all of. Then reenable them one by one to find the culprit. Invoke Mapserver from the command line, and time the runs, for greater precision than you'll get by running it from your webserver.
You mentioned you're serving the images in Google 3857 while the layers are in Gauss-Kruger/EPSG 3912. Reprojecting this on the fly is expensive. Reprojecting the rasters on the fly is very expensive. If you can, you should reproject them ahead of time, and store them in 3857 (add an additional geometry column).
I don't know what a DOF file is--maybe Digital Obstacle File? Perhaps preload the DOF file into PostGIS too? That would eliminate the two pieces you think are problematic.
Take a look at the SQL queries that PostGIS is performing, and make sure those are using indexes
In any case, these individual layers should go into MapCache, in my opinion. Here is a video of a September 2014 talk by the MapCache project leader.

How can I process a -dynamic- videostream and find the (relative) location of a "match" in that videostream?

As the question states: how is it possible to process some dynamic videostream? By saying dynamic, i actually mean I would like to just process stuff on my screen. So the imagearray should be some sort of "continuous screenshot".
I'd like to process the video / images based on certain patterns. How would I go about this?
It would be perfect if there already was (and there probably is) existing components. I need to be able to use the location of the matches (or partial matches). A .NET component for the different requirements could also be useful I guess...
You will probably need to read up on Computer Visual before you attempt this. There is nothing really special about video that seperates it from still imgaes. The process you might want to look at is:
Acquire the data
Split the data into individual frames
Remove noise (Use a Gaussian filter)
Segment the image into the sections you want
Remove the connected components of the image
Find a way to quantize the image for comparison
Store/match the components to a database of previously found components
With this database/datastore you'll have information on matches later in the database. Do what you like with it.
As far as software goes:
Most of these algorithms are not too difficult. You can write them yourself. They do take a bit of work though.
OpenCV does a lot of the basic stuff, but it won't do everything for you
Java: JAI, JHLabs [for filters], Various other 3rd party libraries
C#: AForge.net

Resources