Hi Xin Li,
You're getting the velocities correctly. You connect the Kindata_bus From tag to a bus selector and double-click the signal you want.
In Stateflow, you should then make an input (I called it hand_velocities) in this case. You would use the variable as hand_velocities. Make sure to go to the Description tab of hand_velocities in Model Explorer and set First Index to 1. You would then access the x-position of the hand using hand_velocities[1] and y-position as hand_velocities[2].
Thanks! It takes the velocity inputs now. However, I’m still having trouble having it use the velocity as a transitioning statement. Currently, I have between two states: [sqrt(right_hand_velocities[1]^2+right_hand_velocities[2]^2)>Trial_Protocol[MOVEMENT_ONSET]].
When I set MOVEMENT_ONSET to >=1.8, no matter how fast I move the robot arm, it does not transition between the states. When the value is <= 1.7, the state transition seem to happen without me moving the robot arm. I think part of the problem is that I do not know the unit of the velocity inputs, and I couldn't find it in the manual. More generally, how do we find the units of KINARM outputs?
Please login or Register to submit your answer