Home Questions Spring Attached to a fixed point

Spring Attached to a fixed point

DWQA QuestionsCategory: Custom Task DevelopmentSpring Attached to a fixed point
Duncan McLean Staff asked 9 years ago
from Robert H: How do I make one end of a virtual spring attached to a fixed point (e.g. a starting home position)? I've tried incorporating the multipurpose spring block from the spring demo, but it produces forces based on the position of both hands.
1 Answers
Duncan McLean Staff answered 9 years ago
Assuming you would like some degree of configurability to the fixed location you have a few options. You could define the fixed point as a target, or in the trial protocol table, or as task wide parameters. From there you just need to add a new input on the multi-purpose spring to take in the fixed point. In the MATLAB block you would just need to figure out if you are using the active arm or the inactive arm as the other end of the spring. The active arm is determined by KINdata(3,1). That will be either a 1 or 2, meaning that the position of the active arm is in KINdata(1) or KINdata(2). So in order to make the virtual spring from a point to one of the hands you just need to change the MATLAB code that uses each hand as an end-point for the spring to use your newly defined end point and whichever hand you want as the other end point. That means changing the hand1_pos and hand2_pos variables in the MATLAB code.