Shadow
January 27, 2023, 2:51pm
1
Hello all
The task is simple but i’ve failed to achieve it…
I’ve tried looking at how the software works for releasing the AMR based on the flow and the “PickTime” of that variable… However when I try and make it “event based” (eg. a release signal from a OPC-UA connection from like a Behavior instead of the current “timer based”), it does not work…
I havent posted what i tried to do because i think im not on track… Have someone perhaps done a similar thing or could give me a clue how to change the lines in the python script to react on a signal rather than the timer?
Este
January 30, 2023, 6:51am
2
Something like this?
def place(component, dest_container, dest_prod_wpm, place_time, assisted=False, unload_assisting=None):
global robo
if place_time < 0.0:
place_time = 0.0
slot = pattern_manager.find_slot(component)
if slot:
slot.component = None # release slot
offset_mtx = component.Product.ProductType.OriginFrame
if offset_mtx != IDENTITY_MTX:
offset_mtx.invert()
dest_prod_wpm *= offset_mtx
component.update()
if not robo and slot and slot.pattern.keep_orientation:
dest_prod_wpm.WPR = component.WorldPositionMatrix.WPR
if assisted:
dest_container.OnTransition = activate_trigger
action_manager.pre_process_trigger(add_capacity=0)
ready_p = action_manager.assist_ready_p
ready_p.Value = True
triggerCondition(lambda: component in dest_container.Components)
dest_container.OnTransition = None
ready_p.Value = False
action_manager.post_process_trigger()
return
USE_SIGNAL_FOR_PLACING = True
my_release_signal = comp.findBehaviour("MyReleaseSignal")
if USE_SIGNAL_FOR_PLACING:
triggerCondition(lambda: my_release_signal and my_release_signal.Value)
else:
if comp.SimulationLevel == VC_SIMULATION_DETAILED and sim.SimSpeed < place_time*10:
if robo:
pick_wpm = component.WorldPositionMatrix
comp_bd = component.BoundDiagonal
robo.Configuration = robot_config_prop.Value
robo.jointMoveToMtx(pick_wpm, Tz=comp_bd.Z*2.0 + 50.0, Rx=180.0)
robo.jointMoveToMtx(pick_wpm, Tz=comp_bd.Z*2.0, Rx=180.0)
robo.graspComponent(component)
robo.jointMoveToMtx(pick_wpm, Tz=comp_bd.Z*2.0 + 50.0, Rx=180.0)
robo.jointMoveToMtx(dest_prod_wpm, Tz=comp_bd.Z*2.0+50.0, Rx=180.0)
robo.jointMoveToMtx(dest_prod_wpm, Tz=comp_bd.Z*2.0, Rx=180.0)
action_manager.pre_process_trigger(unload_assisting)
dest_container.grab(component)
action_manager.post_process_trigger()
robo.jointMoveToMtx(dest_prod_wpm, Tz=comp_bd.Z*2.0+50.0, Rx=180.0)
robo.driveJoints(*robot_home_joint_vals)
return
else:
obj_itp = ObjectInterpolator(component, dest_prod_wpm, dest_container, place_time, grab_to_world=False)
obj_interp_manager.add(obj_itp)
obj_interp_manager.wait_to_complete(obj_itp)
else:
delay(place_time)
world_container.grab(component)
component.PositionMatrix = dest_prod_wpm
action_manager.pre_process_trigger(unload_assisting)
dest_container.grab(component)
action_manager.post_process_trigger()
1 Like
Shadow
January 30, 2023, 12:41pm
3
Exactly like that!
Big thanks for that simple solution, a huge help in my application!
@Este Is it possible to apply this same approach to a “move” or “transport” function?
I.E. Mobile robot collects a product and begins moving towards the deliver transport node. However the AMR stops in place when a signal is triggered?
Thanks.