mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-02 13:27:32 +08:00
allow xml in module description
This commit is contained in:
@@ -4,6 +4,12 @@
|
|||||||
<doc>
|
<doc>
|
||||||
<description>
|
<description>
|
||||||
U-blox GPS (I2C)
|
U-blox GPS (I2C)
|
||||||
|
This module provides an I2C interface that can then be used in the gps_ublox module:
|
||||||
|
@verbatim
|
||||||
|
<module name="gps_ublox">
|
||||||
|
<configure name="UBX_GPS_PORT" value="gps_i2c"/>
|
||||||
|
</module>
|
||||||
|
@endverbatim
|
||||||
</description>
|
</description>
|
||||||
<configure name="GPS_UBX_I2C_DEV" value="i2cX" description="set i2c peripheral (default: i2c1)"/>
|
<configure name="GPS_UBX_I2C_DEV" value="i2cX" description="set i2c peripheral (default: i2c1)"/>
|
||||||
</doc>
|
</doc>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<!ELEMENT datalink EMPTY>
|
<!ELEMENT datalink EMPTY>
|
||||||
<!ELEMENT makefile (configure|define|flag|file|file_arch|raw)*>
|
<!ELEMENT makefile (configure|define|flag|file|file_arch|raw)*>
|
||||||
<!ELEMENT section (define|configure)*>
|
<!ELEMENT section (define|configure)*>
|
||||||
<!ELEMENT description (#PCDATA)>
|
<!ELEMENT description (#CDATA)>
|
||||||
<!ELEMENT configure EMPTY>
|
<!ELEMENT configure EMPTY>
|
||||||
<!ELEMENT define EMPTY>
|
<!ELEMENT define EMPTY>
|
||||||
<!ELEMENT flag EMPTY>
|
<!ELEMENT flag EMPTY>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ In the flight plan, the survey blocks call init and run functions:
|
|||||||
- min_rad minimal radius when navigating
|
- min_rad minimal radius when navigating
|
||||||
- altitude the altitude that must be reached before the flyover starts
|
- altitude the altitude that must be reached before the flyover starts
|
||||||
2. Run the survey with nav_survey_polygon_run()
|
2. Run the survey with nav_survey_polygon_run()
|
||||||
<!--
|
|
||||||
Block example:
|
Block example:
|
||||||
@verbatim
|
@verbatim
|
||||||
<block name="Poly Survey" strip_button="Poly Survey">
|
<block name="Poly Survey" strip_button="Poly Survey">
|
||||||
@@ -23,7 +23,6 @@ Block example:
|
|||||||
<call fun="nav_survey_polygon_run()"/>
|
<call fun="nav_survey_polygon_run()"/>
|
||||||
</block>
|
</block>
|
||||||
@endverbatim
|
@endverbatim
|
||||||
-->
|
|
||||||
</description>
|
</description>
|
||||||
</doc>
|
</doc>
|
||||||
<header>
|
<header>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ In the flight plan, the survey blocks call init and run functions:
|
|||||||
- sweep_width distance between the sweeps
|
- sweep_width distance between the sweeps
|
||||||
- angle NS or WE orientation
|
- angle NS or WE orientation
|
||||||
2. Run the survey with nav_survey_rectangle_rotorcraft_run(WP1,WP2)
|
2. Run the survey with nav_survey_rectangle_rotorcraft_run(WP1,WP2)
|
||||||
<!--
|
|
||||||
Block example:
|
Block example:
|
||||||
@verbatim
|
@verbatim
|
||||||
<block name="Poly Survey" strip_button="Poly Survey">
|
<block name="Poly Survey" strip_button="Poly Survey">
|
||||||
@@ -25,12 +25,11 @@ or using flightplan primitive
|
|||||||
<survey_rectangle grid="30" orientation="NS" wp1="S1" wp2="S2"/>
|
<survey_rectangle grid="30" orientation="NS" wp1="S1" wp2="S2"/>
|
||||||
</block>
|
</block>
|
||||||
@endverbatim
|
@endverbatim
|
||||||
-->
|
|
||||||
</description>
|
</description>
|
||||||
<define name="RECTANGLE_SURVEY_DEFAULT_SWEEP" value="25" description="default sweep distance when using dinamic setup"/>
|
<define name="RECTANGLE_SURVEY_DEFAULT_SWEEP" value="25" description="default sweep distance when using dinamic setup"/>
|
||||||
</doc>
|
</doc>
|
||||||
|
|
||||||
<settings>
|
<settings>
|
||||||
<dl_settings>
|
<dl_settings>
|
||||||
<dl_settings NAME="Ret_Survey">
|
<dl_settings NAME="Ret_Survey">
|
||||||
<dl_setting min="10" max="500" step="1" var="sweep" type="float" shortname="Distance" module="modules/nav/nav_survey_rectangle_rotorcraft"/>
|
<dl_setting min="10" max="500" step="1" var="sweep" type="float" shortname="Distance" module="modules/nav/nav_survey_rectangle_rotorcraft"/>
|
||||||
|
|||||||
@@ -171,14 +171,28 @@ def module_configuration(module, mname):
|
|||||||
def get_module_name(module):
|
def get_module_name(module):
|
||||||
return module.get('name')
|
return module.get('name')
|
||||||
|
|
||||||
|
def remove_prefix(text, prefix):
|
||||||
|
if text.startswith(prefix):
|
||||||
|
return text[len(prefix):]
|
||||||
|
return text
|
||||||
|
|
||||||
|
def remove_postfix(text, postfix):
|
||||||
|
if text.endswith(postfix):
|
||||||
|
return text[:-len(postfix)]
|
||||||
|
return text
|
||||||
|
|
||||||
def get_module_description(module):
|
def get_module_description(module):
|
||||||
desc = module.find("./doc/description")
|
desc = module.find("./doc/description")
|
||||||
details = "No detailed description...\n"
|
details = "No detailed description...\n"
|
||||||
if desc is None or desc.text is None:
|
if desc is None or desc.text is None:
|
||||||
brief = module.get('name').replace('_', ' ').title()
|
brief = module.get('name').replace('_', ' ').title()
|
||||||
else:
|
else:
|
||||||
|
# use tostring instead of desc.text to allow xml stuff in description
|
||||||
|
text = ET.tostring(desc, method="xml").strip()
|
||||||
|
text = remove_prefix(text, "<description>")
|
||||||
|
text = remove_postfix(text, "</description>")
|
||||||
# treat first line until dot as brief
|
# treat first line until dot as brief
|
||||||
d = re.split(r'\.|\n', desc.text.strip(), 1)
|
d = re.split(r'\.|\n', text.strip(), 1)
|
||||||
brief = d[0].strip()
|
brief = d[0].strip()
|
||||||
if len(d) > 1:
|
if len(d) > 1:
|
||||||
details = d[1].strip()+"\n"
|
details = d[1].strip()+"\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user