From 11557759fe2c5079dd957d9670a832f219d55121 Mon Sep 17 00:00:00 2001 From: Adnan Munawar Date: Sat, 9 Apr 2022 16:06:57 -0400 Subject: [PATCH] Issue #163. Setting activeControllerType to Force. --- ambf_framework/afInputDevices.cpp | 6 +++++- ambf_plugins/core/ros_comm_plugin/ObjectCommPlugin.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ambf_framework/afInputDevices.cpp b/ambf_framework/afInputDevices.cpp index 942e3fa1e..0a5197ee6 100644 --- a/ambf_framework/afInputDevices.cpp +++ b/ambf_framework/afInputDevices.cpp @@ -640,9 +640,13 @@ bool afSimulatedDevice::createFromAttribs(afSimulatedDeviceAttribs *a_attribs) // Since an existing root body is bound to the physical device whose afComm should already be // running if(attribs.m_sdeDefined){ - std::string simDevName = "simulated_device_" + std::to_string(m_phyDev->m_CCU_Manager->s_inputDeviceCount) + modelName; + m_rootLink->setPassive(false); + m_rootLink->setNamespace(m_rootLink->getNamespace() + "/simulated_device/"); m_rootLink->loadCommunicationPlugin(m_rootLink, a_attribs); } + + // Initialize the default controller to be the force controller + m_rootLink->m_activeControllerType = afControlType::FORCE; } else{ cerr << "ERROR! FAILED TO LOAD ROOT LINK FOR MODEL " << attribs.m_modelAttribs.m_filePath.c_str() << endl; diff --git a/ambf_plugins/core/ros_comm_plugin/ObjectCommPlugin.cpp b/ambf_plugins/core/ros_comm_plugin/ObjectCommPlugin.cpp index bab625786..454dce8d5 100644 --- a/ambf_plugins/core/ros_comm_plugin/ObjectCommPlugin.cpp +++ b/ambf_plugins/core/ros_comm_plugin/ObjectCommPlugin.cpp @@ -555,7 +555,7 @@ void afObjectCommunicationPlugin::rigidBodyFetchCommand(afRigidBodyPtr afRBPtr, // IF THE COMMAND IS OF TYPE FORCE switch (afCommand.cartesian_cmd_type) { case ambf_msgs::RigidBodyCmd::TYPE_FORCE:{ - afRBPtr->m_activeControllerType = afControlType::FORCE; + afRBPtr->m_activeControllerType = afControlType::FORCE; if (afRBPtr->m_bulletRigidBody){ force.setValue(afCommand.wrench.force.x, afCommand.wrench.force.y,