Subject:
|
Re: Ultrasonic sensor interactions
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Mon, 22 May 2006 21:31:17 GMT
|
Viewed:
|
2927 times
|
| |
| |
In lugnet.robotics, Philippe Hurbain wrote:
> Hello Brian,
>
> > Specificly, I can not find a way to turn off the US sensor from the
> > LEGO-provided SW environment. There may very well be some functionality at a
> > lower level I don't have access to (at the moment), or LEGO themselves may do
> > something about this (after all, for FLL it will be an issue).
>
> That's easy to do in NBC
; us_off.nbc
; -------------- variable declarations --------------
dseg segment
;------- definitions -------
TCommLSWrite struct
Result sbyte
Port byte
Buffer byte[]
ReturnLen byte
TCommLSWrite ends
;------- declarations -------
thePort byte 0 // port 1
bufLSOff byte[] 0x2, 0x41, 0x0 // this sequence turns off the US sensor
lswArgs TCommLSWrite
dseg ends
; -------------- program code --------------
thread main
// configure the sensor type
setin IN_TYPE_LOWSPEED_9V, thePort, Type
setin IN_MODE_RAW, thePort, InputMode
// turn off the UltraSonic sensor
mov lswArgs.Port, thePort
mov lswArgs.Buffer, bufLSOff
set lswArgs.ReturnLen, 0
syscall CommLSWrite, lswArgs
exit
endt
Every time you turn on the NXT the Ultrasonic sensor is turned back on.
Executing this little 168 byte program turns it off.
You can also use one-shot mode (0x2, 0x41, 0x1) which will store 8 different
distances into measurement bytes 0-7. In this mode the measurements are taken
when the command is received and then the pinging is turned back off again.
There is also the event capture mode (0x2, 0x41, 0x3) where the US sensor
measures whether other US sensors are in the area and using that measurement it
tries to calculate when to make its own measurement so it can avoid conflict
with the other US sensors. I have no idea whether that works or not.
This functionality is not currently available in NXT-G.
John Hansen
|
|
Message has 1 Reply: | | Re: Ultrasonic sensor interactions
|
| (...) Excellent! Thanks for the update, and it's great to know this is availible within the HW. I wish NXT-G had access, but... well, either it eventually will, or LEGO has specificly included goodies in the FW just for 3rd party environments. (...) (19 years ago, 22-May-06, to lugnet.robotics)
|
Message is in Reply To:
| | Re: Ultrasonic sensor interactions
|
| Hello Brian, (...) That's easy to do in NBC, and not hard with NXT-G: to shut off the US sensor, just "use" another sensor type on the same port. Here is a sample program that switches the US sensor on/off with NXT enter button. (URL) If the sensor (...) (19 years ago, 21-May-06, to lugnet.robotics)
|
27 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|