thefunkybuddha Posted August 17, 2021 Report Posted August 17, 2021 I Have a system that I am using two sensors to located my x and y position within a predefined area. Lets say for the sake of argument that my x and y both range from 0 to 100 meters. Is there a way I can show my position in real time on my HMI screen?
ORSO2001 Posted August 17, 2021 Report Posted August 17, 2021 hi thefunkybuddha, i don't know what sernsor are you using...I am supposing that in someway (on demand) you are able to get info from these sensors...then couple these info with some global tags (or struct...maybe) and couple these tags/struct with the relative HMI elements (text, number...)...all is done...but seems too simple...what sensors are you using?
thefunkybuddha Posted August 17, 2021 Author Report Posted August 17, 2021 Laser sensors. To be more specific, a large overhead crane. The lasers are mounted on the bridge and trolley and aimed at stationary structures ( a wall). So essentially what I have is a cartesian coordinate system with continuous data that gives me position (x, y). I currently report the position with a live reading of the lasers on my "run" screen. What I want to do is have the operator move the crane to the origin, record that value (it may be offset from (0, 0)) then move it to the opposite point and record that position. Have that data scaled to the size of the screen, then in real time graphically report that position on an HMI screen. For sake of simplicity mathematically assume my coordinate system is (0,0) meters to (800, 480) meters. Lets say that I represent my life position with a red circle. At (400, 240) my red circle would be at the mid point of my HMI screen. I want that to move as I move position in real time. Without any further research the only way I can think of to do this would be to overlay a red circle and every possible point with a visibility rule of when (x,y) = live (x,y). It seems like a brute force method. I was hoping for a much more elegant solution.
Ness Posted August 17, 2021 Report Posted August 17, 2021 In the ladder editor's Toolbox there is a 'Drawing' section with ladder functions for drawing and clearing basic shapes on the screen. I think it might be able to do what you're wanting.
Dave Posted August 17, 2021 Report Posted August 17, 2021 I believe you can use the INSERT SHAPE instruction, found at the bottom of the Ladder toolbox, under Drawing. I have never used this, and can't find any help or examples, but when I hover my mouse over the input tag, B, it prompts me to enter the "shape struct". This leads me to believe that you must first define a shape and then create a struct that would include X,Y coordinates. Once you have that struct created, you should be able to manipulate the coordinates based on your laser sensor readings. If anybody knows where to find an example or instructions for creating shape groups and structs, I would be very interested to see that. update... I just tried inserting that instruction and when I create a new tag for each input/output of the instruction, there is a brief description of its purpose/use. There are 3 types of shapes available...line, circle & rectangle. The shape struct is automatically created when you according to the shape type selected when you create the tag. the circle struct, for example, has Thickness, Color, X position, Y position, and radius. Well, I tried a few attempts, but I think I need some more info on shape group ID#'s, and color settings. I managed to get the instruction to execute without an error code, but nothing shows up on the screen. Dave.
MVP 2023 kratmel Posted August 17, 2021 MVP 2023 Report Posted August 17, 2021 I do not test layers in Unilogic. Maybe another idea of brute force - List of Images with vertical line (colour with visible thickness) in different position in one layer (0-100% of x coordinate) and List of Images with horisontal line (another colour with visible thickness) in different position in another layer (0-100% of y coordinate). Yo can do math with real position and convert it to different variant of working range on screen -one combination of two image represent position. User can see on display two crossed line x and y (maybe ). P.S. Maybe foto of terytory can be placed in bottom layer from SD card.
Dave Posted August 18, 2021 Report Posted August 18, 2021 I played around a bit with the drawing tools and came up with a reasonable solution. Have a look at the attached program.(I used a USP-070-B10, with Unistream version 1.30.58) I originally had the circle position updating every scan, but the screen refresh rate could not keep up, so I changed it to update only when the X or Y position values changed. I linked two sliders to the X & Y position tags in the circle struct that was created when I defined the shape tag for the insert shape instruction. It's a bit rough around the edges, but should give you an idea of how the drawing tools function. PositionTracking.ulpr 1
thefunkybuddha Posted August 20, 2021 Author Report Posted August 20, 2021 Just got back from a conference. Thank you all so much for the responses. I will go through them and let you know what happens. Thanks.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now