Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] All methods of the experimental class related to the engine parameters settings are not working in CoppeliaSim 4.8.0-rev0 #5

Open
juanjqo opened this issue Nov 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@juanjqo
Copy link
Member

juanjqo commented Nov 27, 2024


Code of Conduct

By submitting this report you automatically agree that you've read and accepted the following conditions.

  • Support for DQ Robotics is given voluntarily and it's not the developers' role to educate and/or convince anyone of their vision.
  • Any possible response and its timeliness will be based on the relevance, accuracy, and politeness of a request and the following discussion.
  • If a DQ Robotics member replies, the user must let them know if their response solves their issue or not.
  • Any suggestion/advice/request made by anyone, as well intentioned as they might be, might not be incorporated into DQ Robotics.

Bug description

Hi @dqrobotics/developers

All methods of the experimental class related to setting the engine parameters are not working in CoppeliaSim 4.8.0-rev0. Such methods were working well in CoppeliaSim 4.7.0. However, in the 4.8.0 version, Coppelia introduced API modifications that broke the current implementation of the DQ_CoppeliaSimInterfaceZMQExperimental() class. Those modifications are listed in the Coppelia's changelog. For instance, the one related to parameter setting is listed as

All internal variables or states can now be handled as properties: those can be queried or modified via [dedicated API functions. Additionally, most properties, when modified, trigger an event that can be listened to. Signals, custom data, engines parameters and named parameters have been integrated into the properties framework

I reported the issue in Coppelia Forums. This is the second time API modifications from Coppelia break the experimental methods in the class DQ_CoppeliaSimInterfaceZMQExperimental(). The first one was related to simulation scripts, which I fixed in juanjqo@1ec0296. This raises concerns about how hard it will be to support some ZMQ-powered functionalities in the DQ Robotics library.

To Reproduce

Minimal example

Code

#include <dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterfaceZMQExperimental.h>

using namespace std;

int main()
{
    auto vi = std::make_shared<DQ_CoppeliaSimInterfaceZMQExperimental>();
    vi->connect();
    try {
        vi->set_mujoco_joint_damping("Revolute_joint", 0.3);
    } catch (const std::runtime_error& e){
        std::cerr << "Caught a runtime error: " << e.what() << std::endl;
    };
    return 0;
}

Output

Caught a runtime error: No such function: sim.setEngineFloatParam

Note for developers from the future:

Modify the internal implementation of the affected methods. For instance,

Current:

void DQ_CoppeliaSimInterfaceZMQExperimental::set_mujoco_joint_damping(const std::string &jointname, const double &damping)
{
    _ZMQWrapper::get_sim()->setEngineFloatParam(_ZMQWrapper::get_sim()->mujoco_joint_damping, _get_handle_from_map(jointname), damping);
}

proposal based on this (untested):

void DQ_CoppeliaSimInterfaceZMQExperimental::set_mujoco_joint_damping(const std::string &jointname, const double &damping)
{
    _ZMQWrapper::get_sim()->setFloatProperty(_get_handle_from_map(jointname), 'mujoco.springDamping', damping);
}

Environment:

  • OS: MacOS Sonoma 14.7.1 (M3 PRO)
  • dqrobotics-interface-coppeliasim-zmq version commit c71769c
  • CoppeliaSim 4.8.0-rev0
@juanjqo juanjqo added the bug Something isn't working label Nov 27, 2024
@bvadorno
Copy link
Member

bvadorno commented Dec 5, 2024

Hi @juanjqo,

As annoying as it might be, this is a recurring problem in software engineering. That's why we need an API to enable people to use DQ Robotics transparently without concern for those low-level details.

On the other hand, we don't need to support every single version of CoppeliaSim. We should only move to newer versions if it doesn't break our existing code base or if newly introduced functionalities pay off the effort of modifying our APIs.

Kind regards,
Bruno

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants