You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

NAOqi:将NAO代码从2.1迁移至2.8时DCM替代方案咨询

Replacing DCM Module in NAOqi 2.8

Great question! NAOqi 2.8 officially retired the DCM module, and its functionality has been split across core modules like ALMotion (for alias management and actuator control) and ALFrameManager (for process cycle callbacks). Let's walk through rewriting your code step by step:

Replacing DCM Alias Operations

The DCM's alias creation and value setting functionality is now fully handled by the ALMotion module. The method names are nearly identical, so you only need to swap out the proxy type:

// Replace DCMProxy with ALMotionProxy
AL::ALMotionProxy motionProxy(pBroker);

// Create alias (same parameter format as DCM's createAlias)
motionProxy.createAlias(someAliasDeclaration);

// Set values for the alias (matches DCM's setAlias behavior)
motionProxy.setAlias(someValuesForAlias);

Replacing Pre/Post Process Callbacks

The atPreProcess and atPostProcess hooks from DCM are replaced by callback registration in ALFrameManager, which manages the robot's processing cycle. Here's how to register your functions:

// Get the ALFrameManager proxy
AL::ALFrameManagerProxy frameManager(pBroker);

// Register pre-process callback (equivalent to atPreProcess)
frameManager.registerPreProcessCallback("MyCustomPreCallback", &someFunction);

// Register post-process callback (equivalent to atPostProcess)
frameManager.registerPostProcessCallback("MyCustomPostCallback", &someOtherFunction);

If you need to unregister these callbacks later (e.g., when your module shuts down), use:

frameManager.unregisterPreProcessCallback("MyCustomPreCallback");
frameManager.unregisterPostProcessCallback("MyCustomPostCallback");

Full Modified Code Example

Putting it all together, your updated code will look like this:

// Initialize motion and frame manager proxies
AL::ALMotionProxy motionProxy(pBroker);
AL::ALFrameManagerProxy frameManager(pBroker);

// Handle alias creation and configuration
motionProxy.createAlias(someAliasDeclaration);
motionProxy.setAlias(someValuesForAlias);

// Register cycle callbacks
frameManager.registerPreProcessCallback("CustomPreProcess", &someFunction);
frameManager.registerPostProcessCallback("CustomPostProcess", &someOtherFunction);

Key Notes

  • Alias Compatibility: The alias declaration format used with DCM works exactly the same with ALMotion::createAlias, so you don't need to modify your existing alias definitions.
  • Callback Signatures: Ensure your callback functions have a void() signature (no parameters) to match ALFrameManager's requirements.
  • Low-Level Control: If you were using DCM for direct hardware access, ALMotion provides equivalent low-level methods like setAngles, getAngles, and setTorques that are fully supported in NAOqi 2.8+.

内容的提问来源于stack exchange,提问作者Thomas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:16:00