I need to plot a real time signal, 140 points/sec, like an oscilloscope of sorts that traces 7 waves (20 values/sec each). It comes in as a UDP broadcast, this is the visualizer of the traffic. Ideally, this should "flow" to the side, like the output I currently get from the arduino IDE's serial monitor.
I plan to use Qt, which would give me both the networking AND the plotting. I will have an undecorated full-screen modal window (kiosk mode). Output is on an HDMI Touchscreen 1920 x 1080 (but I do not need to use the full surface for the plot, some 40% of it will be used by a GUI). I am thinking I could buffer the values and plot them out only 2-3 times/sec.
Problem is: I have a Raspberry Pi 3 for iron. Do you think a R.Pi can make it or am I just wasting my time with something too undersized for the job?.
Related
So I am building a donkey car in raspberry pi 4 2gb. I have installed the software and all libraries needed and made changes in myconfig.py. My car runs properly, but I couldn't calibrate it to turn properly (left and right) according to https://docs.donkeycar.com/guide/calibrate/. If anyone could help it would be great.
code changes in myconfig.py
# #CAMERA
CAMERA_TYPE = "WEBCAM"
IMAGE_W = 200
IMAGE_H = 120
DRIVE_TRAIN_TYPE = "DC_TWO_WHEEL_L298N"
DC_TWO_WHEEL_L298N = {
"LEFT_FWD_PIN": "RPI_GPIO.BOARD.16", # TTL output pin enables left wheel forward
"LEFT_BWD_PIN": "RPI_GPIO.BOARD.18", # TTL output pin enables left wheel reverse
"LEFT_EN_DUTY_PIN": "RPI_GPIO.BOARD.22", # PWM pin generates duty cycle for left motor speed
"RIGHT_FWD_PIN": "RPI_GPIO.BOARD.15", # TTL output pin enables right wheel forward
"RIGHT_BWD_PIN": "RPI_GPIO.BOARD.13", # TTL output pin enables right wheel reverse
"RIGHT_EN_DUTY_PIN": "RPI_GPIO.BOARD.11", # PWM pin generates duty cycle for right wheel speed
}
This question is probably best asked in the robotics stackexchange or the donkeycar discord. But to answer your question, a differential drive robot (you've chosen the DC_TWO_WHEEL_L298N drive train, so I am assuming you have two motors connected to the L298N) does not need to have it's steering calibrated. So you can ignore that calibration step. The robot is steered by varying the throttle to each motor. For a left turn, the left motor is given less throttle, so it's wheel will turn slower than the right wheel; that will cause the robot to turn in a leftward arc. A right turn is similar but the right wheel turns slower.
So, I need to build a simple gimbal with three servos to control pitch, roll and yaw. I have a 9dof imu which can give me the euler angles in degrees. Can I just connect these angle errors to servo outputs? As in with 1 degree error, the servo should rotate 1 degree, or do I have to use some form of pid control? I have worked with controlling regular dc motors with pid so that the bigger the error, the faster the motor should rotate to compensate. But it's not like I can adjust the speed the servo rotates at.
I recon there would be a problem when the angle error becomes very high in a small amount of time since the servo would take more time to reach the desired position instead of when the error is very small.
I did a similar project. It isn't perfect, but good enough. Cheap servos can't really be precise because of the cheap potentiometer inside and the horrible plastic gears.
There wont be much error overtime because common servos use a potentiometer and not a rotary encoder. Thus a PID is almost impossible.
I know that what I'm going to ask could sounds crazy, but I'm trying to figure out how to resolve a problem in a smart way.
It's quite difficult to explain my problem, that's why I made an hand-made draft downloadable from here :) https://dl.dropboxusercontent.com/u/5049281/static/Images_Impulse_Direction.zip.
images in that zip (copied by Spektre)
The setup can be approximated with a pipe endorsed on a rubber wall. The pipe is firmly connected (whit an unknown position and orientation) to a IMU equipped with an accelerometer and a gyroscope (sample frequency 110 hz).
I would like to discover the direction of the pipe axis (expressed in the IMU reference system) analyzing the data acquired during some taps at the end of the pipe in the same direction of the pipe axis. The taps are applied with the palm of the hand. In the figure the direction should be just on X axis.
I think that if the motion is just a translation (I could verify it checking if gyroscope data is close to zero), the acceleration (with the gravity removed) during the tap should have the same direction of the pipe axis.
Is there a smarter solution than just apply an high-pass filter to the signal an then save the direction of the sample with the higher magnitude?
Thanks for your help!
I'm working in a project that involves gyroscopes...
I'm using Arduino and an ITG 3200 to read the data from the gyroscope. I get 3 values in deg/s for each axis (x,y,z).
My question is: How can I know the actual (physical) position or direction of the device (let's say an airplane). There has to be a math formula or something like that.
Using only the gyroscope signal (which you have to integrate numerically), you'll eventually run into trouble, due to drift. What's normally done is combining an accelerometer (for low frequency signals, i.e. drift) with a gyroscope (for high frequency signals). Here's a link few links showing more or less exactly what you want:
http://www.starlino.com/imu_guide.html
http://www.instructables.com/id/Accelerometer-Gyro-Tutorial
http://www.starlino.com/quadcopter_acc_gyro.html
Also, see these StackOverflow questions:
Combine Gyroscope and Accelerometer Data
Integrating gyro and accelerometer readings
gyro, accelerometer, magnetometer and Kalman filter
How to determine relative position using accelerometer and gyro data
We are working on a similar problem.
We found this video on YouTube especially helpful, as it came with a paper as well as an implementation (which runs on Arduino):
http://www.youtube.com/watch?v=fOSTOnQzZCI
The paper and source code:
http://code.google.com/p/imumargalgorithm30042010sohm/
In our case (getting the orientation of a remote-controlled ball), we also had to include an accelerometer and a magnetoscope.
I want to develop an audio editor using Qt.
For this, I need to plot a waveform of the music track which I think should be a plot of peak amplitude of sound versus time(please correct me if I am wrong).
Currently, I have been using Phonon::AudioOutput class object as an audio sink and connected it with my Phonon::MediaObject class object to play the audio file.
Now, to draw the waveform I need to know the amplitude of audio track at every second (,or so) from this AudioOutput object so that I can draw a line (using QPainter) of length proportional to sound frequency at different times and hence, obtain my waveform.
So, please help me on how to obtain amplitude of audio tracks at different times.
Secondly,am I using the correct way of plotting waveforms of audio tracks - plotting amplitudes of sound against time by plotting lines by QPainter object on a widget at different times.
Thanks.
There is code which does both of the things you ask about (calculating peak amplitude, and plotting audio waveforms) in the Spectrum Analyzer example which ships with Qt (in the demos/spectrum directory).
Screenshot of Spectrum Analyzer demo running on Symbian http://labs.trolltech.com/blogs/wp-content/uploads/2010/05/spectrum.png
This demo also calculates and displays a frequency spectrum. As another commenter points out, this is distinct from a waveform plot: the spectrum is a plot of amplitude against frequency, whereas the waveform plots amplitude against time.
The demo uses QtMultimedia rather than Phonon to capture and render audio. If you are only interested in playing audio, and don't need to record it, Phonon may be sufficient, but be aware that streaming support (i.e. Phonon::MediaSource(QIODevice *)) is not available on all platforms. QAudioInput and QAudioOutput on the other hand are well supported, at least for PCM audio data, on all the main platform targetted by Qt.