Does someone knows how to preform Camera-IMU time offset using GTSAM? - slam-algorithm

Now I have the camera pose and IMU measurement where there exists a time-offset between them? How to model this problem in a factor graph and do estimation use GTSAM, Do someone ever did similar works before? Any advice is needed. Thanks!

Related

Saving Data in Dymos Changes Optimisation and Simulation Results

I had a similar issue as expressed in this question. I followed Rob Flack's answer but had issues. If anyone could help me out, I would appreciate it.
I used the code suggested in the answer but had an issue: It changed the simulation results. I added a line in the script for the min_time_climb example that goes like this:
phase.add_timeseries_output('aero.mach', units=None, shape=(1,), output_name = "recorded_mach")
I used the name "recorded_mach" so as to not override anything else Dymos may or may not have been recording. The issue is that the default Altitude (h) vs. time graph actually changed, both the discrete points and simulation curve. I ended up recording 4 variables with similar commands to what I have just shown and that somehow made the simulation track better with the discrete optimisation points on the graph. When I recorded another 4 variables on top of that, it made it track worse. I find this very strange because I don't see why recording the simulation should change its output.
Have you ever come across this? Any insight you could provide into the issue would be greatly appreciated.
Notes:
I have somewhat modified the example in order to fit a different sutuation (Different thrust and fuel burn data, different lift and drag polars, different height and speed goals) before implimenting the code described above. However, it was working fine still.
Without some kind of example to look at, I can only make an educated guess. So please take my answer with a grain of salt.
Some optimization problems have very ill conditioned Jacobians and/or KKT matrices (which you as a user would not normally see, but can be problematic none the less). There are many potential causes for this ill conditioning, but some common ones are very large derivatives (i.e. approaching infinity) or very larger ranges in magnitude between different derivatives. Another common cuase is the introduction of a saddle point, where you have infinite numbers of answers that are all equally good. Sometimes you can fix the problem with scaling, other times you need to re-work the problem formulation.
Ill conditioning has two bad effects on the optimizer. First, it makes it very hard for the numerics inside to comput inverses which are needed to compute step sizes. It will get an answer, but may be highly subject to numerical noise. Second, it may prevent certain approximations (like BFGS) from performing well in the first place.
In these cases, small changes in execution order or extra steps (e.g. case recoding) can cause the optimizer to take a different path. If you're finding that the path ultimately leads one case to work and another to fail, then you might have a marginally stable problem where you got lucky one time and not the other.
Look carefully for anything singular-like in your jacobian. 0 rows/columns? a constraint that happens to be satisfied, but still has a 0 row is a problem that comes up in Dymos cases if you forget to add additional degrees of freedom when you add constraints. Saddle points also arise if you're careful with your objective.

The Period of Data Using TI-BASIC

I'm in basic trigonometry and currently learning how to find equations having been given the data only. I understand the concept pretty well, but I usually make a program in a TI-BASIC for solving my homework because it helps me understand it at a deeper level and gain an appreciation for the beauty of math, however this time I'm stumped. Is there a known way to take pure data and find it's period or frequency in a way that can be fully automated on TI-BASIC?
I think I have some potential solutions:
If I can figure out getting a mode on a TI-84 I can just figure out the space between the two numbers who are a part of the mode.
Safely decrease the range of the numbers to make the data more manageable, such as making the numbers between -1 and 1 and finding the space between 1 and the next 1
Guess probable equations and just figure it out through brute force
An example would be finding the period on This Table, hopefully, this makes sense, and if there isn't a known way that's okay. Thank you for your time!

DSP method to detect specific frequency which may not be the most dominant in the current sound

