<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.cognimbus.com/index.php?action=history&amp;feed=atom&amp;title=HamsterPythonExample1</id>
		<title>HamsterPythonExample1 - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.cognimbus.com/index.php?action=history&amp;feed=atom&amp;title=HamsterPythonExample1"/>
		<link rel="alternate" type="text/html" href="http://wiki.cognimbus.com/index.php?title=HamsterPythonExample1&amp;action=history"/>
		<updated>2026-06-14T21:48:46Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>http://wiki.cognimbus.com/index.php?title=HamsterPythonExample1&amp;diff=930&amp;oldid=prev</id>
		<title>Ariy: Scan</title>
		<link rel="alternate" type="text/html" href="http://wiki.cognimbus.com/index.php?title=HamsterPythonExample1&amp;diff=930&amp;oldid=prev"/>
				<updated>2019-06-20T09:12:19Z</updated>
		
		<summary type="html">&lt;p&gt;Scan&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:12, 20 June 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/env python&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/env python&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;import rospy&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;import rospy&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;from sensor_msgs.msg import &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Imu&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;from sensor_msgs.msg import &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;LaserScan&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def is_free(ranges ,start_index, end_index ,min_distance):&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def is_free(ranges ,start_index, end_index ,min_distance):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key cogniteam_wiki:diff:version:1.11a:oldid:880:newid:930 --&gt;
&lt;/table&gt;</summary>
		<author><name>Ariy</name></author>	</entry>

	<entry>
		<id>http://wiki.cognimbus.com/index.php?title=HamsterPythonExample1&amp;diff=880&amp;oldid=prev</id>
		<title>Ariy at 09:14, 24 March 2019</title>
		<link rel="alternate" type="text/html" href="http://wiki.cognimbus.com/index.php?title=HamsterPythonExample1&amp;diff=880&amp;oldid=prev"/>
				<updated>2019-03-24T09:14:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:14, 24 March 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l37&quot; &gt;Line 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 37:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==== Ex. 1 ====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==== Ex. 1 ====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Put the hamster in front of a planar obstacle and save a file with readings of distances to that plane&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Calculate the average noise of the range scanner (take into account the angle of the reading)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Add filtering to remove peaks in the laser scan readings at each angle taking into account possible noise&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key cogniteam_wiki:diff:version:1.11a:oldid:872:newid:880 --&gt;
&lt;/table&gt;</summary>
		<author><name>Ariy</name></author>	</entry>

	<entry>
		<id>http://wiki.cognimbus.com/index.php?title=HamsterPythonExample1&amp;diff=872&amp;oldid=prev</id>
		<title>Ariy: Created page with &quot;=== Python Example 1 === * Receive laser scan from robot to decide if free  &lt;syntaxhighlight lang=&quot;python&quot; line='line'&gt; #!/usr/bin/env python import rospy from sensor_msgs.msg...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.cognimbus.com/index.php?title=HamsterPythonExample1&amp;diff=872&amp;oldid=prev"/>
				<updated>2019-03-24T09:01:03Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Python Example 1 === * Receive laser scan from robot to decide if free  &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt; #!/usr/bin/env python import rospy from sensor_msgs.msg...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Python Example 1 ===&lt;br /&gt;
* Receive laser scan from robot to decide if free&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line='line'&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
import rospy&lt;br /&gt;
from sensor_msgs.msg import Imu&lt;br /&gt;
&lt;br /&gt;
def is_free(ranges ,start_index, end_index ,min_distance):&lt;br /&gt;
	#sub array from angle to angle&lt;br /&gt;
	s_ranges = ranges[start_index:end_index]&lt;br /&gt;
	#filter the array &lt;br /&gt;
	b_ranges = filter(lambda x: x &amp;lt;= min_distance, s_ranges)&lt;br /&gt;
	return len(b_ranges) == 0&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
def callback(msg):		    &lt;br /&gt;
	if is_free(msg.ranges,160,200,0.2): print &amp;quot;FREE&amp;quot;&lt;br /&gt;
	else: print &amp;quot;BLOCKED&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
rospy.init_node('scan_values')&lt;br /&gt;
&lt;br /&gt;
#Put your Hamster number instead of agent&amp;lt;number&amp;gt;&lt;br /&gt;
#The agent number is printed on the Hamster cover &lt;br /&gt;
sub = rospy.Subscriber('/agent14/scan', LaserScan, callback)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
rospy.spin()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To execute save this example in example1.py and type in the terminal &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line='line'&amp;gt;&lt;br /&gt;
 $ python example1.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Ex. 1 ====&lt;/div&gt;</summary>
		<author><name>Ariy</name></author>	</entry>

	</feed>