Hi all, I'm having some trouble using the C++ UHD API for writing Python code. I understand that the code has been SWIG'd from C++ to Python.
Specifically, the C++ code I want to convert to Python is: --------------------------------------- uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); stream_cmd.num_samps = samps_to_recv; stream_cmd.stream_now = false; stream_cmd.time_spec = time_to_recv; usrp->issue_stream_cmd(stream_cmd); uhd::time_spec_t cmd_time = usrp->get_time_now() + uhd::time_spec_t(0.1); usrp->set_command_time(cmd_time); usrp->set_rx_freq(1.03e9, 0/*ch0*/); usrp->set_rx_freq(1.03e9, 1/*ch1*/); usrp->set_clear_time(); ---------------------------------------- With my attempt at Python: --------------------------------------- self.stream_cmd = uhd.stream_cmd_t(uhd.stream_cmd_t.stream_mode_t.STREAM_MODE_NUM_SAMPS_AND_DONE) self.stream_cmd.num_samps = samps_to_recv; self.stream_cmd.stream_now = false; self.stream_cmd.time_spec = time_to_recv; self.uhd_usrp_source_0.issue_stream_cmd(self.stream_cmd) cmd_time = self.uhd_usrp_source_0.get_time_now() + uhd.time_spec_t(0.1) self.uhd_usrp_source_0.set_command_time(cmd_time) self.uhd_usrp_source_0.set_rx_freq(1.03e9, 0) self.uhd_usrp_source_0.set_rx_freq(1.03e9, 1) self.uhd_usrp_source_0.set_clear_time() ----------------------------------------- Running this, I get the error: AttributeError: 'module' object has no attribute 'stream_cmd_t' What is this struct called after it has been swigged into Python, and how do I access it? As a follow up, does anyone have any general guidelines to follow when writing code from the C++ UHD API into Python? I've checked the gr-uhd source tree examples, but they didn't provide the insight needed to access the full C++ API. -Alex
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio