diff --git a/.camera.py.swp b/.camera.py.swp index e69de29b..dd0082ed 100644 Binary files a/.camera.py.swp and b/.camera.py.swp differ diff --git a/camera.py b/camera.py index 9abca64c..713a63d5 100644 --- a/camera.py +++ b/camera.py @@ -218,8 +218,8 @@ def get_average(self): return avg def find_line(self): - img = self.get_image().binarize().invert() - img = img.erode().dilate() + img = self.get_image().binarize() + #img = img.erode().dilate() slices = [0,0,0] blobs = [0,0,0] slices[0] = img.crop(0, int(self._camera.out_rgb_resolution[1]/1.2), self._camera.out_rgb_resolution[0], self._camera.out_rgb_resolution[1]) @@ -227,7 +227,7 @@ def find_line(self): slices[2] = img.crop(0, int(self._camera.out_rgb_resolution[1]/2.0), self._camera.out_rgb_resolution[0], int(self._camera.out_rgb_resolution[1]/1.5)) coords = [-1, -1, -1] for idx, slice in enumerate(slices): - blobs[idx] = slice.find_blobs(minsize=4000/(self._cv_image_factor * self._cv_image_factor), maxsize=8000/(self._cv_image_factor * self._cv_image_factor)) + blobs[idx] = slice.find_blobs(minsize=300/(self._cv_image_factor * self._cv_image_factor), maxsize=8000/(self._cv_image_factor * self._cv_image_factor)) if len(blobs[idx]): coords[idx] = (blobs[idx][0].center[0] * 100) / self._camera.out_rgb_resolution[0] logging.info("line coord: " + str(idx) + " " + str(coords[idx])+ " area: " + str(blobs[idx][0].area())) diff --git a/event.py b/event.py index 8bcc6e33..d6ae8953 100644 --- a/event.py +++ b/event.py @@ -14,7 +14,7 @@ def get_instance(cls, node_name=None): def __init__(self, node_name): self._node_name = node_name - rospy.init_node(node_name, disable_signals=True) + rospy.init_node(node_name, anonymous=True, disable_signals=True) self._publishers = {} self._event_generators = [] self._event_listeners = [] @@ -22,12 +22,12 @@ def __init__(self, node_name): def publish(self, topic, message): publisher = self._publishers.get(topic) if publisher is None: - publisher = rospy.Publisher("/" + self._node_name + "/" + topic, std_msgs.msg.String, queue_size=10) + publisher = rospy.Publisher("/" + topic, std_msgs.msg.String, queue_size=10) self._publishers[topic] = publisher publisher.publish(json.dumps(message)) def register_event_listener(self, topic, callback): - self._event_listeners.append(rospy.Subscriber("/" + self._node_name + "/" + topic, std_msgs.msg.String, callback)) + self._event_listeners.append(rospy.Subscriber("/" + topic, std_msgs.msg.String, callback)) def register_event_generator(self, generator_func): generator = threading.Thread(target=generator_func) diff --git a/static/js/blockly/blocks.js b/static/js/blockly/blocks.js index 4f249ade..e7f9fa40 100644 --- a/static/js/blockly/blocks.js +++ b/static/js/blockly/blocks.js @@ -681,7 +681,7 @@ Blockly.Blocks['coderbot_adv_findARCode'] = { this.setColour(250); this.appendDummyInput() .appendField(Blockly.Msg.CODERBOT_SENSOR_FINDARCODE); - this.setOutput(true, 'String'); + this.setOutput(true, 'HashMap'); this.setInputsInline(true); this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP); }