Page 1 of 1

Coupler Coordinate Constraints implementation

Posted: Fri Feb 25, 2022 6:54 pm
by pablo_delgado
Greetings,

I am trying to constraints two coordinates, let's say q1 and q2. I want this relationship q2 = -q1, however, I always end up with q2 = q1. Please look below to the code implementation:

Code: Select all

<CoordinateCouplerConstraint name="q1_q2_con">		
	<isEnforced>true</isEnforced>
	<coupled_coordinates_function>
		<SimmSpline name="f22">
			<x>0 1</x>
			<y>0 -1</y>
		</SimmSpline>
	</coupled_coordinates_function> 
	<independent_coordinate_names>q1</independent_coordinate_names>
        <dependent_coordinate_name>q2</dependent_coordinate_name>
        <scale_factor>1</scale_factor>
</CoordinateCouplerConstraint>
Can anyone help me with this?

Re: Coupler Coordinate Constraints implementation

Posted: Mon Feb 28, 2022 10:59 am
by ongcf
Sounds like using a LinearFunction could be more straightforward than a spline to do this.

Code: Select all

<LinearFunction name="function">
	<coefficients> -1 0 </coefficients>
</LinearFunction>

Re: Coupler Coordinate Constraints implementation

Posted: Mon Feb 28, 2022 11:33 am
by ongcf
By the way, testing on a simple double pendulum, both the SimmSpline you have and the LinearFuction are equivalent, so it's likely you'll get the same behavior in your model after this change too. In case the change doesn't help, consider double checking the definitions of your coordinates to make sure one of them isn't opposite of what is expected.

Re: Coupler Coordinate Constraints implementation

Posted: Mon Mar 07, 2022 10:05 am
by pablo_delgado
ongcf wrote:
Mon Feb 28, 2022 11:33 am
By the way, testing on a simple double pendulum, both the SimmSpline you have and the LinearFuction are equivalent, so it's likely you'll get the same behavior in your model after this change too. In case the change doesn't help, consider double checking the definitions of your coordinates to make sure one of them isn't opposite of what is expected.
Thank you, I will try and let you know how it works!