Sphero 2.0 RollCommand Is not working continuos - sphero-api

maybe I'm getting something wrong but if I send the RollCommand it will only move a little after a sec. it will stop.
In the QuickStart guide there is an information that it will roll until it hits something or it gets out of range.
What I'm not getting here?
Do I have to repeat my function every second?
-(void)rollforward{
[RKRollCommand sendCommandWithHeading:90 velocity:0.5];}

This is called Motion Timeout. It's one of five option flags which can be set since Firmware 1.20. These flags keep their state even after sphero is switched off.
More information on how to set and get the flags can be found on these sample projects:
iOS: https://github.com/orbotix/Sphero-iOS-SDK/tree/master/samples/OptionFlags
Android: https://github.com/orbotix/Sphero-Android-SDK/tree/master/samples/OptionFlags
The documentation says this flag is off by default but maybe they changed this in a prior firmare update.

Related

What's the correct way to CheckDeviceState in DirectX11?

I have built the DX11VideoRenderer sample (a replacement for EVR that uses DirectX11 instead of EVR's DirectX9), and it's working. Problem is, it's not working very well. It's using twice the CPU time that the EVR does for the same videos (more on this in the next question).
Since I've got the source, I decided to profile it to see what's going on. (Among other things) this led me to:
HRESULT DX11VideoRenderer::CPresenter::CheckDeviceState(BOOL* pbDeviceChanged)
I'm not much of a DirectX expert (actually, I'm not one at all), but it seems likely that window handles can invalidate as monitors get unplugged, windows get FullScreened, closed, etc so a function like this makes perfect sense to me.
However.
When I look at the code for CheckDeviceState, the first thing it does is call SetVideoMonitor, which seems odd.
SetVideoMonitor looks like the routine you call when you first initialize the presenter (or change the target window), not something you'd call repeatedly to "Check" the device state.
Indeed, SetVideoMonitor calls TerminateDisplaySystem, followed by InitializeDisplaySystem. I could see doing this once at startup, but those functions are being called once per frame. That can't be right.
I can comment out the call to SetVideoMonitor in CheckDeviceState (or actually all of CheckDeviceState), and the code continues to function correctly (it's predictably a bit faster). But then I'm not checking the device state anymore.
Trying to figure out the proper way to check for state changes in DX11 brought me here which talks about just checking the return codes for IDXGISwapChain::Present and ResizeBuffers. Is that how this should be done? Because that makes it seem like this whole routine is some leftover from DX9 (where it still would have been poorly implemented).
What's the correct way to check the device state in DX11? Is this even a thing anymore?

How can I track an event accross multiple resources in gem5?

I would like to know if there is a proper method to track memory accesses
across multiple resources at once. For example I set up a simple dual core CPU
by advancing the simple.py from learning gem5 (I just added another
TimingSimpleCPU and made the port connections).
I took a look at the different debug options and found for example the
MemoryAccess flag (and others), but this seemed to only show the accesses at
the DRAM or one other resource component.
Nevertheless I imagine a way to track events across CPU, bus and finally memory.
Does this feature already exist?
What can I try next? Is it and idea to add my own --debug-flag or can I work
with the TraceCPU for my specified use?
I haven't worked much with gem5 yet so I'm not sure how to achieve this. Since until now I only ran in SE mode is the FS mode a solution?
Finally I also found the TraceCPUData flag in the --debug-flags, but running
this with my config script created no output (like many other flags btw. ...).
It seems that this is a --debug-flag for the TraceCPU, what kind of output does this flag create and can it help me?

AppInventor - Why does ".initialize" not work?

In my application I want to run some code when opening a screen. AppInventor has a function ".initialize" for this, but it does not seem to work.
When I open the screen the code does not run, while the code is fine because it does work when I trigger it with something else than the ".initialize" function.
I have these code blocks: https://imgur.com/a/y0ZMqa3 as you can see the code inside is exactly the same but it doesn't run when the screen initializes while it does work when I check the checkbox.
I don't think its possible to get tiny DB values when the screen initializes. Perhaps try adding another component like a clock with a timer and then using the same blocks you have on .initialize after a certain time interval of some 500 milliseconds. Since as you say it doesnt work on the .initialize block but does work when the checkbox is changed.
What's the code?
You have to give us an idea of what it is your working with for us to be able to try and help you. Trust me man the chances of your question getting answered here are slim even if you pit it perfectly.
This is way too vague for somebody to even attempt to answer.
Next time make sure you ask with specifics.

SagePay Form upgrade from 2.23 to 3.00 - Simulated transactions and other issues

I've just completed the upgrade from v2.23 to v3.00 and run a successful LIVE transaction, passing 3.00 as the value for VPSProtocol.
However, I've been having issues when running SIMULATED transactions using this value as SagePay returns the following error:
The <b>VPSProtocol</b> field you supplied contains invalid data. It should contain the value <b>2.23</b>
I'm also still seeing the big red bar at the top of MySagePay with the following scary message:
You will have to cease trading on this version (v2.23) unless you upgrade by the end of this month.
So, a couple of questions:
Do I need to do anything in MySagePay to tell the system that I'm
now using v3.00, or will that red bar disappear eventually?
Is there a current issue with simulated transactions because the error is still telling me that I need to pass 2.23 as the value for VPSProtocol despite this version being dropped?
Finally, How do I know that these last transactions I've made while passing 3.00 as the value for VPSProtocol have actually been made under v3.00? There's just a lot of confusing things going on here and no clear way to know exactly what's happening (ie, should I be seeing a completely new version of MySagePay somewhere? Or should I be able to distinguish which transactions were made under v2.23 and which were made under v3.00? Etc, etc.)
Thanks
Few answers for you:
This will disappear eventually if you are processing transactions at 3.00. It seems to behave fairly randomly.
You might as well forget about ever using the simulator. It hasn't been updated for protocol 3.00 (and a long time before that).
You will be using the current version of MSP, so no worry there. MSP won't actually tell you what protocol a transaction was carried out using, so if you want to be sure, you could make a 'getTransactionDetail' API call. Alternatively, call Sage Pay, give them a TransactionId and get them to confirm the protocol the transaction was processed using.

How to prevent time-based cheats on a time-based simulation game?

In the iphone game "Tiny Tower", I'm guessing it uses some kind of simulation based on the time spent between the last play and the current time, because you can set the current time forward and you will get the benefit from the fake elapsed time span.
Is there an algorithm that I can use to prevent this sort of thing? (Or at least make it difficult enough for the average user to pull off!)
Edit: thanks, I understand that, despite my wording, there's no way to prevent things you store on the client side, but I want to make it at least more difficult than "changing the time" to hack it!
The gamecube had a way to do this so it must be possible.
Is there an event triggered when the iphone time is set ? In that case you can react that.
Another solution is to require to be online when the game is launched, this way you can check time on a remote server.
You could has well check if you got an event on the phone login or wake up react to it, saving the time at that moment in your DB. You would have the last non modified time.
A last possible trick is to check for a file you know is going to be modified by an action prior to time change (such as login), and check the 'last modification' date.
You can investigate in the GPS direction as well. A GPS need to be synchronised with the satellite it contact, so it must keep track of time in some way, and maybe there is an API for that.
Unfortunatly you are on an iphone, which mean your possibilities are limited since applications got very few rights and are sandboxed.
EDIT:
Just though about it but, can you create event in the iphone calendar ? And check if it has been trigered ? Cause you could set a fake meeting or something for every day. Not clean, but creative.
EDIT 2: can you set a timer as a code for IOS to execute in 60 minutes ? If you can, set this timer, pass the time expected to be when this code run, then when the code run, compare and inform your program.
One way to prevent it is to monitor time passing by checking timestamps for their logins in a database. It doesn't matter if the client's iPhone's time is off; the database on your end will still know how long it's been since the last login.
I think if you have internet access you can take the time from a server.
A second solution : You can record the "datetime" and every time you see a "BIG" difference between the record datetime and the running datetime you know there might be a problem.
but this is not elegant, i know.
You can also record a small ammount of datetimes that the application started and check the diffrence with the running datetime.
Also you can use "Activity"->"Datetime" so the "Updates" (levels etc) can't be retaken.
Because the system Datetime can be changed by user, there is potential for "hack".
call a web service to get the time, rather than rely on the phone. There are several places you could get time from, google is your friend i'm sure, or create one yourself, and use the local time of the machine the service runs on for the time.
You could also use the Network Time Protocol (NTP) servers to get a consistent time

Resources