I'm trying to determine the best DSP method for what I'm trying to accomplish, which is the following:
In real-time, detect the presence of a frequency from a set of different predefined frequencies (no more than 40 different frequencies all within a 1000Hz range). I need to be able to do this even when there are other frequencies (outside of this set or range) that are more dominant.
It is my understanding that FFT might not be the best method for this, because it tells you the most dominant frequency (magnitude) at any given time. This seems like it wouldn't work because if I'm trying to detect say a frequency at 1650Hz (which is present), but there's also a frequency at 500Hz which is stronger, then it's not going to tell me the current frequency is 1650Hz.
I've heard that maybe the Goertzel algorithm might be better for what I'm trying to do, which is to detect single frequencies or a set of frequencies in real-time, even within sounds that have more dominant frequencies than the ones trying to be detected .
Any guidance is greatly appreciated and please correct me if I'm wrong on these assumptions. Thanks!
In vague and somewhat inaccurate terms, the output of the FFT is the magnitude and phase of all[1] frequencies. That is, your statement, "[The FFT] tells you the most dominant frequency (magnitude) at any given time" is incorrect. The FFT is often used as a first step to determine the most dominant frequency, but that's not what it does. In fact, if you are interested in the most dominant frequency, you need to take extra steps over and beyond the FFT: you take the magnitude of all frequencies output by the FFT, and then find the maximum. The corresponding frequency is the dominant frequency.
For your application as I understand it, the FFT is the correct algorithm.
The Goertzel algorithm is closely related to the FFT. It allows for some optimization over the FFT if you are only interested in the magnitude and/or phase of a small subset of frequencies. It might be the right choice for your application depending on the number of frequencies in question, but only as an optimization -- other than performance, it won't solve any problems the FFT won't solve. Because there is more written about the FFT, I suggest you start there and use the Goertzel algorithm only if the FFT proves to not be fast enough and you can establish the Goertzel will be faster in your case.
[1] For practical purposes, what's most inaccurate about this statement is that the frequencies are grouped together in "bins". There's a limited resolution to the analysis which depends on a variety of factors.
I am leaving my other answer as-is because I think it stands on it's own.
Based on your comments and private email, the problem you are facing is most likely this: sounds, like speech, that are principally in one frequency range, have harmonics that stretch into higher frequency ranges. This problem is exacerbated by low quality microphones and electronics, but it is not caused by them and wouldn't go away even with perfect equipment. Once your signal is cluttered with noise in the same band, you can't really distinguish on from off in a simple and reliable way, because on could be caused by the noise. You could try to do some adaptive thresholding based on noise in other bands, and you'll probably get somewhere, but that's no way to build a robust system.
There are a number of ways to solve this problem, but they all involve modulating your signal and using error detection and correction. Basically, you are building a modem and/or radio. Ultimately, what I'm saying is this: you can't solve your problem on the detector alone. You need to build some redundancy into your signal, and you may need to think about other methods of detection. I know of three methods of sending complex signals:
Amplitude modulation, which is what it sounds like you are doing now.
Frequency modulation, which tends to be more robust in the face of ambient noise. (compare FM and AM radio)
Phase modulation, which is more subtle and tricky.
These methods can be combined and multiplexed in various ways. Read about them on wikipedia. Moreover, once your base signal is transmitted, you can add error correction and detection on top.
I am not an expert in this area, but off the top of my head, I am not sure you'll be able to use PM silently, and AM is simply too sensitive to noise, as you've discovered, although it might work with the right kind of redundancy. FM is probably your best bet.

Attempting to Implement a Neural Network to solve XOR

I'm hoping some of the more experienced users here might have some suggestions for me.
I am implementing a neural network with 2 inputs, 2 hidden nodes, and 1 output.
I have used the sigmoid activation function on both the hidden layer and the output and I'm using back propagation. I am fairly certain I understand the theory correctly. I have the program calculating gradients, updating weights and biases, and I use momentum and strength variables for adjusting.
The point of using multiple layers is to solve non-linearly separable problems, but I have only been able to solve the linear seperable AND and OR boolean functions so far. I have tried playing with all kinds of different momentum and strength settings to no avail.
My usual outputs are always exactly the same for all 4 variables. It was near 0.55 for awhile, until I played with settings and now they're all outputting 0.9. If I remove the bias the first value goes to zero, but not the fourth.
Any suggestions?
To answer my own question ..
After a lot of trial and error, I threw caution to the wind and tried using tanh(x) instead of sigmoid .. and after only a little tweeking, it WORKS!
If anyone else has been struggling with one of these nets, it might work for you.
The derivative is (1 - tanh(x))(1 + tanh(x)).

Deciding on the covariance for a Kalman Filter matrixes

I am beginning to explore using probability in my robotics applications. My goal is to progress to full SLAM, but I am starting with a more simple Kalman Filter to work my way up.
I am using Extended Kalman Filter, with state as [X,Y,Theta]. I use control input [Distance, Vector], and I have an array of 76 laser ranges [Distance,Theta] as my measurement input.
I am having trouble knowing how to decide on the covariance to use in my Gaussian function. Because my measurements are uncertain (The laser is about 1cm accurate at < 1meter, but can be up to 5cm accurate at ranges higher) I do not know how to create the 'function' to estimate the probability of this. I know this function is supposed to 'linearize' to be used, but I'm not sure how to go about this.
I am reasonably confident on how to decide on the function for my state Gaussian, I am happy to use a plain old mean=0,variance=1 on this.. This should work no? I would appreciate some help from people understanding Kalman Filters, because I think I may be missing something.
This paper could be a good starting point for you, but you might just choose to manually tweak the values. That's probably good enough for your application.
For your laser scanner use a variance on the distance of 5cm. The 1cm accuracy below 1m is just tough luck. The Theta is probably very accurate, as this doesn't change, right? If so, take a variance on that of 1°. Assume independence (co-variance is 0).

Resources