It doesn’t surprise me that you would have instability when starting 2 force channels at the same location if your force channels are based on the example code. In that case the force channels are basically going to be fighting one another to find a stable location. I suspect what you will need to do to make this work is add a new block that determines your distance from the start point and ramps up the forces as you move away from the start location. This ramp up could be over a fairly short interval, but you would need to experiment with it to see what would work well for you. It’s possible this would even require some sort of determination to turn off one of the force channels. i.e. When you are a certain distance down force channel A then force channel B is turned off. Again, you will have to play with this to see how it feels.
The demo code doesn’t make the force channel work over a line segment for one main reason: it’s tricky. The problem is you can’t simply cut the forces off perpendicular to the line segment at the end points. That would give you some very odd feeling forces that would be sudden and jarring. My best guess on a reasonable implementation for this is:
Determine which of the 2 ends points you are closer to.
Determine the distance between the 2 end points.
As soon as you are farther from the farthest end point than the distance between the 2 end points then scale the forces down. At a given threshold force the forces to zero.
This would mean either adjusting the scaleWallForce variable in the matlab function or introducing a new variable that works similarly to scaleWallForce.
I hope this makes sense. Please let me know if you’d like any more information.