Compare commits

...

11 Commits

Author SHA1 Message Date
Oleg Kalachev
9c1d854223 Redesign web part a bit 2021-05-20 18:04:03 +03:00
Oleg Kalachev
1f2ba65669 Minor fix 2021-05-20 18:00:22 +03:00
Oleg Kalachev
27be9eb281 www: add viewing clover.err file from web interface 2021-05-19 16:40:10 +03:00
Oleg Kalachev
f8222e1028 mavros.launch: fix 2021-05-14 15:34:41 +03:00
Oleg Kalachev
dce0c00773 Minor fix 2021-05-14 13:29:05 +03:00
Oleg Kalachev
dc8c5d9db9 clover.launch: disable rc node by default 2021-05-14 12:05:43 +03:00
Oleg Kalachev
261faaec0e Add waitfile script to wait for a file before starting a node 2021-05-14 12:05:23 +03:00
Oleg Kalachev
dbd9a4a238 optical_flow: publish debug image even when calc_flow_gyro failed 2021-05-13 18:52:22 +03:00
Oleg Kalachev
80d446e857 blocks: show traceback in error alert 2021-05-13 14:36:15 +03:00
Oleg Kalachev
609a7ab014 blocks: print exception info on error 2021-05-13 11:46:03 +03:00
Oleg Kalachev
c0d9bd7ef0 mavros.launch: add default 'prefix' argument 2021-05-12 23:41:33 +03:00
7 changed files with 47 additions and 21 deletions

View File

@@ -11,7 +11,7 @@
<arg name="rangefinder_vl53l1x" default="true"/> <arg name="rangefinder_vl53l1x" default="true"/>
<arg name="led" default="true"/> <arg name="led" default="true"/>
<arg name="blocks" default="false"/> <arg name="blocks" default="false"/>
<arg name="rc" default="true"/> <arg name="rc" default="false"/>
<arg name="simulator" default="false"/> <!-- flag that we are operating on a simulated drone --> <arg name="simulator" default="false"/> <!-- flag that we are operating on a simulated drone -->

View File

@@ -7,7 +7,8 @@
<arg name="respawn" default="true"/> <arg name="respawn" default="true"/>
<arg name="distance_sensor_remap" default="rangefinder/range"/> <arg name="distance_sensor_remap" default="rangefinder/range"/>
<arg name="usb_device" default="/dev/px4fmu"/> <arg name="usb_device" default="/dev/px4fmu"/>
<arg name="prefix" default="bash -c 'while [ ! -e $(arg usb_device) ]; do sleep 1; done; $0 $@'" if="$(eval fcu_conn == 'usb')"/> <arg name="prefix" default="" unless="$(eval fcu_conn == 'usb')"/>
<arg name="prefix" default="rosrun clover waitfile $(arg usb_device)" if="$(eval fcu_conn == 'usb')"/>
<node pkg="mavros" type="mavros_node" name="mavros" launch-prefix="$(arg prefix)" required="false" clear_params="true" respawn="$(arg respawn)" unless="$(eval fcu_conn == 'none')" respawn_delay="1" output="screen"> <node pkg="mavros" type="mavros_node" name="mavros" launch-prefix="$(arg prefix)" required="false" clear_params="true" respawn="$(arg respawn)" unless="$(eval fcu_conn == 'none')" respawn_delay="1" output="screen">
<!-- UART connection --> <!-- UART connection -->

View File

@@ -206,7 +206,7 @@ private:
} catch (const tf2::TransformException& e) { } catch (const tf2::TransformException& e) {
// Invalidate previous frame // Invalidate previous frame
prev_.release(); prev_.release();
return; goto publish_debug;
} }
} }
@@ -218,6 +218,10 @@ private:
flow_.quality = (uint8_t)(response * 255); flow_.quality = (uint8_t)(response * 255);
flow_pub_.publish(flow_); flow_pub_.publish(flow_);
prev_ = curr_.clone();
prev_stamp_ = msg->header.stamp;
publish_debug:
// Publish debug image // Publish debug image
if (img_pub_.getNumSubscribers() > 0) { if (img_pub_.getNumSubscribers() > 0) {
// publish debug image // publish debug image
@@ -234,12 +238,9 @@ private:
static geometry_msgs::TwistStamped velo; static geometry_msgs::TwistStamped velo;
velo.header.stamp = msg->header.stamp; velo.header.stamp = msg->header.stamp;
velo.header.frame_id = fcu_frame_id_; velo.header.frame_id = fcu_frame_id_;
velo.twist.angular.x = flow_.integrated_x / integration_time.toSec(); velo.twist.angular.x = flow_fcu.vector.x / integration_time.toSec();
velo.twist.angular.y = flow_.integrated_y / integration_time.toSec(); velo.twist.angular.y = flow_fcu.vector.y / integration_time.toSec();
velo_pub_.publish(velo); velo_pub_.publish(velo);
prev_ = curr_.clone();
prev_stamp_ = msg->header.stamp;
} }
} }

