TelloForUnity icon indicating copy to clipboard operation
TelloForUnity copied to clipboard

Conversion of position and orientation to Unity coordinate system

Open joshferns opened this issue 7 years ago • 10 comments

Hello, I've found this to be a good way of converting the position and orientation received by TelloLib to that of Unity's coordinate system.

Maybe after testing, methods for conversion could be added to the repo.

One thing I've noticed is the height data received from TelloLib seems erratic in my case, not really sure why.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TelloLib;

public class TelloPoseReceiver : MonoBehaviour {

   public Vector3 m_position;
   public Quaternion m_rotation;
	
	void Start ()
   {
       Tello.onUpdate += Tello_onUpdate;
   }
       
   private void Tello_onUpdate(int cmdId)
   {
       m_position = new Vector3(Tello.state.posX, Tello.state.posZ, Tello.state.posY);
       m_rotation = new Quaternion(-Tello.state.quatX, Tello.state.quatZ, Tello.state.quatY, Tello.state.quatW);
   }

   private void Update()
   {
       transform.SetPositionAndRotation(m_position, m_rotation);
       //transform.rotation = m_rotation;
       //transform.position = m_position;
   }

   private void OnApplicationQuit()
   {
       Tello.onUpdate -= Tello_onUpdate;
   }
}

joshferns avatar Sep 13 '18 09:09 joshferns

So I have a pretty good start on tracking with my TelloLibForUnity project. I'd like to add all that to my fork of this project though. Still having trouble cloning a fork with GitHub desktop though. Curious if that is on my end, or a setting @comoc needs to change.

I also noticed height is a little erratic, and seems to be updated less frequently than the position data. Here I am tracking both position (red cube) and height (blue cube). This is very basic 2D tracking but I plan to make it in all three dimensions.

https://youtu.be/Q3n4X1Q4HsM?t=73

One major problem is that it doesn't seem to track position during takeoff, so when hover the position is wrong, and needs to be reset. 0,0,0 is when you power the tello on. lots more info here.

https://tellopilots.com/threads/accurate-tello-position-data.1969/

carter-james89 avatar Sep 13 '18 16:09 carter-james89

So I have basic 3D tracking up and running. Also all inputs run through the input manager for fine tuning. I'm curious @comoc what would you like me to do with my project. I need access to make my own branch or fork, else I'm just gonna upload my own Repo.

https://www.youtube.com/watch?v=9oibKtb8_hk

carter-james89 avatar Sep 15 '18 19:09 carter-james89

@carter-james89 this looks really good, The video you posted the tellopilots forum is even better. Any plans on updating your repo with the 3D tracking?

joshferns avatar Sep 18 '18 10:09 joshferns

Thanks. I'm waiting to see if @comoc wants me to to collaborate in this project, or start my own. Either way @joshferns I can send it to you if you want to try.

If you don't have a flightstick the keyboard will work just fine.

carter-james89 avatar Sep 18 '18 15:09 carter-james89

Hi guys, Thank you for sharing the great works! I really wanted to implement some tracking functionality into my project.

@carter-james89 Could you fork my project and send me a pull request based on it which is including your implementations? Otherwise, can I fork your TelloLibForUnity project?

comoc avatar Sep 19 '18 02:09 comoc

I tried making a fork but it said I didn't have permission to pull. In git desktop.

Here's the better video.

https://youtu.be/KrBYfsxCI60

carter-james89 avatar Sep 19 '18 03:09 carter-james89

Amazing video! You are really great!

Have you ever tried to click the fork button on my project page yet? Not so, this instruction may help you. https://help.github.com/articles/fork-a-repo/

comoc avatar Sep 20 '18 00:09 comoc

Hi @carter-james89 any progress here? If it's possible, could you send me your current project in the mean time? I've been itching to try out the tracking. Thanks.

joshferns avatar Sep 25 '18 07:09 joshferns

hey @joshferns sorry for the delay. I was in LA all last week and the thing just wasn't ready for other people to try. @comoc I just kept getting the same permissions complaint for a fork so I ended up creating my own repository. I credit this one at the top of my git readme as well as my tello thread.

https://tellopilots.com/threads/unity-controller-for-tello-3d-tracking-tello-simulator-flight-stick-support.2288/

carter-james89 avatar Oct 04 '18 02:10 carter-james89

@carter-james89 Thank you for sharing that! Your work is really awesome! I'm very happy to help you.

Sorry for the fork problem. Just for future reference, could you please send me a screen shot or error message after you clicked the Fork button on my TelloForUnity project page? I've tried to create and login with my another new account, then I clicked the Fork button on TelloForUnity project. After that, I succeeded to fork them with no error. Here is the result: image

comoc avatar Oct 04 '18 02:10 comoc