Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

SprayOn with continuous line

#1
Hi,

I tried to change Spray on parameter and configured volume several time /last config below), but I was not successful to create a continuous line . Just dots are visible. Off course, when I lower the speed, than more dots are visible. But this would kill my real time simulation (I try to simulate to add glue with a spraygun with bead of 30 mm diameter on an object with dedicated speed).  Unfortunately I am not able to interprete the parameter of the script in the rigth way.
Does anyone has an idea how to achive this?
Thanks, Wolfgang


// tried as rectangle size of 20 mm x 20 mm

 options_command = "RECTANGLE STEP=1x0"
  
    close_p0 = [0, 0, -200]  # xyz in mm: Center of the conical ellypse (side 1)
    close_pA = [20, 0, -200]  # xyz in mm: First vertex of the conical ellypse (side 1)
    close_pB = [0, 20, -200]  # xyz in mm: Second vertex of the conical ellypse (side 1)
    close_color = [1, 0, 0, 1]  # RGBA (0-1)

    far_p0 = [0, 0, 50]  # xyz in mm: Center of the conical ellypse (side 2)
    far_pA = [20, 0, 50]  # xyz in mm: First vertex of the conical ellypse (side 2)
    far_pB = [0, 20, 50]  # xyz in mm: Second vertex of the conical ellypse (side 2)
    far_color = [0, 0, 1, 1]  # RGBA (0-1)
#2
The spray function of RoboDK displays these droplets with every render event. If you simulate faster there will be less render events.
`
If you are looking to draw a continuous line you can use these scripts:
C:/RoboDK/Library/Macros/WeldOn.py
C:/RoboDK/Library/Macros/WeldOff.py

And you should run the simulation at normal speed.
#3
(06-23-2023, 09:44 AM)Albert Wrote: The spray function of RoboDK displays these droplets with every render event. If you simulate faster there will be less render events.
`
If you are looking to draw a continuous line you can use these scripts:
C:/RoboDK/Library/Macros/WeldOn.py
C:/RoboDK/Library/Macros/WeldOff.py

And you should run the simulation at normal speed.

Hi Albert, thanks for response.
But it did not work. I used WeldOn, but particles look similar to Spray_On (just some dots on the way of movement.
Furthermore, the particles are not at the selected object. When using RESET,  the particles to not disapear.
#4
Hi Albert,

yesterday I checked the script for Weld_On and found out that there are some bugs in the script.
- Selecting the Clear function does not work because query is two times for OFF and not for Reset
- Reading parameters need to be updated when reading content for color. Color is read with lower

I fixed the bugs, but the welding/spray parameter still do not enable an continuous line.
#5
You should select the Escape key to clear the trace. You could provoke this event by running this command:
RDK.Command("Escape")

To setup your color I recommend you to use the Hexadecimal color code using the AARRGGBB format (alpha, red, green, blue).

I don't understand the issues and modifications you are referring to. Can you share an RDK project file that shows this issue?
#6
(06-26-2023, 08:02 AM)Albert Wrote: You should select the Escape key to clear the trace. You could provoke this event by running this command:
RDK.Command("Escape")

To setup your color I recommend you to use the Hexadecimal color code using the AARRGGBB format (alpha, red, green, blue).

I don't understand the issues and modifications you are referring to. Can you share an RDK project file that shows this issue?

Hi,
below the comments for the original file "Weld_On.py" in the directory you mentioned.
Line 140 there is  following code, which checks the action ACTION_OFF two times, but not "RESET"
# Apply the desired action
if Action == ACTION_OFF:
    # Turn the gun off
    RDK.Spray_SetState(SPRAY_OFF, spray_id)

elif Action == ACTION_OFF:
    # Clear all spray simulations (same as pressing ESC key)
    RDK.Spray_Clear(spray_id)
Color is read with "lower" (line 107) therfore the Alpha with Digits is probably not interpreted in the right way.
With linear movement of less than 300 mm/s the projected dots are close together to show a continuous line. When simulation with 5 times the normal speed, dot with space between are visible.
This migth be caused due to the fact that the simulation with 5 time speed is just for movements and not for the macro .

Attached my modified file.

br


Attached Files
.py   WeldOnWS1.py (Size: 9.16 KB / Downloads: 135)
#7
Thank you for your feedback! We'll fix this with our next version of RoboDK.
#8
One question more, regaridning the original topic.
Do you think it is possible "somehow" to give process/thread for a macro higher priority than others to achieve a continuous line even when using higher simulation speed.
What I mean is, does RoboDK has an option for the user to control application priorities?
If so, I could give higher priority to the macro thread before robot moving program, so that much more particles will be placed at shorter distance.

Thanks
#9
It is not possible to control the process/thread priorities from RoboDK. 

However, one workaround if want to use the RoboDK API using Python, is to trigger an increment in simulation time by using this command:
Code:
RDK.Command("SimulationTime", 0.1)
This would update robots and programs by this much time in seconds (0.1 seconds).

The workflow would then be:
Code:
RDK.setSimulationSpeed(0) # Stop the simulation
while True:
    RDK.Command("SimulationTime", 0.1) # This moves the simulation by 0.1 sec
    RDK.Render() # This provokes dropping particles
    # time.sleep(0.05) # Optional
However, another way to triggers your code at each render event would be to create a plugin. You have access to the RoboDK API via a plugin and much more through a plugin. For example, you could render your own graphics at each render event.

You can find more information about RoboDK plugins here:
https://robodk.com/doc/en/PlugIns/index.html
  




Users browsing this thread:
1 Guest(s)