Setting up

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #4119
    Author Image
    Antonio Prieto
    Participant

    I am a more or less techie father trying to teach my son to do some programming and robotics with the EV3. We’re building a “mars curiosity robot” replica, using an ipod with the EV3. We already did it, but only with control via the beacon remote, not via wifi.

    We’re trying to set up this libraries to control the EV3 remotely from the Mac or even internet, but… I am getting circular in different parts of the web, trying to figure out what to do next.

    Up to now, I was able to:

    * install monobrick in a sd and make it run in the EV3
    * connect the EV3 to wifi
    * upload a program through terminal (Mac OS), like here:
    http://www.monobrick.dk/guides/ev3firmwareprogrammingguide/
    * make that program run ok.

    * Now… I can compile and install, but it won’t work, any of the other tests, like the TestApplication. Nor in USB nor in wifi.

    In any case, compiling with the wifi option, the console program said “Failed to connect.”. With usb it seemed to respond and I can press some keys and it responds “Motor A power 60″… or so. But the EV3 won’t respond.

    Of course, I am executing at the same time the uploaded program in the EV3 but says “running”, and after a while, it stops.

    [I have a question here:]
    I have compiled TestApplication in mac (xamarin/mono), and it generates “Testapplication.exe”. I executed it in a virtual windows, but since it is a Mac, isn’t there a console program for mac?

    [One last question:]
    This tunnel thing, which i didn’t try as the wifi seemed to work fine, it’s said it won’t work in EV3, only in NXT by now. Is that so? Do I need it to control the Ev3 from the Mac?? I investigated a bit this TCP /UDP/wireshark thing, but it was too much for me without clearer instructions.

    So… I am lost, but eager to try harder with a bit of help.

    Can someone help me with next steps?

    #4123
    Author Image
    Anders Søborg
    Keymaster

    Hi

    Thanks for trying MonoBrick. I think that you might be mixing MonoBrick firmware with MonoBrick communication library.

    • MonoBrick communication library is a library written in C# that let’s you remote control the EV3 using the standard firmware
    • MonoBrick firmware is a firmware replacement that let’s you execute .Net/C# programs on the EV3 brick

    To remote control a EV3 running the MonoBrick firmware you can not use the MonoBrick communication library as it only works with the standard firmware. To establish a connection from a PC to the EV3 running the MonoBrick firmware you simply need to have a program running on the EV3 that accepts a TCP/IP connection and then have the PC establish a connection. Use google to find one of the many tutorial on how to do this in C#…

    Anders

    #4125
    Author Image
    anprieto
    Participant

    many thanks.

    ” you simply need to have a program running on the EV3 that accepts a TCP/IP connection”

    I suppose that Test Application accepts it. I compiled it and uploaded it into the brick, and have it running. And i don’t get it to work. What do you suggest?

    “then have the PC establish a connection. ”

    Do I need a pc? can’t I do it with a mac?

    #4130
    Author Image
    Anders Søborg
    Keymaster

    Hi Antonio

    I am still confused on what it is you are trying to do. Are you running the standard firmware or the MonoBrick firmware (not to be confused with MonoBrick communication library)?

    Anders

    #4131
    Author Image
    Antonio Prieto
    Participant

    Sorry.

    As you suggested me, I am trying to use standard firmware, with the monobrick communication library to be able to control de ev3 brick from my mac computer.

    #4154
    Author Image
    Anders Søborg
    Keymaster

    Hi Antonio

    As you suggested me, I am trying to use standard firmware, with the monobrick communication library to be able to control de ev3 brick from my mac computer.

    If this is the case then you don’t need to

    *install monobrick in a sd and make it run in the EV3
    * connect the EV3 to wifi
    * upload a program through terminal (Mac OS), like here:

    Instead you need to take out the SD card so the EV3 boots the standard firmware and not the MonoBrick Firmware. Then have a look at the programming guide for the MonoBrick communication library which can be found here

    Anders

    #4160
    Author Image
    Antonio Prieto
    Participant

    Hi Anders and thanks again for your response.

    Yes, I understood that from other meesages from you and already realized that. So now:

    I have removed SD
    I have connected EV3 to wifi (followinf your guide here)

    But I’m stuck with UDP receiving and sending messages! I need a tool to do that as it is not mentioned in the guide how to do it from a Mac OS Computer. Can you help me with that?

    Many thanks

    Antonio

    #4164
    Author Image
    Anders Søborg
    Keymaster

    Hi

    Have a look at the programming guide for the MonoBrick communication library… that will show you how to establish a WiFi connection using the MonoBrick communication library…. no need to look at the WiFi guide.

    Anders

    #4170
    Author Image
    Antonio Prieto
    Participant

    Hi Anders,

    I am getting a “Failed to open connection” error when trying to execute my first simple program. The program is very simple, the first example from the guide. Literally, I get this error:

    en MonoBrick.WiFiConnection2.Open()
    en Program.Main(String[] args)
    Error: Failed to open connection
    Press any key yo end….`

    The ev3 brick is connected to wifi and I have established a tcp/ip connection with the brick.

    Compiling the program I get an .exe program, that I execute in the windows virtual machine, as I am using a mac.

    <strong>So, what problem may I have with the program?</strong>

    The program is:

    using System;
    using MonoBrick.EV3;
    
    public static class Program{
    	static void Main(string[] args)
    	{
    		var ev3 = new Brick<Sensor,Sensor,Sensor,Sensor>("wifi");
    		try{
    			ev3.Connection.Open();
    			ev3.MotorA.On(50);
    			System.Threading.Thread.Sleep(3000);
    			ev3.MotorA.Off();
    		}
    		catch(Exception e){
    			Console.WriteLine(e.StackTrace);
    			Console.WriteLine("Error: " + e.Message);
    			Console.WriteLine("Press any key to end...");
    			Console.ReadKey();				
    		}
    		finally{
    			ev3.Connection.Close();
    		}
    	}
    }
    #4171
    Author Image
    Anders Søborg
    Keymaster

    Hi

    Your example looks ok. But why are you running the program inside a VM when the MonoBrick communication library works on Windows, Linux and Mac? When you run inside a VM a lot of things can happen with Network traffic – your host machine has different network settings that the OS running in the VM – this might give your problems like UDP traffic being blocked… Furthermore I need to understand the following:

    The ev3 brick is connected to wifi

    That is good and you are all set to go..

    …and I have established a tcp/ip connection with the brick.

    What do you mean by this? How did you do that? The reason I am asking is that you don’t need to do anything other that connecting the brick to your WiFi network and then use MonoBrick communication library to connect to the brick…. but again try not to run the example inside a VM.

    Hope to hear from you soon…

    Anders

    #4174
    Author Image
    Antonio Prieto
    Participant

    Hi Anders,

    good news, I got it to work BUT in a windows machine. I compiles it in mac, and made it run in a pc with w7. Let me sum up all the things here, and why I am using a VM.

    1) What do I mean with “I have established a tcp/ip connection with the brick.”?
    In this guide: http://goo.gl/eE2cVN, After connecting, it is said that you must establish that TCP connection so I did it with wireshark and packetsender (Mac). That was before I reviewed your code of the library and realized that the library did it automatically :s

    Let me suggest that you delete that part of the guide, or make it clear that it is not necessary.

    2) If I work in a Mac with xamarin / Mono, I can compile the code, BUT, the console program is generated as an .exe for windows. I haven’t found any way to compile it for mac os, even though the compiler is in a mac.

    This is very confusing, and if this mac console cannot be generated, I would suggest that the guides explain this issue very clear, again for us, amateur programmers :).

    3) I have executed this .exe console program in a virtual machine in mac os (with windows 7 installed with Parallels 9). However, I received this failure to connnect message mentioned before. The firewall is deactivated, by the way.

    4) Exactly the same .exe program, I copy it to a windows 7 machine, and it works perfectly!!!

    I hope this helps. I don’t klnow what do you mean with “the library works in MAC”. It compiles, but does not generate a mac console.

    Thanks again for the help. great work.

    #4175
    Author Image
    Antonio Prieto
    Participant

    Hi again Anders, this is a video of the project we’re doing. This is a “replica” of the mars curiosity robot :).

    http://www.youtube.com/watch?v=a-dyAohAi1U

    #4177
    Author Image
    Anders Søborg
    Keymaster

    Hi Antonio

    Great video and a nice idea to use Skype to stream video to the PC…shared it on twitter…

    Let me suggest that you delete that part of the guide, or make it clear that it is not necessary.

    As far as I can tell it says on the top of the page: “This guide descries how to establish a WiFi connection with the EV3 LEGO Mindstorms brick using the standard firmware”. It does not mention anything about the MonoBrick Communication library. To determine how the to establish a connection with the EV3 using the standard firmware I created a Wireshark dump that shows how this is done by the software that comes with the EV3. This is what is show and described in details in the guide…

    If I work in a Mac with xamarin / Mono, I can compile the code, BUT, the console program is generated as an .exe for windows. I haven’t found any way to compile it for mac os, even though the compiler is in a mac.

    A exe file compiled for the .NET framework can run on many different operating systems using Mono. Mono is a open source implementation of the .NET framework. It runs on Windows, Mac OS, Linux and even the EV3 (using the MonoBrick firmware). On Mac OS Simply open a terminal and type “mono someFile.exe” then the program will execute. From Xamarin studio it is also possible to run the program. You might need to make Xamarin open a terminal otherwise it the output will be show in the output window of the IDE.

    I would suggest that the guides explain this issue very clear, again for us, amateur programmers 🙂

    I have to draw the line at some point – and I don’t feel that my site should be a guide on how to use Xamarin studio/Mono there are plenty of other sites that already does that…

    I have executed this .exe console program in a virtual machine in mac os (with windows 7 installed with Parallels 9). However, I received this failure to connnect message mentioned before. The firewall is deactivated, by the way.

    Like I said something must be wrong with your network settings…

    I don’t klnow what do you mean with “the library works in MAC”. It compiles, but does not generate a mac console.

    Look at my answer above

    Anders

    #4188
    Author Image
    Antonio Prieto
    Participant

    Ok, perfect. With this “mono someFile.exe”, now I can work from my Mac.

    Thank you very much.

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.

Posted in

Make a donation