loading
 
Beginners Intro to RoboRealm?
Christian Claudio from United States  [10 posts]
11 year
Our team is relatively new in using RoboRealm. We got a sample program to track a hand but we would want to know how to get RoboRealm interfacing with the cRIO and make a servo move around. Our team would appreciate it if someone would provide help. Thanks
Steven Gentner from United States  [1446 posts] 11 year
Christian,

The easiest way to interface to the CRio is to use the Network Tables module. That will transmit variables to the CRio that can be accessed from Java, C++ or LabView. See

http://www.roborealm.com/help/Network_Tables.php

for more information about how to do that.

STeven.
Christian Claudio from United States  [10 posts] 11 year
So network tables, we ran over a issue though. We setup the camera for 8 slot in the Setup Axis Camera tool and we plugged it in to #2 Ethernet slot on the cRio. We then plugged in #1 to the PC. I then configured the configured the ipv4 to 10.30.13.5 with subnet 255.0.0.0. I fired up RoboReal, and set the IP to 192.168.0.90 because the tool didn't change the ip because the crio is routing it. It didn't work. What did I do wrong?
Steven Gentner from United States  [1446 posts] 11 year
Christian,

It is recommended not to plug the Axis into the CRio since you should have an onboard router (i.e. the thing the CRio plugs into on the robot). By plugging the camera into the router instead of the CRio you save the CRio from dealing with routing those packets which will save a bit of CPU power for other more important tasks. You should assign 10.30.13.11 (assuming you are team 3013) to the camera, 10.30.13.2 to the CRio and 10.30.13.6 to the PC (acting like the dashboard). Plug the CRio, Laptop and Camera into the router. This would then make the router basically a switch (i.e. it should NOT assign IPs) and everything should be happy.

If you are not already comfortable with working with the router admin interface I'd recommend spending some time with it as in today's world it is a very valuable skill to have (i.e. configuring a router).

Note that the admin url is typically written on the back of whatever router you are using. With the PC plugged in, it should be able to bring up that interface in a browser.

STeven.
Christian Claudio from United States  [10 posts] 11 year
We got the module properly identifying targets, now we are stumped on coding it on LabView. We got the COG X and Y sent via network tables, but we don't know how to make the robot act like a "servo" that rotates and tilt to track the target. Can you give guidance on translating the COG Values to Motor Instructions. Thanks!
Steven Gentner from United States  [1446 posts] 11 year
Christian,

The easiest way is to imagine that the COG_X number is like a joystick number. Joysticks will typically range from -1000 (extreme left) to 1000 (extreme right). You already have that code that translates a joystick movement into a motor movement ... otherwise your robot would not move! Note that this number can also be -1.0 to 1.0 or other variations. The number may change but the technique is still the same.

So with the COG_X which will range from 0 to 320 or 0 to 640 depending on the width of the image you are using (if you are streaming this to the classmate it must be 320 otherwise you will run out of bandwidth or need to limit the frames to something less than realtime). So assuming 320 and using

horiz_value = ((COG_X - 120)*1000)/120

you would translate 0 to 320 to -1000 to 1000. Or using

horiz_value = ((COG_X - 120)*1.0)/120.0

from -1 to 1.

Now you *could* plug this value right into the same routines that handle the joysticks but you probably want to dampen that a bit otherwise you may get very violent movement. So using

horiz_value = ((COG_X - 120)*200)/120

would limit the range from -200 to 200 which would slow things down a bit while testing.

Try the above and see if you can at least get the robot to turn the appropriate amount. Note that this is a very basic technique that assume you are constantly scanning the image and getting updates on COG_X.

Let us know if you get this far ...

STeven.

Christian Claudio from United States  [10 posts] 11 year
So its a VB Script then? How about maintaining some sort of distance away from the target or tracking and following something? How will that be coded?
Thanks!
Steven Gentner from United States  [1446 posts] 11 year
Christian,

It could be a VB script ... or you could just grab the COG_X and calculate all that either in LabView, Java or C++ within the CRio.

Lets ensure that you get this far before jumping into the next items ... one step at a time. There is still a lot to learn from just turning the robot correctly. From doing that, you will better and easier see how distance and tracking can be added.

STeven.
Christian Claudio from United States  [1 posts] 11 year
How is this implemented for Tank Drive?
Steven Gentner from United States  [1446 posts] 11 year
Christian,

That's what I described above. If you are driving using tank drive using a joystick, then you already know how to move the robot based on a X value of the joystick. I'd check the code you already have as to how you are currently doing that. Think of replacing the Joystick X with the COG_X and that should lead you in the right direction.

STeven.
Christian Claudio from United States  [10 posts] 11 year
So the setup for us is, we use 2 joysticks and use only the Y Value of each. If the joysticks are at values 1 and -1, it turns to the right. How is it possible for one value to make that turn. Thanks!
Steven Gentner from United States  [1446 posts] 11 year
While this is possible to do in VBScript, perhaps you can just use

http://www.roborealm.com/help/Differential_Drive.php

which may make you life a little easier. The module just implements two equations that translate vector drive into differential.

So instead of joy_x you would instead use COG_X and a min of 0 and max of 320 (assuming 320x240 image). For now, just leave the forward backward alone until you have gotten the right/left to work.

Note that the resulting left and right motor values would then be sent via NT as apposed to the COG_X.

Since the Jags may prefer decimal numbers, use -100 and 100 in this module and divide by 100 in the CRio before sending the value directly to the Jags. Or you could also use direct PWM values ... depends on how you are doing it. Either way, its just a scale change.

STeven.
Christian Claudio from United States  [10 posts] 11 year
Got it turning, now I'm bugged of that forward/backward. I was thinking of COG_BOX_SIZE and compare it to move the robot.
Steven Gentner from United States  [1446 posts] 11 year
Yup, that should do it. Keep in mind that the scale is a bit different with regards to that. You need to decide what the min and max height of the object will correspond to the min and max motor speed. You do this by deciding how far you want the robot to be from the object and measure its height. That will be your "zero" value where the robot will not move forward or backwards. Then if the object height is X pixels smaller than the base you would move forward at full speed, same with reverse. This min and max height would them be the joy_y value seen in the differential module screenshot. Be careful to set this low so the robot does not move too quickly at first.

For example, lets say we ideally want the object to be 50 pixels in the image. That means we want to target the height to be 50 pixels. We could say that at 5 pixels we want to move full forward and at 200 pixels we move full back. Keep in mind, this is NOT linear, the closer you get the less a pixel size change represent distance while the further back you are a pixel change represents a larger value. But for our purposes a linear model will work assuming we are constantly capturing images.

Don't forget to put the bot on blocks first and use a mobile target to check the wheel speeds. Adjust the values to get something that works and then place it on the ground. Safety First!

STeven.

Christian Claudio from United States  [10 posts] 11 year
Now I just modified some stuff now it doesn't work, What did I do wrong?
Christian Claudio from United States  [10 posts] 11 year
Now I just modified some stuff now it doesn't work, What did I do wrong?

 

program.robo
Steven Gentner from United States  [1446 posts] 11 year
Christian,

As I mentioned before, do NOT use -1 and 1 in the differential module and instead use -100 and 100 and divide that number in LabView to get it into the -1 to 1 range. The differential module is integer based (its used to drive PWM signals 0-255) so it will not do decimal numbers.

STeven.
Christian Claudio from United States  [10 posts] 11 year
Like this?(program.robo)
If it works, how do I get RR to send a boolean that it tracked something steady and this would trigger the shooter? Is the VBScript also correct? Thanks!
program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index