Reseting drone position from within python code

In the Sphinx simulation environment, I attempted to reset the position of the anafi4k drone in a live simulation using only python code following the instructions provided by ocrave to graeme22 on 17 Aug 2020:

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’)

The drone then disappears from the simulator. Is there something else that needs to happen in order to reset the drone simulation from within python code?

Hello,

You have to make sure that your initial_pose is valid in your world, “5 5 0.4 0 0 0” is just an example that works in empty.world. If you just want to reset the drone to its initial position, you don’t need to call SetParam on initial_pose, just TriggerAction.

1 Like

that worked! thank you!

1 Like

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