Combining two High Priority User Data

Hello -

Based off of the example code, I’ve gotten our gyro and rangefinder to work in separate codes. However, I am having troubles combining them into one code as Set High Priority User Data only accepts one input, and you cannot use more than one.

I’ve tried sending the output from the rangefinder to the User Messages section of the Driver’s Station. I saw jumbled characters constantly updating when I had linked the output to a string flattener before the Send User Message, and saw nothing when I linked the output directly to Send User Message.

Any help? Need screenshots?


Too vague? Need screenshots?

You can combine data from multiple places using a Cluster Bundle, and then flatten the cluster for the high priority dashboard data.

For the user messages, it expects a string. However, the flatten to string isn’t what you want. It takes the number, converts it to binary, and sends it. You should use the format into string, which takes a number like 10, and coverts it to a string “10”. I hope that’s understandable.

Let’s focus on using a Cluster Bundle. Where would I find such a tool? I can’t find it under WPI or Data Manipulation, but I might just be blind.

So, if I wire in data from our Gyro and Rangefinder to the Cluster Bundle, flatten it, and ship it off into the high priority data, how do I separate the Gyro data from the Rangefinder data once I unflatten the string?

Bundle is under Programming then Cluster, Class, and Variant. On the other side, you would use Unbundle.

99% of what I use is either under programming or under WPI.

Alright, here’s what I’ve come up with.

I’m not sure why the output cluster going to the anything terminal is causing an issue. Any help?

So, after some tinkering, here’s what I came up with.

Do I need the flatten to string between Bundle and Set User Data High?

Use the bundle, rather then bundle by name.

The by name versions are nice if you create a .ctl with your cluster as a typedef, which you’ll want to do once you start adding more things to the dashboard, but is overboard for just two items.

Yes, you need the flatten to string after the bundle, before the flatten from string. On the dashboard side, you’ll need to create a “fake” cluster to feet into the unflatten from string, so that it knows how to decode the string.

Ah, alright. Just replaced it.

So, I should place a 1 block Bundle cluster and pump the high user data into it, and wire the output cluster to the unflatten from string?

That is a bundle by name. It requires an input cluster, defining the potential names of the elements of the cluster. The bundle by name can only used on elements with names in the cluster, unnamed elements are ignored. You can replace that with a bundle if you do not want to define a specific cluster. I would recommend using cluster saved as a typedef. This allows the dashboard project to use the same control, and be automatically updated when the cluster is updated, upon the next opening of the project.

EDIT: Oops, I was not fast enough on that draw…

I’ve replaced the bundle by name with a plain old bundle. Now, I need to know how to unflatten and unbundle the data within the dashboard. I’ve tried pumping the high user data into unbundle, but that didn’t do it.

Here’s what I have now.

Did I do it correctly? Somehow I think not.

You are getting closer. Technically that will should work, but I wouldn’t recommend it, because it is a bit convolved. Here is a small example I just threw together. I used non-typedef’d clusters for portability, but I would highly recommend using typedefs. I try to never use clusters without making them a typedef, it always pays off. The cluster is contains arbitrary data, replace the contents of that cluster at will.

Sending to the driver station:
Send to DS.png

Reading that data back:
Receive robot Data.png

EDIT: These pictures are snippets, and can be dragged onto a LV block diagram. (Firefox requires dragging to disk first, then to LV)

Receive robot Data.png
Send to DS.png

Receive robot Data.png
Send to DS.png

You, sir, have just boggled my mind ¯(º_o)/¯

Thanks for taking the time to help, though. I’m going to run what I’ve got tomorrow and hope for the best.


It worked!