I'm starting my project which is simply about reading the I/Q data from SDR Radio software like GNU Radio as an input for my own application. I thought about using the pipe command to do so, but don't really know how to use it in this case. Another idea is to get I/Q data directly from sound card.
I would like to ask you what is the most effective way to get these data. Thanks.
Named pipes are a very common way to do this. The concept is simple. First, you create a named pipe using the mkfifo command:
$ mkfifo my_named_pipe
$ ls -l
prw-rw-r-- 1 user user 0 Dec 16 10:04 my_named_pipe
As you can see, there's a new file-like thing with a 'p' flag.
Next, configure your GNU Radio app to write to this pipe (i.e. by using a file sink or file descriptor sink).
Then, all you need to do is configure your app to read from this file. Note that the GNU Radio app and your app need to run at the same time.
Of course, you could consider simply writing your app in GNU Radio. Using Python blocks, it's very easy to get started.
Related
I am new to LiDAR technology. From the Documentation I found that we can visualize LiDAR data using Veloview software. But my aim is to create a 3D image using .pcap file and process it further for object detection. Whole working is in Ubuntu 14.04.
Can anyone provide me a good solution?
Open 6 terminal tabs (Ctrl + Shift + t):
1st tab:
$ roscore
2nd tab (run your .pcap file):
$ rosrun velodyne_driver velodyne_node _model:=VLP16 _pcap:=/path/to file.pcap
3rd tab: (create .bag file to visualize in Rviz)
$ rosrun rosbag record -O vlp_16.bag /velodyne_packets
4th. tab: (play your .bag file just created from 3rd. tab):
$ rosbag play vlp_16.bag
5th. tab: (to convert velodyne_msgs/VelodyneScan to /Pointcloud2 and /LaserScan topic to visualize in Rviz):
$ roslaunch velodyne_pointcloud VLP16_points.launch
6th. tab: (fixed frame MUST be assigned to "velodyne")
$ rosrun rviz rviz -f velodyne
In Rviz:
To visualize /scan topic:
Displays -> Add -> By topic -> LaserScan
To visualize velodyne_points topic:
Displays -> Add -> By topic -> PointCloud2
Enjoy!
I would suggest looking into using ROS and the point cloud library. There is a lot of support for this kind of processing using those. For pulling in the data form the VLP-16 you could use this ROS package.
You may use the Point Cloud Library.
Compiling PCL is a bit tricky, but once you get it going, you can do quite a lot of point cloud analysis.
Follow the instructions here for the LiDAR HDL Grabber.
For your purpose, you will want to include the <pcl/io/vlp_grabber.h> along with the <pcl/io/hdl_grabber.h>. The vlp_grabber, basically uses the same hdl_grabber but supplies the vlp calibration parameters. Also in the main, you will want to instantiate a pcl::VLPGrabber instead of a pcl::HDLGrabber.
These few changes alone may not be enough to getting a fully functional grabber and viewer, but it is a start.
The example on PCL is for the hdl_viewer_simple.cpp but there is also a vlp_viewer.cpp also located in visualization/tools/. Check that out.
This is not an answer to fully solve your problem, but provide a path to a solution if you want to use PCL.
I am trying to find a way to send a large amount of SIP INVITE from my linux OS to a remote application that accept SIP INVITE.
I found a way to send many SIP INVITE from the same source (i.e. ip.ethernetcard local linux os):
sipp -sn uac ip.remote.app -i ip.ethernetcard local linux os -m 10 -s "name.user"
This send 10 SIP INVITE. The problem is when I look at the log on the remote side (using tcpdump), I see that source is always the same (ip.ethernetcard local linux os). Is there a way to minimic different sources i.e. we are pretending that we have multiple clients talking to the remote app ?
Use some sip stress test tool such as SIPp to generate varied INVITE messages.
Injecting values from an external CSV during calls
You can use "-inf file_name" as a command line parameter to input values into the scenarios. The first line of the file should say whether the data is to be read in sequence (SEQUENTIAL), random order (RANDOM), or in a user based manner (USER). Each line corresponds to one call and has one or more ';' delimited data fields and they can be referred as [field0], [field1], ... in the xml scenario file. Example:
SEQUENTIAL
sipp1
sipp2
sipp3
...
Will be read in sequence (first call will use first line, second call second line). At any place where the keyword "[field0]" appears in the scenario file, it will be replaced by either "sipp1", "sipp2" or "sipp3" depending on the call.
As before, use
sipp -sn uac ip.remote.app -i ip.ethernetcard_local_linux_os -m 10 -s "name.user"
add -inf file_name and -sf uac.xml
In the xml file (standard example taken from sipp web page), replace
sip:sipp[local_ip]:[local_port]>;tag=[call_number]
sip:[field0]#[local_ip]:[local_port]>;tag=[call_number]
That is it.
I'm trying to write a program that uses GStreamer to connect to PulseAudio as a source so that I can intercept any audio that's being played. I have no need to play it back so my assumption is that my pipeline only needs a source and demuxer, I'm not sure of the latter though. The hello world example that I'm working off of is here, except that instead of using "filesrc" I'm using "pulsesrc".
Is there a good example that shows this out there already and I haven't found the right combination of terms to make Google give it to me? Do you have to do anything to PulseAudio to make it let you monitor its stream? Should I actually be trying to instead connect to a sink to monitor what's being played?
I think you will need to check the sources with e.g.:
pacmd list-sources | grep -e device.string -e 'name:'
and then connct to the source ending on ".monitor" by using the "device" property of pulsesrc.
My goal is to run a bash script automatically whenever any new file is added to a particular directory or any subdirectory of that particular directory.
Detail Scenario:
I am creating an automated process for file submission from teachers to students and vice versa. Sender will upload file and it will be stored inside the Uploads directory in the LAMP server in the format, ex. "name_course-name_filename.pdf". I want some method so that when any file stored inside the Uploads folder, the same time a script will be called and send that file to the list of receives.
From the database I can find the list of receiver for that particular course and student.
The only concern of mine is, how to call a script automatically and make it work on individual file whenever the content of the directory changes. Cron will do in intervals but not a real time work.
Linux provides a nice mechanism for that purpose which is called inotify. inotify is mostly available as a C API. But there have been developed shell utilities as well. You should use inotifywait from inotifytools (pkg name in debian) for this. Here comes a basic example:
#!/bin/bash
directory="/tmp" # or whatever you are interested in
inotifywait -m -e create "$directory" |
while read folder eventlist eventfile
do
echo "the following events happened in folder $folder:"
echo "$eventlist $eventfile"
done
Update:
If the problem goes complicated, for example you'll have to monitor recursive, dynamic directory structures, you should have a look at incron It's a cron like daemon which executes scripts on certain events. But the events are file system events rather than timer events.
There is another option to 'inotifywait':
-d --daemon
Same as --monitor, except run in the background logging events to a file
that must be specified by --outfile. Implies --syslog.
For completeness:
-m --monitor
Instead of exiting after receiving a single event, execute indefinitely.
The default behaviour is to exit after the first event occurs.
Within the do-done block of your 'while' statement, you might parse each event report for interesting details then use 'case-esac' to take action based on each event that you care about.
For something that you plan to rely on for your operations, you might also consider replacing the hard-coded '$directory' with some sort of configuration file. Such a file might include the path and filename, the interesting events for that path and file, and a script to run when those events happened.
The script might take the list of events as parameters and then 'case-esac' again.
Just one man's ramblins,
~~~ 8d;-Dan
I'm working on an application controller for a program that is spitting text directly to /dev/tty.
This is a production application controller that must be able to catch all text going to the terminal. Generally, this isn't a problem. We simply redirect stdout and stderr. This particular application is making direct calls to echo and redirecting the result to /dev/tty (echo "some text" > /dev/tty). Redirects via my application controller are failing to catch the text.
I do have the source for this application, but am not in a position to modify it, nor is it being maintained anymore. Any ideas on how to catch and/or throw away the output?
screen -D -m yourEvilProgram
should work. Much time passed sinced I used it, but if you need to read some of its output it could even be possible that you could utilize some sockets to read it.
[Added: two links, Rackaid and Pixelbeat, and the home page at GNU]
The classic solution to controlling an application like this is Expect, which sets up pseudo-terminals, does logging, and drives the controlled application from a script. It comes with lots of sample scripts so you can probably just adapt one to fit your needs.
This is what I did in python
import pty, os
pid, fd = pty.fork()
if pid == 0: # In the child process execute another command
os.execv('./my-progr', [''])
print "Execv never returns :-)"
else:
while True:
try:
print os.read(fd,65536),
except OSError:
break
I can't quite determine whether the screen program mentioned by #flolo will do what you need or not. It may, but I'm not sure whether there is a logging facility built in, which appears to be what you need.
There probably is a program out there already to do what you need. I'd nominate sudosh as a possibility.
If you end up needing to write your own, you'll probably need to use a pseudo-tty (pty) and have your application controller sit in between the user's real terminal connection and the the pty device, where it can log whatever you need it to log. That's not trivial. You can find information about this in Rochkind's "Advanced UNIX Programming, 2nd Edn" book, and no doubt other similar books (Stevens' "Advanced Programming in the UNIX Environment" book is a likely candidate, but I don't have a copy to verify that).