Forum Replies Created
-
AuthorPosts
-
Anders SøborgKeymasterMy Xamarin studio version is 4.2.1 – this is the version that I used for the guide…
Anders
Anders SøborgKeymasterHi again
I was under the impression that you used the WinSCP to copy the files to the EV3 over WiFi – I will try to reproduce the problem tonight. As for
Is it possible to SSH via USB? I don’t have a wifi dongle and my laptop’s Bluetooth is shot.
No this is not possible at the moment – but we will add USB and BT in one of the next releases.
Anders
Anders SøborgKeymasterDid you reboot your system after you installed GTK#?
I think that there might be some trouble when loading settings. I will post a more detailed answer once I get home from work.
Anders
Anders SøborgKeymasterNo problem
Anders
Anders SøborgKeymasterWhich version of GTK# are you using?
Anders
Anders SøborgKeymasterHi
Try to ssh to the brick. Go to the apps folder and write “mono yourProgramname.exe” – What happens?
Anders
Anders SøborgKeymasterAlthough this forum is related to MonoBrick communication here are some Phyton code to send a message to the EV3 from a PC over Bluetooth
import struct import ctypes import binascii import socket import time import StringIO import serial import struct from array import array from serial import * from threading import Thread class MailboxMessage(): def __init__(self, mailboxName, msg): self.MailboxName = mailboxName self.msg = msg mailboxNameLength = len(mailboxName)+1 msgLength = len(msg) +1 totalLength = mailboxNameLength + msgLength + 7 self.data = bytearray(b"") self.data.append(totalLength)#length self.data.append(0) self.data.append(100)#sequence number self.data.append(0) self.data.append(129)#Command type - system command without reply 0x81 self.data.append(158)#system command type - WriteMailbox 0x9e self.data.append(mailboxNameLength) self.data = self.data + bytearray(mailboxName) self.data.append(0) self.data.append(msgLength) self.data.append(0) self.data = self.data+ bytearray(msg) self.data.append(0) def Mailbox(self): return self.MailboxName def Data(self): return self.data def Message(self): return self.msg class Receiver(Thread): def __init__(self, serialPort): Thread.__init__(self) self.serialPort = serialPort def run(self): message = [] messageSize=0 while True: for c in self.serialPort.read(size=1): message.append(ord(c)) if len(message) == 2: bytes = array('B', message) messageSize = struct.unpack('<H', bytes )[0] #print messageSize for c in self.serialPort.read(size=messageSize): message.append(ord(c)) bytes = array('B', message[6:7]) mailboxNameLength = struct.unpack('<B', bytes )[0] #bytes = array('B', message[7+mailboxNameLength:7+mailboxNameLength+2]) #mailboxTextLength = struct.unpack('<H', bytes )[0] mailboxName = array('B', message[7:7+mailboxNameLength-1]).tostring() mailboxText = array('B', message[7+mailboxNameLength+2 :messageSize+1]).tostring() mailboxMessage = MailboxMessage(mailboxName, mailboxText) print mailboxMessage.Mailbox() print mailboxMessage.Message() message[:] = [] self.serialPort.close() class Sender(Thread): def __init__(self, serialPort): Thread.__init__(self) self.serialPort = serialPort def run(self): text = "" print "Enter text to send" while(text != "quit\n"): msg = raw_input("") mailboxName = "mailbox1" self.sendMessage(mailboxName, msg) self.serialPort.close() def sendMessage(self, mailboxName,msg): mailboxMessage = MailboxMessage(mailboxName,msg) self.serialPort.write(mailboxMessage.Data()) serialPort = Serial(port='/dev/tty.EV3-SerialPort', baudrate=9600) send = Sender(serialPort) receive = Receiver(serialPort) send.start() receive.start()
To start a program you need to change the command to be a start program command. You can find more info on this and other direct commands here.
Anders
Anders SøborgKeymasterI don’t have my windows PC with me right now – but I downloaded the latest version about a month ago.
Anders
Anders SøborgKeymasterHi
This is really amazing – I hope you succeed to help boost the popularity of MonoBrick firmware…
Isolate timer in even higher priority thread to improve accuracy?
I already think that your approach with the hight priority thread seems good enough (if I understand correctly)
How to debug this on the brick? Xamarin seems to have a bug with mono on windows currently.
Log values to an array and when done write these to a file to plot in matlab. This way you only spend time on “saving” values to the array. It would be nice to debug over a WiFi connection – but for a real-time system it does not make sense. So from your point of view it does not matter if debugging is working or not. Also make sure that when running tests use a release build to get the best performance.
How to use brick sounds which could support “oral debugging”?
Sound support will be available in the next release.
I hope this answers your questions.
Anders
Anders SøborgKeymasterBoth – look at the guide. There are instructions for both Mac and Windows.
Anders
Anders SøborgKeymasterDid you unpack the zip file to a folder? I does not work when you run it from the zip folder.
Have you installed .Net 4.0 runtime?
Try to run the application as adminitrator!
Anders
Anders SøborgKeymasterHi
Do you know about the problem? Any idea to get around it?
No sorry – I did what is shown here. For this I used Mono 2.10.9…
Anders
Anders SøborgKeymasterYes copy the file on the SD card.
From the programming guide
With WinSCP copy all files to the apps folder on the EV3
Anders
Anders SøborgKeymasterHi
Ok – did you copy the MonoBrick.dll as well? If not you will get an exception and the program will crash. We are working on some way to notify the user if you get an exception during runtime.
Anders
Anders SøborgKeymasterFor NXT it is possible – but support for this on the EV3 has not been added. On the NXT you can ask for new messages but this is not how it works on the EV3 – so the communication layer has to be refactored – it can be done I just haven’t had the time. If you need to send data back and forth between a PC and the EV3 you could consider trying the MonoBrick firmware – with this you could send data with unlimited length.
Anders
-
AuthorPosts
Follow