Commit 53d84cc32c960f3b312d8ad7b3b05c09cc82f839

Authored by bmarechal
1 parent 8b90e736c4
Exists in master

-

Showing 6 changed files with 917 additions and 6 deletions Inline Diff

redpitaya/client/dds_gnuradio.grc
<?xml version='1.0' encoding='utf-8'?> 1 1 <?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.10'?> 2 2 <?grc format='1' created='3.7.10'?>
<flow_graph> 3 3 <flow_graph>
<timestamp>Thu Feb 2 22:54:58 2017</timestamp> 4 4 <timestamp>Thu Feb 2 22:54:58 2017</timestamp>
<block> 5 5 <block>
<key>options</key> 6 6 <key>options</key>
<param> 7 7 <param>
<key>author</key> 8 8 <key>author</key>
<value></value> 9 9 <value></value>
</param> 10 10 </param>
<param> 11 11 <param>
<key>window_size</key> 12 12 <key>window_size</key>
<value></value> 13 13 <value></value>
</param> 14 14 </param>
<param> 15 15 <param>
<key>category</key> 16 16 <key>category</key>
<value>[GRC Hier Blocks]</value> 17 17 <value>[GRC Hier Blocks]</value>
</param> 18 18 </param>
<param> 19 19 <param>
<key>comment</key> 20 20 <key>comment</key>
<value></value> 21 21 <value></value>
</param> 22 22 </param>
<param> 23 23 <param>
<key>description</key> 24 24 <key>description</key>
<value></value> 25 25 <value></value>
</param> 26 26 </param>
<param> 27 27 <param>
<key>_enabled</key> 28 28 <key>_enabled</key>
<value>True</value> 29 29 <value>True</value>
</param> 30 30 </param>
<param> 31 31 <param>
<key>_coordinate</key> 32 32 <key>_coordinate</key>
<value>(8, 8)</value> 33 33 <value>(8, 8)</value>
</param> 34 34 </param>
<param> 35 35 <param>
<key>_rotation</key> 36 36 <key>_rotation</key>
<value>0</value> 37 37 <value>0</value>
</param> 38 38 </param>
<param> 39 39 <param>
<key>generate_options</key> 40 40 <key>generate_options</key>
<value>qt_gui</value> 41 41 <value>qt_gui</value>
</param> 42 42 </param>
<param> 43 43 <param>
<key>hier_block_src_path</key> 44 44 <key>hier_block_src_path</key>
<value>.:</value> 45 45 <value>.:</value>
</param> 46 46 </param>
<param> 47 47 <param>
<key>id</key> 48 48 <key>id</key>
<value>dds_gnuradio</value> 49 49 <value>dds_gnuradio</value>
</param> 50 50 </param>
<param> 51 51 <param>
<key>max_nouts</key> 52 52 <key>max_nouts</key>
<value>0</value> 53 53 <value>0</value>
</param> 54 54 </param>
<param> 55 55 <param>
<key>qt_qss_theme</key> 56 56 <key>qt_qss_theme</key>
<value></value> 57 57 <value></value>
</param> 58 58 </param>
<param> 59 59 <param>
<key>realtime_scheduling</key> 60 60 <key>realtime_scheduling</key>
<value></value> 61 61 <value></value>
</param> 62 62 </param>
<param> 63 63 <param>
<key>run_command</key> 64 64 <key>run_command</key>
<value>{python} -u {filename}</value> 65 65 <value>{python} -u {filename}</value>
</param> 66 66 </param>
<param> 67 67 <param>
<key>run_options</key> 68 68 <key>run_options</key>
<value>prompt</value> 69 69 <value>prompt</value>
</param> 70 70 </param>
<param> 71 71 <param>
<key>run</key> 72 72 <key>run</key>
<value>True</value> 73 73 <value>True</value>
</param> 74 74 </param>
<param> 75 75 <param>
<key>thread_safe_setters</key> 76 76 <key>thread_safe_setters</key>
<value></value> 77 77 <value></value>
</param> 78 78 </param>
<param> 79 79 <param>
<key>title</key> 80 80 <key>title</key>
<value></value> 81 81 <value></value>
</param> 82 82 </param>
</block> 83 83 </block>
<block> 84 84 <block>
<key>variable_qtgui_range</key> 85 85 <key>variable_qtgui_range</key>
<param> 86 86 <param>
<key>comment</key> 87 87 <key>comment</key>
<value></value> 88 88 <value></value>
</param> 89 89 </param>
<param> 90 90 <param>
<key>value</key> 91 91 <key>value</key>
<value>0</value> 92 92 <value>0</value>
</param> 93 93 </param>
<param> 94 94 <param>
<key>_enabled</key> 95 95 <key>_enabled</key>
<value>True</value> 96 96 <value>True</value>
</param> 97 97 </param>
<param> 98 98 <param>
<key>_coordinate</key> 99 99 <key>_coordinate</key>
<value>(600, 12)</value> 100 100 <value>(600, 12)</value>
</param> 101 101 </param>
<param> 102 102 <param>
<key>gui_hint</key> 103 103 <key>gui_hint</key>
<value>1, 0</value> 104 104 <value>1, 0</value>
</param> 105 105 </param>
<param> 106 106 <param>
<key>_rotation</key> 107 107 <key>_rotation</key>
<value>0</value> 108 108 <value>0</value>
</param> 109 109 </param>
<param> 110 110 <param>
<key>id</key> 111 111 <key>id</key>
<value>a_dds</value> 112 112 <value>a_dds</value>
</param> 113 113 </param>
<param> 114 114 <param>
<key>label</key> 115 115 <key>label</key>
<value>DDS amplitude</value> 116 116 <value>DDS amplitude</value>
</param> 117 117 </param>
<param> 118 118 <param>
<key>min_len</key> 119 119 <key>min_len</key>
<value>200</value> 120 120 <value>200</value>
</param> 121 121 </param>
<param> 122 122 <param>
<key>orient</key> 123 123 <key>orient</key>
<value>Qt.Horizontal</value> 124 124 <value>Qt.Horizontal</value>
</param> 125 125 </param>
<param> 126 126 <param>
<key>start</key> 127 127 <key>start</key>
<value>0</value> 128 128 <value>0</value>
</param> 129 129 </param>
<param> 130 130 <param>
<key>step</key> 131 131 <key>step</key>
<value>1</value> 132 132 <value>1</value>
</param> 133 133 </param>
<param> 134 134 <param>
<key>stop</key> 135 135 <key>stop</key>
<value>2**13-1</value> 136 136 <value>2**13-1</value>
</param> 137 137 </param>
<param> 138 138 <param>
<key>rangeType</key> 139 139 <key>rangeType</key>
<value>int</value> 140 140 <value>int</value>
</param> 141 141 </param>
<param> 142 142 <param>
<key>widget</key> 143 143 <key>widget</key>
<value>counter_slider</value> 144 144 <value>counter_slider</value>
</param> 145 145 </param>
</block> 146 146 </block>
<block> 147 147 <block>
<key>variable</key> 148 148 <key>variable</key>
<param> 149 149 <param>
<key>comment</key> 150 150 <key>comment</key>
<value></value> 151 151 <value></value>
</param> 152 152 </param>
<param> 153 153 <param>
<key>_enabled</key> 154 154 <key>_enabled</key>
<value>True</value> 155 155 <value>True</value>
</param> 156 156 </param>
<param> 157 157 <param>
<key>_coordinate</key> 158 158 <key>_coordinate</key>
<value>(8, 104)</value> 159 159 <value>(8, 104)</value>
</param> 160 160 </param>
<param> 161 161 <param>
<key>_rotation</key> 162 162 <key>_rotation</key>
<value>0</value> 163 163 <value>0</value>
</param> 164 164 </param>
<param> 165 165 <param>
<key>id</key> 166 166 <key>id</key>
<value>addr</value> 167 167 <value>addr</value>
</param> 168 168 </param>
<param> 169 169 <param>
<key>value</key> 170 170 <key>value</key>
<value>"192.168.0.203"</value> 171 171 <value>"192.168.0.201"</value>
</param> 172 172 </param>
</block> 173 173 </block>
<block> 174 174 <block>
<key>variable_qtgui_range</key> 175 175 <key>variable_qtgui_range</key>
<param> 176 176 <param>
<key>comment</key> 177 177 <key>comment</key>
<value></value> 178 178 <value></value>
</param> 179 179 </param>
<param> 180 180 <param>
<key>value</key> 181 181 <key>value</key>
<value>0</value> 182 182 <value>0</value>
</param> 183 183 </param>
<param> 184 184 <param>
<key>_enabled</key> 185 185 <key>_enabled</key>
<value>True</value> 186 186 <value>True</value>
</param> 187 187 </param>
<param> 188 188 <param>
<key>_coordinate</key> 189 189 <key>_coordinate</key>
<value>(384, 12)</value> 190 190 <value>(384, 12)</value>
</param> 191 191 </param>
<param> 192 192 <param>
<key>gui_hint</key> 193 193 <key>gui_hint</key>
<value>0, 0</value> 194 194 <value>0, 0</value>
</param> 195 195 </param>
<param> 196 196 <param>
<key>_rotation</key> 197 197 <key>_rotation</key>
<value>0</value> 198 198 <value>0</value>
</param> 199 199 </param>
<param> 200 200 <param>
<key>id</key> 201 201 <key>id</key>
<value>f_dds</value> 202 202 <value>f_dds</value>
</param> 203 203 </param>
<param> 204 204 <param>
<key>label</key> 205 205 <key>label</key>
<value>DDS frequency</value> 206 206 <value>DDS frequency</value>
</param> 207 207 </param>
<param> 208 208 <param>
<key>min_len</key> 209 209 <key>min_len</key>
<value>200</value> 210 210 <value>200</value>
</param> 211 211 </param>
<param> 212 212 <param>
<key>orient</key> 213 213 <key>orient</key>
<value>Qt.Horizontal</value> 214 214 <value>Qt.Horizontal</value>
</param> 215 215 </param>
<param> 216 216 <param>
<key>start</key> 217 217 <key>start</key>
<value>0</value> 218 218 <value>0</value>
</param> 219 219 </param>
<param> 220 220 <param>
<key>step</key> 221 221 <key>step</key>
<value>1000</value> 222 222 <value>1000</value>
</param> 223 223 </param>
<param> 224 224 <param>
<key>stop</key> 225 225 <key>stop</key>
<value>60000000</value> 226 226 <value>60000000</value>
</param> 227 227 </param>
<param> 228 228 <param>
<key>rangeType</key> 229 229 <key>rangeType</key>
<value>float</value> 230 230 <value>float</value>
</param> 231 231 </param>
<param> 232 232 <param>
<key>widget</key> 233 233 <key>widget</key>
<value>counter_slider</value> 234 234 <value>counter_slider</value>
</param> 235 235 </param>
</block> 236 236 </block>
<block> 237 237 <block>
<key>variable_qtgui_range</key> 238 238 <key>variable_qtgui_range</key>
<param> 239 239 <param>
<key>comment</key> 240 240 <key>comment</key>
<value></value> 241 241 <value></value>
</param> 242 242 </param>
<param> 243 243 <param>
<key>value</key> 244 244 <key>value</key>
<value>0</value> 245 245 <value>0</value>
</param> 246 246 </param>
<param> 247 247 <param>
<key>_enabled</key> 248 248 <key>_enabled</key>
<value>True</value> 249 249 <value>True</value>
</param> 250 250 </param>
<param> 251 251 <param>
<key>_coordinate</key> 252 252 <key>_coordinate</key>
<value>(224, 12)</value> 253 253 <value>(224, 12)</value>
</param> 254 254 </param>
<param> 255 255 <param>
<key>gui_hint</key> 256 256 <key>gui_hint</key>
<value>2, 0</value> 257 257 <value>2, 0</value>
</param> 258 258 </param>
<param> 259 259 <param>
<key>_rotation</key> 260 260 <key>_rotation</key>
<value>0</value> 261 261 <value>0</value>
</param> 262 262 </param>
<param> 263 263 <param>
<key>id</key> 264 264 <key>id</key>
<value>offset_out1</value> 265 265 <value>offset_out1</value>
</param> 266 266 </param>
<param> 267 267 <param>
<key>label</key> 268 268 <key>label</key>
<value>Offset DDS</value> 269 269 <value>Offset DDS</value>
</param> 270 270 </param>
<param> 271 271 <param>
<key>min_len</key> 272 272 <key>min_len</key>
<value>200</value> 273 273 <value>200</value>
</param> 274 274 </param>
<param> 275 275 <param>
<key>orient</key> 276 276 <key>orient</key>
<value>Qt.Horizontal</value> 277 277 <value>Qt.Horizontal</value>
</param> 278 278 </param>
<param> 279 279 <param>
<key>start</key> 280 280 <key>start</key>
<value>-2**13</value> 281 281 <value>-2**13</value>
</param> 282 282 </param>
<param> 283 283 <param>
<key>step</key> 284 284 <key>step</key>
<value>1</value> 285 285 <value>1</value>
</param> 286 286 </param>
<param> 287 287 <param>
<key>stop</key> 288 288 <key>stop</key>
<value>2**13-1</value> 289 289 <value>2**13-1</value>
</param> 290 290 </param>
<param> 291 291 <param>
<key>rangeType</key> 292 292 <key>rangeType</key>
<value>int</value> 293 293 <value>int</value>
</param> 294 294 </param>
<param> 295 295 <param>
<key>widget</key> 296 296 <key>widget</key>
<value>counter_slider</value> 297 297 <value>counter_slider</value>
</param> 298 298 </param>
</block> 299 299 </block>
<block> 300 300 <block>
<key>variable</key> 301 301 <key>variable</key>
<param> 302 302 <param>
<key>comment</key> 303 303 <key>comment</key>
<value></value> 304 304 <value></value>
</param> 305 305 </param>
<param> 306 306 <param>
<key>_enabled</key> 307 307 <key>_enabled</key>
<value>True</value> 308 308 <value>True</value>
</param> 309 309 </param>
<param> 310 310 <param>
<key>_coordinate</key> 311 311 <key>_coordinate</key>
<value>(8, 176)</value> 312 312 <value>(8, 176)</value>
</param> 313 313 </param>
<param> 314 314 <param>
<key>_rotation</key> 315 315 <key>_rotation</key>
<value>0</value> 316 316 <value>0</value>
</param> 317 317 </param>
<param> 318 318 <param>
<key>id</key> 319 319 <key>id</key>
<value>port</value> 320 320 <value>port</value>
</param> 321 321 </param>
<param> 322 322 <param>
<key>value</key> 323 323 <key>value</key>
<value>1001</value> 324 324 <value>1001</value>
</param> 325 325 </param>
</block> 326 326 </block>
<block> 327 327 <block>
<key>add_const_set_offset</key> 328 328 <key>add_const_set_offset</key>
<param> 329 329 <param>
<key>addr</key> 330 330 <key>addr</key>
<value>addr</value> 331 331 <value>addr</value>
</param> 332 332 </param>
<param> 333 333 <param>
<key>alias</key> 334 334 <key>alias</key>
<value></value> 335 335 <value></value>
</param> 336 336 </param>
<param> 337 337 <param>
<key>comment</key> 338 338 <key>comment</key>
<value></value> 339 339 <value></value>
</param> 340 340 </param>
<param> 341 341 <param>
<key>const</key> 342 342 <key>const</key>
<value>offset_out1</value> 343 343 <value>offset_out1</value>
</param> 344 344 </param>
<param> 345 345 <param>
<key>device</key> 346 346 <key>device</key>
<value>/dev/dds_offset</value> 347 347 <value>/dev/dds_offset</value>
</param> 348 348 </param>
<param> 349 349 <param>
<key>_enabled</key> 350 350 <key>_enabled</key>
<value>True</value> 351 351 <value>True</value>
</param> 352 352 </param>
<param> 353 353 <param>
<key>_coordinate</key> 354 354 <key>_coordinate</key>
<value>(200, 164)</value> 355 355 <value>(200, 164)</value>
</param> 356 356 </param>
<param> 357 357 <param>
<key>_rotation</key> 358 358 <key>_rotation</key>
<value>0</value> 359 359 <value>0</value>
</param> 360 360 </param>
<param> 361 361 <param>
<key>id</key> 362 362 <key>id</key>
<value>add_const_set_offset_0</value> 363 363 <value>add_const_set_offset_0</value>
</param> 364 364 </param>
<param> 365 365 <param>
<key>port</key> 366 366 <key>port</key>
<value>port</value> 367 367 <value>port</value>
</param> 368 368 </param>
</block> 369 369 </block>
<block> 370 370 <block>
<key>add_const_set_offset</key> 371 371 <key>add_const_set_offset</key>
<param> 372 372 <param>
<key>addr</key> 373 373 <key>addr</key>
<value>addr</value> 374 374 <value>addr</value>
</param> 375 375 </param>
<param> 376 376 <param>
<key>alias</key> 377 377 <key>alias</key>
<value></value> 378 378 <value></value>
</param> 379 379 </param>
<param> 380 380 <param>
<key>comment</key> 381 381 <key>comment</key>
<value></value> 382 382 <value></value>
</param> 383 383 </param>
<param> 384 384 <param>
<key>const</key> 385 385 <key>const</key>
<value>a_dds</value> 386 386 <value>a_dds</value>
</param> 387 387 </param>
<param> 388 388 <param>
<key>device</key> 389 389 <key>device</key>
<value>/dev/dds_ampl</value> 390 390 <value>/dev/dds_ampl</value>
</param> 391 391 </param>
<param> 392 392 <param>
<key>_enabled</key> 393 393 <key>_enabled</key>
<value>True</value> 394 394 <value>True</value>
</param> 395 395 </param>
<param> 396 396 <param>
<key>_coordinate</key> 397 397 <key>_coordinate</key>
<value>(600, 164)</value> 398 398 <value>(600, 164)</value>
</param> 399 399 </param>
<param> 400 400 <param>
<key>_rotation</key> 401 401 <key>_rotation</key>
<value>0</value> 402 402 <value>0</value>
</param> 403 403 </param>
<param> 404 404 <param>
<key>id</key> 405 405 <key>id</key>
<value>add_const_set_offset_0_0</value> 406 406 <value>add_const_set_offset_0_0</value>
</param> 407 407 </param>
<param> 408 408 <param>
<key>port</key> 409 409 <key>port</key>
<value>port</value> 410 410 <value>port</value>
</param> 411 411 </param>
</block> 412 412 </block>
<block> 413 413 <block>
<key>nco_counter_send_conf</key> 414 414 <key>nco_counter_send_conf</key>
<param> 415 415 <param>
<key>acc_size</key> 416 416 <key>acc_size</key>
<value>32</value> 417 417 <value>32</value>
</param> 418 418 </param>
<param> 419 419 <param>
<key>addr</key> 420 420 <key>addr</key>
<value>addr</value> 421 421 <value>addr</value>
</param> 422 422 </param>
<param> 423 423 <param>
<key>alias</key> 424 424 <key>alias</key>
<value></value> 425 425 <value></value>
</param> 426 426 </param>
<param> 427 427 <param>
<key>comment</key> 428 428 <key>comment</key>
<value></value> 429 429 <value></value>
</param> 430 430 </param>
<param> 431 431 <param>
<key>device</key> 432 432 <key>device</key>
<value>/dev/dds_freq</value> 433 433 <value>/dev/dds_freq</value>
</param> 434 434 </param>
<param> 435 435 <param>
<key>_enabled</key> 436 436 <key>_enabled</key>
<value>True</value> 437 437 <value>True</value>
</param> 438 438 </param>
<param> 439 439 <param>
<key>freq_dds</key> 440 440 <key>freq_dds</key>
<value>f_dds</value> 441 441 <value>f_dds</value>
</param> 442 442 </param>
<param> 443 443 <param>
<key>freq_ref</key> 444 444 <key>freq_ref</key>
<value>125000000</value> 445 445 <value>125000000</value>
</param> 446 446 </param>
<param> 447 447 <param>
<key>_coordinate</key> 448 448 <key>_coordinate</key>
<value>(384, 160)</value> 449 449 <value>(384, 160)</value>
</param> 450 450 </param>
<param> 451 451 <param>
<key>_rotation</key> 452 452 <key>_rotation</key>
<value>0</value> 453 453 <value>0</value>
</param> 454 454 </param>
<param> 455 455 <param>
<key>id</key> 456 456 <key>id</key>
<value>nco_counter_send_conf_0</value> 457 457 <value>nco_counter_send_conf_0</value>
</param> 458 458 </param>
<param> 459 459 <param>
<key>offset</key> 460 460 <key>offset</key>
<value>0</value> 461 461 <value>0</value>
</param> 462 462 </param>
<param> 463 463 <param>
<key>pinc_sw</key> 464 464 <key>pinc_sw</key>
<value>1</value> 465 465 <value>1</value>
</param> 466 466 </param>
<param> 467 467 <param>
<key>poff_sw</key> 468 468 <key>poff_sw</key>
<value>1</value> 469 469 <value>1</value>
</param> 470 470 </param>
<param> 471 471 <param>
<key>port</key> 472 472 <key>port</key>
<value>port</value> 473 473 <value>port</value>
</param> 474 474 </param>
</block> 475 475 </block>
</flow_graph> 476 476 </flow_graph>
477 477
redpitaya/client/dds_gnuradio.py
#!/usr/bin/env python2 1 1 #!/usr/bin/env python2
# -*- coding: utf-8 -*- 2 2 # -*- coding: utf-8 -*-
################################################## 3 3 ##################################################
# GNU Radio Python Flow Graph 4 4 # GNU Radio Python Flow Graph
# Title: Dds Gnuradio 5 5 # Title: Dds Gnuradio
# Generated: Sat Apr 8 10:39:47 2017 6 6 # Generated: Thu Apr 20 11:13:10 2017
################################################## 7 7 ##################################################
8 8
if __name__ == '__main__': 9 9 if __name__ == '__main__':
import ctypes 10 10 import ctypes
import sys 11 11 import sys
if sys.platform.startswith('linux'): 12 12 if sys.platform.startswith('linux'):
try: 13 13 try:
x11 = ctypes.cdll.LoadLibrary('libX11.so') 14 14 x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads() 15 15 x11.XInitThreads()
except: 16 16 except:
print "Warning: failed to XInitThreads()" 17 17 print "Warning: failed to XInitThreads()"
18 18
from PyQt4 import Qt 19 19 from PyQt4 import Qt
from gnuradio import eng_notation 20 20 from gnuradio import eng_notation
from gnuradio import gr 21 21 from gnuradio import gr
from gnuradio.eng_option import eng_option 22 22 from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes 23 23 from gnuradio.filter import firdes
from gnuradio.qtgui import Range, RangeWidget 24 24 from gnuradio.qtgui import Range, RangeWidget
from optparse import OptionParser 25 25 from optparse import OptionParser
import redpitaya_gnuradio 26 26 import redpitaya_gnuradio
import sys 27 27 import sys
28 28
29 29
class dds_gnuradio(gr.top_block, Qt.QWidget): 30 30 class dds_gnuradio(gr.top_block, Qt.QWidget):
31 31
def __init__(self): 32 32 def __init__(self):
gr.top_block.__init__(self, "Dds Gnuradio") 33 33 gr.top_block.__init__(self, "Dds Gnuradio")
Qt.QWidget.__init__(self) 34 34 Qt.QWidget.__init__(self)
self.setWindowTitle("Dds Gnuradio") 35 35 self.setWindowTitle("Dds Gnuradio")
try: 36 36 try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) 37 37 self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except: 38 38 except:
pass 39 39 pass
self.top_scroll_layout = Qt.QVBoxLayout() 40 40 self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout) 41 41 self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea() 42 42 self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) 43 43 self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll) 44 44 self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True) 45 45 self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget() 46 46 self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget) 47 47 self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget) 48 48 self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout() 49 49 self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout) 50 50 self.top_layout.addLayout(self.top_grid_layout)
51 51
self.settings = Qt.QSettings("GNU Radio", "dds_gnuradio") 52 52 self.settings = Qt.QSettings("GNU Radio", "dds_gnuradio")
self.restoreGeometry(self.settings.value("geometry").toByteArray()) 53 53 self.restoreGeometry(self.settings.value("geometry").toByteArray())
54 54
################################################## 55 55 ##################################################
# Variables 56 56 # Variables
################################################## 57 57 ##################################################
self.port = port = 1001 58 58 self.port = port = 1001
self.offset_out1 = offset_out1 = 0 59 59 self.offset_out1 = offset_out1 = 0
self.f_dds = f_dds = 0 60 60 self.f_dds = f_dds = 0
self.addr = addr = "192.168.0.203" 61 61 self.addr = addr = "192.168.0.201"
self.a_dds = a_dds = 0 62 62 self.a_dds = a_dds = 0
63 63
################################################## 64 64 ##################################################
# Blocks 65 65 # Blocks
################################################## 66 66 ##################################################
self._offset_out1_range = Range(-2**13, 2**13-1, 1, 0, 200) 67 67 self._offset_out1_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._offset_out1_win = RangeWidget(self._offset_out1_range, self.set_offset_out1, 'Offset DDS', "counter_slider", int) 68 68 self._offset_out1_win = RangeWidget(self._offset_out1_range, self.set_offset_out1, 'Offset DDS', "counter_slider", int)
self.top_grid_layout.addWidget(self._offset_out1_win, 2, 0) 69 69 self.top_grid_layout.addWidget(self._offset_out1_win, 2, 0)
self._f_dds_range = Range(0, 60000000, 1000, 0, 200) 70 70 self._f_dds_range = Range(0, 60000000, 1000, 0, 200)
self._f_dds_win = RangeWidget(self._f_dds_range, self.set_f_dds, 'DDS frequency', "counter_slider", float) 71 71 self._f_dds_win = RangeWidget(self._f_dds_range, self.set_f_dds, 'DDS frequency', "counter_slider", float)
self.top_grid_layout.addWidget(self._f_dds_win, 0, 0) 72 72 self.top_grid_layout.addWidget(self._f_dds_win, 0, 0)
self._a_dds_range = Range(0, 2**13-1, 1, 0, 200) 73 73 self._a_dds_range = Range(0, 2**13-1, 1, 0, 200)
self._a_dds_win = RangeWidget(self._a_dds_range, self.set_a_dds, 'DDS amplitude', "counter_slider", int) 74 74 self._a_dds_win = RangeWidget(self._a_dds_range, self.set_a_dds, 'DDS amplitude', "counter_slider", int)
self.top_grid_layout.addWidget(self._a_dds_win, 1, 0) 75 75 self.top_grid_layout.addWidget(self._a_dds_win, 1, 0)
self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf( 76 76 self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf(
addr=addr, 77 77 addr=addr,
port=port, 78 78 port=port,
device='/dev/dds_freq', 79 79 device='/dev/dds_freq',
freq_ref=125000000, 80 80 freq_ref=125000000,
freq_dds=f_dds, 81 81 freq_dds=f_dds,
acc_size=32, 82 82 acc_size=32,
offset=0, 83 83 offset=0,
pinc_sw=1, 84 84 pinc_sw=1,
poff_sw=1, 85 85 poff_sw=1,
) 86 86 )
87 87
self.add_const_set_offset_0_0 = redpitaya_gnuradio.add_const_set_offset( 88 88 self.add_const_set_offset_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 89 89 addr=addr,
port=port, 90 90 port=port,
device='/dev/dds_ampl', 91 91 device='/dev/dds_ampl',
const=a_dds, 92 92 const=a_dds,
) 93 93 )
94 94
self.add_const_set_offset_0 = redpitaya_gnuradio.add_const_set_offset( 95 95 self.add_const_set_offset_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 96 96 addr=addr,
port=port, 97 97 port=port,
device='/dev/dds_offset', 98 98 device='/dev/dds_offset',
const=offset_out1, 99 99 const=offset_out1,
) 100 100 )
101 101
102 102
def closeEvent(self, event): 103 103 def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "dds_gnuradio") 104 104 self.settings = Qt.QSettings("GNU Radio", "dds_gnuradio")
self.settings.setValue("geometry", self.saveGeometry()) 105 105 self.settings.setValue("geometry", self.saveGeometry())
event.accept() 106 106 event.accept()
107 107
def get_port(self): 108 108 def get_port(self):
return self.port 109 109 return self.port
110 110
def set_port(self, port): 111 111 def set_port(self, port):
self.port = port 112 112 self.port = port
113 113
def get_offset_out1(self): 114 114 def get_offset_out1(self):
return self.offset_out1 115 115 return self.offset_out1
116 116
def set_offset_out1(self, offset_out1): 117 117 def set_offset_out1(self, offset_out1):
self.offset_out1 = offset_out1 118 118 self.offset_out1 = offset_out1
self.add_const_set_offset_0.set_const(device='/dev/dds_offset', const=self.offset_out1) 119 119 self.add_const_set_offset_0.set_const(device='/dev/dds_offset', const=self.offset_out1)
120 120
def get_f_dds(self): 121 121 def get_f_dds(self):
return self.f_dds 122 122 return self.f_dds
123 123
def set_f_dds(self, f_dds): 124 124 def set_f_dds(self, f_dds):
self.f_dds = f_dds 125 125 self.f_dds = f_dds
self.nco_counter_send_conf_0.set_nco(device='/dev/dds_freq', freq_ref=125000000, freq_dds=self.f_dds, acc_size=32, offset=0, pinc_sw=1, poff_sw=1) 126 126 self.nco_counter_send_conf_0.set_nco(device='/dev/dds_freq', freq_ref=125000000, freq_dds=self.f_dds, acc_size=32, offset=0, pinc_sw=1, poff_sw=1)
127 127
def get_addr(self): 128 128 def get_addr(self):
return self.addr 129 129 return self.addr
130 130
def set_addr(self, addr): 131 131 def set_addr(self, addr):
self.addr = addr 132 132 self.addr = addr
133 133
def get_a_dds(self): 134 134 def get_a_dds(self):
return self.a_dds 135 135 return self.a_dds
redpitaya/client/iq_demod_only.grc
File was created 1 <?xml version='1.0' encoding='utf-8'?>
2 <?grc format='1' created='3.7.10'?>
3 <flow_graph>
4 <timestamp>Thu Feb 2 22:54:58 2017</timestamp>
5 <block>
6 <key>options</key>
7 <param>
8 <key>author</key>
9 <value></value>
10 </param>
11 <param>
12 <key>window_size</key>
13 <value></value>
14 </param>
15 <param>
16 <key>category</key>
17 <value>[GRC Hier Blocks]</value>
18 </param>
19 <param>
20 <key>comment</key>
21 <value></value>
22 </param>
23 <param>
24 <key>description</key>
25 <value></value>
26 </param>
27 <param>
28 <key>_enabled</key>
29 <value>True</value>
30 </param>
31 <param>
32 <key>_coordinate</key>
33 <value>(8, 8)</value>
34 </param>
35 <param>
36 <key>_rotation</key>
37 <value>0</value>
38 </param>
39 <param>
40 <key>generate_options</key>
41 <value>qt_gui</value>
42 </param>
43 <param>
44 <key>hier_block_src_path</key>
45 <value>.:</value>
46 </param>
47 <param>
48 <key>id</key>
49 <value>iq_demod_only</value>
50 </param>
51 <param>
52 <key>max_nouts</key>
53 <value>0</value>
54 </param>
55 <param>
56 <key>qt_qss_theme</key>
57 <value></value>
58 </param>
59 <param>
60 <key>realtime_scheduling</key>
61 <value></value>
62 </param>
63 <param>
64 <key>run_command</key>
65 <value>{python} -u {filename}</value>
66 </param>
67 <param>
68 <key>run_options</key>
69 <value>prompt</value>
70 </param>
71 <param>
72 <key>run</key>
73 <value>True</value>
74 </param>
75 <param>
76 <key>thread_safe_setters</key>
77 <value></value>
78 </param>
79 <param>
80 <key>title</key>
81 <value></value>
82 </param>
83 </block>
84 <block>
85 <key>variable_qtgui_range</key>
86 <param>
87 <key>comment</key>
88 <value></value>
89 </param>
90 <param>
91 <key>value</key>
92 <value>0</value>
93 </param>
94 <param>
95 <key>_enabled</key>
96 <value>True</value>
97 </param>
98 <param>
99 <key>_coordinate</key>
100 <value>(568, 4)</value>
101 </param>
102 <param>
103 <key>gui_hint</key>
104 <value>0, 1</value>
105 </param>
106 <param>
107 <key>_rotation</key>
108 <value>0</value>
109 </param>
110 <param>
111 <key>id</key>
112 <value>adc1_offset</value>
113 </param>
114 <param>
115 <key>label</key>
116 <value>adc1_offset</value>
117 </param>
118 <param>
119 <key>min_len</key>
120 <value>200</value>
121 </param>
122 <param>
123 <key>orient</key>
124 <value>Qt.Horizontal</value>
125 </param>
126 <param>
127 <key>start</key>
128 <value>-2**13</value>
129 </param>
130 <param>
131 <key>step</key>
132 <value>1</value>
133 </param>
134 <param>
135 <key>stop</key>
136 <value>2**13-1</value>
137 </param>
138 <param>
139 <key>rangeType</key>
140 <value>int</value>
141 </param>
142 <param>
143 <key>widget</key>
144 <value>counter_slider</value>
145 </param>
146 </block>
147 <block>
148 <key>variable</key>
149 <param>
150 <key>comment</key>
151 <value></value>
152 </param>
153 <param>
154 <key>_enabled</key>
155 <value>True</value>
156 </param>
157 <param>
158 <key>_coordinate</key>
159 <value>(8, 104)</value>
160 </param>
161 <param>
162 <key>_rotation</key>
163 <value>0</value>
164 </param>
165 <param>
166 <key>id</key>
167 <value>addr</value>
168 </param>
169 <param>
170 <key>value</key>
171 <value>"192.168.0.201"</value>
172 </param>
173 </block>
174 <block>
175 <key>variable_qtgui_range</key>
176 <param>
177 <key>comment</key>
178 <value></value>
179 </param>
180 <param>
181 <key>value</key>
182 <value>0</value>
183 </param>
184 <param>
185 <key>_enabled</key>
186 <value>True</value>
187 </param>
188 <param>
189 <key>_coordinate</key>
190 <value>(296, 356)</value>
191 </param>
192 <param>
193 <key>gui_hint</key>
194 <value>1, 0</value>
195 </param>
196 <param>
197 <key>_rotation</key>
198 <value>0</value>
199 </param>
200 <param>
201 <key>id</key>
202 <value>dds_ampl</value>
203 </param>
204 <param>
205 <key>label</key>
206 <value>dds_ampl</value>
207 </param>
208 <param>
209 <key>min_len</key>
210 <value>200</value>
211 </param>
212 <param>
213 <key>orient</key>
214 <value>Qt.Horizontal</value>
215 </param>
216 <param>
217 <key>start</key>
218 <value>0</value>
219 </param>
220 <param>
221 <key>step</key>
222 <value>1</value>
223 </param>
224 <param>
225 <key>stop</key>
226 <value>2**13-1</value>
227 </param>
228 <param>
229 <key>rangeType</key>
230 <value>int</value>
231 </param>
232 <param>
233 <key>widget</key>
234 <value>counter_slider</value>
235 </param>
236 </block>
237 <block>
238 <key>variable_qtgui_range</key>
239 <param>
240 <key>comment</key>
241 <value></value>
242 </param>
243 <param>
244 <key>value</key>
245 <value>0</value>
246 </param>
247 <param>
248 <key>_enabled</key>
249 <value>True</value>
250 </param>
251 <param>
252 <key>_coordinate</key>
253 <value>(312, 652)</value>
254 </param>
255 <param>
256 <key>gui_hint</key>
257 <value>2, 0</value>
258 </param>
259 <param>
260 <key>_rotation</key>
261 <value>0</value>
262 </param>
263 <param>
264 <key>id</key>
265 <value>dds_offset</value>
266 </param>
267 <param>
268 <key>label</key>
269 <value>dds_offset</value>
270 </param>
271 <param>
272 <key>min_len</key>
273 <value>200</value>
274 </param>
275 <param>
276 <key>orient</key>
277 <value>Qt.Horizontal</value>
278 </param>
279 <param>
280 <key>start</key>
281 <value>-2**13</value>
282 </param>
283 <param>
284 <key>step</key>
285 <value>1</value>
286 </param>
287 <param>
288 <key>stop</key>
289 <value>2**13-1</value>
290 </param>
291 <param>
292 <key>rangeType</key>
293 <value>int</value>
294 </param>
295 <param>
296 <key>widget</key>
297 <value>counter_slider</value>
298 </param>
299 </block>
300 <block>
301 <key>variable_qtgui_range</key>
302 <param>
303 <key>comment</key>
304 <value></value>
305 </param>
306 <param>
307 <key>value</key>
308 <value>0</value>
309 </param>
310 <param>
311 <key>_enabled</key>
312 <value>True</value>
313 </param>
314 <param>
315 <key>_coordinate</key>
316 <value>(568, 372)</value>
317 </param>
318 <param>
319 <key>gui_hint</key>
320 <value>1, 1</value>
321 </param>
322 <param>
323 <key>_rotation</key>
324 <value>0</value>
325 </param>
326 <param>
327 <key>id</key>
328 <value>demod_f</value>
329 </param>
330 <param>
331 <key>label</key>
332 <value>demod_f</value>
333 </param>
334 <param>
335 <key>min_len</key>
336 <value>200</value>
337 </param>
338 <param>
339 <key>orient</key>
340 <value>Qt.Horizontal</value>
341 </param>
342 <param>
343 <key>start</key>
344 <value>0</value>
345 </param>
346 <param>
347 <key>step</key>
348 <value>1000</value>
349 </param>
350 <param>
351 <key>stop</key>
352 <value>60000000</value>
353 </param>
354 <param>
355 <key>rangeType</key>
356 <value>float</value>
357 </param>
358 <param>
359 <key>widget</key>
360 <value>counter_slider</value>
361 </param>
362 </block>
363 <block>
364 <key>variable_qtgui_range</key>
365 <param>
366 <key>comment</key>
367 <value></value>
368 </param>
369 <param>
370 <key>value</key>
371 <value>0</value>
372 </param>
373 <param>
374 <key>_enabled</key>
375 <value>True</value>
376 </param>
377 <param>
378 <key>_coordinate</key>
379 <value>(288, 4)</value>
380 </param>
381 <param>
382 <key>gui_hint</key>
383 <value>0, 0</value>
384 </param>
385 <param>
386 <key>_rotation</key>
387 <value>0</value>
388 </param>
389 <param>
390 <key>id</key>
391 <value>f_dds</value>
392 </param>
393 <param>
394 <key>label</key>
395 <value>f_dds</value>
396 </param>
397 <param>
398 <key>min_len</key>
399 <value>200</value>
400 </param>
401 <param>
402 <key>orient</key>
403 <value>Qt.Horizontal</value>
404 </param>
405 <param>
406 <key>start</key>
407 <value>0</value>
408 </param>
409 <param>
410 <key>step</key>
411 <value>1000</value>
412 </param>
413 <param>
414 <key>stop</key>
415 <value>60000000</value>
416 </param>
417 <param>
418 <key>rangeType</key>
419 <value>float</value>
420 </param>
421 <param>
422 <key>widget</key>
423 <value>counter_slider</value>
424 </param>
425 </block>
426 <block>
427 <key>variable</key>
428 <param>
429 <key>comment</key>
430 <value></value>
431 </param>
432 <param>
433 <key>_enabled</key>
434 <value>True</value>
435 </param>
436 <param>
437 <key>_coordinate</key>
438 <value>(8, 176)</value>
439 </param>
440 <param>
441 <key>_rotation</key>
442 <value>0</value>
443 </param>
444 <param>
445 <key>id</key>
446 <value>port</value>
447 </param>
448 <param>
449 <key>value</key>
450 <value>1001</value>
451 </param>
452 </block>
453 <block>
454 <key>add_const_set_offset</key>
455 <param>
456 <key>addr</key>
457 <value>addr</value>
458 </param>
459 <param>
460 <key>alias</key>
461 <value></value>
462 </param>
463 <param>
464 <key>comment</key>
465 <value></value>
466 </param>
467 <param>
468 <key>const</key>
469 <value>dds_offset</value>
470 </param>
471 <param>
472 <key>device</key>
473 <value>/dev/dds_offset</value>
474 </param>
475 <param>
476 <key>_enabled</key>
477 <value>True</value>
478 </param>
479 <param>
480 <key>_coordinate</key>
481 <value>(288, 804)</value>
482 </param>
483 <param>
484 <key>_rotation</key>
485 <value>0</value>
486 </param>
487 <param>
488 <key>id</key>
489 <value>add_const_set_offset_0</value>
490 </param>
491 <param>
492 <key>port</key>
493 <value>port</value>
494 </param>
495 </block>
496 <block>
497 <key>add_const_set_offset</key>
498 <param>
499 <key>addr</key>
500 <value>addr</value>
501 </param>
502 <param>
503 <key>alias</key>
504 <value></value>
505 </param>
506 <param>
507 <key>comment</key>
508 <value></value>
509 </param>
510 <param>
511 <key>const</key>
512 <value>dds_ampl</value>
513 </param>
514 <param>
515 <key>device</key>
516 <value>/dev/dds_ampl</value>
517 </param>
518 <param>
519 <key>_enabled</key>
520 <value>True</value>
521 </param>
522 <param>
523 <key>_coordinate</key>
524 <value>(296, 508)</value>
525 </param>
526 <param>
527 <key>_rotation</key>
528 <value>0</value>
529 </param>
530 <param>
531 <key>id</key>
532 <value>add_const_set_offset_0_0</value>
533 </param>
534 <param>
535 <key>port</key>
536 <value>port</value>
537 </param>
538 </block>
539 <block>
540 <key>add_const_set_offset</key>
541 <param>
542 <key>addr</key>
543 <value>addr</value>
544 </param>
545 <param>
546 <key>alias</key>
547 <value></value>
548 </param>
549 <param>
550 <key>comment</key>
551 <value></value>
552 </param>
553 <param>
554 <key>const</key>
555 <value>adc1_offset</value>
556 </param>
557 <param>
558 <key>device</key>
559 <value>/dev/adc1_offset</value>
560 </param>
561 <param>
562 <key>_enabled</key>
563 <value>True</value>
564 </param>
565 <param>
566 <key>_coordinate</key>
567 <value>(544, 156)</value>
568 </param>
569 <param>
570 <key>_rotation</key>
571 <value>0</value>
572 </param>
573 <param>
574 <key>id</key>
575 <value>add_const_set_offset_0_1</value>
576 </param>
577 <param>
578 <key>port</key>
579 <value>port</value>
580 </param>
581 </block>
582 <block>
583 <key>nco_counter_send_conf</key>
584 <param>
585 <key>acc_size</key>
586 <value>32</value>
587 </param>
588 <param>
589 <key>addr</key>
590 <value>addr</value>
591 </param>
592 <param>
593 <key>alias</key>
594 <value></value>
595 </param>
596 <param>
597 <key>comment</key>
598 <value></value>
599 </param>
600 <param>
601 <key>device</key>
602 <value>/dev/dds_nco</value>
603 </param>
604 <param>
605 <key>_enabled</key>
606 <value>True</value>
607 </param>
608 <param>
609 <key>freq_dds</key>
610 <value>f_dds</value>
611 </param>
612 <param>
613 <key>freq_ref</key>
614 <value>125000000</value>
615 </param>
616 <param>
617 <key>_coordinate</key>
618 <value>(288, 152)</value>
619 </param>
620 <param>
621 <key>_rotation</key>
622 <value>0</value>
623 </param>
624 <param>
625 <key>id</key>
626 <value>nco_counter_send_conf_0</value>
627 </param>
628 <param>
629 <key>offset</key>
630 <value>0</value>
631 </param>
632 <param>
633 <key>pinc_sw</key>
634 <value>1</value>
635 </param>
636 <param>
637 <key>poff_sw</key>
638 <value>1</value>
639 </param>
640 <param>
641 <key>port</key>
642 <value>port</value>
643 </param>
644 </block>
645 <block>
646 <key>nco_counter_send_conf</key>
647 <param>
648 <key>acc_size</key>
649 <value>32</value>
650 </param>
651 <param>
652 <key>addr</key>
653 <value>addr</value>
654 </param>
655 <param>
656 <key>alias</key>
657 <value></value>
658 </param>
659 <param>
660 <key>comment</key>
661 <value></value>
662 </param>
663 <param>
664 <key>device</key>
665 <value>/dev/demod_nco</value>
666 </param>
667 <param>
668 <key>_enabled</key>
669 <value>True</value>
670 </param>
671 <param>
672 <key>freq_dds</key>
673 <value>demod_f</value>
674 </param>
675 <param>
676 <key>freq_ref</key>
677 <value>125000000</value>
678 </param>
679 <param>
680 <key>_coordinate</key>
681 <value>(568, 528)</value>
682 </param>
683 <param>
684 <key>_rotation</key>
685 <value>0</value>
686 </param>
687 <param>
688 <key>id</key>
689 <value>nco_counter_send_conf_0_0</value>
690 </param>
691 <param>
692 <key>offset</key>
693 <value>0</value>
694 </param>
695 <param>
696 <key>pinc_sw</key>
697 <value>1</value>
698 </param>
699 <param>
700 <key>poff_sw</key>
701 <value>1</value>
702 </param>
703 <param>
704 <key>port</key>
705 <value>port</value>
706 </param>
707 </block>
708 </flow_graph>
redpitaya/client/iq_demod_only.py
File was created 1 #!/usr/bin/env python2
2 # -*- coding: utf-8 -*-
3 ##################################################
4 # GNU Radio Python Flow Graph
5 # Title: Iq Demod Only
6 # Generated: Thu Apr 20 11:09:14 2017
7 ##################################################
8
9 if __name__ == '__main__':
10 import ctypes
11 import sys
12 if sys.platform.startswith('linux'):
13 try:
14 x11 = ctypes.cdll.LoadLibrary('libX11.so')
15 x11.XInitThreads()
16 except:
17 print "Warning: failed to XInitThreads()"
18
19 from PyQt4 import Qt
20 from gnuradio import eng_notation
21 from gnuradio import gr
22 from gnuradio.eng_option import eng_option
23 from gnuradio.filter import firdes
24 from gnuradio.qtgui import Range, RangeWidget
25 from optparse import OptionParser
26 import redpitaya_gnuradio
27 import sys
28
29
30 class iq_demod_only(gr.top_block, Qt.QWidget):
31
32 def __init__(self):
33 gr.top_block.__init__(self, "Iq Demod Only")
34 Qt.QWidget.__init__(self)
35 self.setWindowTitle("Iq Demod Only")
36 try:
37 self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
38 except:
39 pass
40 self.top_scroll_layout = Qt.QVBoxLayout()
41 self.setLayout(self.top_scroll_layout)
42 self.top_scroll = Qt.QScrollArea()
43 self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
44 self.top_scroll_layout.addWidget(self.top_scroll)
45 self.top_scroll.setWidgetResizable(True)
46 self.top_widget = Qt.QWidget()
47 self.top_scroll.setWidget(self.top_widget)
48 self.top_layout = Qt.QVBoxLayout(self.top_widget)
49 self.top_grid_layout = Qt.QGridLayout()
50 self.top_layout.addLayout(self.top_grid_layout)
51
52 self.settings = Qt.QSettings("GNU Radio", "iq_demod_only")
53 self.restoreGeometry(self.settings.value("geometry").toByteArray())
54
55 ##################################################
56 # Variables
57 ##################################################
58 self.port = port = 1001
59 self.f_dds = f_dds = 0
60 self.demod_f = demod_f = 0
61 self.dds_offset = dds_offset = 0
62 self.dds_ampl = dds_ampl = 0
63 self.addr = addr = "192.168.0.201"
64 self.adc1_offset = adc1_offset = 0
65
66 ##################################################
67 # Blocks
68 ##################################################
69 self._f_dds_range = Range(0, 60000000, 1000, 0, 200)
70 self._f_dds_win = RangeWidget(self._f_dds_range, self.set_f_dds, 'f_dds', "counter_slider", float)
71 self.top_grid_layout.addWidget(self._f_dds_win, 0, 0)
72 self._demod_f_range = Range(0, 60000000, 1000, 0, 200)
73 self._demod_f_win = RangeWidget(self._demod_f_range, self.set_demod_f, 'demod_f', "counter_slider", float)
74 self.top_grid_layout.addWidget(self._demod_f_win, 1, 1)
75 self._dds_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
76 self._dds_offset_win = RangeWidget(self._dds_offset_range, self.set_dds_offset, 'dds_offset', "counter_slider", int)
77 self.top_grid_layout.addWidget(self._dds_offset_win, 2, 0)
78 self._dds_ampl_range = Range(0, 2**13-1, 1, 0, 200)
79 self._dds_ampl_win = RangeWidget(self._dds_ampl_range, self.set_dds_ampl, 'dds_ampl', "counter_slider", int)
80 self.top_grid_layout.addWidget(self._dds_ampl_win, 1, 0)
81 self._adc1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
82 self._adc1_offset_win = RangeWidget(self._adc1_offset_range, self.set_adc1_offset, 'adc1_offset', "counter_slider", int)
83 self.top_grid_layout.addWidget(self._adc1_offset_win, 0, 1)
84 self.nco_counter_send_conf_0_0 = redpitaya_gnuradio.nco_counter_send_conf(
85 addr=addr,
86 port=port,
87 device='/dev/demod_nco',
88 freq_ref=125000000,
89 freq_dds=demod_f,
90 acc_size=32,
91 offset=0,
92 pinc_sw=1,
93 poff_sw=1,
94 )
95
96 self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf(
97 addr=addr,
98 port=port,
99 device='/dev/dds_nco',
100 freq_ref=125000000,
101 freq_dds=f_dds,
102 acc_size=32,
103 offset=0,
104 pinc_sw=1,
105 poff_sw=1,
106 )
107
108 self.add_const_set_offset_0_1 = redpitaya_gnuradio.add_const_set_offset(
109 addr=addr,
110 port=port,
111 device='/dev/adc1_offset',
112 const=adc1_offset,
113 )
114
115 self.add_const_set_offset_0_0 = redpitaya_gnuradio.add_const_set_offset(
116 addr=addr,
117 port=port,
118 device='/dev/dds_ampl',
119 const=dds_ampl,
120 )
121
122 self.add_const_set_offset_0 = redpitaya_gnuradio.add_const_set_offset(
123 addr=addr,
124 port=port,
125 device='/dev/dds_offset',
126 const=dds_offset,
127 )
128
129
130 def closeEvent(self, event):
131 self.settings = Qt.QSettings("GNU Radio", "iq_demod_only")
132 self.settings.setValue("geometry", self.saveGeometry())
133 event.accept()
134
135 def get_port(self):
136 return self.port
137
138 def set_port(self, port):
139 self.port = port
140
141 def get_f_dds(self):
142 return self.f_dds
143
144 def set_f_dds(self, f_dds):
145 self.f_dds = f_dds
146 self.nco_counter_send_conf_0.set_nco(device='/dev/dds_nco', freq_ref=125000000, freq_dds=self.f_dds, acc_size=32, offset=0, pinc_sw=1, poff_sw=1)
147
148 def get_demod_f(self):
149 return self.demod_f
150
151 def set_demod_f(self, demod_f):
152 self.demod_f = demod_f
153 self.nco_counter_send_conf_0_0.set_nco(device='/dev/demod_nco', freq_ref=125000000, freq_dds=self.demod_f, acc_size=32, offset=0, pinc_sw=1, poff_sw=1)
154
155 def get_dds_offset(self):
156 return self.dds_offset
157
158 def set_dds_offset(self, dds_offset):
159 self.dds_offset = dds_offset
160 self.add_const_set_offset_0.set_const(device='/dev/dds_offset', const=self.dds_offset)
161
162 def get_dds_ampl(self):
163 return self.dds_ampl
164
165 def set_dds_ampl(self, dds_ampl):
166 self.dds_ampl = dds_ampl
167 self.add_const_set_offset_0_0.set_const(device='/dev/dds_ampl', const=self.dds_ampl)
168
redpitaya/client/pid_only.grc
<?xml version='1.0' encoding='utf-8'?> 1 1 <?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.10'?> 2 2 <?grc format='1' created='3.7.10'?>
<flow_graph> 3 3 <flow_graph>
<timestamp>Thu Feb 2 22:54:58 2017</timestamp> 4 4 <timestamp>Thu Feb 2 22:54:58 2017</timestamp>
<block> 5 5 <block>
<key>options</key> 6 6 <key>options</key>
<param> 7 7 <param>
<key>author</key> 8 8 <key>author</key>
<value></value> 9 9 <value></value>
</param> 10 10 </param>
<param> 11 11 <param>
<key>window_size</key> 12 12 <key>window_size</key>
<value></value> 13 13 <value></value>
</param> 14 14 </param>
<param> 15 15 <param>
<key>category</key> 16 16 <key>category</key>
<value>[GRC Hier Blocks]</value> 17 17 <value>[GRC Hier Blocks]</value>
</param> 18 18 </param>
<param> 19 19 <param>
<key>comment</key> 20 20 <key>comment</key>
<value></value> 21 21 <value></value>
</param> 22 22 </param>
<param> 23 23 <param>
<key>description</key> 24 24 <key>description</key>
<value></value> 25 25 <value></value>
</param> 26 26 </param>
<param> 27 27 <param>
<key>_enabled</key> 28 28 <key>_enabled</key>
<value>True</value> 29 29 <value>True</value>
</param> 30 30 </param>
<param> 31 31 <param>
<key>_coordinate</key> 32 32 <key>_coordinate</key>
<value>(8, 8)</value> 33 33 <value>(8, 8)</value>
</param> 34 34 </param>
<param> 35 35 <param>
<key>_rotation</key> 36 36 <key>_rotation</key>
<value>0</value> 37 37 <value>0</value>
</param> 38 38 </param>
<param> 39 39 <param>
<key>generate_options</key> 40 40 <key>generate_options</key>
<value>qt_gui</value> 41 41 <value>qt_gui</value>
</param> 42 42 </param>
<param> 43 43 <param>
<key>hier_block_src_path</key> 44 44 <key>hier_block_src_path</key>
<value>.:</value> 45 45 <value>.:</value>
</param> 46 46 </param>
<param> 47 47 <param>
<key>id</key> 48 48 <key>id</key>
<value>pid_only</value> 49 49 <value>pid_only</value>
</param> 50 50 </param>
<param> 51 51 <param>
<key>max_nouts</key> 52 52 <key>max_nouts</key>
<value>0</value> 53 53 <value>0</value>
</param> 54 54 </param>
<param> 55 55 <param>
<key>qt_qss_theme</key> 56 56 <key>qt_qss_theme</key>
<value></value> 57 57 <value></value>
</param> 58 58 </param>
<param> 59 59 <param>
<key>realtime_scheduling</key> 60 60 <key>realtime_scheduling</key>
<value></value> 61 61 <value></value>
</param> 62 62 </param>
<param> 63 63 <param>
<key>run_command</key> 64 64 <key>run_command</key>
<value>{python} -u {filename}</value> 65 65 <value>{python} -u {filename}</value>
</param> 66 66 </param>
<param> 67 67 <param>
<key>run_options</key> 68 68 <key>run_options</key>
<value>prompt</value> 69 69 <value>prompt</value>
</param> 70 70 </param>
<param> 71 71 <param>
<key>run</key> 72 72 <key>run</key>
<value>True</value> 73 73 <value>True</value>
</param> 74 74 </param>
<param> 75 75 <param>
<key>thread_safe_setters</key> 76 76 <key>thread_safe_setters</key>
<value></value> 77 77 <value></value>
</param> 78 78 </param>
<param> 79 79 <param>
<key>title</key> 80 80 <key>title</key>
<value></value> 81 81 <value></value>
</param> 82 82 </param>
</block> 83 83 </block>
<block> 84 84 <block>
<key>variable_qtgui_range</key> 85 85 <key>variable_qtgui_range</key>
<param> 86 86 <param>
<key>comment</key> 87 87 <key>comment</key>
<value></value> 88 88 <value></value>
</param> 89 89 </param>
<param> 90 90 <param>
<key>value</key> 91 91 <key>value</key>
<value>0</value> 92 92 <value>0</value>
</param> 93 93 </param>
<param> 94 94 <param>
<key>_enabled</key> 95 95 <key>_enabled</key>
<value>True</value> 96 96 <value>True</value>
</param> 97 97 </param>
<param> 98 98 <param>
<key>_coordinate</key> 99 99 <key>_coordinate</key>
<value>(216, 8)</value> 100 100 <value>(216, 8)</value>
</param> 101 101 </param>
<param> 102 102 <param>
<key>gui_hint</key> 103 103 <key>gui_hint</key>
<value>1, 1</value> 104 104 <value>1, 1</value>
</param> 105 105 </param>
<param> 106 106 <param>
<key>_rotation</key> 107 107 <key>_rotation</key>
<value>0</value> 108 108 <value>0</value>
</param> 109 109 </param>
<param> 110 110 <param>
<key>id</key> 111 111 <key>id</key>
<value>adc1_offset</value> 112 112 <value>adc1_offset</value>
</param> 113 113 </param>
<param> 114 114 <param>
<key>label</key> 115 115 <key>label</key>
<value>adc1_offset</value> 116 116 <value>adc1_offset</value>
</param> 117 117 </param>
<param> 118 118 <param>
<key>min_len</key> 119 119 <key>min_len</key>
<value>200</value> 120 120 <value>200</value>
</param> 121 121 </param>
<param> 122 122 <param>
<key>orient</key> 123 123 <key>orient</key>
<value>Qt.Horizontal</value> 124 124 <value>Qt.Horizontal</value>
</param> 125 125 </param>
<param> 126 126 <param>
<key>start</key> 127 127 <key>start</key>
<value>-2**13</value> 128 128 <value>-2**13</value>
</param> 129 129 </param>
<param> 130 130 <param>
<key>step</key> 131 131 <key>step</key>
<value>1</value> 132 132 <value>1</value>
</param> 133 133 </param>
<param> 134 134 <param>
<key>stop</key> 135 135 <key>stop</key>
<value>2**13-1</value> 136 136 <value>2**13-1</value>
</param> 137 137 </param>
<param> 138 138 <param>
<key>rangeType</key> 139 139 <key>rangeType</key>
<value>int</value> 140 140 <value>int</value>
</param> 141 141 </param>
<param> 142 142 <param>
<key>widget</key> 143 143 <key>widget</key>
<value>counter_slider</value> 144 144 <value>counter_slider</value>
</param> 145 145 </param>
</block> 146 146 </block>
<block> 147 147 <block>
<key>variable</key> 148 148 <key>variable</key>
<param> 149 149 <param>
<key>comment</key> 150 150 <key>comment</key>
<value></value> 151 151 <value></value>
</param> 152 152 </param>
<param> 153 153 <param>
<key>_enabled</key> 154 154 <key>_enabled</key>
<value>True</value> 155 155 <value>True</value>
</param> 156 156 </param>
<param> 157 157 <param>
<key>_coordinate</key> 158 158 <key>_coordinate</key>
<value>(8, 104)</value> 159 159 <value>(8, 104)</value>
</param> 160 160 </param>
<param> 161 161 <param>
<key>_rotation</key> 162 162 <key>_rotation</key>
<value>0</value> 163 163 <value>0</value>
</param> 164 164 </param>
<param> 165 165 <param>
<key>id</key> 166 166 <key>id</key>
<value>addr</value> 167 167 <value>addr</value>
</param> 168 168 </param>
<param> 169 169 <param>
<key>value</key> 170 170 <key>value</key>
<value>"192.168.0.202"</value> 171 171 <value>"192.168.0.201"</value>
</param> 172 172 </param>
</block> 173 173 </block>
<block> 174 174 <block>
<key>variable_qtgui_range</key> 175 175 <key>variable_qtgui_range</key>
<param> 176 176 <param>
<key>comment</key> 177 177 <key>comment</key>
<value></value> 178 178 <value></value>
</param> 179 179 </param>
<param> 180 180 <param>
<key>value</key> 181 181 <key>value</key>
<value>0</value> 182 182 <value>0</value>
</param> 183 183 </param>
<param> 184 184 <param>
<key>_enabled</key> 185 185 <key>_enabled</key>
<value>True</value> 186 186 <value>True</value>
</param> 187 187 </param>
<param> 188 188 <param>
<key>_coordinate</key> 189 189 <key>_coordinate</key>
<value>(400, 8)</value> 190 190 <value>(400, 8)</value>
</param> 191 191 </param>
<param> 192 192 <param>
<key>gui_hint</key> 193 193 <key>gui_hint</key>
<value>1, 2</value> 194 194 <value>1, 2</value>
</param> 195 195 </param>
<param> 196 196 <param>
<key>_rotation</key> 197 197 <key>_rotation</key>
<value>0</value> 198 198 <value>0</value>
</param> 199 199 </param>
<param> 200 200 <param>
<key>id</key> 201 201 <key>id</key>
<value>dac1_offset</value> 202 202 <value>dac1_offset</value>
</param> 203 203 </param>
<param> 204 204 <param>
<key>label</key> 205 205 <key>label</key>
<value>dac1_offset</value> 206 206 <value>dac1_offset</value>
</param> 207 207 </param>
<param> 208 208 <param>
<key>min_len</key> 209 209 <key>min_len</key>
<value>200</value> 210 210 <value>200</value>
</param> 211 211 </param>
<param> 212 212 <param>
<key>orient</key> 213 213 <key>orient</key>
<value>Qt.Horizontal</value> 214 214 <value>Qt.Horizontal</value>
</param> 215 215 </param>
<param> 216 216 <param>
<key>start</key> 217 217 <key>start</key>
<value>-2**13</value> 218 218 <value>-2**13</value>
</param> 219 219 </param>
<param> 220 220 <param>
<key>step</key> 221 221 <key>step</key>
<value>1</value> 222 222 <value>1</value>
</param> 223 223 </param>
<param> 224 224 <param>
<key>stop</key> 225 225 <key>stop</key>
<value>2**13-1</value> 226 226 <value>2**13-1</value>
</param> 227 227 </param>
<param> 228 228 <param>
<key>rangeType</key> 229 229 <key>rangeType</key>
<value>int</value> 230 230 <value>int</value>
</param> 231 231 </param>
<param> 232 232 <param>
<key>widget</key> 233 233 <key>widget</key>
<value>counter_slider</value> 234 234 <value>counter_slider</value>
</param> 235 235 </param>
</block> 236 236 </block>
<block> 237 237 <block>
<key>variable_qtgui_push_button</key> 238 238 <key>variable_qtgui_push_button</key>
<param> 239 239 <param>
<key>comment</key> 240 240 <key>comment</key>
<value></value> 241 241 <value></value>
</param> 242 242 </param>
<param> 243 243 <param>
<key>value</key> 244 244 <key>value</key>
<value>0</value> 245 245 <value>0</value>
</param> 246 246 </param>
<param> 247 247 <param>
<key>_enabled</key> 248 248 <key>_enabled</key>
<value>True</value> 249 249 <value>True</value>
</param> 250 250 </param>
<param> 251 251 <param>
<key>_coordinate</key> 252 252 <key>_coordinate</key>
<value>(920, 288)</value> 253 253 <value>(920, 288)</value>
</param> 254 254 </param>
<param> 255 255 <param>
<key>gui_hint</key> 256 256 <key>gui_hint</key>
<value>4, 2</value> 257 257 <value>4, 2</value>
</param> 258 258 </param>
<param> 259 259 <param>
<key>_rotation</key> 260 260 <key>_rotation</key>
<value>0</value> 261 261 <value>0</value>
</param> 262 262 </param>
<param> 263 263 <param>
<key>id</key> 264 264 <key>id</key>
<value>pid_int_rst</value> 265 265 <value>pid_int_rst</value>
</param> 266 266 </param>
<param> 267 267 <param>
<key>label</key> 268 268 <key>label</key>
<value>pid_int_rst</value> 269 269 <value>pid_int_rst</value>
</param> 270 270 </param>
<param> 271 271 <param>
<key>pressed</key> 272 272 <key>pressed</key>
<value>1</value> 273 273 <value>1</value>
</param> 274 274 </param>
<param> 275 275 <param>
<key>released</key> 276 276 <key>released</key>
<value>0</value> 277 277 <value>0</value>
</param> 278 278 </param>
<param> 279 279 <param>
<key>type</key> 280 280 <key>type</key>
<value>int</value> 281 281 <value>int</value>
</param> 282 282 </param>
</block> 283 283 </block>
<block> 284 284 <block>
<key>variable_qtgui_range</key> 285 285 <key>variable_qtgui_range</key>
<param> 286 286 <param>
<key>comment</key> 287 287 <key>comment</key>
<value></value> 288 288 <value></value>
</param> 289 289 </param>
<param> 290 290 <param>
<key>value</key> 291 291 <key>value</key>
<value>0</value> 292 292 <value>0</value>
</param> 293 293 </param>
<param> 294 294 <param>
<key>_enabled</key> 295 295 <key>_enabled</key>
<value>True</value> 296 296 <value>True</value>
</param> 297 297 </param>
<param> 298 298 <param>
<key>_coordinate</key> 299 299 <key>_coordinate</key>
<value>(400, 272)</value> 300 300 <value>(400, 272)</value>
</param> 301 301 </param>
<param> 302 302 <param>
<key>gui_hint</key> 303 303 <key>gui_hint</key>
<value>4, 1</value> 304 304 <value>4, 1</value>
</param> 305 305 </param>
<param> 306 306 <param>
<key>_rotation</key> 307 307 <key>_rotation</key>
<value>0</value> 308 308 <value>0</value>
</param> 309 309 </param>
<param> 310 310 <param>
<key>id</key> 311 311 <key>id</key>
<value>pid_kd</value> 312 312 <value>pid_kd</value>
</param> 313 313 </param>
<param> 314 314 <param>
<key>label</key> 315 315 <key>label</key>
<value>pid_kd</value> 316 316 <value>pid_kd</value>
</param> 317 317 </param>
<param> 318 318 <param>
<key>min_len</key> 319 319 <key>min_len</key>
<value>200</value> 320 320 <value>200</value>
</param> 321 321 </param>
<param> 322 322 <param>
<key>orient</key> 323 323 <key>orient</key>
<value>Qt.Horizontal</value> 324 324 <value>Qt.Horizontal</value>
</param> 325 325 </param>
<param> 326 326 <param>
<key>start</key> 327 327 <key>start</key>
<value>0</value> 328 328 <value>0</value>
</param> 329 329 </param>
<param> 330 330 <param>
<key>step</key> 331 331 <key>step</key>
<value>1</value> 332 332 <value>1</value>
</param> 333 333 </param>
<param> 334 334 <param>
<key>stop</key> 335 335 <key>stop</key>
<value>2**13-1</value> 336 336 <value>2**13-1</value>
</param> 337 337 </param>
<param> 338 338 <param>
<key>rangeType</key> 339 339 <key>rangeType</key>
<value>int</value> 340 340 <value>int</value>
</param> 341 341 </param>
<param> 342 342 <param>
<key>widget</key> 343 343 <key>widget</key>
<value>counter_slider</value> 344 344 <value>counter_slider</value>
</param> 345 345 </param>
</block> 346 346 </block>
<block> 347 347 <block>
<key>variable_qtgui_range</key> 348 348 <key>variable_qtgui_range</key>
<param> 349 349 <param>
<key>comment</key> 350 350 <key>comment</key>
<value></value> 351 351 <value></value>
</param> 352 352 </param>
<param> 353 353 <param>
<key>value</key> 354 354 <key>value</key>
<value>0</value> 355 355 <value>0</value>
</param> 356 356 </param>
<param> 357 357 <param>
<key>_enabled</key> 358 358 <key>_enabled</key>
<value>True</value> 359 359 <value>True</value>
</param> 360 360 </param>
<param> 361 361 <param>
<key>_coordinate</key> 362 362 <key>_coordinate</key>
<value>(232, 272)</value> 363 363 <value>(232, 272)</value>
</param> 364 364 </param>
<param> 365 365 <param>
<key>gui_hint</key> 366 366 <key>gui_hint</key>
<value>3, 1</value> 367 367 <value>3, 1</value>
</param> 368 368 </param>
<param> 369 369 <param>
<key>_rotation</key> 370 370 <key>_rotation</key>
<value>0</value> 371 371 <value>0</value>
</param> 372 372 </param>
<param> 373 373 <param>
<key>id</key> 374 374 <key>id</key>
<value>pid_ki</value> 375 375 <value>pid_ki</value>
</param> 376 376 </param>
<param> 377 377 <param>
<key>label</key> 378 378 <key>label</key>
<value>pid_ki</value> 379 379 <value>pid_ki</value>
</param> 380 380 </param>
<param> 381 381 <param>
<key>min_len</key> 382 382 <key>min_len</key>
<value>200</value> 383 383 <value>200</value>
</param> 384 384 </param>
<param> 385 385 <param>
<key>orient</key> 386 386 <key>orient</key>
<value>Qt.Horizontal</value> 387 387 <value>Qt.Horizontal</value>
</param> 388 388 </param>
<param> 389 389 <param>
<key>start</key> 390 390 <key>start</key>
<value>0</value> 391 391 <value>0</value>
</param> 392 392 </param>
<param> 393 393 <param>
<key>step</key> 394 394 <key>step</key>
<value>1</value> 395 395 <value>1</value>
</param> 396 396 </param>
<param> 397 397 <param>
<key>stop</key> 398 398 <key>stop</key>
<value>2**13-1</value> 399 399 <value>2**13-1</value>
</param> 400 400 </param>
<param> 401 401 <param>
<key>rangeType</key> 402 402 <key>rangeType</key>
<value>int</value> 403 403 <value>int</value>
</param> 404 404 </param>
<param> 405 405 <param>
<key>widget</key> 406 406 <key>widget</key>
<value>counter_slider</value> 407 407 <value>counter_slider</value>
</param> 408 408 </param>
</block> 409 409 </block>
<block> 410 410 <block>
<key>variable_qtgui_range</key> 411 411 <key>variable_qtgui_range</key>
<param> 412 412 <param>
<key>comment</key> 413 413 <key>comment</key>
<value></value> 414 414 <value></value>
</param> 415 415 </param>
<param> 416 416 <param>
<key>value</key> 417 417 <key>value</key>
<value>0</value> 418 418 <value>0</value>
</param> 419 419 </param>
<param> 420 420 <param>
<key>_enabled</key> 421 421 <key>_enabled</key>
<value>True</value> 422 422 <value>True</value>
</param> 423 423 </param>
<param> 424 424 <param>
<key>_coordinate</key> 425 425 <key>_coordinate</key>
<value>(56, 272)</value> 426 426 <value>(56, 272)</value>
</param> 427 427 </param>
<param> 428 428 <param>
<key>gui_hint</key> 429 429 <key>gui_hint</key>
<value>2, 1</value> 430 430 <value>2, 1</value>
</param> 431 431 </param>
<param> 432 432 <param>
<key>_rotation</key> 433 433 <key>_rotation</key>
<value>0</value> 434 434 <value>0</value>
</param> 435 435 </param>
<param> 436 436 <param>
<key>id</key> 437 437 <key>id</key>
<value>pid_kp</value> 438 438 <value>pid_kp</value>
</param> 439 439 </param>
<param> 440 440 <param>
<key>label</key> 441 441 <key>label</key>
<value>pid_kp</value> 442 442 <value>pid_kp</value>
</param> 443 443 </param>
<param> 444 444 <param>
<key>min_len</key> 445 445 <key>min_len</key>
<value>200</value> 446 446 <value>200</value>
</param> 447 447 </param>
<param> 448 448 <param>
<key>orient</key> 449 449 <key>orient</key>
<value>Qt.Horizontal</value> 450 450 <value>Qt.Horizontal</value>
</param> 451 451 </param>
<param> 452 452 <param>
<key>start</key> 453 453 <key>start</key>
<value>0</value> 454 454 <value>0</value>
</param> 455 455 </param>
<param> 456 456 <param>
<key>step</key> 457 457 <key>step</key>
<value>1</value> 458 458 <value>1</value>
</param> 459 459 </param>
<param> 460 460 <param>
<key>stop</key> 461 461 <key>stop</key>
<value>2**13-1</value> 462 462 <value>2**13-1</value>
</param> 463 463 </param>
<param> 464 464 <param>
<key>rangeType</key> 465 465 <key>rangeType</key>
<value>int</value> 466 466 <value>int</value>
</param> 467 467 </param>
<param> 468 468 <param>
<key>widget</key> 469 469 <key>widget</key>
<value>counter_slider</value> 470 470 <value>counter_slider</value>
</param> 471 471 </param>
</block> 472 472 </block>
<block> 473 473 <block>
<key>variable_qtgui_check_box</key> 474 474 <key>variable_qtgui_check_box</key>
<param> 475 475 <param>
<key>comment</key> 476 476 <key>comment</key>
<value></value> 477 477 <value></value>
</param> 478 478 </param>
<param> 479 479 <param>
<key>value</key> 480 480 <key>value</key>
<value>0</value> 481 481 <value>0</value>
</param> 482 482 </param>
<param> 483 483 <param>
<key>_enabled</key> 484 484 <key>_enabled</key>
<value>True</value> 485 485 <value>True</value>
</param> 486 486 </param>
<param> 487 487 <param>
<key>false</key> 488 488 <key>false</key>
<value>0</value> 489 489 <value>0</value>
</param> 490 490 </param>
<param> 491 491 <param>
<key>_coordinate</key> 492 492 <key>_coordinate</key>
<value>(752, 288)</value> 493 493 <value>(752, 288)</value>
</param> 494 494 </param>
<param> 495 495 <param>
<key>gui_hint</key> 496 496 <key>gui_hint</key>
<value>3, 2</value> 497 497 <value>3, 2</value>
</param> 498 498 </param>
<param> 499 499 <param>
<key>_rotation</key> 500 500 <key>_rotation</key>
<value>0</value> 501 501 <value>0</value>
</param> 502 502 </param>
<param> 503 503 <param>
<key>id</key> 504 504 <key>id</key>
<value>pid_sign</value> 505 505 <value>pid_sign</value>
</param> 506 506 </param>
<param> 507 507 <param>
<key>label</key> 508 508 <key>label</key>
<value>pid_sign</value> 509 509 <value>pid_sign</value>
</param> 510 510 </param>
<param> 511 511 <param>
<key>true</key> 512 512 <key>true</key>
<value>1</value> 513 513 <value>1</value>
</param> 514 514 </param>
<param> 515 515 <param>
<key>type</key> 516 516 <key>type</key>
<value>int</value> 517 517 <value>int</value>
</param> 518 518 </param>
</block> 519 519 </block>
<block> 520 520 <block>
<key>variable_qtgui_range</key> 521 521 <key>variable_qtgui_range</key>
<param> 522 522 <param>
<key>comment</key> 523 523 <key>comment</key>
<value></value> 524 524 <value></value>
</param> 525 525 </param>
<param> 526 526 <param>
<key>value</key> 527 527 <key>value</key>
<value>0</value> 528 528 <value>0</value>
</param> 529 529 </param>
<param> 530 530 <param>
<key>_enabled</key> 531 531 <key>_enabled</key>
<value>True</value> 532 532 <value>True</value>
</param> 533 533 </param>
<param> 534 534 <param>
<key>_coordinate</key> 535 535 <key>_coordinate</key>
<value>(592, 272)</value> 536 536 <value>(592, 272)</value>
</param> 537 537 </param>
<param> 538 538 <param>
<key>gui_hint</key> 539 539 <key>gui_hint</key>
<value>2, 2</value> 540 540 <value>2, 2</value>
</param> 541 541 </param>
<param> 542 542 <param>
<key>_rotation</key> 543 543 <key>_rotation</key>
<value>0</value> 544 544 <value>0</value>
</param> 545 545 </param>
<param> 546 546 <param>
<key>id</key> 547 547 <key>id</key>
<value>pid_sp</value> 548 548 <value>pid_sp</value>
</param> 549 549 </param>
<param> 550 550 <param>
<key>label</key> 551 551 <key>label</key>
<value>pid_sp</value> 552 552 <value>pid_sp</value>
</param> 553 553 </param>
<param> 554 554 <param>
<key>min_len</key> 555 555 <key>min_len</key>
<value>200</value> 556 556 <value>200</value>
</param> 557 557 </param>
<param> 558 558 <param>
<key>orient</key> 559 559 <key>orient</key>
<value>Qt.Horizontal</value> 560 560 <value>Qt.Horizontal</value>
</param> 561 561 </param>
<param> 562 562 <param>
<key>start</key> 563 563 <key>start</key>
<value>-2**13</value> 564 564 <value>-2**13</value>
</param> 565 565 </param>
<param> 566 566 <param>
<key>step</key> 567 567 <key>step</key>
<value>1</value> 568 568 <value>1</value>
</param> 569 569 </param>
<param> 570 570 <param>
<key>stop</key> 571 571 <key>stop</key>
<value>2**13-1</value> 572 572 <value>2**13-1</value>
</param> 573 573 </param>
<param> 574 574 <param>
<key>rangeType</key> 575 575 <key>rangeType</key>
<value>int</value> 576 576 <value>int</value>
</param> 577 577 </param>
<param> 578 578 <param>
<key>widget</key> 579 579 <key>widget</key>
<value>counter_slider</value> 580 580 <value>counter_slider</value>
</param> 581 581 </param>
</block> 582 582 </block>
<block> 583 583 <block>
<key>variable</key> 584 584 <key>variable</key>
<param> 585 585 <param>
<key>comment</key> 586 586 <key>comment</key>
<value></value> 587 587 <value></value>
</param> 588 588 </param>
<param> 589 589 <param>
<key>_enabled</key> 590 590 <key>_enabled</key>
<value>True</value> 591 591 <value>True</value>
</param> 592 592 </param>
<param> 593 593 <param>
<key>_coordinate</key> 594 594 <key>_coordinate</key>
<value>(8, 176)</value> 595 595 <value>(8, 176)</value>
</param> 596 596 </param>
<param> 597 597 <param>
<key>_rotation</key> 598 598 <key>_rotation</key>
<value>0</value> 599 599 <value>0</value>
</param> 600 600 </param>
<param> 601 601 <param>
<key>id</key> 602 602 <key>id</key>
<value>port</value> 603 603 <value>port</value>
</param> 604 604 </param>
<param> 605 605 <param>
<key>value</key> 606 606 <key>value</key>
<value>1001</value> 607 607 <value>1001</value>
</param> 608 608 </param>
</block> 609 609 </block>
<block> 610 610 <block>
<key>add_const_set_offset</key> 611 611 <key>add_const_set_offset</key>
<param> 612 612 <param>
<key>addr</key> 613 613 <key>addr</key>
<value>addr</value> 614 614 <value>addr</value>
</param> 615 615 </param>
<param> 616 616 <param>
<key>alias</key> 617 617 <key>alias</key>
<value></value> 618 618 <value></value>
</param> 619 619 </param>
<param> 620 620 <param>
<key>comment</key> 621 621 <key>comment</key>
<value></value> 622 622 <value></value>
</param> 623 623 </param>
<param> 624 624 <param>
<key>const</key> 625 625 <key>const</key>
<value>adc1_offset</value> 626 626 <value>adc1_offset</value>
</param> 627 627 </param>
<param> 628 628 <param>
<key>device</key> 629 629 <key>device</key>
<value>/dev/adc1_offset</value> 630 630 <value>/dev/adc1_offset</value>
</param> 631 631 </param>
<param> 632 632 <param>
<key>_enabled</key> 633 633 <key>_enabled</key>
<value>True</value> 634 634 <value>True</value>
</param> 635 635 </param>
<param> 636 636 <param>
<key>_coordinate</key> 637 637 <key>_coordinate</key>
<value>(200, 144)</value> 638 638 <value>(200, 144)</value>
</param> 639 639 </param>
<param> 640 640 <param>
<key>_rotation</key> 641 641 <key>_rotation</key>
<value>0</value> 642 642 <value>0</value>
</param> 643 643 </param>
<param> 644 644 <param>
<key>id</key> 645 645 <key>id</key>
<value>add_const_set_offset_0_0_0</value> 646 646 <value>add_const_set_offset_0_0_0</value>
</param> 647 647 </param>
<param> 648 648 <param>
<key>port</key> 649 649 <key>port</key>
<value>port</value> 650 650 <value>port</value>
</param> 651 651 </param>
</block> 652 652 </block>
<block> 653 653 <block>
<key>add_const_set_offset</key> 654 654 <key>add_const_set_offset</key>
<param> 655 655 <param>
<key>addr</key> 656 656 <key>addr</key>
<value>addr</value> 657 657 <value>addr</value>
</param> 658 658 </param>
<param> 659 659 <param>
<key>alias</key> 660 660 <key>alias</key>
<value></value> 661 661 <value></value>
</param> 662 662 </param>
<param> 663 663 <param>
<key>comment</key> 664 664 <key>comment</key>
<value></value> 665 665 <value></value>
</param> 666 666 </param>
<param> 667 667 <param>
<key>const</key> 668 668 <key>const</key>
<value>dac1_offset</value> 669 669 <value>dac1_offset</value>
</param> 670 670 </param>
<param> 671 671 <param>
<key>device</key> 672 672 <key>device</key>
<value>/dev/dac1_offset</value> 673 673 <value>/dev/dac1_offset</value>
</param> 674 674 </param>
<param> 675 675 <param>
<key>_enabled</key> 676 676 <key>_enabled</key>
<value>True</value> 677 677 <value>True</value>
</param> 678 678 </param>
<param> 679 679 <param>
<key>_coordinate</key> 680 680 <key>_coordinate</key>
<value>(384, 144)</value> 681 681 <value>(384, 144)</value>
</param> 682 682 </param>
<param> 683 683 <param>
<key>_rotation</key> 684 684 <key>_rotation</key>
<value>0</value> 685 685 <value>0</value>
</param> 686 686 </param>
<param> 687 687 <param>
<key>id</key> 688 688 <key>id</key>
<value>add_const_set_offset_0_0_0_0</value> 689 689 <value>add_const_set_offset_0_0_0_0</value>
</param> 690 690 </param>
<param> 691 691 <param>
<key>port</key> 692 692 <key>port</key>
<value>port</value> 693 693 <value>port</value>
</param> 694 694 </param>
</block> 695 695 </block>
<block> 696 696 <block>
<key>add_const_set_offset</key> 697 697 <key>add_const_set_offset</key>
<param> 698 698 <param>
<key>addr</key> 699 699 <key>addr</key>
<value>addr</value> 700 700 <value>addr</value>
</param> 701 701 </param>
<param> 702 702 <param>
<key>alias</key> 703 703 <key>alias</key>
<value></value> 704 704 <value></value>
</param> 705 705 </param>
<param> 706 706 <param>
<key>comment</key> 707 707 <key>comment</key>
<value></value> 708 708 <value></value>
</param> 709 709 </param>
<param> 710 710 <param>
<key>const</key> 711 711 <key>const</key>
<value>pid_sp</value> 712 712 <value>pid_sp</value>
</param> 713 713 </param>
<param> 714 714 <param>
<key>device</key> 715 715 <key>device</key>
<value>/dev/pid_sp</value> 716 716 <value>/dev/pid_sp</value>
</param> 717 717 </param>
<param> 718 718 <param>
<key>_enabled</key> 719 719 <key>_enabled</key>
<value>True</value> 720 720 <value>True</value>
</param> 721 721 </param>
<param> 722 722 <param>
<key>_coordinate</key> 723 723 <key>_coordinate</key>
<value>(576, 408)</value> 724 724 <value>(576, 408)</value>
</param> 725 725 </param>
<param> 726 726 <param>
<key>_rotation</key> 727 727 <key>_rotation</key>
<value>0</value> 728 728 <value>0</value>
</param> 729 729 </param>
<param> 730 730 <param>
<key>id</key> 731 731 <key>id</key>
<value>add_const_set_offset_0_0_0_1</value> 732 732 <value>add_const_set_offset_0_0_0_1</value>
</param> 733 733 </param>
<param> 734 734 <param>
<key>port</key> 735 735 <key>port</key>
<value>port</value> 736 736 <value>port</value>
</param> 737 737 </param>
</block> 738 738 </block>
<block> 739 739 <block>
<key>add_const_set_offset</key> 740 740 <key>add_const_set_offset</key>
<param> 741 741 <param>
<key>addr</key> 742 742 <key>addr</key>
<value>addr</value> 743 743 <value>addr</value>
</param> 744 744 </param>
<param> 745 745 <param>
<key>alias</key> 746 746 <key>alias</key>
<value></value> 747 747 <value></value>
</param> 748 748 </param>
<param> 749 749 <param>
<key>comment</key> 750 750 <key>comment</key>
<value></value> 751 751 <value></value>
</param> 752 752 </param>
<param> 753 753 <param>
<key>const</key> 754 754 <key>const</key>
<value>pid_kp</value> 755 755 <value>pid_kp</value>
</param> 756 756 </param>
<param> 757 757 <param>
<key>device</key> 758 758 <key>device</key>
<value>/dev/pid_kp</value> 759 759 <value>/dev/pid_kp</value>
</param> 760 760 </param>
<param> 761 761 <param>
<key>_enabled</key> 762 762 <key>_enabled</key>
<value>True</value> 763 763 <value>True</value>
</param> 764 764 </param>
<param> 765 765 <param>
<key>_coordinate</key> 766 766 <key>_coordinate</key>
<value>(40, 408)</value> 767 767 <value>(40, 408)</value>
</param> 768 768 </param>
<param> 769 769 <param>
<key>_rotation</key> 770 770 <key>_rotation</key>
<value>0</value> 771 771 <value>0</value>
</param> 772 772 </param>
<param> 773 773 <param>
<key>id</key> 774 774 <key>id</key>
<value>add_const_set_offset_0_0_0_1_0</value> 775 775 <value>add_const_set_offset_0_0_0_1_0</value>
</param> 776 776 </param>
<param> 777 777 <param>
<key>port</key> 778 778 <key>port</key>
<value>port</value> 779 779 <value>port</value>
</param> 780 780 </param>
</block> 781 781 </block>
<block> 782 782 <block>
<key>add_const_set_offset</key> 783 783 <key>add_const_set_offset</key>
<param> 784 784 <param>
<key>addr</key> 785 785 <key>addr</key>
<value>addr</value> 786 786 <value>addr</value>
</param> 787 787 </param>
<param> 788 788 <param>
<key>alias</key> 789 789 <key>alias</key>
<value></value> 790 790 <value></value>
</param> 791 791 </param>
<param> 792 792 <param>
<key>comment</key> 793 793 <key>comment</key>
<value></value> 794 794 <value></value>
</param> 795 795 </param>
<param> 796 796 <param>
<key>const</key> 797 797 <key>const</key>
<value>pid_ki</value> 798 798 <value>pid_ki</value>
</param> 799 799 </param>
<param> 800 800 <param>
<key>device</key> 801 801 <key>device</key>
<value>/dev/pid_ki</value> 802 802 <value>/dev/pid_ki</value>
</param> 803 803 </param>
<param> 804 804 <param>
<key>_enabled</key> 805 805 <key>_enabled</key>
<value>True</value> 806 806 <value>True</value>
</param> 807 807 </param>
<param> 808 808 <param>
<key>_coordinate</key> 809 809 <key>_coordinate</key>
<value>(216, 408)</value> 810 810 <value>(216, 408)</value>
</param> 811 811 </param>
<param> 812 812 <param>
<key>_rotation</key> 813 813 <key>_rotation</key>
<value>0</value> 814 814 <value>0</value>
</param> 815 815 </param>
<param> 816 816 <param>
<key>id</key> 817 817 <key>id</key>
<value>add_const_set_offset_0_0_0_1_0_0</value> 818 818 <value>add_const_set_offset_0_0_0_1_0_0</value>
</param> 819 819 </param>
<param> 820 820 <param>
<key>port</key> 821 821 <key>port</key>
<value>port</value> 822 822 <value>port</value>
</param> 823 823 </param>
</block> 824 824 </block>
<block> 825 825 <block>
<key>add_const_set_offset</key> 826 826 <key>add_const_set_offset</key>
<param> 827 827 <param>
<key>addr</key> 828 828 <key>addr</key>
<value>addr</value> 829 829 <value>addr</value>
</param> 830 830 </param>
<param> 831 831 <param>
<key>alias</key> 832 832 <key>alias</key>
<value></value> 833 833 <value></value>
</param> 834 834 </param>
<param> 835 835 <param>
<key>comment</key> 836 836 <key>comment</key>
<value></value> 837 837 <value></value>
</param> 838 838 </param>
<param> 839 839 <param>
<key>const</key> 840 840 <key>const</key>
<value>pid_kd</value> 841 841 <value>pid_kd</value>
</param> 842 842 </param>
<param> 843 843 <param>
<key>device</key> 844 844 <key>device</key>
<value>/dev/pid_kd</value> 845 845 <value>/dev/pid_kd</value>
</param> 846 846 </param>
<param> 847 847 <param>
<key>_enabled</key> 848 848 <key>_enabled</key>
<value>True</value> 849 849 <value>True</value>
</param> 850 850 </param>
<param> 851 851 <param>
<key>_coordinate</key> 852 852 <key>_coordinate</key>
<value>(384, 408)</value> 853 853 <value>(384, 408)</value>
</param> 854 854 </param>
<param> 855 855 <param>
<key>_rotation</key> 856 856 <key>_rotation</key>
<value>0</value> 857 857 <value>0</value>
</param> 858 858 </param>
<param> 859 859 <param>
<key>id</key> 860 860 <key>id</key>
<value>add_const_set_offset_0_0_0_1_0_0_0</value> 861 861 <value>add_const_set_offset_0_0_0_1_0_0_0</value>
</param> 862 862 </param>
<param> 863 863 <param>
<key>port</key> 864 864 <key>port</key>
<value>port</value> 865 865 <value>port</value>
</param> 866 866 </param>
</block> 867 867 </block>
<block> 868 868 <block>
<key>add_const_set_offset</key> 869 869 <key>add_const_set_offset</key>
<param> 870 870 <param>
<key>addr</key> 871 871 <key>addr</key>
<value>addr</value> 872 872 <value>addr</value>
</param> 873 873 </param>
<param> 874 874 <param>
<key>alias</key> 875 875 <key>alias</key>
<value></value> 876 876 <value></value>
</param> 877 877 </param>
<param> 878 878 <param>
<key>comment</key> 879 879 <key>comment</key>
<value></value> 880 880 <value></value>
</param> 881 881 </param>
<param> 882 882 <param>
<key>const</key> 883 883 <key>const</key>
<value>pid_sign</value> 884 884 <value>pid_sign</value>
</param> 885 885 </param>
<param> 886 886 <param>
<key>device</key> 887 887 <key>device</key>
<value>/dev/pid_sign</value> 888 888 <value>/dev/pid_sign</value>
</param> 889 889 </param>
<param> 890 890 <param>
<key>_enabled</key> 891 891 <key>_enabled</key>
<value>True</value> 892 892 <value>True</value>
</param> 893 893 </param>
<param> 894 894 <param>
<key>_coordinate</key> 895 895 <key>_coordinate</key>
<value>(744, 408)</value> 896 896 <value>(744, 408)</value>
</param> 897 897 </param>
<param> 898 898 <param>
<key>_rotation</key> 899 899 <key>_rotation</key>
<value>0</value> 900 900 <value>0</value>
</param> 901 901 </param>
<param> 902 902 <param>
<key>id</key> 903 903 <key>id</key>
<value>add_const_set_offset_0_0_0_1_0_0_0_0</value> 904 904 <value>add_const_set_offset_0_0_0_1_0_0_0_0</value>
</param> 905 905 </param>
<param> 906 906 <param>
<key>port</key> 907 907 <key>port</key>
<value>port</value> 908 908 <value>port</value>
</param> 909 909 </param>
</block> 910 910 </block>
<block> 911 911 <block>
<key>add_const_set_offset</key> 912 912 <key>add_const_set_offset</key>
<param> 913 913 <param>
<key>addr</key> 914 914 <key>addr</key>
<value>addr</value> 915 915 <value>addr</value>
</param> 916 916 </param>
<param> 917 917 <param>
<key>alias</key> 918 918 <key>alias</key>
<value></value> 919 919 <value></value>
</param> 920 920 </param>
<param> 921 921 <param>
<key>comment</key> 922 922 <key>comment</key>
<value></value> 923 923 <value></value>
</param> 924 924 </param>
<param> 925 925 <param>
<key>const</key> 926 926 <key>const</key>
<value>pid_int_rst</value> 927 927 <value>pid_int_rst</value>
</param> 928 928 </param>
<param> 929 929 <param>
<key>device</key> 930 930 <key>device</key>
<value>/dev/pid_int_rst</value> 931 931 <value>/dev/pid_int_rst</value>
</param> 932 932 </param>
<param> 933 933 <param>
<key>_enabled</key> 934 934 <key>_enabled</key>
<value>True</value> 935 935 <value>True</value>
</param> 936 936 </param>
<param> 937 937 <param>
<key>_coordinate</key> 938 938 <key>_coordinate</key>
<value>(920, 408)</value> 939 939 <value>(920, 408)</value>
</param> 940 940 </param>
<param> 941 941 <param>
<key>_rotation</key> 942 942 <key>_rotation</key>
<value>0</value> 943 943 <value>0</value>
</param> 944 944 </param>
<param> 945 945 <param>
<key>id</key> 946 946 <key>id</key>
<value>add_const_set_offset_0_0_0_1_0_0_0_0_0</value> 947 947 <value>add_const_set_offset_0_0_0_1_0_0_0_0_0</value>
</param> 948 948 </param>
<param> 949 949 <param>
<key>port</key> 950 950 <key>port</key>
<value>port</value> 951 951 <value>port</value>
</param> 952 952 </param>
</block> 953 953 </block>
</flow_graph> 954 954 </flow_graph>
955 955
redpitaya/client/pid_only.py
#!/usr/bin/env python2 1 1 #!/usr/bin/env python2
# -*- coding: utf-8 -*- 2 2 # -*- coding: utf-8 -*-
################################################## 3 3 ##################################################
# GNU Radio Python Flow Graph 4 4 # GNU Radio Python Flow Graph
# Title: Pid Only 5 5 # Title: Pid Only
# Generated: Fri Mar 31 15:40:54 2017 6 6 # Generated: Wed Apr 19 09:35:59 2017
################################################## 7 7 ##################################################
8 8
if __name__ == '__main__': 9 9 if __name__ == '__main__':
import ctypes 10 10 import ctypes
import sys 11 11 import sys
if sys.platform.startswith('linux'): 12 12 if sys.platform.startswith('linux'):
try: 13 13 try:
x11 = ctypes.cdll.LoadLibrary('libX11.so') 14 14 x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads() 15 15 x11.XInitThreads()
except: 16 16 except:
print "Warning: failed to XInitThreads()" 17 17 print "Warning: failed to XInitThreads()"
18 18
from PyQt4 import Qt 19 19 from PyQt4 import Qt
from gnuradio import eng_notation 20 20 from gnuradio import eng_notation
from gnuradio import gr 21 21 from gnuradio import gr
from gnuradio.eng_option import eng_option 22 22 from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes 23 23 from gnuradio.filter import firdes
from gnuradio.qtgui import Range, RangeWidget 24 24 from gnuradio.qtgui import Range, RangeWidget
from optparse import OptionParser 25 25 from optparse import OptionParser
import redpitaya_gnuradio 26 26 import redpitaya_gnuradio
import sys 27 27 import sys
28 28
29 29
class pid_only(gr.top_block, Qt.QWidget): 30 30 class pid_only(gr.top_block, Qt.QWidget):
31 31
def __init__(self): 32 32 def __init__(self):
gr.top_block.__init__(self, "Pid Only") 33 33 gr.top_block.__init__(self, "Pid Only")
Qt.QWidget.__init__(self) 34 34 Qt.QWidget.__init__(self)
self.setWindowTitle("Pid Only") 35 35 self.setWindowTitle("Pid Only")
try: 36 36 try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) 37 37 self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except: 38 38 except:
pass 39 39 pass
self.top_scroll_layout = Qt.QVBoxLayout() 40 40 self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout) 41 41 self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea() 42 42 self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) 43 43 self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll) 44 44 self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True) 45 45 self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget() 46 46 self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget) 47 47 self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget) 48 48 self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout() 49 49 self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout) 50 50 self.top_layout.addLayout(self.top_grid_layout)
51 51
self.settings = Qt.QSettings("GNU Radio", "pid_only") 52 52 self.settings = Qt.QSettings("GNU Radio", "pid_only")
self.restoreGeometry(self.settings.value("geometry").toByteArray()) 53 53 self.restoreGeometry(self.settings.value("geometry").toByteArray())
54 54
################################################## 55 55 ##################################################
# Variables 56 56 # Variables
################################################## 57 57 ##################################################
self.port = port = 1001 58 58 self.port = port = 1001
self.pid_sp = pid_sp = 0 59 59 self.pid_sp = pid_sp = 0
self.pid_sign = pid_sign = 0 60 60 self.pid_sign = pid_sign = 0
self.pid_kp = pid_kp = 0 61 61 self.pid_kp = pid_kp = 0
self.pid_ki = pid_ki = 0 62 62 self.pid_ki = pid_ki = 0
self.pid_kd = pid_kd = 0 63 63 self.pid_kd = pid_kd = 0
self.pid_int_rst = pid_int_rst = 0 64 64 self.pid_int_rst = pid_int_rst = 0
self.dac1_offset = dac1_offset = 0 65 65 self.dac1_offset = dac1_offset = 0
self.addr = addr = "192.168.0.202" 66 66 self.addr = addr = "192.168.0.201"
self.adc1_offset = adc1_offset = 0 67 67 self.adc1_offset = adc1_offset = 0
68 68
################################################## 69 69 ##################################################
# Blocks 70 70 # Blocks
################################################## 71 71 ##################################################
self._pid_sp_range = Range(-2**13, 2**13-1, 1, 0, 200) 72 72 self._pid_sp_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._pid_sp_win = RangeWidget(self._pid_sp_range, self.set_pid_sp, 'pid_sp', "counter_slider", int) 73 73 self._pid_sp_win = RangeWidget(self._pid_sp_range, self.set_pid_sp, 'pid_sp', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid_sp_win, 2, 2) 74 74 self.top_grid_layout.addWidget(self._pid_sp_win, 2, 2)
_pid_sign_check_box = Qt.QCheckBox('pid_sign') 75 75 _pid_sign_check_box = Qt.QCheckBox('pid_sign')
self._pid_sign_choices = {True: 1, False: 0} 76 76 self._pid_sign_choices = {True: 1, False: 0}
self._pid_sign_choices_inv = dict((v,k) for k,v in self._pid_sign_choices.iteritems()) 77 77 self._pid_sign_choices_inv = dict((v,k) for k,v in self._pid_sign_choices.iteritems())
self._pid_sign_callback = lambda i: Qt.QMetaObject.invokeMethod(_pid_sign_check_box, "setChecked", Qt.Q_ARG("bool", self._pid_sign_choices_inv[i])) 78 78 self._pid_sign_callback = lambda i: Qt.QMetaObject.invokeMethod(_pid_sign_check_box, "setChecked", Qt.Q_ARG("bool", self._pid_sign_choices_inv[i]))
self._pid_sign_callback(self.pid_sign) 79 79 self._pid_sign_callback(self.pid_sign)
_pid_sign_check_box.stateChanged.connect(lambda i: self.set_pid_sign(self._pid_sign_choices[bool(i)])) 80 80 _pid_sign_check_box.stateChanged.connect(lambda i: self.set_pid_sign(self._pid_sign_choices[bool(i)]))
self.top_grid_layout.addWidget(_pid_sign_check_box, 3, 2) 81 81 self.top_grid_layout.addWidget(_pid_sign_check_box, 3, 2)
self._pid_kp_range = Range(0, 2**13-1, 1, 0, 200) 82 82 self._pid_kp_range = Range(0, 2**13-1, 1, 0, 200)
self._pid_kp_win = RangeWidget(self._pid_kp_range, self.set_pid_kp, 'pid_kp', "counter_slider", int) 83 83 self._pid_kp_win = RangeWidget(self._pid_kp_range, self.set_pid_kp, 'pid_kp', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid_kp_win, 2, 1) 84 84 self.top_grid_layout.addWidget(self._pid_kp_win, 2, 1)
self._pid_ki_range = Range(0, 2**13-1, 1, 0, 200) 85 85 self._pid_ki_range = Range(0, 2**13-1, 1, 0, 200)
self._pid_ki_win = RangeWidget(self._pid_ki_range, self.set_pid_ki, 'pid_ki', "counter_slider", int) 86 86 self._pid_ki_win = RangeWidget(self._pid_ki_range, self.set_pid_ki, 'pid_ki', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid_ki_win, 3, 1) 87 87 self.top_grid_layout.addWidget(self._pid_ki_win, 3, 1)
self._pid_kd_range = Range(0, 2**13-1, 1, 0, 200) 88 88 self._pid_kd_range = Range(0, 2**13-1, 1, 0, 200)
self._pid_kd_win = RangeWidget(self._pid_kd_range, self.set_pid_kd, 'pid_kd', "counter_slider", int) 89 89 self._pid_kd_win = RangeWidget(self._pid_kd_range, self.set_pid_kd, 'pid_kd', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid_kd_win, 4, 1) 90 90 self.top_grid_layout.addWidget(self._pid_kd_win, 4, 1)
_pid_int_rst_push_button = Qt.QPushButton('pid_int_rst') 91 91 _pid_int_rst_push_button = Qt.QPushButton('pid_int_rst')
self._pid_int_rst_choices = {'Pressed': 1, 'Released': 0} 92 92 self._pid_int_rst_choices = {'Pressed': 1, 'Released': 0}
_pid_int_rst_push_button.pressed.connect(lambda: self.set_pid_int_rst(self._pid_int_rst_choices['Pressed'])) 93 93 _pid_int_rst_push_button.pressed.connect(lambda: self.set_pid_int_rst(self._pid_int_rst_choices['Pressed']))
_pid_int_rst_push_button.released.connect(lambda: self.set_pid_int_rst(self._pid_int_rst_choices['Released'])) 94 94 _pid_int_rst_push_button.released.connect(lambda: self.set_pid_int_rst(self._pid_int_rst_choices['Released']))
self.top_grid_layout.addWidget(_pid_int_rst_push_button, 4, 2) 95 95 self.top_grid_layout.addWidget(_pid_int_rst_push_button, 4, 2)
self._dac1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200) 96 96 self._dac1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._dac1_offset_win = RangeWidget(self._dac1_offset_range, self.set_dac1_offset, 'dac1_offset', "counter_slider", int) 97 97 self._dac1_offset_win = RangeWidget(self._dac1_offset_range, self.set_dac1_offset, 'dac1_offset', "counter_slider", int)
self.top_grid_layout.addWidget(self._dac1_offset_win, 1, 2) 98 98 self.top_grid_layout.addWidget(self._dac1_offset_win, 1, 2)
self._adc1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200) 99 99 self._adc1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._adc1_offset_win = RangeWidget(self._adc1_offset_range, self.set_adc1_offset, 'adc1_offset', "counter_slider", int) 100 100 self._adc1_offset_win = RangeWidget(self._adc1_offset_range, self.set_adc1_offset, 'adc1_offset', "counter_slider", int)
self.top_grid_layout.addWidget(self._adc1_offset_win, 1, 1) 101 101 self.top_grid_layout.addWidget(self._adc1_offset_win, 1, 1)
self.add_const_set_offset_0_0_0_1_0_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset( 102 102 self.add_const_set_offset_0_0_0_1_0_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 103 103 addr=addr,
port=port, 104 104 port=port,
device='/dev/pid_int_rst', 105 105 device='/dev/pid_int_rst',
const=pid_int_rst, 106 106 const=pid_int_rst,
) 107 107 )
108 108
self.add_const_set_offset_0_0_0_1_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset( 109 109 self.add_const_set_offset_0_0_0_1_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 110 110 addr=addr,
port=port, 111 111 port=port,
device='/dev/pid_sign', 112 112 device='/dev/pid_sign',
const=pid_sign, 113 113 const=pid_sign,
) 114 114 )
115 115
self.add_const_set_offset_0_0_0_1_0_0_0 = redpitaya_gnuradio.add_const_set_offset( 116 116 self.add_const_set_offset_0_0_0_1_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 117 117 addr=addr,
port=port, 118 118 port=port,
device='/dev/pid_kd', 119 119 device='/dev/pid_kd',
const=pid_kd, 120 120 const=pid_kd,
) 121 121 )
122 122
self.add_const_set_offset_0_0_0_1_0_0 = redpitaya_gnuradio.add_const_set_offset( 123 123 self.add_const_set_offset_0_0_0_1_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 124 124 addr=addr,
port=port, 125 125 port=port,
device='/dev/pid_ki', 126 126 device='/dev/pid_ki',
const=pid_ki, 127 127 const=pid_ki,
) 128 128 )
129 129
self.add_const_set_offset_0_0_0_1_0 = redpitaya_gnuradio.add_const_set_offset( 130 130 self.add_const_set_offset_0_0_0_1_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 131 131 addr=addr,
port=port, 132 132 port=port,
device='/dev/pid_kp', 133 133 device='/dev/pid_kp',
const=pid_kp, 134 134 const=pid_kp,
) 135 135 )
136 136
self.add_const_set_offset_0_0_0_1 = redpitaya_gnuradio.add_const_set_offset( 137 137 self.add_const_set_offset_0_0_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 138 138 addr=addr,
port=port, 139 139 port=port,
device='/dev/pid_sp', 140 140 device='/dev/pid_sp',
const=pid_sp, 141 141 const=pid_sp,
) 142 142 )
143 143
self.add_const_set_offset_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset( 144 144 self.add_const_set_offset_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 145 145 addr=addr,
port=port, 146 146 port=port,
device='/dev/dac1_offset', 147 147 device='/dev/dac1_offset',
const=dac1_offset, 148 148 const=dac1_offset,
) 149 149 )
150 150
self.add_const_set_offset_0_0_0 = redpitaya_gnuradio.add_const_set_offset( 151 151 self.add_const_set_offset_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr, 152 152 addr=addr,
port=port, 153 153 port=port,
device='/dev/adc1_offset', 154 154 device='/dev/adc1_offset',
const=adc1_offset, 155 155 const=adc1_offset,
) 156 156 )
157 157
158 158
def closeEvent(self, event): 159 159 def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "pid_only") 160 160 self.settings = Qt.QSettings("GNU Radio", "pid_only")
self.settings.setValue("geometry", self.saveGeometry()) 161 161 self.settings.setValue("geometry", self.saveGeometry())
event.accept() 162 162 event.accept()
163 163
def get_port(self): 164 164 def get_port(self):
return self.port 165 165 return self.port
166 166
def set_port(self, port): 167 167 def set_port(self, port):
self.port = port 168 168 self.port = port
169 169
def get_pid_sp(self): 170 170 def get_pid_sp(self):
return self.pid_sp 171 171 return self.pid_sp
172 172
def set_pid_sp(self, pid_sp): 173 173 def set_pid_sp(self, pid_sp):
self.pid_sp = pid_sp 174 174 self.pid_sp = pid_sp
self.add_const_set_offset_0_0_0_1.set_const(device='/dev/pid_sp', const=self.pid_sp) 175 175 self.add_const_set_offset_0_0_0_1.set_const(device='/dev/pid_sp', const=self.pid_sp)
176 176
def get_pid_sign(self): 177 177 def get_pid_sign(self):
return self.pid_sign 178 178 return self.pid_sign
179 179
def set_pid_sign(self, pid_sign): 180 180 def set_pid_sign(self, pid_sign):
self.pid_sign = pid_sign 181 181 self.pid_sign = pid_sign
self._pid_sign_callback(self.pid_sign) 182 182 self._pid_sign_callback(self.pid_sign)
self.add_const_set_offset_0_0_0_1_0_0_0_0.set_const(device='/dev/pid_sign', const=self.pid_sign) 183 183 self.add_const_set_offset_0_0_0_1_0_0_0_0.set_const(device='/dev/pid_sign', const=self.pid_sign)
184 184
def get_pid_kp(self): 185 185 def get_pid_kp(self):
return self.pid_kp 186 186 return self.pid_kp
187 187
def set_pid_kp(self, pid_kp): 188 188 def set_pid_kp(self, pid_kp):
self.pid_kp = pid_kp 189 189 self.pid_kp = pid_kp
self.add_const_set_offset_0_0_0_1_0.set_const(device='/dev/pid_kp', const=self.pid_kp) 190 190 self.add_const_set_offset_0_0_0_1_0.set_const(device='/dev/pid_kp', const=self.pid_kp)
191 191
def get_pid_ki(self): 192 192 def get_pid_ki(self):
return self.pid_ki 193 193 return self.pid_ki
194 194
def set_pid_ki(self, pid_ki): 195 195 def set_pid_ki(self, pid_ki):
self.pid_ki = pid_ki 196 196 self.pid_ki = pid_ki
self.add_const_set_offset_0_0_0_1_0_0.set_const(device='/dev/pid_ki', const=self.pid_ki) 197 197 self.add_const_set_offset_0_0_0_1_0_0.set_const(device='/dev/pid_ki', const=self.pid_ki)
198 198
def get_pid_kd(self): 199 199 def get_pid_kd(self):
return self.pid_kd 200 200 return self.pid_kd
201 201
def set_pid_kd(self, pid_kd): 202 202 def set_pid_kd(self, pid_kd):
self.pid_kd = pid_kd 203 203 self.pid_kd = pid_kd
self.add_const_set_offset_0_0_0_1_0_0_0.set_const(device='/dev/pid_kd', const=self.pid_kd) 204 204 self.add_const_set_offset_0_0_0_1_0_0_0.set_const(device='/dev/pid_kd', const=self.pid_kd)
205 205
def get_pid_int_rst(self): 206 206 def get_pid_int_rst(self):
return self.pid_int_rst 207 207 return self.pid_int_rst
208 208
def set_pid_int_rst(self, pid_int_rst): 209 209 def set_pid_int_rst(self, pid_int_rst):
self.pid_int_rst = pid_int_rst 210 210 self.pid_int_rst = pid_int_rst
self.add_const_set_offset_0_0_0_1_0_0_0_0_0.set_const(device='/dev/pid_int_rst', const=self.pid_int_rst) 211 211 self.add_const_set_offset_0_0_0_1_0_0_0_0_0.set_const(device='/dev/pid_int_rst', const=self.pid_int_rst)
212 212