mirror of
https://github.com/CopterExpress/clover.git
synced 2026-06-02 16:09:32 +00:00
Compare commits
27 Commits
rtui
...
roswww-sta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d34f98f8c6 | ||
|
|
a42ee2ab1e | ||
|
|
209d5dde2f | ||
|
|
27ee253234 | ||
|
|
a2639204e4 | ||
|
|
7a8b5585c1 | ||
|
|
06a4478b5e | ||
|
|
71f2d69139 | ||
|
|
b2c98ba502 | ||
|
|
49338e6f58 | ||
|
|
d5baa0b1e1 | ||
|
|
ee81586fa5 | ||
|
|
5da20d4ac5 | ||
|
|
d2e886d952 | ||
|
|
0a1c98d5f0 | ||
|
|
ee7da701e6 | ||
|
|
873a08865e | ||
|
|
9461e2120f | ||
|
|
9cae4c9064 | ||
|
|
87361c3499 | ||
|
|
9aa5a7e447 | ||
|
|
cd08dba827 | ||
|
|
f960e5e662 | ||
|
|
a82736f041 | ||
|
|
278aa7b58b | ||
|
|
08f6d82fd2 | ||
|
|
8a8dc8b78f |
@@ -112,7 +112,7 @@ my_travis_retry pip3 install wheel
|
|||||||
my_travis_retry pip3 install -r /home/pi/catkin_ws/src/clover/clover/requirements.txt
|
my_travis_retry pip3 install -r /home/pi/catkin_ws/src/clover/clover/requirements.txt
|
||||||
source /opt/ros/${ROS_DISTRO}/setup.bash
|
source /opt/ros/${ROS_DISTRO}/setup.bash
|
||||||
# Don't build simulation plugins for actual drone
|
# Don't build simulation plugins for actual drone
|
||||||
catkin_make -j2 -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
sudo -E -u pi sh -c '. /opt/ros/${ROS_DISTRO}/setup.sh && catkin_make -j2 -DCMAKE_BUILD_TYPE=RelWithDebInfo'
|
||||||
source devel/setup.bash
|
source devel/setup.bash
|
||||||
|
|
||||||
echo_stamp "Install clever package (for backwards compatibility)"
|
echo_stamp "Install clever package (for backwards compatibility)"
|
||||||
|
|||||||
@@ -75,3 +75,8 @@ fi
|
|||||||
|
|
||||||
# validate examples are present
|
# validate examples are present
|
||||||
[[ $(ls $H/examples/*) ]]
|
[[ $(ls $H/examples/*) ]]
|
||||||
|
|
||||||
|
# validate web tools present
|
||||||
|
[ -d $H/.ros/www ]
|
||||||
|
[ "$(readlink $H/.ros/www/clover)" = "$H/catkin_ws/src/clover/clover/www" ]
|
||||||
|
[ "$(readlink $H/.ros/www/clover_blocks)" = "$H/catkin_ws/src/clover/clover_blocks/www" ]
|
||||||
|
|||||||
@@ -230,6 +230,9 @@ target_link_libraries(${PROJECT_NAME}
|
|||||||
${OpenCV_LIBRARIES}
|
${OpenCV_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Set Clover to default www page
|
||||||
|
set(ROSWWW_STATIC_DEFAULT ${PROJECT_NAME})
|
||||||
|
|
||||||
#############
|
#############
|
||||||
## Install ##
|
## Install ##
|
||||||
#############
|
#############
|
||||||
|
|||||||
@@ -84,9 +84,4 @@
|
|||||||
<!-- Send fake GCS heartbeats. Set to "true" for upstream PX4 -->
|
<!-- Send fake GCS heartbeats. Set to "true" for upstream PX4 -->
|
||||||
<param name="use_fake_gcs" value="false"/>
|
<param name="use_fake_gcs" value="false"/>
|
||||||
</node>
|
</node>
|
||||||
|
|
||||||
<!-- Update static directory -->
|
|
||||||
<node pkg="roswww_static" name="roswww_static" type="main.py" clear_params="true">
|
|
||||||
<param name="default_package" value="clover"/>
|
|
||||||
</node>
|
|
||||||
</launch>
|
</launch>
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
<li><a href="console.html">Clover console</a> (<code>/var/log/clover.log</code>)</li>
|
<li><a href="console.html">Clover console</a> (<code>/var/log/clover.log</code>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Update www using <code>rosrun roswww_static update</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="version"></div>
|
<div class="version"></div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|||||||
@@ -5,8 +5,19 @@ find_package(catkin REQUIRED)
|
|||||||
|
|
||||||
catkin_package()
|
catkin_package()
|
||||||
|
|
||||||
|
macro(roswww_static_make_default)
|
||||||
|
message(STATUS "roswww_static: make ${PROJECT_NAME} package default")
|
||||||
|
set(ROSWWW_STATIC_DEFAULT ${PROJECT_NAME} CACHE STRING "Default roswww_static package")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
|
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
|
||||||
|
|
||||||
catkin_install_python(PROGRAMS main.py
|
catkin_install_python(PROGRAMS src/update
|
||||||
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
message(status "CATKIN_ENV: ${CATKIN_ENV}")
|
||||||
|
|
||||||
|
add_custom_target(roswww_static ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env ROSWWW_STATIC_DEFAULT=${ROSWWW_STATIC_DEFAULT}
|
||||||
|
${CATKIN_ENV} ${CMAKE_CURRENT_SOURCE_DIR}/src/update)
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ Note: you should configure your web server to make it follow symlinks.
|
|||||||
|
|
||||||
## Instructions
|
## Instructions
|
||||||
|
|
||||||
* Run `main.py` node and it will generate the symlinks and index file.
|
* Run `update` script and it will generate the symlinks and index file: `rosrun roswww_static update`.
|
||||||
* Point your static web server path to `~/.ros/www`.
|
* Point your static web server path to `~/.ros/www`.
|
||||||
|
|
||||||
You can rerun `main.py` if the list of installed packages changes.
|
You can rerun `update` if the list of installed packages changes.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
* `index` – path for index page, otherwise packages list would be generated.
|
* `index` – path for index page, otherwise packages list would be generated.
|
||||||
* `default_package` – if set then the index page would redirect to this package's page.
|
* `default_package` – if set then the index page would redirect to this package's page.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<launch>
|
<launch>
|
||||||
<node pkg="roswww_static" name="roswww_static" type="main.py" clear_params="true" output="screen">
|
<node pkg="roswww_static" name="roswww_static" type="update" clear_params="true" output="screen">
|
||||||
<!-- <param name="index" value="$(find my_package)/www/index.html"/> -->
|
<!-- <param name="index" value="$(find my_package)/www/index.html"/> -->
|
||||||
<!-- <param name="default_package" value="my_package"/> -->
|
<!-- <param name="default_package" value="my_package"/> -->
|
||||||
</node>
|
</node>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# Copyright (C) 2020 Copter Express Technologies
|
# Copyright (C) 2020 Copter Express Technologies
|
||||||
#
|
#
|
||||||
@@ -16,13 +16,16 @@ import shutil
|
|||||||
import rospy
|
import rospy
|
||||||
import rospkg
|
import rospkg
|
||||||
|
|
||||||
rospy.init_node('roswww_static')
|
#rospy.init_node('roswww_static')
|
||||||
|
|
||||||
rospack = rospkg.RosPack()
|
rospack = rospkg.RosPack()
|
||||||
|
|
||||||
www = rospkg.get_ros_home() + '/www'
|
www = rospkg.get_ros_home() + '/www'
|
||||||
index_file = rospy.get_param('~index_file', None)
|
index_file = None # rospy.get_param('~index_file', None)
|
||||||
default_package = rospy.get_param('~default_package', None)
|
default_package = os.environ.get('ROSWWW_STATIC_DEFAULT') # rospy.get_param('~default_package', None)
|
||||||
|
|
||||||
|
print('roswww_static: destination directory:', www)
|
||||||
|
print('roswww_static: default package:', default_package)
|
||||||
|
|
||||||
shutil.rmtree(www, ignore_errors=True) # reset www directory content
|
shutil.rmtree(www, ignore_errors=True) # reset www directory content
|
||||||
os.mkdir(www)
|
os.mkdir(www)
|
||||||
@@ -34,7 +37,7 @@ index = '<h1>Packages list</h1>\n<ul>\n'
|
|||||||
for name in packages:
|
for name in packages:
|
||||||
path = rospack.get_path(name)
|
path = rospack.get_path(name)
|
||||||
if os.path.exists(path + '/www'):
|
if os.path.exists(path + '/www'):
|
||||||
rospy.loginfo('found www path for %s package', name)
|
print('roswww_static: found www path for package', name)
|
||||||
os.symlink(path + '/www', www + '/' + name)
|
os.symlink(path + '/www', www + '/' + name)
|
||||||
index += '<li><a href="{name}/">{name}</a></li>'.format(name=name)
|
index += '<li><a href="{name}/">{name}</a></li>'.format(name=name)
|
||||||
|
|
||||||
@@ -42,7 +45,7 @@ if default_package is not None:
|
|||||||
redirect_html = '<meta http-equiv=refresh content="0; url={name}/">'.format(name=default_package)
|
redirect_html = '<meta http-equiv=refresh content="0; url={name}/">'.format(name=default_package)
|
||||||
open(www + '/index.html', 'w').write(redirect_html)
|
open(www + '/index.html', 'w').write(redirect_html)
|
||||||
elif index_file is not None:
|
elif index_file is not None:
|
||||||
rospy.loginfo('symlinking index file')
|
print('roswww_static: symlinking index file')
|
||||||
os.symlink(index_file, www + '/index.html')
|
os.symlink(index_file, www + '/index.html')
|
||||||
else:
|
else:
|
||||||
open(www + '/index.html', 'w').write(index)
|
open(www + '/index.html', 'w').write(index)
|
||||||
Reference in New Issue
Block a user