Forum Replies Created
-
AuthorPosts
-
Anders SøborgKeymasterLooks ok – be sure not to clear the mailbox each time you read it.
Try to go through all mailboxes in your PC application. If that doesn’t work try the following…
If I remember correctly – the NXT has something with the ten first mailboxes being for read and the next ten being for write (it might be the other way around). So you might need to add ten to your mailbox number on either the PC or NXT side. This is from a phone so you might need to clarify this by having a look at the MonoBrick code yourself…
Anders
Anders SøborgKeymasterHi Matthew
Thanks for the update. So far we have tested it on
NetGear WNA1100. Buy at Amazon.
Edimax EW-7811UN
Buy at AmazonIn general I would expect that most of the adapters that work for with Raspberry Pi also works with the MonoBrick firmware.
Anders
Anders SøborgKeymasterHi – thanks for using MonoBrick firmware
Try to grab the motor. When it is off you can rotate it with your fingers while brake will apply some current so the motor holds it current position. Try to make the motor move at full speed. Sleep one second and then apply either off or brake. Then you should definitely be able to see the difference.
Anders
Anders SøborgKeymasterHi again
Did you create your own profile or are you just calling the move to function?
Anders
Anders SøborgKeymasterHi
Thanks for trying MonoBrick!
What error are you getting? Try to tell in details what you have done!
Anders
Anders SøborgKeymasterPost the program that you have running on the NXT – and I will have a look at it. The “toggle light” and GPS are for “future” use.
Anders
Anders SøborgKeymasterHi Again
¡Works GREAT! Is much more than fast enough to remote controlling the robot in real time, my friend, really really nice work.
Great
I still have problems sending messages to the NXT: my machine sports a rotaing turret for holding the phone, and I want to trigger different movements. I understand that if the program is running, it will compare text strings I could send from single keys using your PC software and, when correct, make the required actions. But it still does nothing, even with the console showing “Write message: OK” in the status bar.
You must be using the wrong mailbox or something else is wrong in your program
Anders
Anders SøborgKeymasterHi Jacek
Are there any alternatives to use monobrick library for android without buying xamarin license?
No Sorry – but if you are a student you can get a discount…
Anders
Anders SøborgKeymasterHi again.
Let me start off by “reviewing” your program. For whatever reason you have the following code when waiting for the tacho count to exceed 3600.
while(motor.GetTachoCount() <= 3600){ System.Threading.Thread.Sleep(1); }
On Windows the minimum sleep time is something like 20-30 ms – what it is on the EV3’s ARM processor I am not aware off but you could do some measurements to find out. Moreover Thread.Sleep is not guaranteed to sleep for exactly the specified amount of time – so that is why you get different results each time. So instead of suspending the current thread with a sleep do busy polling like shown below.
using System; using MonoBrickFirmware; using MonoBrickFirmware.Movement; using MonoBrickFirmware.Display; using MonoBrickFirmware.UserInput; namespace MotorExample { class MainClass { public static void Main (string[] args) { Motor motor = new Motor(MotorPort.OutA); motor.ResetTacho(); motor.On(100); while(motor.GetTachoCount() <= 3600){} motor.Brake(); LcdConsole.WriteLine("Tacho count: " + motor.GetTachoCount()); Buttons btns = new Buttons(); btns.GetKeypress(); motor.Off(); } } }
When I run this program the motor stops at the same position each time (+/- 1 degree). However the position it stops at is 3625 due to that fact that when you “ask” the motor to stop it will have a certain moment of inertia so physically you can not stop strait away. When you run the above program you will probably get a different result – your motor might stop at 3619 each time – why? You might be using rechargeable batteries which has a lower voltage so your motor will actually run slower when you apply full “speed” by calling motor.On(100). Another option could be that your motor might have a slightly larger internal resistance (more friction or even a different internal ohmic resistance). This is the reason why this is a bad solution for position control. Another reason is that the motor might have a large load (a large robot that it has to move) and when you try to brake instantly when it is running at full speed – it will take longer to brake compared to a motor without a load. The position it stops at even depends on the surface on which the robot is running… for some project the code above might be sufficient but if you want to be sure that you end up at the exact position you need to use some sort of control loop.
With a control loop you calculate the difference between where you want to move and the current position. This difference is most often called “the error”. The error is then fed into the controller. Based on the current error (and the previous errors) a new output value is calculated and applied. This is repeated until the error is zero (or within some limits). A control loop is not only limited to controlling the position but can also be applied to control the speed.
The function build into the MonoBrick firmware calls the “kernel” driver which uses a PID controller with a build in ramp generator. This is fine for most motor movements. What is wrong with the ramp of this function?
Anders SøborgKeymasterHi thanks for using the MonoBrick communication library
I am not sure which steps you followed – but did you follow this guide?
Anders SøborgKeymasterHi again
I deleted some part of the discussion since I just realised that I misunderstood what it is your are trying to do.
Are excepting your program to do stop at 3600? this will never work as the sample frequency at which you are polling the tacho count is not fixed. You need to write a control loop with feedback – the easy way is to write a PID controller where your set-point is the position that you want to move to and the feedback is the tacho value. Once you have the PID controller working you need to create a profile generator to generate the profile/ramp that you want the motor “follow”. I will be back from vacation the day after tomorrow – so if you need any help to get started let me know and I can post some code to get the PID controller working.
Anders
Anders SøborgKeymasterHi again
Try the following. Create a WiFi hotspot on your phone – without a encryption/no password. Then connect from your PC to the phone’s WiFi network. Once connected disable your firewall on the PC and run the Android Tunnel software. Check if the connection is ok by sending a motor command or something. Finally try to stream video… this should work.
Anders
Anders SøborgKeymasterHi
Thanks for visiting the site and the kind words.
Sorry no building instructions – I also think that once I get around to programming the robot and creating building instructions a new generation of Mindstorms might have seen the day of light. That is another way of saying that it is on my to do list but not at the top :-). But I was inspired by Agilis – which I think has some building instructions. You can see more here here
Anders SøborgKeymasterAre you using a firewall? Have you installed VLC? What is your configuration – RTSP port video port? Are you connect directly to your phone (your phone is acting as WiFi hotspot) or through a router? What are the settings on your router. Are you forwarding traffic from your PC to your phone on the router? A more detailed description would be nice…
Anders SøborgKeymasterHi
Thanks for trying the MonoBrick Firmware.
There is no need to poll the tacho count. Simply use the functions already provided.
LcdConsole.WriteLine ("Creating a step profile"); motor.SpeedProfileStep(40,100, 1500, 100, true); motor.Off(); System.Threading.Thread.Sleep(2000); LcdConsole.WriteLine ("Move to zero"); motor.MoveTo(40, 0, true); LcdConsole.WriteLine("Motor at position: " + motor.GetTachoCount()); System.Threading.Thread.Sleep(2000);
You can read more about the motor functions here. You might also want to check out the examples here.
Anders
-
AuthorPosts
Follow