Install OV7251 driver in RPI-3B+ to use with ROS - linux

I wanted to install the OV7251 camera driver to work with a module I've recently purchased, the Arducam OV7251 MIPI, as I need to perform SLAM-like system called Virtual Inertial Navigation (VIN) and global shutter cameras are preferred for this. As far as my system goes, I'm using ROS Kinetic on an RPI-3B+ running Ubuntu 16.04 . I am using this camera as it is near my price point (<20$), and goes through the RPI's CSI Port, which sources say is easier and faster than ones going through USB.
I wanted to take this camera and publish its data to a topic, that way the repository I'm using for VIN, OpenVINS, can track the camera's position. Now, the camera that I'm using doesn't have much on it other than the manufacturer's github page, which does not work on Ubuntu, and cannot connect to ROS. Now, I'm decently inexperienced with RPI's, ROS included, since I wanted to originally perform this on an Arduino, but that was majorly impossible, so I doubt I would be able to write a simple ROS node, let alone one that connected with the CSI port.
Currently, I am unable to find many libraries for this, and help given to me has proved to be un-substantial. The camera does not natively have drivers supported on RPI, which is why I cannot find any /dev/video libraries, cheese turns up nothing, and the command $ Vcgencmd get_camera returns no detected devices. Someone suggested kernel hacking, in order to enable the module in menuconfig using libraries like the ones here. While I do not know much about kernel hacking, he reccomended that I follow this guide and after I run the defconfig line, I should search for "OV7251" in menuconfig and modularize the only one which popped up. And despite flashing and repeating this process multiple times to ensure I did not choose the wrong branch, the rpi-5.4.y branch, or wrong model, the RPI-3B+, I ended up being stuck on the rainbow screen after I rebooted every time. I know that the rainbow screen either means low power, which it wasn't because I had it run before, or a kernel error, which would most likely make sense.
Now, while I would most definitely like to fix the rainbow screen error, I would also like to know, how after installing the OV7251 driver, how do I get it working with ROS to send data to topics? Since I doubt I could write my own node, is there a library that I could look for to perform this, or would libraries that did not work previously due to a missing driver suddenly work now, or would I have to take an existing one and modify it? In any case, A more low-level tutorial to accomplish this would be quite handy seeing as I am new.
But, in the case this is not software, and the reason this camera is not supported is for good reason, is there any other cheap global shutter camera I can work with? I couldn't seem to find many over my various searches, but maybe you all have better luck/experience in this field. Although, I did manage to find another library by this same manufacturer which happens to support my camera model and even has a ROS node that works on ubuntu. However, I believe that if this can be done, then so can doing so by just the CSI port rather than buying an additional 40$ USB camera hat for the pi, and along with that, I am starting to doubt the validity of this companies repositories.
Yet the fact I am finding little information on the topic of this camera alone on the CSI port of an RPI and how renowned this company it scares me that it could be impossible, which if it is, do link me some other good and hopefully well-documented cameras, which could very well be a lot to ask for. And if it is just simply impossible to get the results I want with the parameters I have set, then how badly would a rolling shutter camera affect VIN'S performance, and furthermore is there any special dataset designed for rolling shutter which could minimize the drop in quality? This terrain is all too new to me.

Ok, so I got a rpi engineer to add a dtoverlay for the ov7251 in the rpi's firmware, and the most recent rpi-update has the overlay in the kernel.
I did sudo rpi-update to install the update, i then added dtoverlay=ov7251 to /boot/config.txt in order to enable the overlay, and i edited it by running sudo nano /boot/config.txt. And the repository only has one dependency, v4l-utils, which is installed easily enough by running sudo apt-get install v4l-utils. Finally i ran sudo reboot to initialize the changes.
And in order to pull the images into ROS, i edited a v4l2 node called usb_cam in order to accept the pixel format that the ov7251 camera uses (Y10). My fork can be found here. In order to install it, (since the docs for the original repo say very little on installation), i ran:
cd ~/catkin_ws/src
git clone https://github.com/ai-are-better-than-humans/usb_cam.git
cd ..
catkin_make
and then after that all you have to do is roslaunch usb_cam usb_cam-test.launch to start the node. Mine started out dark, so i had to go into the launch file and mess around with the brightness for a bit. And while youre there, make sure the pixel_format parameter has a value of Y10
You should get a sensor_msgs::Image message being published to a topic named "<camera_name>/image_raw", you can run rqt_graph to visualize it. Big thanks to 6by9 over at raspberry pi forums, dont think i could have gotten it done without him, he did alot of work that im very thankfull for. Thought id share the knowledge back here in case anyone finds it usefull.
EDIT: I hear you can also compile with catkin_make --pkg usb_cam -DCMAKE_BUILD_TYPE=Release instead of catkin_make if the node takes too much CPU. Also, if you see a ton of error messages while compiling, its fine, it still should work, but if you want to get rid of them you can refer to this answer from a ros thread:
It looks like you need to install libavcodec. I don't know the exact
command to install it off the top of my head, but the format will look
like this:
sudo apt-get install libavcodec
The exact package name might not be
libavcodec. It maybe looks something like libavcodec-VERSION-NUMBER or
libavcodec-dev. In these situations you can search for packages with a
command like this:
apt-cache search libavcodec
This will find all packages that have text
containing "libavcodec". This should find the correct package for you
to install.

Related

Problems in transmission and reception in USRP N210

