This PR adds methods to get an object's inertial parameters in CoppeliaSim to the class 'DQ_VrepInterface'#109
Conversation
…' and methods 'call_script_function()', 'get_center_of_mass()', 'get_mass()', and 'get_inertia_matrix()'.
… DQ. Also simplified how methods 'get_center_of_mass()', 'get_mass()', and 'get_inertia_matrix()' handle their returns from 'call_script_function()'.
|
@ffasilva Thank you for your PR. Right now, we are trying to avoid new proposals that contribute to the divergence between the languages since those usually require a lot of time, and we are working on the new release. As discussed internally, we decided to implement the methods |
…de it private to match the C++ implementation.
…me behaviour of the C++ implementation. Also added the properties 'BODY_FRAME' and 'ABSOLUTE_FRAME' to match the C++ implementation.
…ur of the C++ implementation.
…FRAME' to match the C++ implementation.
…me behaviour of the C++ implementation.
…'get_mass()', and 'get_inertia_matrix()'.
|
Hi @juanjqo, I refactored vi.get_inertia_matrix(objectname);
vi.get_center_of_mass(objectname);
return the inertia matrix and the center of mass with respect to the shape frame, whereas vi.get_inertia_matrix(objectname, vi.ABSOLUTE_FRAME);
vi.get_center_of_mass(objectname, vi.ABSOLUTE_FRAME);
return those parameters with respect to the inertial frame. The behavior is the same when using the new or old Lua API. Let me know what you think. Kind regards, |
|
@ffasilva thank you. Please check the comments I made in your proposed example dqrobotics/matlab-examples#10 (comment). Cheers, Juancho |
…t_inertia_matrix()' and 'get_center_of_mass()' methods.
@ffasilva thanks. I was wondering if there are potential changes in the description of this PR and/or in the methods you are proposing since the DQRoboticsApiCommandServer.lua does not support arbitrary frames. If any, please update the description and adjust the methods accordingly. |
|
Hi @juanjqo,
Not necessarily. Without a Furthermore, the methods are independent of any LUA script executing on CoppeliaSim's side. So even if we currently don't provide the users with a Finally, I already opened a pull request proposing the new DQRoboticsApiCommandServer.lua. Kind regards, |
|
Hi @bvadorno, @mmmarinho and @ffasilva Since I'll forget the context of this PR, I left here a brief description:
Kind regards, Juancho |
|
Hi @bvadorno, No, there are not pending issues. Kind regards, Juancho |
Main instructions
By submitting this pull request, you automatically agree that you have read and accepted the following conditions:
Description of changes
Hi, @dqrobotics/developers,
I've added to the class
DQ_VrepInterface:DF_LUA_SCRIPT_APIST_CHILDcall_script_function()get_center_of_mass()get_mass()get_inertia_matrix()It diverges from the implementation of its C++ counterpart in the following regards:
DF_LUA_SCRIPT_APIstores the default name (/DQRoboticsApiCommandServer) for the child script in CoppeliaSim with the LUA methods necessary to read an object's inertia parameters;call_script_function()follows the signature of the underlying CoppeliaSim API methodsimxCallScriptFunction;get_center_of_mass()andget_inertia_matrix()pass the relative reference frame parameter as an int to methodcall_script_function().An example of use is given in 10.
Rationale
The class
DQ_VrepInterfacealready has the methodscall_script_function(),get_center_of_mass(),get_mass(), andget_inertia_matrix()in the C++ library but they were missing on MATLAB.The reasons for the divergence with the C++ implementation are:
call_script_function()scrambles the input arguments of the underlying CoppeliaSim API methodsimxCallScriptFunction(e.g.,function_namegoes from being the third argument to being the first). This is unnecessarily confusing and adds no real benefit to its usage.get_center_of_mass()andget_inertia_matrix()are in their C++ implementation, they do not allow for arbitrary reference frames. More details on that are given in 10, where I discuss the modifications I've made to the default LUA script used for getting the inertial parameters of an object.Kind regards,
Frederico