Modifying drone's pose (during sphinx simulation) with parrot-gz results in drone bouncing

Hello,

When using the command bellow to modify the drone’s pose (only its position) during sphinx simulation, it results in the model bouncing to randomly (as seen in this video).

parrot-gz topic -p "~/pose/modify" -m "position{x:0 y:0 z:0} orientation{w:0 x:0 y:0 z:0} name:'anafi4k_1::gimbal_2'"

I have tried:

  • setting the z position to 0.2 instead of 0 (in case a glitch with the terrain happens during the modification, but the drone still bounces)
  • changing the body’s position instead of gimbal_2
  • resetting its position while hovering

In all cases the bouncing still happens.

In any case, are there any other ways to reset the drone’s position fast?

Thank you in advance.

Hello,

With sphinx 1.9, you can use the handling plugin to update the position of the drone (see How to simulate a human operator physically interacting with a drone — Parrot-Sphinx 1.2.1 documentation).

This example updates the script parameter of the “calibration” plugin to move the drone 5 meters north (and 20 cm above the ground to prevent any collision):

echo '{"jsonrpc": "2.0", "method": "SetParam", "params": {"machine":"anafi4k", "object":"calibration/handling", "parameter":"script", "value":"[ { \"stop_condition_expr\": \"step_time > 1\", \"start_pose\": { \"x_expr\": \"0\", \"y_expr\": \"5\", \"z_expr\": \"0.2\", \"roll_expr\": \"val\", \"pitch_expr\": \"val\", \"yaw_expr\": \"val\" }, \"pose\": { \"x_expr\": \"0\", \"y_expr\": \"0\", \"z_expr\": \"0\", \"roll_expr\": \"start_val\", \"pitch_expr\": \"start_val\", \"yaw_expr\": \"start_val\" } }]"}, "id": 1}' | curl -d @- http://127.0.0.1:8383 | python -m json.tool

The script can then be executed with:

echo '{"jsonrpc": "2.0", "method": "TriggerAction", "params": {"machine":"anafi4k", "object":"calibration/handling", "action":"start"}, "id": 1}' | curl -d @- http://127.0.0.1:8383 | python -m json.tool

Thank you for your reply.
When I try to start the sphinx-dashboard, I get the following error:

Using JSON-RPC port 8383.
Error: Cannot connect to sphinx. Is Sphinx running?

When I start sphinx, I do receive the following message indicating that the parameter server has started:

[Msg] Publicized address: 127.0.0.1
[Msg] created parameter server on http:8383

As the title of the documentation you provided says, it is used to simulate an operator/move the drone. Is it a practical way to follow when I need to reset the drone’s position (move it instantly to a specific position inside the world) many times during a single simulation?

That is a known issue with sphinx 1.9. To access the dashboard you have to open http://localhost:9002 in your web browser.

The handling plugin can be used multiple times during a single simulation.

A safer way to move the drone is by setting its initial_pose parameter:

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

Then, you can call parrot-gz world -r to reset the world and the drone will be spawned at its new position.

I am aware of the parrot-gz world -r command, but it resets the whole world, which doesn’t help me in my case. I need to be able to reset only the position of a specific drone (I am simulating multiple drones at once).
As for the initial_pose you mentioned, it’s the same as setting its spawn_point inside the .world file, right?

Yes, it’s identical to the spawn_point parameter. It lets you update the spawn_point of a drone when sphinx is running without having to restart it. But it requires a world reset.

I get the following output for both of the commands you provided:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   668  100   528  100   140   103k  28000 --:--:-- --:--:-- --:--:--  130k
Expecting value: line 1 column 1 (char 0)

When the second command is executed, the drone’s position isn’t changed.
I executed the commands with the following differences:

  1. “machine”: “anafi4k_1” instead of “anafi4k” as I spawn it with a different name
  2. curl -d @- http://localhost:9002 instead of curl -d @- http://127.0.0.1:8383, as I couldn’t launch sphinx dashboard

In case it helps, I am using Python 3.6.13.

You must use http://127.0.0.1:8383. 9002 is the port of the web server (for the web dashboard), 8383 is the port of the server that listens for json-rpc requests like the ones above.

1 Like

I see.
Works good now. Thank you very much!

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