How do I programmatically set the parameters of a Get Transform block?

I want to programmatically set the rigid body tree parameter of a get transform block and I tried doing that using the set_param function. If i write the value of the parameter as a string:
set_param(strcat(modelName, '/Get Transform'), 'RigidBodyTree', 'DOF3_Arm') %DOF3_Arm = importrobot('RobotStructure');
the associated field in the Block's Parameter will just have a string but no rigid body tree, and if I use a variable instead of the string i get the following error:
Error using Script_function_back2WF
Invalid setting in Get Transform block (mask) 'Get Transform' for parameter
'RigidBodyTree'
What is the correct way of setting this parameter? Thank you in advance!

1 comentario

Ganesh
Ganesh el 15 de Jun. de 2024
Editada: Ganesh el 15 de Jun. de 2024
Hi @Anna,
Passing the variable name as a string is the right way to do it.
You need to ensure that "DOF3_Arm" is a valid "RigidBodyTree" object in your base workspace.
The parameter field is expected to show the name of the variable as a string. When you click on the three dots beside it, you will see the location of the variable.

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 15 de Jun. de 2024

Editada:

el 15 de Jun. de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by