Start a new topic
Answered

Zeroes in VHL interface

image


I created a VHL interface...i can access the parameters and input by code but all the outputs are zeros.


Here is the code:



 

	// populated
	auto shiftmass = wheelInterface->getParameter(kParamId)->getValue<double>();
	auto mass = wheelInterface->getInput(kMassId)->getValue<double>();
	// empty
	auto v1 = wheelInterface->getOutput(kOrientationId)->getValue<VxMath::Vector3>();
	auto v2 = wheelInterface->getOutput(kPosId)->getValue<VxMath::Vector3>();		
	auto suspension = wheelInterface->getOutput(kSuspensionId)->getValue<double>();

 


Best Answer
Hi Christian,

have you looked at the tutorial "ExVHLIntegration"?

the following code also gets some VHL output values
// Get the ball mechanism position that by its interface Position output value.
 Vx::VxVector3 pos = VxMath::Transformation::getTranslation( mBall->getOutput(kPositionId)->getValue<VxMath::Matrix44>() );

Can you describe the difference with your content or your code?


Did you use an application setup containing the dynamics module?


Are you executing the code in Editing or Simulating mode?


Regards,

Marc.

Answer
Hi Christian,

have you looked at the tutorial "ExVHLIntegration"?

the following code also gets some VHL output values
// Get the ball mechanism position that by its interface Position output value.
 Vx::VxVector3 pos = VxMath::Transformation::getTranslation( mBall->getOutput(kPositionId)->getValue<VxMath::Matrix44>() );

Can you describe the difference with your content or your code?


Did you use an application setup containing the dynamics module?


Are you executing the code in Editing or Simulating mode?


Regards,

Marc.

1 person likes this

Hi Christian,


Also, you can validate that VHL outputs are working fine by using a python script in your mechanism (or scene):


def post_step(self):

    vhl = self.getOwner().findExtensionByName("Interface")

    if vhl != None:

        print("Steering: %f" % vhl.getInput("Input Steering").value)

        print("Suspension: %f" % vhl.getOutput("Suspension Position").value)


When simulating (you need to simulate in order to get the vehicle outputs), I got the following:

Steering: 1.000000

Suspension: -0.134445

Steering: 1.000000

Suspension: -0.119042

Steering: 1.000000

Suspension: -0.177246

...


Regards,


Sylvain Giasson

Team Lead - Front End - Vortex Studio

CM Labs Simulations 


1 person likes this
Login to post a comment