Add ROS service for executing shell commands (#210)

* Add ROS service for executing shell commands

* Show image version on index web page

* Add test for exec service

* Add shell node to clover.launch

* Remake exec handling, consider exit code and exec failures
This commit is contained in:
Oleg Kalachev
2020-03-17 20:11:59 +03:00
committed by GitHub
parent 6879723771
commit 1746381da1
7 changed files with 97 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
import rospy
import pytest
from mavros_msgs.msg import State
from clover import srv
@pytest.fixture()
def node():
@@ -27,3 +28,19 @@ def test_simple_offboard_services_available():
def test_web_video_server(node):
import urllib2
urllib2.urlopen("http://localhost:8080").read()
def test_shell(node):
execute = rospy.ServiceProxy('exec', srv.Execute)
execute.wait_for_service(5)
res = execute(cmd='echo foo')
assert res.code == 0
assert res.output == 'foo\n'
res = execute(cmd='foo')
assert res.code == 32512
assert res.output == ''
res = execute(cmd='ls foo')
assert res.code == 512
assert res.output == ''