I’m trying to have the target jump when hand velocity exceeds a certain threshold. I used the BusSelector to pull out a1_hand_velocities from KINdata_bus and used it as input for the Stateflow chart. I have something like a1_hand_velocities(1,1)^2+a1_hand_velocities(1,2)^2 > 1.0 as a condition for transition between two states. However, when compiling, the error said something to the effects that the variable a1_hand_velocities was not defined. What is the correct way to use data from KINdata_bus? Can it be used for state transition?
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 and y-position as hand_velocities.
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^2+right_hand_velocities^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?
Hello Xin Li,
With only one exception, we always use SI units. The exception is that target positions are handled in centimeters since that is an easier unit of measure to deal with.
So in this case the hand velocities are in m/s.
If you look in the Task Programming Guide for Dexterit-E 3.7 section 10.1 details the data in KINdata and KINdata_bus. In this case the KINdata table has values HVX and HVY – which are Hand Velocity X and Y. In the next version of the guide we’ll be switching everything over to the KINdata_bus so that the the table is easier to read and understand.
Could you please send your model to firstname.lastname@example.org? We can take a look at the model and see if we can determine what is happening.
All the best,