How to set the qt gui sink display order in gnuradio? - qt

I create simple grc flow in gnuradio as below:
The expected output show be:
1.qt gui sink
2.frequency sink
3.time sink
But time sink appear first,then gui sink:
How to set the qt gui sink display order in gnuradio?

The location of elements in the GUI is ordered by ROWS and COLUMNS. They can be set in the GUI corresponding properties named 'GUI Hint'.
Example and overview can be found in the wiki:
https://wiki.gnuradio.org/index.php/GUI_Hint

Related

How to read the map output file generated by a project using Cartographer without ROS

Currently I can successfully generate the map output file but I have no idea how to display it in practice. Basically, it should be a 2D SLAM map.
The project I'm using is available at the following link on Github. This project basically uses Google Cartographer 2D SLAM without ROS.
Compiling the project I get an output file called "map_output" but it seems to be completely raw: it's not even binary. How can I convert or read it in a viewable format?
Inside the main file, specifically inside the main function, it can be seen how data consisting of inertial measurements (IMU) is taken as input and processed to provide an output map.
Update: map_output file is available here. (IMU data file is available here.) I'm pretty sure both can be read and/or represented in the same way.

How do I draw a mesh loaded from .obj(wavefront) file in qt3d by reading file myself?

The example code(comes with the Qt creator tool) for loading a wireframe mesh from .obj files in Qt3D draws this elephant (which I found in a site that peddled digital assets).
The question is I want to open the .obj files using my own code and form a geometry. I have code to open .obj file and form triangles. All I want to know is how shall I write the C++ part to populate the geometry.
Like I want to know how to structure the C++ code.
Here is the code that I have to read obj file.
Well for those of you wondering about the same thing I found a github repo that creates a geometry in C++ by reading an OBJ model and rendering it in a Qt3D context.
It is a simple process if you think about it.
First you need to Create a Qt3DRender::QGeometry based object.
class ModelGeometry : public Qt3DRender::QGeometry
{
public:
ModelGeometry(){
}
Then you need to add attributes like points, triangles and normals to it using
auto attribute = new Qt3DRender::QAttribute(parent);
and then adding the attributes to the geometry.
The entire process is illustrated in the repo here: https://github.com/bmkamath2000/Qt3DExamples
After running this repo with the example OBJ file containing the elephant I have got it to draw as expected:
Thanks A Lot!!!

gnuplot - How can I save a graphics file of a plot that is the same as I designed it in xterminal?

I have been making plots for some time now, and they are precisely the way I like them, on screen. The data is coming in from sensors related to solar power collection and storage.
Plotted on screen they look great so I do a screen region capture to save them.
So now I would like to automate the saving process.
Here is what I have done so far:
I set up a cron job so they would be run right at midnight, capturing the whole day and saving it as a .png file
Then it moves the "today.dat" data file to the archive named by date.
This part is all working as designed.
EXCEPT, by using .PNG the images do not look the same.
I really thought png would be the best option, but it turns out that the font used for the X-axis (HH:MM ticks) is too thick and they run together. It looks like a crayon-drawn version of my plot designs.
Can someone please give me some guidance on how to best programatically generate the plots for saving so they look like the way I designed them?
As pointed out in the comments above, the best way is probably to use a different terminal for output to an image file, and simply ignore the fact that the generated images are not identical to what you see on your screen when using the x11 terminal. However, if you really need an exact copy, there are (at least) two options:
You could automate the process of taking a screenshot. You can even do this from within gnuplot, where it might come handy that the GPVAL_TERM_WINDOWID variable contains the X Windows ID for the current plot window. You can use that to make a screenshot of the window after you made the plot:
system(sprintf("xwd -id 0x%x | convert xwd:- screenshot.png", GPVAL_TERM_WINDOWID))
Here I included a call to convert to convert the xwd file format to png.
Another option is to use the xlib terminal, which saves the sequence of commands that the gnuplot_x11 helper application turns into the window you see on the screen. For example,
set term push; set term xlib; set output "file.xlib"; replot; set output; set term pop
will create the file file.xlib that has all the information of the last plot. To later view this plot, use
gnuplot_x11 -noevents -persist < file.xlib
where you might have to specify the path to gnuplot_x11.
Similar as #user8153 suggested for x11, you can use import, which is as convert an imagemagick tool
system("import -window ".GPVAL_TERM_WINDOWID." screenshot.png")
Convenient is also a shortcut to copy the image into clipboard and paste it with Ctrl+v elsewhere:
bind Ctrl-c 'system("import -window ".GPVAL_TERM_WINDOWID." png:- | xclip -sel clip -t image/png")'
See also Show graph on display and save it to file simultaneously in gnuplot.

R Studio/R Accessing Blocks of Previously Run Code

Is there a way to display past commands in R/R Studio?? I know in R Studio there is a shortcut (CTRL+UP Arrow) that allows you to see past lines you have ran. But this shortcut only allows you to access only a single line, not a block of previously run code. Is there a package, or some way in R to display and select blocks of past code in R/R Studio?
Here you can find a description of the panes in R Studio, including the "history" pane.
There you can select several lines and paste them into the code.
Also, you can use the command savehistory() to save your history in a file you can the modify. If you want to choose the name of the file to be saved, use
savehistory(file = filename)
The same option is available in the basic R GUI (MS Windows), with "Save history" in the "File" menu (as a .RHistory file). Then, you can open it with any text editor and modify your history to make a script.
To see a specific number of lines, you can use history(25) (for 25 previous lines).

QFile: chop a file into parts

I am making a Qt application (4.7). Is there a way to split a file easily with QFile so that if I have a file x, I can split it equally into n parts fileX1, fileX2, ... fileXn?
As far as I know there is no in-build QFile method to split an existing file.
Depending on your use-case you can easily read the file into a QByteArray, split that into n parts and save those back to disc. (If you want an example of how to do that, just comment to this answer.)
There used to be an option to configure Qt, to build it with "large file support". Just Google for "qt large file support" (without the quotes), to see many references to this.
But I can't find any mention of this in the the Qt 4.7 Installation guide.
However, the option -no-largefile is mentioned in the page Platform and Compiler Notes - X11.

Resources