9
clover/src/waitfile Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# $ ./waitfile <file> <command> <args...>
# wait until <file> appears and then invoke <command> with <args>
echo "wait for file $1"
while [ ! -e "$1" ]; do sleep 1; done;
echo "file $1 appeared"
"${@:2}"

1
clover/www/clover.err Symbolic link
View File

@@ -0,0 +1 @@
/tmp/clover.err

View File

@@ -1,17 +1,25 @@
<style>
body { font-family: sans-serif; }
main { max-width: 600px; margin: 50px auto; }
</style>
<title>Clover Drone Kit Tools</title> <title>Clover Drone Kit Tools</title>
<h1>Clover Drone Kit Tools</h1> <main>
<h1>Clover Drone Kit Tools</h1>
<ul> <ul>
<li><a href="docs">View documentation</a> (snapshot of <a href="https://clover.coex.tech">clover.coex.tech</a>)</li> <li><a href="docs">View documentation</a> (snapshot of <a href="https://clover.coex.tech">clover.coex.tech</a>)</li>
<li><a href="" id="wvs">View image topics</a> (<code>web_video_server</code>)</li> <li><a href="" id="wvs">View image topics</a> (<code>web_video_server</code>)</li>
<li><a href="" id="butterfly">Open web terminal</a> (<code>Butterfly</code>)</li> <li><a href="" id="butterfly">Open web terminal</a> (<code>Butterfly</code>)</li>
<li><a href="viz.html">View 3D visualization</a> (<code>ros3djs</code>)</li> <li><a href="viz.html">View 3D visualization</a> (<code>ros3djs</code>)</li>
<li><a href="aruco_map.html">3D visualization for markers map</a> (<code>ros3djs</code>)</li> <li><a href="aruco_map.html">3D visualization for markers map</a> (<code>ros3djs</code>)</li>
<li><a href="../clover_blocks/">Blocks programming</a> (<code>Blockly</code>)</li> <li><a href="../clover_blocks/">Blocks programming</a> (<code>Blockly</code>)</li>
</ul> <li><a href="clover.err">Clover console</a> (<code>/tmp/clover.err</code>)</li>
</ul>
<div class="version"></div> <div class="version"></div>
</main>
<script type="text/javascript"> <script type="text/javascript">
document.querySelector("#wvs").href = location.protocol + '//' + location.hostname + ':8080'; document.querySelector("#wvs").href = location.protocol + '//' + location.hostname + ':8080';
@@ -21,7 +29,7 @@
fetch('clover_version').then(function(response) { fetch('clover_version').then(function(response) {
if (response.status !== 200) return; if (response.status !== 200) return;
response.text().then(function(text) { response.text().then(function(text) {
document.querySelector('.version').innerHTML = 'Version: ' + text; document.querySelector('.version').innerHTML = 'Version: <code>' + text + '</code>';
}); });
}); });
</script> </script>

View File

@@ -11,7 +11,8 @@
from __future__ import print_function from __future__ import print_function
import rospy import rospy
import os import os, sys
import traceback
import threading import threading
import re import re
import uuid import uuid
@@ -116,7 +117,12 @@ def run(req):
rospy.loginfo('Program forced to stop') rospy.loginfo('Program forced to stop')
except Exception as e: except Exception as e:
rospy.logerr(str(e)) rospy.logerr(str(e))
error_pub.publish(str(e)) traceback.print_exc()
etype, value, tb = sys.exc_info()
fmt = traceback.format_exception(etype, value, tb)
fmt.pop(1) # remove 'clover_blocks' file frame
exc_info = ''.join(fmt)
error_pub.publish(str(e) + '\n\n' + exc_info)
rospy.loginfo('Program terminated') rospy.loginfo('Program terminated')
running_lock.release() running_lock.release()