Changes between Initial Version and Version 1 of clone_demo


Ignore:
Timestamp:
Mar 23, 2021, 4:30:06 PM (4 years ago)
Author:
Sanahuja Guillaume
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • clone_demo

    v1 v1  
     1[[PageOutline]]
     2
     3= How to properly clone a demo =
     4
     5== Intro ==
     6
     7This page will help you to copy sources of an existing demo and prepare them for your new application.
     8
     9A script is provided to do that, it will change any references from the old demo to the new one. If needed, it will rename source files, change the name of the classes, adapt the CMakeLists.txt and adapt the launch scripts for both uav and simulator.
     10
     11This is very useful if you want to base your work on an existing demo. **Just copying source files from the demos is not a good practice.**
     12
     13== Cloning a demo ==
     14
     15A good practice is to put your sources in a separate folder (assumed to be ''my_src'' in this section) from other flair sources.
     16To clone the !CircleFollower demo to a new application called !MyApp in ''my_src'' folder:
     17{{{
     18cd $FLMAIR_ROOT/my_src
     19$FLAIR_ROOT/flair-src/scripts/clone_demo.sh $FLAIR_ROOT/flair-src/demos/CircleFollower/ MyApp
     20}}}
     21Output should be something like that:
     22{{{
     23cloning CircleFollower/ to MyApp
     24old project name is CircleFollower
     25
     26parsing ./CMakeLists.txt
     27changed reference of CircleFollower to MyApp
     28
     29parsing ./simulator/CMakeLists.txt
     30changed reference of CircleFollower to MyApp
     31
     32parsing ./uav/CMakeLists.txt
     33renamed src/CircleFollower.cpp to src/MyApp.cpp
     34renamed src/CircleFollower.h to src/MyApp.h
     35changed reference of CircleFollower to MyApp
     36
     37parsing ./uav/src/main.cpp
     38changed reference of CircleFollower to MyApp
     39
     40parsing ./uav/src/MyApp.cpp
     41changed reference of CircleFollower to MyApp
     42
     43parsing ./simulator/src/main.cpp
     44changed reference of CircleFollower to MyApp
     45
     46parsing ./uav/src/MyApp.h
     47changed reference of CircleFollower to MyApp
     48
     49parsing ./uav/resources/core2-64/x4.sh
     50changed reference of CircleFollower to MyApp
     51
     52parsing ./uav/resources/core2-64/x8.sh
     53changed reference of CircleFollower to MyApp
     54
     55parsing ./uav/resources/armv5te/CircleFollower_minidrones.sh
     56changed reference of CircleFollower to MyApp
     57
     58parsing ./uav/resources/armv7a-neon/CircleFollower_hdsx8.sh
     59changed reference of CircleFollower to MyApp
     60
     61parsing ./uav/resources/armv7a-neon/CircleFollower_bebop.sh
     62changed reference of CircleFollower to MyApp
     63
     64parsing ./uav/resources/armv7a-neon/CircleFollower_ardrone2.sh
     65changed reference of CircleFollower to MyApp
     66
     67parsing ./simulator/resources/core2-64/simulator_x8.sh
     68changed reference of CircleFollower to MyApp
     69
     70parsing ./simulator/resources/core2-64/simulator_x4.sh
     71changed reference of CircleFollower to MyApp
     72}}}
     73Showing you the changes made.
     74
     75You can then build the project with the documentation from [wiki:compile_all#Compileyourownproject this page].
     76
     77== Notes ==
     78
     79This script has been successfully tested on the following demos:
     80
     81* !CircleFollower
     82* !TwoWheelRobotCircleFollower
     83* !DemoGps
     84* !MixedReality
     85* !DemoOpticalFlow
     86* !PidStandalone
     87* !SimpleFleet
     88* !TwoWheelRobotSimpleFleet
     89* Sinus
     90
     91It also should work to clone your own applications!
     92
     93**NB**: the script heavily relies on ''sed'' to replace strings. It can make mistakes if the source or the destination project name is contained in an existing class or method of flair!
     94