<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sniffer</id>
	<title>PaparazziUAV - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sniffer"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Sniffer"/>
	<updated>2026-04-26T22:08:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=18999</id>
		<title>NPS</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=18999"/>
		<updated>2014-09-04T15:29:23Z</updated>

		<summary type="html">&lt;p&gt;Sniffer: /* Visualization in FlightGear */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
NPS is our advanced rotorcraft simulator with sensor models and uses [[JSBSim]] as FDM (FlightDynamicModel) to allow fairly complex airframes.&lt;br /&gt;
JSBSim can easily be replaced by the FDM of your choice.&lt;br /&gt;
&lt;br /&gt;
Fixedwing support can also be easily added as soon as someone actually wants to use it ;-)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
See [[Installation|installation of Paparazzi]], [[JSBSim]] and optionally [[FlightGear]].&lt;br /&gt;
&lt;br /&gt;
=== Configuration/Build ===&lt;br /&gt;
Add the '''nps''' target to your [[Rotorcraft Configuration|airframe]] with the fdm you want to use:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;nps&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;subsystem name=&amp;quot;fdm&amp;quot;   type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;SIMULATOR&amp;quot; prefix=&amp;quot;NPS_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ACTUATOR_NAMES&amp;quot; value=&amp;quot;{&amp;amp;quot;front_motor&amp;amp;quot;, &amp;amp;quot;back_motor&amp;amp;quot;, &amp;amp;quot;right_motor&amp;amp;quot;, &amp;amp;quot;left_motor&amp;amp;quot;}&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SENSORS_PARAMS&amp;quot; value=&amp;quot;&amp;amp;quot;nps_sensors_params_default.h&amp;amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;JSBSIM_MODEL&amp;quot; value=&amp;quot;&amp;amp;quot;simple_quad&amp;amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;JSBSIM_INIT&amp;quot; value=&amp;quot;&amp;amp;quot;reset00&amp;amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;JSBSIM_LAUNCHSPEED&amp;quot; value=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You can also take a look at the example airframe ''conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml'' or use it for your first tests.&lt;br /&gt;
&lt;br /&gt;
The xml file with the JSBSim model of the aircraft is located in ''conf/simulator/jsbsim/aircraft/''&lt;br /&gt;
and needs to have the name of the aircraft postfixed with ''.xml''&lt;br /&gt;
(e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml])&lt;br /&gt;
&lt;br /&gt;
* NPS_ACTUATOR_NAMES: mapping of the motors defined in the [[Rotorcraft_Configuration#Motor_Mixing|MOTOR_MIXING section]] to the actuators in the JSBSim model (the order is important, also make sure that your motors in JSBSim spin in the same direction as your real ones)&lt;br /&gt;
* NPS_SENSORS_PARAMS: the parameter file for the sensor simulation (noise/delay) under ''conf/simulator/nps/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/nps/nps_sensors_params_default.h nps_sensors_params_default.h])&lt;br /&gt;
* NPS_JSBSIM_MODEL: name of the JSBSim model in ''conf/simulator/jsbsim/aircraft/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/simple_quad.xml simple_quad]), if not defined it defaults to AIRCRAFT_NAME&lt;br /&gt;
* NPS_JSBSIM_INIT: the xml file containing the initial conditions (location, attitude, wind) for JSBSim in ''conf/simulator/jsbsim/aircraft/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/reset00.xml reset00])&amp;lt;br&amp;gt;This define is optional and if not specified the initial position of the aircraft will be set to the flight plan location. Prior to v5.1 this was called INITIAL_CONDITITONS.&lt;br /&gt;
* NPS_JSBSIM_LAUNCHSPEED: if defined this sets an initial launchspeed in m/s for fixedwings, available since v5.1.0_testing-54-g2ac094f&lt;br /&gt;
&lt;br /&gt;
Then build the nps target...&lt;br /&gt;
&lt;br /&gt;
== Running the Simulation ==&lt;br /&gt;
The most convenient way to start the simulation is via the ''Simulation'' session from the [[Paparazzi Center]].&lt;br /&gt;
Just select e.g. the Quad_LisaM_2 example airframe and start the ''Simulation'' session with the simulator, GCS and server.&lt;br /&gt;
&lt;br /&gt;
You can also start it via the generic simulation launcher:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;sw/simulator/pprzsim-launch --aircraft Quad_LisaM_2 --type nps&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Prior to '''v5.0''' pprzsim-launch was not available. Click expand to see the details.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
In earlier versions, start your tools (e.g. [[GCS]], [[server]] and messages) separately, then launch the nps simulator for your aircraft directly:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Options ===&lt;br /&gt;
Start the simulator with the ''--help'' option to list them all.&lt;br /&gt;
&lt;br /&gt;
* ''--ivy_bus'': Set ivy bus broadcast address to use (default 127.255.255.255, 224.255.255.255 on OSX)&lt;br /&gt;
* ''--rc_script'': Execute script with specified number to emulate RC input.&lt;br /&gt;
* ''--js_dev'': Use joystick for radio control (specify index, normally 0), also see [[NPS#Use_a_joystick]].&lt;br /&gt;
* ''--spektrum_dev'': Spektrum device to use for radio control (e.g. /dev/ttyUSB0)&lt;br /&gt;
* ''--fg_host'': Host for FlightGear visualization (e.g. 127.0.0.1)&lt;br /&gt;
* ''--fg_port'': Port on FlightGear host to connect to (Default: 5501)&lt;br /&gt;
* ''--fg_time_offset'': FlightGear time offset in seconds (e.g. 21600 for 6h), this is useful if it is currently night at the location you are flying and you want to add an offset to fly in daylight. (Since ''v4.9_devel_413-g9d55d6f)&lt;br /&gt;
&lt;br /&gt;
=== Typical Simulation ===&lt;br /&gt;
In general you go through the same steps as with the real aircraft:&lt;br /&gt;
* It should start on the ground and you have to wait a few seconds until the AHRS is aligned.&lt;br /&gt;
* If you have a (simulated) RC, you can now arm the motors and fly around in manual.&lt;br /&gt;
* To fly autonomously, make sure your ''AUTO2'' mode is ''NAV'', you can change it in the GCS-&amp;gt;settings-&amp;gt;system-&amp;gt;auto2.&lt;br /&gt;
** Switch to it if you are using an RC, otherwise you should already be in this mode.&lt;br /&gt;
** Arm your motors: either via the resurrect button or by going to the ''Start Motors'' block of the [[Flight Plans|Flight Plan]].&lt;br /&gt;
** Takeoff: via the takeoff button or the corresponding flight plan block.&lt;br /&gt;
* Do your stuff... :-)&lt;br /&gt;
&lt;br /&gt;
=== Pausing or running the sim at a different speed ===&lt;br /&gt;
If you start the simulation from a terminal, hit ''CTRL-z'' to pause it. You can then enter a different time factor (default 1.0) to make the simulation run slower or faster than real-time. Hit enter to resume the simulation or ''CTRL-z'' again to suspend it like any normal Unix process (use the ''fg'' (foreground) command to un-suspend it again).&lt;br /&gt;
&lt;br /&gt;
This simulation speed parameter ?can be edited? in a configuration file : FIXME&lt;br /&gt;
&lt;br /&gt;
=== Use a Joystick ===&lt;br /&gt;
You can use a [[joystick]] (or connect your RC transmitter as a joystick) to control the quad in the simulator.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl -j&amp;lt;/source&amp;gt;&lt;br /&gt;
or, with a specific device index (0 is default):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl --js_dev 0&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Joystick support uses the Simple DirectMedia Layer (SDL) library. Rather than specifying an input device name as one normally does on Linux, you just supply an index value (0, 1, 2,...) of the device you wish to use. Typically, the order of devices is the order in which you plugged them into your computer. The sim will display the name of the device being used to double check. If the &amp;lt;tt&amp;gt;-j&amp;lt;/tt&amp;gt; option is used with no argument, the sim defaults to using device on index 0 (which is usually correct if you have only one joystick attached).&lt;br /&gt;
&lt;br /&gt;
Also see [[Joystick#Calibration]].&lt;br /&gt;
&lt;br /&gt;
=== Visualization in [[FlightGear]] ===&lt;br /&gt;
[[FlightGear#Installation|Install]] and [[FlightGear#Using_FlightGear_for_Visualization|start flightgear]], e.g. with a quadrotor model:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;fgfs --fdm=null --native-gui=socket,in,30,,5501,udp --prop:/sim/model/path=Models/Aircraft/paparazzi/mikrokopter.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
restart your simulator with the ''--fg_host'' option:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
* If you get an error like &amp;quot;JSBSim failed to open the configuration file: (null)/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml&amp;quot;, you need to set your $PAPARAZZI_SRC and $PAPARAZZI_HOME environment variables. Add the following to your .bashrc, change paths according to where you put Paparazzi. Open a new terminal and launch the sim again.&lt;br /&gt;
 export PAPARAZZI_SRC=~/paparazzi&lt;br /&gt;
 export PAPARAZZI_HOME=~/paparazzi&lt;br /&gt;
&lt;br /&gt;
* If you did not install the jsbsim package your JSBSim installation under /opt/jsbsim will be used and you will have to set your library path (either in your shell startup file or when running the sim on the command line), e.g.:&lt;br /&gt;
 LD_LIBRARY_PATH=/opt/jsbsim/lib ./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
* If you get an error like &amp;quot;fatal error: gsl/gsl_rng.h: No such file or directory&amp;quot;, you need to install the GNU Scientific Library and corresponding development packages (libgsl).&lt;br /&gt;
&lt;br /&gt;
* If you get an error like &amp;quot;undefined reference to `pcre_compile'&amp;quot;, edit file conf/Makefile.nps, look for the line that begins with LDFLAGS and add -lpcre, e.g.:&lt;br /&gt;
 LDFLAGS += $($(TARGET).LDFLAGS) -lpcre&lt;br /&gt;
&lt;br /&gt;
== Usage Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Plot the value of a message field ===&lt;br /&gt;
Start the [[RTPlotter|real-time plotter]] tool menu of [[Paparazzi Center]] or with&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./sw/logalizer/plotter&amp;lt;/source&amp;gt;&lt;br /&gt;
for example drag the label 'int32 phi' from the ROTORCRAFT_FP message to the drawing area of the plotter&lt;br /&gt;
&lt;br /&gt;
* Use the datalink to change the telemetry mode&lt;br /&gt;
start 'settings' ( from the tool menu of paparazzi center) or with&lt;br /&gt;
  ./sw/ground_segment/tmtc/settings -ac Quad_LisaM_2&lt;br /&gt;
start 'server' to dispatch datalink messages ( from the tool menu of paparazzi center) or with&lt;br /&gt;
 ./sw/ground_segment/tmtc/server &lt;br /&gt;
change the field &amp;quot;telemetry&amp;quot; on the first page to &amp;quot;Att loop&amp;quot; and send by pressing the green check button. The label on the left or the drop box should change to &amp;quot;Att loop&amp;quot; confirming your message has been received. &amp;quot;message&amp;quot; should now show that the message &amp;quot;STAB_ATTITUDE_INT&amp;quot; is received&lt;br /&gt;
&lt;br /&gt;
=== Tuning the attitude control loop ===&lt;br /&gt;
Here we are going to use the simulator to demonstrate a way of tuning the attitude control loop for a multicopter (rotorcraft firmware only).&lt;br /&gt;
&lt;br /&gt;
* Restart your previous session&lt;br /&gt;
* Set telemetry mode to &amp;quot;attitude_loop&amp;quot;&lt;br /&gt;
* Display two real time plotter windows&lt;br /&gt;
&lt;br /&gt;
In the first one, plot the field &amp;quot;m_phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_int&amp;quot; message. This is our estimation of roll angle.&lt;br /&gt;
On top of that, plot the field &amp;quot;phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_REF_INT&amp;quot; message. This is our reference roll angle, that is, the roll value we are trying to achieve.&lt;br /&gt;
&lt;br /&gt;
In the second plotter, plot the fields &amp;quot;delta_a_fb&amp;quot; and &amp;quot;delta_a_ff&amp;quot;. Those are respectively the feedback and feedforward part of our roll command. The sum of those two terms is what is used as roll command.The feedforward part is the part used to follow our trajectory and the feedback part is the part used to reject perturbations.&lt;br /&gt;
&lt;br /&gt;
* In &amp;quot;Settings&amp;quot;, go to the &amp;quot;Att Loop&amp;quot; tab&lt;br /&gt;
We notice that the vehicle doesn't follow the step trajectory we are trying to make him do accurately.&lt;br /&gt;
 &lt;br /&gt;
Start by setting the value of the proportional gain ('pgain_phi') to 1000 instead of 400. The vehicle now follows the trajectory faster but overshoots. To prevent that, increase the value of the derivative gain ('dgain p') from 300 to 700.&lt;br /&gt;
&lt;br /&gt;
If you look at the plotter where you're plotting the commands, you'll notice that during steps, the feedback command has to work hard. This means that our feedforward command is badly tuned, and namely not working hard enough. Increase the value of the feedforward gain ('ddgain p') from 300 to 540. You'll notice that now the feedback command has become marginal during the steps. This is the right value for the gain. Anything bigger will make the feedback command fight against the feedforward command during steps, anything smaller will make the feedback command have to complement the feedforward command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Sniffer</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=18998</id>
		<title>NPS</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=18998"/>
		<updated>2014-09-04T15:28:18Z</updated>

		<summary type="html">&lt;p&gt;Sniffer: /* Visualization in FlightGear */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
NPS is our advanced rotorcraft simulator with sensor models and uses [[JSBSim]] as FDM (FlightDynamicModel) to allow fairly complex airframes.&lt;br /&gt;
JSBSim can easily be replaced by the FDM of your choice.&lt;br /&gt;
&lt;br /&gt;
Fixedwing support can also be easily added as soon as someone actually wants to use it ;-)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
See [[Installation|installation of Paparazzi]], [[JSBSim]] and optionally [[FlightGear]].&lt;br /&gt;
&lt;br /&gt;
=== Configuration/Build ===&lt;br /&gt;
Add the '''nps''' target to your [[Rotorcraft Configuration|airframe]] with the fdm you want to use:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;nps&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;subsystem name=&amp;quot;fdm&amp;quot;   type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;SIMULATOR&amp;quot; prefix=&amp;quot;NPS_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ACTUATOR_NAMES&amp;quot; value=&amp;quot;{&amp;amp;quot;front_motor&amp;amp;quot;, &amp;amp;quot;back_motor&amp;amp;quot;, &amp;amp;quot;right_motor&amp;amp;quot;, &amp;amp;quot;left_motor&amp;amp;quot;}&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SENSORS_PARAMS&amp;quot; value=&amp;quot;&amp;amp;quot;nps_sensors_params_default.h&amp;amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;JSBSIM_MODEL&amp;quot; value=&amp;quot;&amp;amp;quot;simple_quad&amp;amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;JSBSIM_INIT&amp;quot; value=&amp;quot;&amp;amp;quot;reset00&amp;amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;JSBSIM_LAUNCHSPEED&amp;quot; value=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You can also take a look at the example airframe ''conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml'' or use it for your first tests.&lt;br /&gt;
&lt;br /&gt;
The xml file with the JSBSim model of the aircraft is located in ''conf/simulator/jsbsim/aircraft/''&lt;br /&gt;
and needs to have the name of the aircraft postfixed with ''.xml''&lt;br /&gt;
(e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml])&lt;br /&gt;
&lt;br /&gt;
* NPS_ACTUATOR_NAMES: mapping of the motors defined in the [[Rotorcraft_Configuration#Motor_Mixing|MOTOR_MIXING section]] to the actuators in the JSBSim model (the order is important, also make sure that your motors in JSBSim spin in the same direction as your real ones)&lt;br /&gt;
* NPS_SENSORS_PARAMS: the parameter file for the sensor simulation (noise/delay) under ''conf/simulator/nps/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/nps/nps_sensors_params_default.h nps_sensors_params_default.h])&lt;br /&gt;
* NPS_JSBSIM_MODEL: name of the JSBSim model in ''conf/simulator/jsbsim/aircraft/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/simple_quad.xml simple_quad]), if not defined it defaults to AIRCRAFT_NAME&lt;br /&gt;
* NPS_JSBSIM_INIT: the xml file containing the initial conditions (location, attitude, wind) for JSBSim in ''conf/simulator/jsbsim/aircraft/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/reset00.xml reset00])&amp;lt;br&amp;gt;This define is optional and if not specified the initial position of the aircraft will be set to the flight plan location. Prior to v5.1 this was called INITIAL_CONDITITONS.&lt;br /&gt;
* NPS_JSBSIM_LAUNCHSPEED: if defined this sets an initial launchspeed in m/s for fixedwings, available since v5.1.0_testing-54-g2ac094f&lt;br /&gt;
&lt;br /&gt;
Then build the nps target...&lt;br /&gt;
&lt;br /&gt;
== Running the Simulation ==&lt;br /&gt;
The most convenient way to start the simulation is via the ''Simulation'' session from the [[Paparazzi Center]].&lt;br /&gt;
Just select e.g. the Quad_LisaM_2 example airframe and start the ''Simulation'' session with the simulator, GCS and server.&lt;br /&gt;
&lt;br /&gt;
You can also start it via the generic simulation launcher:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;sw/simulator/pprzsim-launch --aircraft Quad_LisaM_2 --type nps&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Prior to '''v5.0''' pprzsim-launch was not available. Click expand to see the details.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
In earlier versions, start your tools (e.g. [[GCS]], [[server]] and messages) separately, then launch the nps simulator for your aircraft directly:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Options ===&lt;br /&gt;
Start the simulator with the ''--help'' option to list them all.&lt;br /&gt;
&lt;br /&gt;
* ''--ivy_bus'': Set ivy bus broadcast address to use (default 127.255.255.255, 224.255.255.255 on OSX)&lt;br /&gt;
* ''--rc_script'': Execute script with specified number to emulate RC input.&lt;br /&gt;
* ''--js_dev'': Use joystick for radio control (specify index, normally 0), also see [[NPS#Use_a_joystick]].&lt;br /&gt;
* ''--spektrum_dev'': Spektrum device to use for radio control (e.g. /dev/ttyUSB0)&lt;br /&gt;
* ''--fg_host'': Host for FlightGear visualization (e.g. 127.0.0.1)&lt;br /&gt;
* ''--fg_port'': Port on FlightGear host to connect to (Default: 5501)&lt;br /&gt;
* ''--fg_time_offset'': FlightGear time offset in seconds (e.g. 21600 for 6h), this is useful if it is currently night at the location you are flying and you want to add an offset to fly in daylight. (Since ''v4.9_devel_413-g9d55d6f)&lt;br /&gt;
&lt;br /&gt;
=== Typical Simulation ===&lt;br /&gt;
In general you go through the same steps as with the real aircraft:&lt;br /&gt;
* It should start on the ground and you have to wait a few seconds until the AHRS is aligned.&lt;br /&gt;
* If you have a (simulated) RC, you can now arm the motors and fly around in manual.&lt;br /&gt;
* To fly autonomously, make sure your ''AUTO2'' mode is ''NAV'', you can change it in the GCS-&amp;gt;settings-&amp;gt;system-&amp;gt;auto2.&lt;br /&gt;
** Switch to it if you are using an RC, otherwise you should already be in this mode.&lt;br /&gt;
** Arm your motors: either via the resurrect button or by going to the ''Start Motors'' block of the [[Flight Plans|Flight Plan]].&lt;br /&gt;
** Takeoff: via the takeoff button or the corresponding flight plan block.&lt;br /&gt;
* Do your stuff... :-)&lt;br /&gt;
&lt;br /&gt;
=== Pausing or running the sim at a different speed ===&lt;br /&gt;
If you start the simulation from a terminal, hit ''CTRL-z'' to pause it. You can then enter a different time factor (default 1.0) to make the simulation run slower or faster than real-time. Hit enter to resume the simulation or ''CTRL-z'' again to suspend it like any normal Unix process (use the ''fg'' (foreground) command to un-suspend it again).&lt;br /&gt;
&lt;br /&gt;
This simulation speed parameter ?can be edited? in a configuration file : FIXME&lt;br /&gt;
&lt;br /&gt;
=== Use a Joystick ===&lt;br /&gt;
You can use a [[joystick]] (or connect your RC transmitter as a joystick) to control the quad in the simulator.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl -j&amp;lt;/source&amp;gt;&lt;br /&gt;
or, with a specific device index (0 is default):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl --js_dev 0&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Joystick support uses the Simple DirectMedia Layer (SDL) library. Rather than specifying an input device name as one normally does on Linux, you just supply an index value (0, 1, 2,...) of the device you wish to use. Typically, the order of devices is the order in which you plugged them into your computer. The sim will display the name of the device being used to double check. If the &amp;lt;tt&amp;gt;-j&amp;lt;/tt&amp;gt; option is used with no argument, the sim defaults to using device on index 0 (which is usually correct if you have only one joystick attached).&lt;br /&gt;
&lt;br /&gt;
Also see [[Joystick#Calibration]].&lt;br /&gt;
&lt;br /&gt;
=== Visualization in [[FlightGear]] ===&lt;br /&gt;
[[FlightGear#Installation|Install]] and [[FlightGear#Using_FlightGear_for_Visualization|start flightgear]], e.g. with a quadrotor model:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;fgfs --fdm=null --native-gui=socket,in,30,,5501,udp --prop:/sim/model/path=Models/Aircraft/paparazzi/mikrokopter.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
restart your simulator with the ''--fg_host'' option:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/aircrafts/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
* If you get an error like &amp;quot;JSBSim failed to open the configuration file: (null)/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml&amp;quot;, you need to set your $PAPARAZZI_SRC and $PAPARAZZI_HOME environment variables. Add the following to your .bashrc, change paths according to where you put Paparazzi. Open a new terminal and launch the sim again.&lt;br /&gt;
 export PAPARAZZI_SRC=~/paparazzi&lt;br /&gt;
 export PAPARAZZI_HOME=~/paparazzi&lt;br /&gt;
&lt;br /&gt;
* If you did not install the jsbsim package your JSBSim installation under /opt/jsbsim will be used and you will have to set your library path (either in your shell startup file or when running the sim on the command line), e.g.:&lt;br /&gt;
 LD_LIBRARY_PATH=/opt/jsbsim/lib ./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
* If you get an error like &amp;quot;fatal error: gsl/gsl_rng.h: No such file or directory&amp;quot;, you need to install the GNU Scientific Library and corresponding development packages (libgsl).&lt;br /&gt;
&lt;br /&gt;
* If you get an error like &amp;quot;undefined reference to `pcre_compile'&amp;quot;, edit file conf/Makefile.nps, look for the line that begins with LDFLAGS and add -lpcre, e.g.:&lt;br /&gt;
 LDFLAGS += $($(TARGET).LDFLAGS) -lpcre&lt;br /&gt;
&lt;br /&gt;
== Usage Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Plot the value of a message field ===&lt;br /&gt;
Start the [[RTPlotter|real-time plotter]] tool menu of [[Paparazzi Center]] or with&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./sw/logalizer/plotter&amp;lt;/source&amp;gt;&lt;br /&gt;
for example drag the label 'int32 phi' from the ROTORCRAFT_FP message to the drawing area of the plotter&lt;br /&gt;
&lt;br /&gt;
* Use the datalink to change the telemetry mode&lt;br /&gt;
start 'settings' ( from the tool menu of paparazzi center) or with&lt;br /&gt;
  ./sw/ground_segment/tmtc/settings -ac Quad_LisaM_2&lt;br /&gt;
start 'server' to dispatch datalink messages ( from the tool menu of paparazzi center) or with&lt;br /&gt;
 ./sw/ground_segment/tmtc/server &lt;br /&gt;
change the field &amp;quot;telemetry&amp;quot; on the first page to &amp;quot;Att loop&amp;quot; and send by pressing the green check button. The label on the left or the drop box should change to &amp;quot;Att loop&amp;quot; confirming your message has been received. &amp;quot;message&amp;quot; should now show that the message &amp;quot;STAB_ATTITUDE_INT&amp;quot; is received&lt;br /&gt;
&lt;br /&gt;
=== Tuning the attitude control loop ===&lt;br /&gt;
Here we are going to use the simulator to demonstrate a way of tuning the attitude control loop for a multicopter (rotorcraft firmware only).&lt;br /&gt;
&lt;br /&gt;
* Restart your previous session&lt;br /&gt;
* Set telemetry mode to &amp;quot;attitude_loop&amp;quot;&lt;br /&gt;
* Display two real time plotter windows&lt;br /&gt;
&lt;br /&gt;
In the first one, plot the field &amp;quot;m_phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_int&amp;quot; message. This is our estimation of roll angle.&lt;br /&gt;
On top of that, plot the field &amp;quot;phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_REF_INT&amp;quot; message. This is our reference roll angle, that is, the roll value we are trying to achieve.&lt;br /&gt;
&lt;br /&gt;
In the second plotter, plot the fields &amp;quot;delta_a_fb&amp;quot; and &amp;quot;delta_a_ff&amp;quot;. Those are respectively the feedback and feedforward part of our roll command. The sum of those two terms is what is used as roll command.The feedforward part is the part used to follow our trajectory and the feedback part is the part used to reject perturbations.&lt;br /&gt;
&lt;br /&gt;
* In &amp;quot;Settings&amp;quot;, go to the &amp;quot;Att Loop&amp;quot; tab&lt;br /&gt;
We notice that the vehicle doesn't follow the step trajectory we are trying to make him do accurately.&lt;br /&gt;
 &lt;br /&gt;
Start by setting the value of the proportional gain ('pgain_phi') to 1000 instead of 400. The vehicle now follows the trajectory faster but overshoots. To prevent that, increase the value of the derivative gain ('dgain p') from 300 to 700.&lt;br /&gt;
&lt;br /&gt;
If you look at the plotter where you're plotting the commands, you'll notice that during steps, the feedback command has to work hard. This means that our feedforward command is badly tuned, and namely not working hard enough. Increase the value of the feedforward gain ('ddgain p') from 300 to 540. You'll notice that now the feedback command has become marginal during the steps. This is the right value for the gain. Anything bigger will make the feedback command fight against the feedforward command during steps, anything smaller will make the feedback command have to complement the feedforward command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Sniffer</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Server&amp;diff=18960</id>
		<title>Server</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Server&amp;diff=18960"/>
		<updated>2014-08-23T18:28:55Z</updated>

		<summary type="html">&lt;p&gt;Sniffer: url bug&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Tools&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;server&amp;lt;/tt&amp;gt; (in &amp;lt;tt&amp;gt;sw/ground_segment/tmtc/&amp;lt;/tt&amp;gt;) is an agent that logs, distributes, and preprocesses messages for the [[GCS]] and other agents as described in the [[Overview#System_Architecture|system overview]].&lt;br /&gt;
&lt;br /&gt;
See [[DevGuide/Server_GCS_com]] for the communication between the ''server'' and the ''[[GCS]]''.&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
  -b Bus	Default is 127.255.255.255:2010&lt;br /&gt;
  -hostname &amp;lt;hostname&amp;gt; Set the address for the http server&lt;br /&gt;
  -http Send http: URLs (default is file:)&lt;br /&gt;
  -kml Enable KML file updating&lt;br /&gt;
  -kml_no_http KML without web server (local files only)&lt;br /&gt;
  -kml_port Port for KML files (default is 8889)&lt;br /&gt;
  -n Disable log&lt;br /&gt;
  -no_md5_check Disable safety matching of live and current configurations&lt;br /&gt;
  -replay_old_log Enable aircraft registering on PPRZ_MODE messages&lt;br /&gt;
  -help  Display this list of options&lt;br /&gt;
  --help  Display this list of options&lt;br /&gt;
&lt;br /&gt;
== Export KML to Google Map==&lt;br /&gt;
It is useful to export Flight information to Google Map. you can show basic flight information in google map cross platform through IP network.&lt;br /&gt;
&lt;br /&gt;
You will need a webserver runing in the GCS computer, for python simpleHTTPServer:&lt;br /&gt;
&lt;br /&gt;
 ''cd ~/paparazzi/''&lt;br /&gt;
&lt;br /&gt;
 ''python -m SimpleHTTPServer''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
to check if it work, you should see 8000 port is opened for listening.&lt;br /&gt;
&lt;br /&gt;
 -''netstat -l|grep 8000''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then in Paparazzi center, excute a session. Pass some parameters to server agent:&lt;br /&gt;
&lt;br /&gt;
 ''server -kml -kml_port 8000 -hostname 192.168.0.100(replace with you paparazzi center IP address)''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It's done. Now in any computer in the network, open browser to access &amp;lt;nowiki&amp;gt;http://192.168.0.100:8000/var/aircrafts/(you AC name)/&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
you will see FollowMe.kml file, open it with Google earth. you will be able to see the real time flight information. the information updated are:&lt;br /&gt;
&lt;br /&gt;
  1. AC lat, lon, alt&lt;br /&gt;
  2. Flight Plan&lt;br /&gt;
  3. current route&lt;br /&gt;
&lt;br /&gt;
[[File:Kml_export.png]]&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tools]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Sniffer</name></author>
	</entry>
</feed>