Anders Søborg

Forum Replies Created

Viewing 15 posts - 376 through 390 (of 411 total)
  • Author
    Posts
  • in reply to: How to handle when a brick is turned off & back on? #3760
    Author Image
    Anders Søborg
    Keymaster

    Hi

    You could also try to send a EV3 command to see if the brick sends a reply. If yes it is a EV3 otherwise a NXT.

    Anders

    in reply to: Other WiFi Dongle than WNA1100 #3757
    Author Image
    Anders Søborg
    Keymaster

    Hi Ulrich

    It is correct that the standard firmware only works with the Netgear WNA1100.

    The MonoBrick firmware has been tested to work with several WiFi adapters. The one you see in the video is

    Edimax EW-7811UN
    Buy at Amazon

    You can find more adapters that work with our firmware at http://www.monobrick.dk/forums/topic/cheap-compact-wifi-adapter-for-monobrick/

    in reply to: How to handle when a brick is turned off & back on? #3755
    Author Image
    Anders Søborg
    Keymaster

    Great so everything is now in place? Keep me posted on your project. You might even create a new thread/topic when you are done to show off the result.

    Anders

    in reply to: How to handle when a brick is turned off & back on? #3752
    Author Image
    Anders Søborg
    Keymaster

    Hi

    I just had a quick look and I don’t see you calling disconnect anywhere. Where do you close the connection?

    Anders

    in reply to: Rotation Count Question #3745
    Author Image
    Anders Søborg
    Keymaster

    No problem

    in reply to: Mailbox Send and Receive on Android #3744
    Author Image
    Anders Søborg
    Keymaster

    Hi

    For the EV3 you would do something like this (taken from the programming guide)

    using System;
    using MonoBrick.EV3;
    using System.Threading;
    public static class Program{
      static void Main(string[] args)
      {
          var ev3 = new Brick<Sensor,Sensor,Sensor,Sensor<("usb");
          ev3.Connection.Open();
          ConsoleKeyInfo cki;
          Console.WriteLine("Press Q to quit");    
          do     
          {    
              cki = Console.ReadKey(true); //press a key    
              switch(cki.Key){
                case ConsoleKey.M:
                    Console.WriteLine("String to send to mailbox");
                    string input = Console.ReadLine();
                    ev3.Mailbox.Send("mailbox1", input, false);
                    break;                                 
              }    
          } while (cki.Key != ConsoleKey.Q);  
          ev3.Connection.Close();
      }
    }

    On the NXT you need to know that in NXT-G mailbox numbers range from 1 to 10, while Monobrick ranges from 0 to 9 so sending to mailbox 0 will be mailbox 1 in NXT-G.

    Hope this helps

    Anders

    in reply to: Unable to start streaming/not sending messages #3743
    Author Image
    Anders Søborg
    Keymaster

    Great – its a good thing that you posted the solution…

    Anders

    in reply to: Remote Debugging with VisualStudio 2013 Express? #3739
    Author Image
    Anders Søborg
    Keymaster

    Since the firmware uses the Mono Runtime I am/was under the impression that remote debugging only works with MonoDevelop/Xamarin studio as described in the programming guide. However after doing a little search I found that it might be possible using MonoTools for Visual Studio. Here is what I found so far:

    MonoTools for Visual Studio 1.0 supports the Hard Debugger interface, and MonoTools for Visual Studio 2.0 introduces support for the Soft Debugger as well.

    from Mono Debugger.

    Getting started with MonoTools might also be helpfull.

    Please let all of us know how it goes…

    Anders

    in reply to: No WiFi-Connection with Edimax EW-7811UN: SOLVED #3730
    Author Image
    Anders Søborg
    Keymaster

    Hi Martin

    Great – I hope you enjoy the firmware…

    Anders

    in reply to: Java API for Android Apps #3722
    Author Image
    Anders Søborg
    Keymaster

    Hi Matt

    Thanks for visiting my site….

    if there is some Monobrick-like API for java?

    I don’t know to be honest – but I think the best place to ask this question is at the LeJOS forum/site!

    Do you have some documentation about the underlying TCP protocol that is
    used my the native EV3 firmware? I.e. what are the TCP packet / stream
    contents and their respective replies. Is it String-based or byte-based?

    It is byte-based. I think the past place to start is to look at the source
    code of the standard EV3 firmware. It has some documentation that is very
    usefull. You can find it here. Also you might have a look at the source code for MonoBrick.

    What are the limitations to the commands sent to and received from the EV3
    via TCP using the native firmware?

    To many to list here – have a look at the source code.

    Designing the Monobrick firmware on the EV3, have you added any TCP oder UDP
    based protocol that would allow for an extended control of the EV3?

    No – but I have added some extension that allows to send tunnel specific
    commands. I think that the mailbox system is what you might be thinking off.
    This allows you to send custom data back and forth between the PC and EV3.
    However with MonoBrick you can only send custom data. It is nothing that
    can’t be fixed but I haven’t yet had the time to fix it.

    Anders

    in reply to: Rotation Count Question #3720
    Author Image
    Anders Søborg
    Keymaster

    Call the output(float ek) with the error that you just calculated this will give you the output to apply. Call this code with a fixed interval/sample rate. The constructor takes four arguments P, I, D and the sample rate. You will need to do some tuning on the P, I and D to get the desired result. I will move the last part of this discussion to a new thread when I have added a working example to the firmware.

    Anders

    in reply to: Streaming does not work #3718
    Author Image
    Anders Søborg
    Keymaster

    Disable your firewall and try to use wireshark to see if you receive any UDP data from the phone.

    in reply to: Streaming does not work #3713
    Author Image
    Anders Søborg
    Keymaster
    in reply to: Unable to start streaming/not sending messages #3706
    Author Image
    Anders Søborg
    Keymaster

    Hi

    Just try it and see how it goes

    Anders

    in reply to: Rotation Count Question #3704
    Author Image
    Anders Søborg
    Keymaster

    Ok then you need to create your own PID controller. We will add one at some point since the profile as you mention makes it impossible to start at some speed. If you can not wait for this use the following PID code to get started (originally C++)

    
    using System;
    
    namespace MonoBrickFirmware.Movement
    {
    	class PID
    	{
    		private float k1;
    	    private float k2;
    	    private float k3;
    	   
    	    private float Kp;
    	    private float Ki;
    	    private float Kd;
    	   
    	    private float Ts;
    	   
    	    private float ek2;
    	    private float ek1;
    	   
    	    private float uk;
    	    private float uk1;
    	    private float max;
    	    private float min;
    	   
    	    private float maxChange;
    	    private float minChange;
    	   
    	    private bool maxMinChangeSet;
    	    
    		private void update(){
    	      k1 = Kp;
    	      k2 = Kp*(Ts/Ki);
    	      k3 = Kp*(Kd/Ts);
    	    }
     	 	public PID(float P, float I, float D, float newSampleTime, float maxOut, float minOut, float maxChangePerSec = 0.0f, float minChangePerSec = 0.0f){
    			Kp = P;
    			Ki = I;
    			Kd = D;
    			Ts = newSampleTime;
    			ek1 = 0;
    			ek2 = 0;
    			uk1 = 0;
    			max = maxOut;
    			min = minOut;
    			if(maxChangePerSec != 0.0){
    			  maxMinChangeSet = true;
    			  maxChange = Ts * maxChangePerSec;
    			  minChange = Ts * minChangePerSec;
    			}
    			else{
    			  maxMinChangeSet = false;
    			}
    			update();
    		}
    		public void setP(float P){
    		 	 Kp = P;
    		  	update();
    		}
    		public void setI(float I){
    		  	Ki = I;
    		  	update();
    		}
    		public void setD(float D){
    		  	Kd = D;
    		  	update();
    		}
    		public void setMaxMin(float newMax, float newMin){
    			max = newMax;
    			min = newMin;
    		}
    		
    		public void setUk1(float newUk1){
    		 	uk1 = newUk1; 
    		}
    		
    		public void setSampleTime(float time){
    			Ts = time;
    		  	update(); 
    		}
    		
    		public float output(float ek){
    			uk = uk1 + k1 *(ek -ek1) + k2*ek +k3*(ek-2*ek1+ek2);
    			if(uk > max){uk = max;}
    			if(uk < min){uk = min;}
    			
    			if(maxMinChangeSet){
    			  if( (uk-uk1) > maxChange){uk = uk1 + maxChange;}
    			  if( (uk-uk1) < minChange){uk = uk1 + minChange;}
    			}
    			uk1 = uk;
    			ek2 = ek1;
    			ek1 = ek;
    			
    			return uk;
    		}
    	};
    }
    
    

    Anders

Viewing 15 posts - 376 through 390 (of 411 total)
Posted in

Make a donation