Skip to content

Commit

Permalink
Image sending tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelchang committed Feb 13, 2016
1 parent 40d6dd6 commit 4b048ae
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
24 changes: 20 additions & 4 deletions launch/example.launch
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@
<node pkg="jammi" type="client_node.py" name="foo_client_node" output="screen">
<param name="name" value="foo"/>
<param name="host" value="wallar.me"/>
<param name="port" value="50000"/>
<param name="port" value="9000"/>
</node>

<node pkg="jammi" type="client_node.py" name="bar_client_node" output="screen">
<param name="name" value="bar"/>
<param name="host" value="wallar.me"/>
<param name="port" value="50000"/>
<param name="port" value="9000"/>
</node>

<node pkg="jammi" type="client_node.py" name="baz_client_node" output="screen">
<param name="name" value="baz"/>
<param name="host" value="wallar.me"/>
<param name="port" value="50000"/>
<param name="port" value="9000"/>
</node>

<node pkg="jammi" type="client_node.py" name="qux_client_node" output="screen">
<param name="name" value="qux"/>
<param name="host" value="wallar.me"/>
<param name="port" value="50000"/>
<param name="port" value="9000"/>
<rosparam>
publishing:
- /state
- /filtered_state
- /usb_cam/image_raw/compressed
types:
- geometry_msgs/Point
- geometry_msgs/Point
- sensor_msgs/CompressedImage
trusted:
- "*"
- foo bar
- foo
</rosparam>

</node>
Expand All @@ -40,4 +43,17 @@
args="pub -r 100 /state geometry_msgs/Point '{x: 1, y: 1, z: 0}'"/>
<node pkg="rostopic" type="rostopic" name="filtered_state_pub"
args="pub -r 100 /filtered_state geometry_msgs/Point '{x: 2, y: 1, z: 1}'" />
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="320" />
<param name="image_height" value="240" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="usb_cam" />
<param name="io_method" value="mmap"/>
</node>
<node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
<remap from="image" to="/usb_cam/image_raw"/>
<param name="autosize" value="true" />
</node>

</launch>
2 changes: 1 addition & 1 deletion launch/server.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<launch>
<node pkg="jammi" type="server_node.py" name="jammi_server" output="screen">
<param name="host" value="wallar.me"/>
<param name="port" value="8080"/>
<param name="port" value="9000"/>
</node>

</launch>
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
twisted
autobahn
tornado
5 changes: 5 additions & 0 deletions src/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import copy
import struct
import rospy
import time
import tornado.web
import tornado.websocket
import tornado.httpserver
import tornado.ioloop
from std_msgs.msg import Float32

class Connection(threading.Thread):
def __init__(self, host, port, name):
Expand All @@ -22,6 +24,7 @@ def __init__(self, host, port, name):
self.values = dict()
self.acknowledged = True
self.timer = threading.Timer
self.freqPub = rospy.Publisher("/{}/ping".format(name), Float32, queue_size=0)

def run(self):
tornado.websocket.websocket_connect(
Expand All @@ -45,6 +48,8 @@ def send_message_cb(self, data):
# rospy.loginfo(self.acknowledged)
if self.acknowledged:
self.acknowledged = False
if binLen > 1000:
self.freqPub.publish(0.0)
self.connection.write_message(compressed, True)
self.timer = threading.Timer(1, self.timeout)
self.timer.start()
Expand Down

0 comments on commit 4b048ae

Please sign in to comment.