Germany
Asked — Edited

Mono Ezb.Connect Not Working

Hello, i tried to program my EZ Robot with C# under Ubuntu 15.04.

using System; using EZ_B;

public class HelloWorld { public static void Main() { Console.WriteLine("Enter IP of EZ-Robot"); string ip = Console.ReadLine(); Console.WriteLine("IP: "+ip ); Console.WriteLine("trying "+ ip); Console.WriteLine("trying to connect with " +ip);

    //connecting
    EZB _ezb = new EZB();
    _ezb.Connect(ip);
    Console.WriteLine("connecting...");
    if (_ezb.IsConnected)
            {
            Console.WriteLine("[+] EZB connected at ip: " + ip);
            }
            else
            {
            Console.WriteLine("[-] EZB NOT connected at ip: " + ip);
            }

}

}

Thats my code, but if i execute it...

patrick@patrick-X781X-X782X:~/ezrobot$ mono bsp.exe Unknown heap type: #GUlD

Unknown heap type: #Blop

Enter IP of EZ-Robot 192.168.1.1 IP: 192.168.1.1 trying 192.168.1.1 trying to connect with 192.168.1.1 Missing method .ctor in assembly /home/patrick/ezrobot/EZ_B.dll, type System.Runtime.CompilerServices.ExtensionAttribute Can't find custom attr constructor image: /home/patrick/ezrobot/EZ_B.dll mtoken: 0x0a00000a

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'EZ_B'. at HelloWorld.Main () [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'EZ_B'. at HelloWorld.Main () [0x00000] in :0

There must be a mistake with the "ez.Connect" command....

Thanks for help, Patrick.


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

#17  
bsp.cs(27,14): error CS1056: Unexpected character `­'
bsp.cs(27,21): error CS1056: Unexpected character `­'
bsp.cs(27,25): error CS1056: Unexpected character `­'
bsp.cs(27,31): error CS1056: Unexpected character `­'
bsp.cs(27,31): error CS1525: Unexpected symbol `Fine', expecting `,', `;', or `='
bsp.cs(27,36): error CS1056: Unexpected character `­'
bsp.cs(27,42): error CS1056: Unexpected character `­'
bsp.cs(27,49): error CS1056: Unexpected character `­'
bsp.cs(27,55): error CS1056: Unexpected character `­'
bsp.cs(27,60): error CS1056: Unexpected character `­'
bsp.cs(27,70): error CS1056: Unexpected character `­'
bsp.cs(27,70): error CS1525: Unexpected symbol `5', expecting `,', `;', or `='
#18  

with this command

_ezb.­Servo.­Set­Servo­Fine­Tune(­Servo.­Servo­Port­Enum.D0, ­5);
PRO
Synthiam
#19  

I just ran that command with no errors - are you executing that method before or after the ez-b is connected?

#20  
using System;
using EZ_B;
   
public class HelloWorld {
 
    static EZB _ezb;
 
    public static void Main() {
 
        _ezb = new EZB();
 
        Console.WriteLine("Connecting to EZ-B v4...");
 
        _ezb.Connect("192.168.1.1");
 
        if (!_ezb.IsConnected) {
 
            Console.WriteLine("Unable to connect to EZ-B v4");
 
            return;
        }
 
        Console.WriteLine("Hello World, I am moving servo d0 to position 90!");
  
        _ezb.Servo.SetServoPosition(Servo.ServoPortEnum.D0, 90);
        _ezb.­Servo.­Set­Servo­Fine­Tune(­Servo.­Servo­Port­Enum.D0, ­5);
 
        _ezb.Disconnect();
    }
}
PRO
Synthiam
#21  

Setting the fine tune after the servo position is set is backward approach.

Try this...


using System;
using EZ_B;
   
public class HelloWorld {
 
    static EZB _ezb;
 
    public static void Main() {
 
        _ezb = new EZB();

        _ezb.­Servo.­Set­Servo­Fine­Tune(­Servo.­Servo­Port­Enum.D0, ­5);
 
        Console.WriteLine("Connecting to EZ-B v4...");
 
        _ezb.Connect("192.168.1.1");
 
        if (!_ezb.IsConnected) {
 
            Console.WriteLine("Unable to connect to EZ-B v4");
 
            return;
        }
 
        Console.WriteLine("Hello World, I am moving servo d0 to position 90!");
  
        _ezb.Servo.SetServoPosition(Servo.ServoPortEnum.D0, 90);
 
        _ezb.Disconnect();
    }
}

Set the fine tune before you use the servos - because that's an offset which the servos will require.

PS, thanks for wrapping your code:D Much easier for my eyes!

#22  

I tried exactly the same code as you posted, but the same error:

[u]bsp.cs(12,14): error CS1056: Unexpected character ­' bsp.cs(12,21): error CS1056: Unexpected character ­' bsp.cs(12,25): error CS1056: Unexpected character ­' bsp.cs(12,31): error CS1056: Unexpected character ­' bsp.cs(12,31): error CS1525: Unexpected symbol Fine', expecting ,', ;', or =' bsp.cs(12,36): error CS1056: Unexpected character ­' bsp.cs(12,42): error CS1056: Unexpected character ­' bsp.cs(12,49): error CS1056: Unexpected character ­' bsp.cs(12,55): error CS1056: Unexpected character ­' bsp.cs(12,60): error CS1056: Unexpected character ­' bsp.cs(12,70): error CS1056: Unexpected character ­' bsp.cs(12,70): error CS1525: Unexpected symbol 5', expecting ,', ;', or =' Compilation failed: 12 error(s), 0 warnings [/u]

PRO
Synthiam
#23  

Not sure where those errors are coming from - but looks like something broken in Mono (not surprising). Try reinstalling mono? Ensuring you have the latest version and dependencies? There are no known issues with the entire EZ-Robot mono library - i ran the entire test last night.

When googling the error "error CS1056", it could be caused by a European character in code: https://msdn.microsoft.com/en-us/library/59k0x971.aspx

Mono, like most programming languages, it not friendly to all character sets. Given that it's complaining about the commas "," and semicolons ";" or something.

PRO
Synthiam
#24  

It indeed looks like strange unicode characters in your code. For example, when i copy and paste the errors that you posted into Notepad.exe, this is what i see.

User-inserted image

Notice how after filtering the code that you posted through notepad (Which removes any bits outside of the ascii-7 charset), displays different errors.

Somehow, your keyboard is putting strange characters into the code while you type.