Skip to content

Commit

Permalink
update client code. for some reason foo is receiving faster. 💩
Browse files Browse the repository at this point in the history
  • Loading branch information
braraki committed Feb 12, 2018
1 parent 505d2aa commit 569d1a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
26 changes: 3 additions & 23 deletions launch/bar.launch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<launch>
<arg name="host" default="192.168.1.110"/>
<arg name="host" default="wallar.csail.mit.edu"/>
<arg name="port" default="8080"/>
<node pkg="canopy_client" type="client_node.py" name="bar_client_node" output="screen">
<param name="name" value="bar"/>
Expand All @@ -10,36 +10,16 @@
<param name="description" value="bar robot" />
<rosparam>
publishing:
- /state
- /filtered_state
- /test_string
- /test_string2
- /test_string3
types:
- geometry_msgs/Point
- geometry_msgs/PointStamped
- std_msgs/String
- std_msgs/String
- std_msgs/String
trusted:
- ".*"
- ".*"
- ".*"
- ".*"
- ".*"
- foo
</rosparam>
</node>

<node pkg="rostopic" type="rostopic" name="state_pub"
args="pub -r 20 /state geometry_msgs/Point '{x: 1, y: 1, z: 0}'"/>
<node pkg="rostopic" type="rostopic" name="filtered_state_pub"
args="pub -sr 20 /filtered_state geometry_msgs/PointStamped '{header: {stamp: now, frame_id: base_link}, point: {x: 2.0, y: 1.0, z: 1.0}}'" />
<node pkg="rostopic" type="rostopic" name="string_pub"
args="pub -r 20 /test_string std_msgs/String 'test'" />
<node pkg="rostopic" type="rostopic" name="string_pub2"
args="pub -r 20 /test_string2 std_msgs/String 'test2'" />
<node pkg="rostopic" type="rostopic" name="string_pub3"
args="pub -r 20 /test_string3 std_msgs/String 'test3'" />
args="pub -sr 40 /filtered_state geometry_msgs/PointStamped '{header: {stamp: now, frame_id: base_link}, point: {x: 2.0, y: 1.0, z: 1.0}}'" />
<!--<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="640" />
Expand Down
5 changes: 2 additions & 3 deletions src/client_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ def run(self):
self.receiver.start()
self.descriptionConn.start()
self.timer.start()
self.post_leaflet_urls()
#self.post_leaflet_urls()
while not rospy.is_shutdown():
#for key, conn in self.conn.iteritems():
# updates = conn.updates()
updates = self.receiver.updates()
for v in updates.values():
self.pub_man.publish(v)

for key, conn in self.conn.iteritems():
conn.stop()
self.receiver.stop()
Expand Down
5 changes: 4 additions & 1 deletion src/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import tornado.httpserver
import tornado.ioloop
from std_msgs.msg import Float32

# Represents a threaded websocket connection to the server.
class Connection(threading.Thread):

Expand Down Expand Up @@ -63,9 +62,13 @@ def send_message_cb(self, data):
if not self.connection is None:
if self.acknowledged:
self.acknowledged = False
start = time.time()
self.connection.write_message(compressed, True)
end = time.time()
print "Write time: {}".format(end - start)
self.timer = threading.Timer(1, self.timeout)
self.timer.start()


# Creates callback to send message in IOLoop.
def send_message(self, data):
Expand Down

0 comments on commit 569d1a5

Please sign in to comment.