hexagon logo

Get the action time of senor

Hell everyone,
 
I make one seonr to monitor the angle of robort arm. Now I try to make the arm stop with function(step) when the seonsor is active. I think there are wrong about the time setting in the function. Should I get the action time of senor, then set into the funtion of stopping-step function? If yes, which command can i use?
 
! begining
motion/1, velocity, Func = step(time,0,0,1,85d)
simulate/transient, end=10,steps=1000
! stop
deactivate/sensor, id=1
motion/1, velocity, Func = step(time,0,85d,1,0)
simulate/transient, end=10,steps=1000
 
 
 
  • Hi Zhenhui,
     
    In your SENSOR, you can return the time at which the sensor is triggered by enabling the Event Evaluation option and setting it to Run-Time Function. Here you can simply enter the string time for the function.
     
    The in your Solver script for stopping the motion, you simply need to subtract this sensed time from the time in the new STEP() function like so:
     
    sim/trans,end=2,dtout=0.01
    deact/sens,id=1
    motion/1,velocity,func=step(time-senval(1),0,85d,1,0)
    sim/trans,end=2,dtout=0.01
     
    Please note that the function SENVAL() help return the evaluated function at the time the sensor was triggered.
     
    I recommend that you review the attached example.
     
    Thank you,
    Maziar Rostamian

    Attached Files (1)