Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109977

Re: GoPiGo distence sensor

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From MRAB <python@mrabarnett.plus.com>
Newsgroups comp.lang.python
Subject Re: GoPiGo distence sensor
Date Wed, 15 Jun 2016 16:00:10 +0100
Lines 21
Message-ID <mailman.74.1466002814.2288.python-list@python.org> (permalink)
References <24fc1dae-5411-44fa-89e2-d2859d27594f@googlegroups.com> <14e59bbf-34aa-f83e-ab2f-a623c1380310@mrabarnett.plus.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de y+af4Nenb1JkiU4CmjLEgwIriqmHA9cq9HtSmKrMQlJw==
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'value,': 0.03; 'api': 0.09; 'python.': 0.11; '...)': 0.16; 'clock.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'increment': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'ticks': 0.16; 'wrote:': 0.16; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'reaches': 0.27; 'this.': 0.28; 'regular': 0.29; 'reset': 0.29; 'checks': 0.30; 'seconds': 0.31; 'certain': 0.31; 'previous': 0.34; 'but': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'someone': 0.38; 'means': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'distance': 0.63; 'here:': 0.63; 'url:programming': 0.84; 'wheels': 0.84; 'distance.': 0.91; 'robot': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=K//fZHiI c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=SJe_thOIAAAA:8 a=KjbzdTz0pW5oGM1KimcA:9 a=QEXdDO2ut3YA:10 a=G4vmt1aGjLbDuOXu-pPO:22
X-AUTH mrabarnett@:2500
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
In-Reply-To <24fc1dae-5411-44fa-89e2-d2859d27594f@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <14e59bbf-34aa-f83e-ab2f-a623c1380310@mrabarnett.plus.com>
X-Mailman-Original-References <24fc1dae-5411-44fa-89e2-d2859d27594f@googlegroups.com>
Xref csiph.com comp.lang.python:109977

Show key headers only | View raw


On 2016-06-15 15:15, ldompeling@casema.nl wrote:
> I have a small robot on wheels named the GoPiGo.
> What I want is if the distence sensor read the same distence for let say 5 seconds then the GoPiGo go's backward.
>
> But I don't now how to program this in python.
> The Api functions for the GoPiGo are here: http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-raspberry-pi-gopigo/
>
> Can someone help me with this.
>
Check the distance at regular intervals, like the ticks of a clock.

At each tick, check the distance.

If the distance is the same as the previous measurement, increment a 
counter, else reset the counter.

If the counter reaches a certain value, it means that the robot has been 
at that distance for that many ticks. (If it checks every second and the 
counter reaches 5, then it has been at that distance for 5 seconds ... 
approximately ...)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

GoPiGo distence sensor ldompeling@casema.nl - 2016-06-15 07:15 -0700
  Re: GoPiGo distence sensor Joel Goldstick <joel.goldstick@gmail.com> - 2016-06-15 10:59 -0400
  Re: GoPiGo distence sensor MRAB <python@mrabarnett.plus.com> - 2016-06-15 16:00 +0100
  Re: GoPiGo distence sensor Joel Goldstick <joel.goldstick@gmail.com> - 2016-06-15 11:13 -0400
  Re: GoPiGo distence sensor William Ray Wing <wrw@mac.com> - 2016-06-15 11:47 -0400

csiph-web