[USRP-users] Save GPS epoch into a file

Marcus Müller marcus.mueller at ettus.com
Wed Oct 14 05:08:58 EDT 2015


Hi Giovanni,

ah OK, this means you're already using GNU Radio; that was my question.

> GPS Epoch = <gnuradio.uhd.uhd_swig.sensor_value_t; proxy of <Swig
> Object of type 'uhd::sensor_value_t *' at 0x7ff62a97eae0> > 
ah, that's because the repr() (repr for "string representation") of the
python-wrapped return value of the get_mboard_sensor method is not the
string that is contained in the sensor value.

Try:

f.write( "GPS Epoch = " + gps_time.value + "\n" )

> I indeed read that there exists also get_time_now(), but I wasn't able
> to find the difference between get_mboard_sensor command and
> get_time_now. 
get_time_now() reads the current time in the USRP's timer register;
get_mboard_sensor uses the serial line to the GPSDO and parses the data
the GPS receiver gives. If you set the time source of the USRP to GPSDO,
then the device time is related to what the GPSDO says. If not, these
are two totally independent times.

Best regards,
Marcus


On 10/14/2015 10:47 AM, Giovanni Marino wrote:
> Hi Marcus and Moritz,
> Thank you for your emails. I have no idea what you mean. Before
> sending the email I have already tried to use the method proposed by
> Moritz:
>
> gps_time=self.uhd_usrp_source_0.get_mboard_sensor("gps_time",0)
> f = open( "GPStime.txt", "w" )
> f.write( "GPS Epoch = " + repr(gps_time) + "\n" )
> f.close()
>
> I suppose I missed something because I obtained:
> GPS Epoch = <gnuradio.uhd.uhd_swig.sensor_value_t; proxy of <Swig
> Object of type 'uhd::sensor_value_t *' at 0x7ff62a97eae0> >
>
> Despite I got the GPS epoch on my screen.
> Since I have to save the timestamp of the first samples of the output
> of the USRP, I was wondering also if there is an alternative methods
> for save the GPS time into the file, i.e. if there is another command
> which can directly give to the user the GPS time with microsecond
> accuracy.
> I indeed read that there exists also get_time_now(), but I wasn't able
> to find the difference between get_mboard_sensor command and
> get_time_now.
> Thank you again
> Giovanni
>
>
> On 10/12/15 19:23, Moritz Fischer wrote:
>> On Mon, Oct 12, 2015 at 9:48 AM, Giovanni MARINO via USRP-users
>> <usrp-users at lists.ettus.com> wrote:
>>> Hi,
>>> Is there any method for saving the output of
>>> get_mboard_sensor("gps_locked")
>>> into a txt file (by using python)?
>> https://docs.python.org/2/tutorial/inputoutput.html
>>
>>> Thank you in advance.
>>> Giovanni Marino
>>>
>>> _______________________________________________
>>> USRP-users mailing list
>>> USRP-users at lists.ettus.com
>>> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>>>
>> Moritz
>





More information about the USRP-users mailing list