Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

MOBOT steering problem

Solved!
Go to solution

Ok, so if I understand, you need to send 4 bytes, so what you can do is simple:

 

1) FC 0A is constant, so create a constant, right click and make sure "Hex Display" is selected. If you then change display to "Normal Display", you should see something like "ü" and invisible character.

2) Speed1 and Speed2 should have representation set to U8

3) use build array and connect there speed1 and speed2

4) use "Binary Array to String" to convert this generated array (step 3) to generate string

5) concactenate strings from step 1 and step 4

 

you should have string which will contain what you need

 

 

regards,

stefo

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 21 of 29
(1,249 Views)

Yes, it works. Very good, thank a lot. This is what I was looking for.

0 Kudos
Message 22 of 29
(1,243 Views)

Another question. Mobot is equipped with sonars (distance sensors). I want to add an distance 'if' condition - e.g. if distance to an object <5 MOBOT stops. I prepared an if condition, but it doesn't work properly. It looks like timeouts are the problem. MOBOT stops at every moment I don't read data from sonars. On the other hand I cannot read data from sonars continuosly because there is a delay when signal reaches an object and goes back. How to deal with this? How to write condition properly? VI is attached.

0 Kudos
Message 23 of 29
(1,230 Views)

Hi,

 

The first visible problem with your VI is that things do not execute in a loop, therefore you cannot acquire/send multiple commands, as everything executes only once.

 

Please analyze Advanced Serial Write and Read.vi from LabVIEW Examples to see how a continous write/read to/from serial port is performed.

 

Based on that, you can finetune your application,

 

Mircea

0 Kudos
Message 24 of 29
(1,220 Views)

Hi,

 

I did like you adviced but there is another problem... I added a while loop, it helped me to run the program continuously, I also added a distance condition. 

 

The problem is that after when I added this condition, program stopped reading data from sonars. I have no idea why this happened, maybe you have some.

0 Kudos
Message 25 of 29
(1,200 Views)

Hi!

 

Actually your VI won't be able to read the controls but once (you should put them inside the while loop, to let the values update).

 

However I am sort of confused about the condition, could you describe how it is working in more detail?

 

What I see is that you are:

 

1. reading the values from the serial port

 

2. craeting a byte array

 

3. multiplying the byte array by 2 (in DBL representation)

 

3. comparing it to 20.

 

 

Best regards,
Jano
0 Kudos
Message 26 of 29
(1,196 Views)

As you can see, I added a condition only in two places (move ahead and move forward). The point is that when I push the left or right button I can read the data from sensors. I cannot do this when push button ahead or forward (this buttons are connected to condition). Condition should check if the distance value read from chosen sonar is bigger than e.g. 20. if yes - it should allow to move the platform in chosen direction, if not - it should be stopped.

 

I added an while loop for read block, like in file attached but it didn't changed anything.

0 Kudos
Message 27 of 29
(1,193 Views)

Hi,

 

the controls reading was not actually connected to the problem with the comparison.

 

Easy way to find out what is happening would be to put an indicator to the string command you are getting and an indicator to the number you are actually comparing.

 

If the sonar is actually returning the values in ASCII format, you are getting an effect similar to the one in the attached example which I encourage you to try.

 

Best regards,
Jano
0 Kudos
Message 28 of 29
(1,182 Views)

Hi Jan,

 

Thank you for your reply. Probably I didn't describe the problem precisely. When I push one of the buttons connected to the distance condition program don't read data from serial ports (from sonars). It happens only when using buttons connected to distance conditions, if I use any other button, data from sonars are read correctly.

 

I used a .vi you sent before as you suggested and my previous diagnose seems to be confirmed. No data are read when pushing one of buttons connected to distance condition.

 

regards,

Marcin

0 Kudos
Message 29 of 29
(1,180 Views)