Is there any way to move drone instantaneously?

I’m interested doing some RL training on the drones. Is there a way to “teleport” the drone, that is, instantaneously move it somewhere? I would like to move it to the origin when I reset the environment.

Hi Graeme22,

in case you’re refering to the Sphinx simulation environment, you can manually set the drone position.

  • Go to the world tab
  • select “anafi4k” under “Models”
  • In the Property/Value table search for “pose”
  • manually set x y and z to 0.0

I use the tab key on the keyboard to move to the next field. The reason for this is, that I experienced the drone’s position not being updated in the 3D world if I just click the next field with the mouse.
It may also help to pause/resume the simulation for the position change, the controls can be find at the bottom bar of the screen.

I hope this information was helpful :slight_smile:

You can set the initial_pose parameter as explained here: https://developer.parrot.com/docs/sphinx/pluginctrl_howtos.html#how-to-change-initial-drone-position-for-next-world-reset

Example:

echo '{"jsonrpc": "2.0", "method": "SetParam", "params": {"machine":"anafi4k", "object":"fwman/fwman", "parameter":"initial_pose", "value":"5 5 0.4 0 0 0"}, "id": 1}' | curl --silent -d @- http://localhost:8383 | python -m json.tool

You can then call parrot-gz --reset-all (resets time and model poses) or just parrot-gz --reset-models (resets models, faster) to spawn the drone at its new initial position.

Sorry for not clarifying. This needs to be done within Python code, not the Sphinx environment or the command line.

Hello,

You can perform the same operation in python with jsonrpclib:

import jsonrpclib

sphinx = jsonrpclib.Server('http://127.0.0.1:8383')
sphinx.SetParam(machine='anafi4k', object='fwman/fwman', parameter='initial_pose', value='5 5 0.4 0 0 0')
sphinx.TriggerAction(machine='world', object='fwman/fwman', action='world_reset_all')

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.