Coupler Coordinate Constraints implementation

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Pablo Delgado
Posts: 24
Joined: Tue Feb 11, 2020 3:39 pm

Coupler Coordinate Constraints implementation

Post by Pablo Delgado » Fri Feb 25, 2022 6:54 pm

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?

Tags:

User avatar
Carmichael Ong
Posts: 378
Joined: Fri Feb 24, 2012 11:50 am

Re: Coupler Coordinate Constraints implementation

Post by Carmichael Ong » Mon Feb 28, 2022 10:59 am

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>

User avatar
Carmichael Ong
Posts: 378
Joined: Fri Feb 24, 2012 11:50 am

Re: Coupler Coordinate Constraints implementation

Post by Carmichael Ong » 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.

User avatar
Pablo Delgado
Posts: 24
Joined: Tue Feb 11, 2020 3:39 pm

Re: Coupler Coordinate Constraints implementation

Post by Pablo Delgado » Mon Mar 07, 2022 10:05 am

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!

POST REPLY