I want to generate wind on the simulation. 
I referred to the following page.
https://developer.parrot.com/docs/sphinx/pluginctrl_howtos.html 
I added the wind plugin in my world file. 
Then I try to run the following command, but I don’t know which path <path/to/unix/socket>  to choose.
Please tell me what to do
*$ echo ‘{“jsonrpc”: “2.0”, “method”: “SetParameter”, * 
*“params”: {“machine”:“world”, “object”:“wind/wind”, “parameter”:“magnitude_mean”, “value”:“5.0”}, “id”: 1}’*
| nc -U <path/to/unix/socket> | python -m json.tool* 
 
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                ocrave  
                
               
              
                  
                    April 9, 2021, 11:57am
                   
                   
              2 
               
             
            
              Hello,
<path/to/unix/socket> is http://localhost:8383  in most cases.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              Thank you for your reply. 
Based on your opinion, I entered the following command after launching the Sphinx.
$ echo '{“jsonrpc”: “2.0”, “method”: “SetParameter”, *  
“params”: {“machine”:“world”, “object”:“wind/wind”, “parameter”:“magnitude_mean”, “value”:“5.0”}, “id”: 1}’*  
** | nc -U http://localhost:8383  | python -m json.tool
And I got the following error:
nc: unix connect failed:No such file or directory  
No JSON object could be decoded 
I thought about it myself, but I don’t know what to do. 
I would like to know what to do next.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                ocrave  
                
               
              
                  
                    April 12, 2021,  9:01am
                   
                   
              4 
               
             
            
              When you start sphinx, you should see these lines:
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 127.0.0.1
[Msg] created parameter server on http:8383
 
In this example, the server is listening on http://127.0.0.1:8383  and the following command should work:
echo '{"jsonrpc": "2.0", "method": "SetParam", "params": {"machine":"world", "object":"wind/wind", "parameter":"magnitude_mean", "value":"5.0"}, "id": 1}' | curl -d @- http://127.0.0.1:8383 | python -m json.tool 
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              Thank you very much. I was able to enter that command to generate a wind of 5m / s in the x direction.
I have another question,is it possible to generate wind from the y direction or two-dimensional wind (wind from the x and y directions)?
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                ocrave  
                
               
              
                  
                    April 12, 2021,  1:05pm
                   
                   
              6 
               
             
            
              If you are not happy with the expressions used to compute the wind in Tuning of drone internals at runtime - Howtos — Parrot-Sphinx 1.2.1 documentation  you can change either of them with the same kind of JSON-RPC command. For example, this command simplifies the magnitude_expr expression to its bare minimum value:
echo '{"jsonrpc": "2.0", "method": "SetParam", "params": {"machine":"world", "object":"wind/wind", "parameter":"magnitude_expr", "value":"val"}, "id": 1}' | curl -d @- http://127.0.0.1:8383 | python -m json.tool
 
If you want to get rid of this plugin and use the default wind from gazebo, you have to remove it from your .world file. If you do that, the wind velocity can be set this way:
parrot-gz topic -p "~/wind" -m linear_velocity{x:5\ y:0\ z:0} 
             
            
               
               
              2 Likes 
            
            
                 
                 
              
           
          
            
            
              I was able to generate a two-dimensional wind using the second command.
Is it possible to change the wind over time? 
For example, 5 m / s for 1 minute, then 3 m / s.
I’m sorry to ask you a lot of questions.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                ocrave  
                
               
              
                  
                    April 19, 2021,  5:02pm
                   
                   
              8 
               
             
            
              Because the real-time factor is probably less than 1, you have to take into account the simulation time that comes from telemetry. A bash script like this should work:
#!/bin/bash
function get_sphinx_time
{
    echo $(tlm-data-logger inet:127.0.0.1:9060 9061 | grep -m1 time_anafi.SimTimestamp_ns | sed 's/time_anafi.SimTimestamp_ns://g')
}
function set_wind_vel
{
    local x=$1
    local y=$2
    local z=$3
    echo "set wind velocity to [$x $y $z]"
    parrot-gz topic -p "~/wind" -m linear_velocity{x:$x\ y:$y\ z:$z}
}
function wait_for
{
    local wait_time=$1
    time0=$(get_sphinx_time)
    while true; do
        now=$(get_sphinx_time)
        diff=$(($now - $time0))
        if [ $diff -ge $wait_time ]; then
            break
        fi
        echo "remaining time: $(($(($wait_time - $diff)) / 1000000000)) seconds"
        sleep 1
    done
}
set_wind_vel 5 5 0
wait_for $((1000000000 * 60 * 1)) # nanoseconds
set_wind_vel 3 3 0 
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              By writing a script based on your opinion, I was able to change the wind over time.
Thank you for answering the question many times.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                system  
                
                  Closed 
               
              
                  
                    April 22, 2021,  3:53pm
                   
                   
              10 
               
             
            
              This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.