1

我刚得到一个 Sphero v2.0 并且一直在使用 SDK 在 Eclipse 中为 Sphero 创建 android 应用程序。

在官方应用中有一个功能可以让 Sphero 跳到地面 https://play.google.com/store/apps/details?id=orbotix.sphero&hl=en

我可以控制 Sphero 的移动,但找不到通过代码使其跳转的方法。有谁知道如何做到这一点?

4

1 回答 1

0

我已经能够使用这个宏在 iOS 上做到这一点:

RKMacroObject *macro = [RKMacroObject new];
[macro addCommand:[RKMCRoll commandWithSpeed:0.15 heading:0 delay:0]];
[macro addCommand:[RKMCRawMotor commandWithLeftMode:1 leftSpeed:255 rightMode:1 rightSpeed:253 delay:255]];
[macro addCommand:[RKMCDelay commandWithDelay:1000]];
[macro playMacro];

我想它在Java中看起来像这样:)

MacroObject macro = new MacroObject();
macro.addCommand(new Roll(0.15, 0, 0));
macro.addCommand(new RawMotor(1, 255, 1, 253, 255);
macro.addCommand(new Delay(1000));
sphero.executeMacro(macro);

然后,您可以调整滚动速度、延迟和左右电机速度之间的差异。

于 2014-07-13T16:19:31.087 回答