有什么方法可以在它的摇篮充电时访问它?我正在寻求将信息传递给它,但仍然把它放在支架上并充电(即,在不耗尽电池的情况下全天改变颜色).谢谢!
我正在迈出MvvmCross框架的第一步,我正在尝试在项目和类结构方面决定最佳方法.我现在最关心的是决定如何组织我的视图模型以便在它们之间共享数据,同时遵循mvvm指南.
我有一个关于视图和相应视图模型(主要和配置)的简单示例.主视图具有绑定到viewmodel中的属性的一些控件.配置视图使用户能够更改文本颜色,列表中的项目数等...当用户更改配置时,这应该反映在主视图中.
我的第一种方法是创建单独的视图和视图模型.但是,如何通知主视图配置已更改?我在Github/Slodge下看到了Sphero项目,我意识到视图模型可以直接引用其他视图.这样,每次配置更改时都很容易通知主视图.但这不是mvvm推荐的解耦视图模型的偏差吗?
我能否获得一些有关处理此类类结构的最佳方法的见解?
Sphero是否有任何传感器可以帮助它在与实际碰撞之前检测障碍物?像红外线传感器,或任何可以用作Sphero"眼睛"的东西.
一个用例是将Sphero编程为跟踪移动对象,或者只是为了避免与其他对象发生碰撞.
谢谢!
我正在尝试将Sphero连接到我正在构建的Cocos2d游戏中.Sphero有一些很好的文档和示例,我可以运行示例代码.我从一个cocos2d项目开始,并添加了Sphero框架.我无法得到球的基本命令.我相信问题在于这个功能:
-(void)setupRobotConnection
{
/*Try to connect to the robot*/
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleRobotOnline) name:RKDeviceConnectionOnlineNotification object:nil];
if ([[RKRobotProvider sharedRobotProvider] isRobotUnderControl])
[[RKRobotProvider sharedRobotProvider] openRobotConnection];
}
Run Code Online (Sandbox Code Playgroud)
(其余代码在链接处)我相信它与NSNotificationCenter有关.我从CCLayerColor调用此代码,而不是像演示那样调用UIViewController.我收到此错误:
2012-08-25 01:54:19.738 bgmmo[1414:2d07] ERROR - opening session failed as protocol com.orbotix.robotprotocol is not declared in Info.plist
Run Code Online (Sandbox Code Playgroud)
(这在Sphero IOS论坛中得到了回答)
我想让sphero向前移动一定量的厘米,但到目前为止我还没有设法让任何东西正常工作这是我现在的代码:
EditText distanceText = (EditText) findViewById(R.id.distanceText);
int inputMSec = Integer.parseInt(distanceText.getText().toString());
int time = (inputMSec - inputMSec/2);
// The ball is given the RollCommand at half speed.
RollCommand.sendCommand(mRobot, heading,0.5f);
// A handler is created to delay the Stop command.
final Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run() {
// Makes the ball stop
RollCommand.sendStop(mRobot);
}
// The variable 'time' defines how long the ball rolls until it is told to stop.
}, time);
Run Code Online (Sandbox Code Playgroud)
有没有其他命令我可以发送到球而不是RollCommand?或者任何人都可以从EditText中找到对输入做什么,以便距离变得正确?
Orbbasic语言被认为是孩子们在这次采访中控制sphero的好方法.
orbbasic的局限性是什么?它是否实现与宏相同的1ms粒度?
在哪个时间粒度范围内,流式传输数据和执行orbbasic同样可以接受?
用orbbasic编程可以稳定球的运动吗?数据流?
我正在制作一款使用Sphero机器人球的游戏.当游戏启动/恢复时,它会检查配对或连接的球.如果蓝牙关闭,或者没有球配对,它会隐藏连接窗口.如果有球配对但未连接,则进入此功能.
// If the user clicked a Sphero and it failed to connect, this event will be fired
@Override
public void onRobotConnectionFailed(Robot robot) {
Log.d("activity", "onRobotConnectionFailed");
removeConnectionView();
}
Run Code Online (Sandbox Code Playgroud)
它在以下方法中崩溃.
private void removeConnectionView() {
mFrameLayout.removeView(mSpheroConnectionView);
mSpheroConnectionView = null;
}
Run Code Online (Sandbox Code Playgroud)
此功能适用于其他可能的结果.这是错误.
Thread [<14> Thread-2606] (Suspended (exception ViewRootImpl$CalledFromWrongThreadException))
<VM does not provide monitor information>
ViewRootImpl.checkThread() line: 5031
ViewRootImpl.invalidateChildInParent(int[], Rect) line: 998
FrameLayout(ViewGroup).invalidateChild(View, Rect) line: 4358
ImageView(View).invalidate(boolean) line: 10565
ImageView(View).invalidate() line: 10520
ImageView.invalidateDrawable(Drawable) line: 202
XDrawable(Drawable).invalidateSelf() line: 382
XDrawable(Drawable).setVisible(boolean, boolean) line: 578
ImageView.onDetachedFromWindow() line: …Run Code Online (Sandbox Code Playgroud) sphero-api ×7
android ×1
decouple ×1
distance ×1
ios ×1
mvvmcross ×1
objective-c ×1
structure ×1
viewmodel ×1