http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&user=Laurentc&feedformat=atomPaparazziUAV - User contributions [en]2024-03-28T14:04:27ZUser contributionsMediaWiki 1.37.1http://wiki.paparazziuav.org/w/index.php?title=Talk:NPS&diff=15721Talk:NPS2013-08-17T11:29:51Z<p>Laurentc: </p>
<hr />
<div>I could not find where this simulation speed factor can be edited in any configuration file of NPS or anywhere else<br />
<br />
You can not supply a simulation speed in a configuration file right now - is that something you want to do? It would be quite easy to add. --[[User:Scdwyer|Scdwyer]] 21:35, 16 August 2013 (UTC)<br />
<br />
Hello human. My problem is that the simulator generates the warning "Warning: The time factor is too large for efficient operation! Please reduce the time factor.". This happens with a Samsung NC10, and Quad_LisaM2, which seems by the way to be the only way for me to simulate rotor_craft.xml flight plan. So i wonder if this time factor is why the simulator doesn't work properly yet for me with rotorcrafts. All I want to do is to simulate flight plans for an ARDrone2, but since there's no such thing as an paparazzi/conf/simulator/jsbsim/aircraft/ardrone2_raw.xml file, I use Quad_LisaM2. Or is there ?<br />
Here I used https://github.com/paparazzi/paparazzi.git<br />
Changing the time code directly in the code is fine for me. Then where is it ?<br />
By the way, is there a forum for these discussions, especially for the Ardrone2 ?<br />
<br />
Ok, I have found that the simulator essentially works, but provides a sort of random position on earth for the startup GPS position instead of those in the flight plan header. And in order to have in view the waypoints, you have to press the icon "fit to window" in GCS. Not at the right place on earth, but that"s ok to test the flight plan. --[[User:Laurentc|Laurentc]] 11:29, 17 August 2013 (UTC)</div>Laurentchttp://wiki.paparazziuav.org/w/index.php?title=Talk:NPS&diff=15720Talk:NPS2013-08-17T10:52:53Z<p>Laurentc: </p>
<hr />
<div>I could not find where this simulation speed factor can be edited in any configuration file of NPS or anywhere else<br />
<br />
You can not supply a simulation speed in a configuration file right now - is that something you want to do? It would be quite easy to add. --[[User:Scdwyer|Scdwyer]] 21:35, 16 August 2013 (UTC)<br />
<br />
Hello human. My problem is that the simulator generates the warning "Warning: The time factor is too large for efficient operation! Please reduce the time factor.". This happens with a Samsung NC10, and Quad_LisaM2, which seems by the way to be the only way for me to simulate rotor_craft.xml flight plan. So i wonder if this time factor is why the simulator doesn't work properly yet for me with rotorcrafts. All I want to do is to simulate flight plans for an ARDrone2, but since there's no such thing as an paparazzi/conf/simulator/jsbsim/aircraft/ardrone2_raw.xml file, I use Quad_LisaM2. Or is there ?<br />
Here I used https://github.com/paparazzi/paparazzi.git<br />
Changing the time code directly in the code is fine for me. Then where is it ?<br />
By the way, is there a forum for these discussions, especially for the Ardrone2 ?<br />
--[[User:Laurentc|Laurentc]] 10:52, 17 August 2013 (UTC)</div>Laurentchttp://wiki.paparazziuav.org/w/index.php?title=Talk:NPS&diff=15718Talk:NPS2013-08-16T20:49:28Z<p>Laurentc: Created page with " I could not find where this simulation speed factor can be edited in any configuration file of NPS or anywhere else"</p>
<hr />
<div><br />
I could not find where this simulation speed factor can be edited in any configuration file of NPS or anywhere else</div>Laurentchttp://wiki.paparazziuav.org/w/index.php?title=NPS&diff=15717NPS2013-08-16T20:45:58Z<p>Laurentc: /* Pausing or running the sim at a different speed */</p>
<hr />
<div><categorytree style="float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;" mode=pages>Simulation</categorytree><br />
__TOC__<br />
<br />
NPS is our advanced rotorcraft simulator with sensor models and uses [[JSBSim]] as FDM (FlightDynamicModel) to allow fairly complex airframes.<br />
JSBSim can easily be replaced by the FDM of your choice.<br />
<br />
Fixedwing support can also be easily added as soon as someone actually wants to use it ;-)<br />
<br />
== Installation ==<br />
<br />
See [[Installation|installation of Paparazzi]], [[JSBSim]] and optionally [[FlightGear]].<br />
<br />
=== Configuration/Build ===<br />
Add the ''nps'' target to your [[Rotorcraft Configuration|airframe]] with the fdm you want to use:<br />
{{Box Code|conf/airframes/myplane.xml|<br />
<source lang="xml"><br />
<firmware name="rotorcraft"><br />
<target name="nps" board="pc"><br />
<subsystem name="fdm" type="jsbsim"/><br />
</target><br />
...<br />
</firmware><br />
<br />
<section name="SIMULATOR" prefix="NPS_"><br />
<define name="ACTUATOR_NAMES" value="{&quot;front_motor&quot;, &quot;back_motor&quot;, &quot;right_motor&quot;, &quot;left_motor&quot;}" /><br />
<define name="INITIAL_CONDITITONS" value="&quot;reset00&quot;" /><br />
<define name="SENSORS_PARAMS" value="&quot;nps_sensors_params_default.h&quot;" /><br />
</section><br />
</source><br />
}}<br />
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.<br />
<br />
The xml file with the JSBSim model of the aircraft is located in ''conf/simulator/jsbsim/aircraft/''<br />
and needs to have the name of the aircraft postfixed with ''.xml''<br />
(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])<br />
<br />
* 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)<br />
* INITIAL_CONDITITONS: 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])<br />
* 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])<br />
<br />
Then build the nps target...<br />
<br />
== Running the Simulation ==<br />
Since paparazzi version ''v4.9_devel-425'' the most convenient way to start the simulation is via the ''Simulation'' session from the [[Paparazzi Center]].<br />
Just select e.g. the Quad_LisaM_2 example airframe and start the ''Simulation'' session with the simulator, GCS and server.<br />
<br />
You can also start it via the generic simulation launcher:<br />
<source lang="bash">sw/simulator/pprzsim-launch --aircraft Quad_LisaM_2 --type nps</source><br />
<br />
In earlier versions, start your tools (e.g. [[GCS]], [[server]] and messages) separately, then launch the nps simulator for your aircraft directly:<br />
<source lang="bash">./var/Quad_LisaM_2/nps/simsitl</source><br />
<br />
=== Options ===<br />
Start the simulator with the ''--help'' option to list them all.<br />
<br />
* ''--ivy_bus'': Set ivy bus broadcast address to use (default 127.255.255.255, 224.255.255.255 on OSX)<br />
* ''--rc_script'': Execute script with specified number to emulate RC input.<br />
* ''--js_dev'': Use joystick for radio control (specify index, normally 0), also see [[NPS#Use_a_joystick]].<br />
* ''--spektrum_dev'': Spektrum device to use for radio control (e.g. /dev/ttyUSB0)<br />
* ''--fg_host'': Host for FlightGear visualization (e.g. 127.0.0.1)<br />
* ''--fg_port'': Port on FlightGear host to connect to (Default: 5501)<br />
* ''--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)<br />
<br />
=== Typical Simulation ===<br />
In general you go through the same steps as with the real aircraft:<br />
* It should start on the ground and you have to wait a few seconds until the AHRS is aligned.<br />
* If you have a (simulated) RC, you can now arm the motors and fly around in manual.<br />
* To fly autonomously, make sure your ''AUTO2'' mode is ''NAV'', you can change it in the GCS->settings->system->auto2.<br />
** Switch to it if you are using an RC, otherwise you should already be in this mode.<br />
** Arm your motors: either via the resurrect button or by going to the ''Start Motors'' block of the [[Flight Plans|Flight Plan]].<br />
** Takeoff: via the takeoff button or the corresponding flight plan block.<br />
* Do your stuff... :-)<br />
<br />
=== Pausing or running the sim at a different speed ===<br />
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).<br />
<br />
This simulation speed parameter ?can be edited? in a configuration file : FIXME<br />
<br />
=== Use a Joystick ===<br />
You can use a [[joystick]] (or connect your RC transmitter as a joystick) to control the quad in the simulator.<br />
<source lang="bash">./var/Quad_LisaM_2/nps/simsitl -j</source><br />
or, with a specific device index (0 is default):<br />
<source lang="bash">./var/Quad_LisaM_2/nps/simsitl --js_dev 0</source><br />
<br />
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 <tt>-j</tt> 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).<br />
<br />
Also see [[Joystick#Calibration]].<br />
<br />
=== Visualization in [[FlightGear]] ===<br />
[[FlightGear#Installation|Install]] and [[FlightGear#Using_FlightGear_for_Visualization|start flightgear]], e.g. with a quadrotor model:<br />
<source lang="bash">fgfs --fdm=null --native-gui=socket,in,30,,5501,udp --prop:/sim/model/path=Models/Aircraft/paparazzi/mikrokopter.xml</source><br />
restart your simulator with the ''--fg_host'' option:<br />
<source lang="bash">./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1</source><br />
<br />
=== Troubleshooting ===<br />
* If you get an error like "JSBSim failed to open the configuration file: (null)/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml", 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.<br />
export PAPARAZZI_SRC=~/paparazzi<br />
export PAPARAZZI_HOME=~/paparazzi<br />
<br />
* 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.:<br />
LD_LIBRARY_PATH=/opt/jsbsim/lib ./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1<br />
<br />
* If you get an error like "fatal error: gsl/gsl_rng.h: No such file or directory", you need to install the GNU Scientific Library and corresponding development packages (libgsl).<br />
<br />
* If you get an error like "undefined reference to `pcre_compile'", edit file conf/Makefile.nps, look for the line that begins with LDFLAGS and add -lpcre, e.g.:<br />
LDFLAGS += $($(TARGET).LDFLAGS) -lpcre<br />
<br />
== Usage Examples ==<br />
<br />
=== Plot the value of a message field ===<br />
Start the [[RTPlotter|real-time plotter]] tool menu of [[Paparazzi Center]] or with<br />
<source lang="bash">./sw/logalizer/plotter</source><br />
for example drag the label 'int32 phi' from the ROTORCRAFT_FP message to the drawing area of the plotter<br />
<br />
* Use the datalink to change the telemetry mode<br />
start 'settings' ( from the tool menu of paparazzi center) or with<br />
./sw/ground_segment/tmtc/settings -ac Quad_LisaM_2<br />
start 'server' to dispatch datalink messages ( from the tool menu of paparazzi center) or with<br />
./sw/ground_segment/tmtc/server <br />
change the field "telemetry" on the first page to "Att loop" and send by pressing the green check button. The label on the left or the drop box should change to "Att loop" confirming your message has been received. "message" should now show that the message "STAB_ATTITUDE_INT" is received<br />
<br />
=== Tuning the attitude control loop ===<br />
Here we are going to use the simulator to demonstrate a way of tuning the attitude control loop.<br />
<br />
* Restart your previous session<br />
* Set telemetry mode to "attitude_loop"<br />
* Display two real time plotter windows<br />
<br />
In the first one, plot the field "m_phi" from the "STAB_ATTITUDE_int" message. This is our estimation of roll angle.<br />
On top of that, plot the field "phi" from the "STAB_ATTITUDE_REF_INT" message. This is our reference roll angle, that is, the roll value we are trying to achieve.<br />
<br />
In the second plotter, plot the fields "delta_a_fb" and "delta_a_ff". 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.<br />
<br />
* In "Settings", go to the "Att Loop" tab<br />
We notice that the vehicle doesn't follow the step trajectory we are trying to make him do accurately.<br />
<br />
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.<br />
<br />
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.<br />
<br />
<br />
[[Category:Simulation]] [[Category:Software]] [[Category:User_Documentation]]</div>Laurentchttp://wiki.paparazziuav.org/w/index.php?title=Talk:AR_Drone_2/getting_started_advanced&diff=15714Talk:AR Drone 2/getting started advanced2013-08-14T22:47:56Z<p>Laurentc: </p>
<hr />
<div>Change proposal for "Get the sourcecode"<br />
<br />
----<br />
<br />
<br />
Now we need to get the Paparazzi sourcecode<br />
<br />
$ mkdir -p ~/develop<br />
$ cd ~/develop<br />
$ git clone https://github.com/RoboticaTUDelft/paparazzi.git<br />
<br />
Or if you want to use AR Drone and Paparazzi control via SDK <br />
<br />
$ git checkout minor2<br />
<br />
This will create a directory named Paparazzi in the folder called 'develop'<br />
<br />
----<br />
'''should be i think, even though i am a linux newbie, and paparazzi newbie, something like''':<br />
----<br />
<br />
Now we need to get the Paparazzi sourcecode<br />
<br />
$ mkdir -p ~/develop<br />
$ cd ~/develop<br />
$ git clone https://github.com/RoboticaTUDelft/paparazzi.git paparazzi<br />
<br />
This will create a directory named Paparazzi in the folder called 'develop'<br />
<br />
If instead of the RAW mode, you want Paparazzi to control the AR Drone via the AR Drone SDK, then select another source code branch <br />
<br />
$ git checkout minor2<br />
----<br />
While https://github.com/paparazzi/paparazzi.git does compile, <br />
that one https://github.com/RoboticaTUDelft/paparazzi.git, does not compile as of august 15th 2013. <br />
Here is the log I get for ref.<br />
<br />
This was compiled with a fresh ubuntu as specified. Even after full ubuntu system update, the error remains.<br />
<br />
Everything seems to go fine until..i get<br />
<br />
<PRE><br />
/opt/paparazzi/arm-multilib/bin/arm-none-eabi-gcc -Os -g3 -Istm32/include -mcpu=cortex-m3 -mthumb -msoft-float -DSTM32F1 -I../../libopencm3/include --function-sections --data-sections -DVERSION="\"V1.1\"" -DDEV_SERIAL="\"NSERIAL\"" -c -o luftboot.o luftboot.c<br />
luftboot.c: In function 'main':<br />
luftboot.c:448:9: note: #pragma message: Luftboot using 12MHz external clock to PLL it to 72MHz.<br />
luftboot.c:463:2: error: too many arguments to function 'usbd_init'<br />
../../libopencm3/include/libopencm3/usb/usbd.h:42:21: note: declared here<br />
make[2]: *** [luftboot.o] Error 1<br />
make[1]: *** [luftboot.module] Error 2<br />
make: *** [ext] Error 2<br />
<br />
</PRE></div>Laurentchttp://wiki.paparazziuav.org/w/index.php?title=Talk:AR_Drone_2/getting_started_advanced&diff=15713Talk:AR Drone 2/getting started advanced2013-08-14T22:40:57Z<p>Laurentc: </p>
<hr />
<div>proposition de changement pour le chapitre "Get the sourcecode"<br />
<br />
----<br />
<br />
<br />
Now we need to get the Paparazzi sourcecode<br />
<br />
$ mkdir -p ~/develop<br />
$ cd ~/develop<br />
$ git clone https://github.com/RoboticaTUDelft/paparazzi.git<br />
<br />
Or if you want to use AR Drone and Paparazzi control via SDK <br />
<br />
$ git checkout minor2<br />
<br />
This will create a directory named Paparazzi in the folder called 'develop'<br />
<br />
----<br />
should be i think, even though i am a linux newbie, and paparazzi newbie, something like:<br />
----<br />
<br />
Now we need to get the Paparazzi sourcecode<br />
<br />
$ mkdir -p ~/develop<br />
$ cd ~/develop<br />
$ git clone https://github.com/RoboticaTUDelft/paparazzi.git paparazzi<br />
<br />
This will create a directory named Paparazzi in the folder called 'develop'<br />
<br />
If instead of the RAW mode, you want Paparazzi to control the AR Drone via the AR Drone SDK, then select another source code branch <br />
<br />
$ git checkout minor2<br />
----<br />
While https://github.com/paparazzi/paparazzi.git does compile, <br />
that one https://github.com/RoboticaTUDelft/paparazzi.git, does not compile as of august 15th 2013. <br />
Here is the log I get for ref.</div>Laurentchttp://wiki.paparazziuav.org/w/index.php?title=Talk:AR_Drone_2/getting_started_advanced&diff=15712Talk:AR Drone 2/getting started advanced2013-08-14T22:36:05Z<p>Laurentc: Created page with " proposition de changement pour le chapitre "Get the sourcecode" ============================== Now we need to get the Paparazzi sourcecode $ mkdir -p ~/develop $ cd ~/develo…"</p>
<hr />
<div><br />
proposition de changement pour le chapitre "Get the sourcecode"<br />
==============================<br />
<br />
Now we need to get the Paparazzi sourcecode<br />
<br />
$ mkdir -p ~/develop<br />
$ cd ~/develop<br />
$ git clone https://github.com/RoboticaTUDelft/paparazzi.git<br />
<br />
Or if you want to use AR Drone and Paparazzi control via SDK <br />
<br />
$ git checkout minor2<br />
<br />
This will create a directory named Paparazzi in the folder called 'develop'<br />
<br />
=================================<br />
should be i think, even though i am a linux newbie, and paparazzi newbie, something like:<br />
=================================<br />
<br />
Now we need to get the Paparazzi sourcecode<br />
<br />
$ mkdir -p ~/develop<br />
$ cd ~/develop<br />
$ git clone https://github.com/RoboticaTUDelft/paparazzi.git paparazzi<br />
<br />
This will create a directory named Paparazzi in the folder called 'develop'<br />
<br />
If instead of the RAW mode, you want Paparazzi to control the AR Drone via the AR Drone SDK, then select another source code branch <br />
<br />
$ git checkout minor2</div>Laurentc