I am developing a code for transmission and reception of a txt file using fec correction and qam modulation. The main problem is in transmission it only send one character or nothing just for a second and then get freeze. It's the first time that i used GNU radio and i don't know what caused this problem can you check the code in the images below and tell me what it could be and how to solve this. If i am doing something wrong please tell me.
Sorry, I don't have the range to post images so instead that I posted links.
This is for TX
Txcode1
Txcode2
This is for RX
RXcode1
RXcode2
You're using an outdated version of GNU Radio, and within that, you're using the explicitly deprecated Packet Encoder, which randomly drops data. Don't do that, you had to pick that block from a category called "Deprecated" for a reason.
Also, it looks like you're using Throttle together with hardware. That doesn't work, and GRC also explicitly tells you it's a bad idea – you should pay attention to the console output in the lower left, it contains useful information!
So, don't start a new project on GNU Radio 3.7; GNU Radio 3.8 or 3.9 is trivial to install from Linux distro sources on any modern Linux Distro, and on Windows, you can use the excellent anaconda installer method.
Afterwards, orient on the examples that come with GNU Radio (installed, typically, under /usr/share/gnuradio/examples) in the digital subfolder. packet_loopback and other files will be good examples to learn from!
Other than that, make sure you've clicked on the "Get Started" button on gnuradio.org, and followed the tutorials up to the point of the PSK transmission tutorial. This should be a good entry to exactly what you're doing.

Tips for customizing a driver for my laptop chassis?

Running an up-to-date Gentoo on my Sager NP8298 (Clevo P177SM-A), and I am heartbreakingly close to having all of my hardware running beautifully. I found a nice open source driver to run my keyboard backlight at this GitHub repo, but the problem was it was made for a Clevo chassis that didn't have the touchpad light that mine does. Kinda tacky, I know, but the problem is that the default color for the touchpad light is blue, and can be kind of distracting when the keyboard is set to a different color.
I'd at least like to be able to turn the light off, if not control its color. I have a Windows install and am able to access the proprietary driver that came with the computer. I just don't quite know where to start on trying to modify this driver, if there were some Windows utilities that I could use to see what the driver is doing and how to access the LED programatically, it would be a huge help. Any ideas?
Other functionality that I'd like to add is Fn+Num pad 7 through 9 for toggling the left, center, and right part of the keyboard individually, and Fn+5 for a num pad light toggle, as the Windows driver does. I just need to know what signals need to be sent to the hardware and how to send them.
Whatever I end up with I'll be sure to fork the project and share the results with other users of this hardware.
You need the source code of driver you want to change. With that and all required bits and bobs (a.k.a. dependences) you can change it to do whatever you want.
That said, there are quite a few things to consider. You need to know, at least at a reasonable level, the language used to build the driver, platform dependencies if any.
I've done similar work for some network drivers like 15 years ago and no it's not a fun job.

Replace Android with real Linux in smartphones?

I always wondered if, android is a linux derived SO, why I can't just compile a Gentoo (for example) with correct arch, and little modifications in boot to fully replace android.
I know that I may miss some functions, but having already kernel sources, and existing AOSP ROMs, and even, with UbuntuOS, I think it should be possible.
The only problem I have is that I don't know anything about the boot process, so even if I could manage to build an image, I wouldn't know how to boot it.
Any hints, information, or advises about this area?
P.S. In this case is a Samsung Galaxy S3 (I-9300), but could be applicable to other brands as well.

Grabbing Images from a Webcam to be used with OpenCV

This is a follow up to my previous question,
OpenCV PS 3 Eye
Can someone suggest a library that would allow me grab frames from camera without too much fuss (like video videoinput lib for windows) and pass them to opencv within my application?
I had a parallel problem using a completely different webcam: worked well in cheese/etc, v4l-info showed proper setup, but openCV would fail with:
HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream.: Bad file descriptor
After much flailing I found that at least one guy had similar problems with webcams in various applications.
In blind faith I promptly punched in export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so and «poof» it worked.
The openCV v4l2 interface is not as robust as the v4l implementation and the export is a quick workaround (openCV appears to revert to v4l).
With a quick browse of opencv/modules/highgui/src/cap_v4l.cpp it would appear as though openCV would like to use v4l2.
I'm running Ubuntu Lucid 2.6.32-28-generic x86_64, libv4l-0 v0.6.4-1ubuntu1 with openCV pulled from the HEAD of the repo a few days ago.
In the course of explaining this I've resolved my issue. It turns out that openCV forces the resolution on a v4l2 device to 640x480 by default - and my device had a max 320x240 resolution which caused the fault when testing for the format type in opencv::highgui::cap_v41::try_palette_v4l2. I changed DEFAULT_V4L_WIDTH and, DEFAULT_V4L_HEIGHT.

How can I send input to multiple terminal windows (not tabs)?

I use gnome-terminal (Ubuntu 10.10). I like it, though I'd be willing to switch to another for this feature.
Can anyone tell me how I can broadcast keystrokes to multiple windows? The closest thing I've found is the "Terminator" program, which allows for broadcasting to multiple tabs, but not to multiple windows. Apparently a similar feature was removed from v3 of Konsole when it went to v4 (no idea why). There are also similar capabilities in screen, but not between windows, as far as I can tell.
I've spent a number of hours looking, but no joy.
I'd also be willing for a general solution (input to multiple windows of any kind) that I could adapt for use with terminal windows.
Thanks.
Try with a software called keyboardcast: apt-get install keyboardcast
For the source: http://web.archive.org/web/20100130104001/http://desrt.mcmaster.ca/code/keyboardcast/

Resources