I currently use URScript to connect my program on my laptop to the UR robot. I don't know how to determine if a movement is finished.
When I send one movement command, say moveL, to the robotic arm. The moveL command will block until the movement is finished so that I can use UR script to send a socket message back to my laptop to know when the movement is finished, which is good.
However, if I pass a 'blend' parameter to the moveL function, it will not block, because it expects me to send further moveL functions which enable it to blend the series of movement. Because of this feature, I could not know when the series of movement is finished. I tried to get the speed of the robot, but it seems like there is always some delay.
Is it possible for me to get a notification or something after the robot finishes the movement?
Thank you very much!
Related
I'm trying to let Pepper do a really basic sequence of movements, with Choregraphe: a rotation, then one meter forward, than another rotation and finally one meter forward.
Most of the times that I'm running the behaviour, the sequence cannot be completed as the robot freezes. Every time I can hear the noise of the motors, but most of the times the robot won't move. Please consider that it is on a perfectly smooth surface.
Does anybody know what could be the reason of this problem? Do you have any suggestion on how to fix it?
The version of NAOqi is 2.5.5.5
The robot has a lot of safety. If the robot can't move because of an obstacle, the choregraphe box will say that your movement failed (grey output on the move To box) and cancel your flow. In your program, the flow will only continue if the movement is a success.
As mcaniot says the robot has some aggressive safety features and the robot may stop suddenly. However if you know what you are doing and accept the risk, you can disable the security in the web settings.
Read the specifics of the collision avoidance here:
http://doc.aldebaran.com/2-5/naoqi/motion/reflexes-external-collision.html#pepp-pepper
You can find the settings to disable it here:
Use this method to enable/disable settings:
http://doc.aldebaran.com/2-5/naoqi/motion/reflexes-external-collision-api.html#ALMotionProxy::setExternalCollisionProtectionEnabled__ssCR.bCR
I am creating an iphone project where I need to make a ball move in the same direction of the shake while the device is being shaken.. and then take a certain speed and path when the shake event ends.
I have searched the net and have only posts that can detect a shake effect after which you will be able to run a preset animation that you want.. and I have found many tutorials where you can make a ball move depending on the tilt of the screen.. however what I would like to do, is make the ball move depending on all criterias: shake rythm, shake speed, and giroscope tilt.. is that possible?
Thanks
To do this accurately you must use Core Motion framework, specifically CMMotionManager class. Depending on the device capabilities this class provides both accelerometer and gyroscope data.
To get the ball moving in correct way, this would require a function that would translate the received data from CMMotionManager into values you can animate. That is hard to guess, so I suggest creating a basic function that detects the force and direction and then tuning the parameters by testing.
I'm trying to understand the proper way to move "obstacle" objects in corona/box2d. I want to know how to write my code so that the movement is deterministic and in-step with the physics engine. Is this possible?
I'm familiar with Unity which has a physics update (FixedUpdate). Where you can add a bit of code to execute on every physics step. This keeps the physics deterministic, frame and system time independent.
For example, in my game I want to do things like: Make a platform that moves back and forth, make an object that scales up and down in size. I would still like the physics to work properly and allow the ball in my game to bounce off of these for example. Depending on the case, I imagine that I should use either kinematic or dynamic bodies.
I've searched around and the way to periodically manipulate these objects is to use:
timer.performWithDelay. But this has an issue mentioned in the docs "Timers run on system time. If the app is suspended, running timers will not be automatically paused"
Listening to an enterFrame event. But this has a similar issue, if the frame rate drops then the object won't be moved enough. We can use delta time to deal with this, but this has determinism issues (moving an object too much on a lag spike).
transition.to. I'm guessing this is implemented with timer.performWithDelay and has the same issues.
I don't think that any of these will behave deterministic. Any suggestions? Thanks for the help.
You should really use:
object:setLinearVelocity(xVelocity, yVelocity)
or
object:applyForce(xForce, yForce)
instead of transition.to.
Im using Union server for my iOS (Starling) billiard game.
So far the connections work great.
My question is:
How would you handle the transfer of the ball positions from the opponent.
Lets say I make the break, and I want to copy that shot to the other player?
Do you think its a good idea to send a message over union every frame (x, y)?
Will this cause latency problems?
First about your question:
The game is installed on both devices, the rules are same. So on shot send the white balls force and all other properties you modify. On the receiving device add that force etc. and the ball will repeat the action done by the sending user.
Now the sad part:
I will be the first one to disappoint you - even if you solve your problem and send the message from player to player with out problems the result won't be pleasant: box2d calculations are optimised for performance, but the result will differ as it's calculated with approximate accuracy. As a result even on the same device the balls will end up in a different location on different runs. You won't notice it in one-two hits, but after playing for a minute you'll end up with deferent ball locations.
You can also try to send a message of every ball position in space after all balls stop moving and relocate the remote users ball positions. After that "correcting" message was received return the control to the player.
We had a similar game and I just wrote my own 2d engine. If you're working only with ball to ball and ball to rectangle collisions it's easy to write your own engine.
ok, so apparently xna games can only run at 30fps, which is a shame, because our game on iphone looked alot better at 60...
at any rate, because the only way you can get information about the touch screen state is to get its current state, effectively this means you can only sample the touch screen at 30 fps.
even if our game has to run at 30fps, is there any way to get higher resolution sampling from the touch screen? maybe through callbacks? or by accessing a list of touch events with time stamps?
The function you are looking for is TouchPanel.GetState. It is a simple matter of calling this function at 60Hz.
To get 60Hz you could set Game.TargetElapsedTime to 1/60th of a second. This will give you two updates to every one draw (according to Shawn Hargreaves' post here) assuming you are VSyncing at 30FPS.
If you still want your game state updates to run at 30FPS (just doing touch input at 60FPS), then you could put those updates on a different thread. Start an update going on that thread on the first call to Game.Update, and wait for it to finish on the second one, and so on.
(You should note that normally XNA input must be done on the main thread (source). I assume this applies to Phone and to touch input.)
Alternately you could replace the Game class's timing yourself entirely (calling GraphicsDevice.Present yourself). It's not easy to do, but it's possible. A good place to start is to look at the Game class in Reflector.
(Disclaimer: I haven't tried any actual Phone-based development yet, so there may be some Phone-related gotchas I am unaware of.)
The sampling rate of 30fps is set for performance reasons.
Even if you could find a way to query for touches more frequently you still couldn't update the UI at a faster rate so I'm not sure what benefit you'd get.
Before spending too much time on trying to find a solution I'd test on an actual device to see how acceptable 30fps really is.