Home Questions Movement time calculation in stateflow

Movement time calculation in stateflow

DWQA QuestionsCategory: Custom Task DevelopmentMovement time calculation in stateflow
Joseph Galea asked 7 years ago
What is the easiest way to calculate movement time within stateflow? I would like to calculate movement time from target appearing to pts reaching that target. I do not simply want to use: after (specified_time, e_clk) but actually create a movement time parameter. I will then use this value to determine movement time feedback. I cannot seem to work out how to use e_clk or if there a timer I can use...    
1 Answers
Duncan McLean Staff answered 7 years ago
Hello Dr Galea, The easiest way to calculate times would be to use a Counter block as an input to State Flow. You should use a 32 bit counter with the update rate set to 0.001. That will give you a relative time in milliseconds since the model started running. You would just need to grab the current time before the movement starts and when the movement ends. Please let me know if that helps or if I can be of more assistance. Cheers!