there are data sets coming in via mqtt/json.
Each of such data sets makes up an entity (object).
The data coming in can have a new ID (= new entity) or an existing ID (new values for an existing entity).
I want to store the entity data so that I can add a new data set (= new ID) somehow or update an existing one (ID already exists somehow).
I read the graybook, the forum and many places and didn’t get a working solution. It’s so easy in other languages though.
thank you for pointing me to using classes. I didn’t find documentation that helps me understanding the use of classes and instantianting objects as well as manipulating individual objects (instances).
But I found and watched Joreg’s tutorial “Object oriented patching with Joreg” which deals with records.
Now I understand much better how to program object oriented with VL.
Thank you Joreg!
Thank you so much everyone!
I watched the suggested videos and learned already a lot from them. Impressive how people share their knowledge (and have time to do so).
Thanks @joreg for your “personal” patch. I adopted it and it works!
Unfortunately I still know so little about VL that I’m troubled with understanding how I can work with the MutableDictionary. It might even be a wrong aproach to get to my goal.
As I described, I want to control the particles meaning that I want to update existing ones with new position data and of course render them and also I want to add color, size ‘n’ stuff and I need to be able to select the particles with the mouse so I can use them for further processing (get values and send them via e.g. MQTT).
I know how to use MQTT and how to render, but how can I do this with selected particles (= key/value pair in the dictionary)? The dottore-videos proposed by @chk might describe what I could use but they are not too easy to understand. He definitely describes something quite complex.
This might be too much to ask but I don’t know better.
i think you’ll have to be more precise with your requirements if you want more help.
this is what’s happening in the patch. any particle coming in with the id of an already existing one, will update/overwrite the existing one.
what’s not clear from your descriptions is how you’d want to manipulate particles with the mouse, but then a particle coming in via mqtt with an existing id will override all those manipulations again? so please try to give us more context so we can build a mental model of what you’re looking for.
Well, I didn’t dare to ask so much. I thought getting a hint how to control some objects will lead me to a solution.
Anyway, I’m happy you’re proposing to find a mental model together.
I have a camera based sensor that can detect objects, e.g. people.
The sensor is mounted about 3 m high facing down.
It “looks” down and can detect people (and other objects).
Once a person is detected, it is tracked, meaning the sensor follows that person.
Following the person means updating its track data which contains
pos X, Y, Z
age (in frames, i.e. the number is incremented with each frame [there are 20 per sec.] where the object is tracked)
For every newly detected object there will be a new ID and the other data.
These tracks (as dots) along with the real scene (my room or where ever the sensor is mounted) can be displayed in the sensor’s user interface.
The track data can be distributed via mqtt.
What I want to do is using these track data in vvvv, i.e. receiving them via mqtt (already works well) and display them in a nice environment, i.e. with a renderer rendering some graphics with the objects of the sensor world as sprites of arbitrary shape.
One of many ideas is a Pac-Man environment:
I am the first entering the room and so I get tracked by the sensor. The sensor assigns ID 1 to “me” = my data object/collection.
Two other people enter the room, are tracked by the sensor and get assigned IDs 2 and 3.
I am Pac-Man and will be rendered as yellow circle and the other two as Blinky and Pinky.
So what needs to happen is that my movement will control Pac-Man and the movements of the other two will control Blinky and Pinky.
That means, whenever vvvv receives the data of track with ID 1, it needs to move Pac-Man. When it receives data with ID 2, it moves Blinky and Pinky with ID 3.
I don’t ask you to write up a Pac-Man game but I very much hope to get some more ideas how I could go further to reach the goal.
I must admit that I am still fascinated by vvvv’s and VL’s concept, the passion you developers show in bringing new updates and infos and keeping the community alive but that on the other hand I am quite overwhelmed by the number of nodes I sometimes need to use (and need to know) to come to small goals.
I’m sure it’ll take only some more practicing hours (or weeks) for me to get on the feet!
So if i understand correctly, the example i posted is not too far from. you already have particles following the incoming data. now i understand that you want to link the first of those with a PacMan. this should easily be done by letting your PacMan read the data from the first Particle, right? so what exactly are you missing there?
yes, exactly. I’m missing that link.
I still don’t know how to “select” e.g. particle 1 and process its data. For example, when particle 1 moves along, something happens (dots get deleted because it’s Pac-Man eating them) or when particle 2 moves to particle 1’s position, Pac-Man changes shape and vanishes.
Pac-Man is just an use case example.
In an abstract code example it could look as easy as this:
vl doesn’t seem to be my friend yet. :-(
But my heart is beating for it in a way.
((If I told you I’d like to see the particles flying in a beautiful 3D world …))
ok, the following further outlines the idea: assume you have a node that represents pacman, you’d now give it access to the list of particles and tell it to take its position from the partcile with id 0. ParticlesFromMqtt.vl (36.4 KB)