So i found the problem (which came from me).

The segfault happened because the meyer-heavy.txt had just 10 line (in the
tutorial I didn't read "these are the first 10 lines of meyer-heavy.txt" :(
and I ran event from 0 to 100 steps).
So I just copied ten time these 10 lines and it works.
(I thought 't.getNode(i).createNoiseModel()' create automatically a suite
from the first ten lines...)

Rémi

2009/4/16 Rémi Villé <ville.r...@gmail.com>

> I tried to remove the part concerning meyer-heavy noise (from 'noise =
> open("meyer-heavy.txt", "r")' to 't.getNode(i).createNoiseModel()'), then i
> have no segfault but the output is not good (nothing happen after packet
> sent) :
>
> --------------
> $ python test.py
>
>   1   2   -54.0
>   2   1   -55.0
>   1   3   -60.0
>   3   1   -60.0
>   2   3   -64.0
>   3   2   -64.0
> DEBUG (1): RadioCountToLedsC: timer fired, counter is 1.
> DEBUG (1): RadioCountToLedsC: packet sent.
> DEBUG (2): RadioCountToLedsC: timer fired, counter is 1.
> DEBUG (2): RadioCountToLedsC: packet sent.
> DEBUG (3): RadioCountToLedsC: timer fired, counter is 1.
> DEBUG (3): RadioCountToLedsC: packet sent.
> --------------
>
> Rémi
>
> 2009/4/16 Rémi Villé <ville.r...@gmail.com>
>
> Thanks for your help Poonam.
>>
>> The test.py I use is copied from the tutorial :
>> http://docs.tinyos.net/index.php/TOSSIM#Configuring_a_Network
>>
>> ----------------------
>> $ cat test.py
>>
>> #! /usr/bin/python
>> from TOSSIM import *
>> import sys
>>
>> t = Tossim([])
>> r = t.radio()
>> f = open("topo.txt", "r")
>>
>> lines = f.readlines()
>> for line in lines:
>>   s = line.split()
>>   if (len(s) > 0):
>>     print " ", s[0], " ", s[1], " ", s[2];
>>     r.add(int(s[0]), int(s[1]), float(s[2]))
>>
>> t.addChannel("RadioCountToLedsC", sys.stdout)
>> t.addChannel("Boot", sys.stdout)
>>
>> noise = open("meyer-heavy.txt", "r")
>> lines = noise.readlines()
>> for line in lines:
>>   str = line.strip()
>>   if (str != ""):
>>     val = int(str)
>>     for i in range(1, 4):
>>       t.getNode(i).addNoiseTraceReading(val)
>>
>> for i in range(1, 4):
>>   print "Creating noise model for ",i;
>>   t.getNode(i).createNoiseModel()
>>
>> t.getNode(1).bootAtTime(100001);
>> t.getNode(2).bootAtTime(800008);
>> t.getNode(3).bootAtTime(1800009);
>>
>> for i in range(0, 100):
>>   t.runNextEvent()
>> ----------------------
>>
>> Rémi
>>
>> 2009/4/16 Poonam Hiwal <poonam.hi...@googlemail.com>
>>
>> Hi,
>>> Once i had similar problem, as i remember, that may be due to time
>>> periods specified in test.py.
>>>
>>>
>>> Can you send the test.py which you are using.
>>>
>>> --Poonam
>>>
>>>
>>>
>>> On Wed, Apr 15, 2009 at 3:40 PM, Rémi Villé <ville.r...@gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> I am learning TOSSIM thanks to the TOSSIM tutorial and I have a segfault
>>>> when running test.py (or python_test.py) in the apps/RadioCountToLeds
>>>> directory.
>>>>
>>>> I work on Xubuntu Hardy Heron ($ uname -r => 2.6.24-23-generic)
>>>> I use TinyOS 2.1
>>>> $ gcc -v => version gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
>>>> $ python -V => Python 2.5.2
>>>>
>>>> To successfully  built the micaz TOSSIM library I had to add :
>>>> $ export CFLAGS="-I/usr/lib/gcc/i486-linux-gnu/4.2/include
>>>> -I/usr/include"
>>>> before
>>>> $make micaz sim
>>>>
>>>> But I have warnings with the g++ command, e.g.  (maybe its a clue):
>>>> /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx: In function «PyObject*
>>>> _wrap_nesc_app_t_numVariables_set(PyObject*, PyObject*)»:
>>>> /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:1999: attention :
>>>> deprecated conversion from string constant to «char*»
>>>> /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:2000: attention :
>>>> deprecated conversion from string constant to «char*»
>>>>
>>>> So this is the trace with : $ gdb /usr/bin/python and (gdb) run test.py
>>>> (the last lines refer to sim_noise.c)
>>>> --------------------
>>>> Starting program: /usr/bin/python test.py
>>>> (no debugging symbols found)
>>>> (no debugging symbols found)
>>>> (no debugging symbols found)
>>>> [Thread debugging using libthread_db enabled]
>>>> (no debugging symbols found)
>>>> (no debugging symbols found)
>>>> (no debugging symbols found)
>>>> (no debugging symbols found)
>>>> [New Thread 0xb7d8d8c0 (LWP 14155)]
>>>>   1   2   -54.0
>>>>   2   1   -55.0
>>>>   1   3   -60.0
>>>>   3   1   -60.0
>>>>   2   3   -64.0
>>>>   3   2   -64.0
>>>> Creating noise model for  1
>>>> Creating noise model for  2
>>>> Creating noise model for  3
>>>> DEBUG (1): Application booted.
>>>> DEBUG (2): Application booted.
>>>> DEBUG (3): Application booted.
>>>> DEBUG (1): RadioCountToLedsC: timer fired, counter is 1.
>>>> DEBUG (1): RadioCountToLedsC: packet sent.
>>>> DEBUG (2): RadioCountToLedsC: timer fired, counter is 1.
>>>> DEBUG (2): RadioCountToLedsC: packet sent.
>>>> DEBUG (3): RadioCountToLedsC: timer fired, counter is 1.
>>>> DEBUG (3): RadioCountToLedsC: packet sent.
>>>>
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> [Switching to Thread 0xb7d8d8c0 (LWP 14155)]
>>>> 0xb7c33d76 in sim_noise_gen (node_id=1) at
>>>> /opt/tinyos-2.1.0/tos/lib/tossim/sim_noise.c:311
>>>> 311      dbg("HASH", "noise_hash->numElements=%d\n",
>>>> noise_hash->numElements);
>>>> --------------------
>>>>
>>>> (And $ cat meyer-heavy.txt
>>>> -39
>>>> -98
>>>> -98
>>>> -98
>>>> -99
>>>> -98
>>>> -94
>>>> -98
>>>> -98
>>>> -98)
>>>>
>>>> Thanks for your help,
>>>>
>>>> Rémi Villé
>>>>
>>>> _______________________________________________
>>>> Tinyos-help mailing list
>>>> Tinyos-help@millennium.berkeley.edu
>>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>>
>>>
>>>
>>
>
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to