|
If a Different Object Recognized= Different Robot Action William from United States [2 posts] |
7 year
|
Hello,
I have three different objects. The Object Recognition module performs excellent and if any of the three objects are recognized, my Trossen Robotics turret performs an action perfectly. I want to recognize three different objects, and if Object 1 is recognized, Action 1 is carried out; if Object 2 is recognized, Action 2 is taken, etc. Is there a cut and paste script?
Thank you
|
|
|
Steven Gentner from United States [273 posts] |
7 year
|
|
|
William from United States [2 posts] |
7 year
|
Hi - I attached a screen shot. The object recognition sees my object named "Red", and labelled it on the screen.
The object name shows up as "Red" in the Watch_Variable.
I'm at a loss as to how to tweak the Roborealm so the Rotate_Servo will move the servo? I'm using Arduino and Sparkfun which moves my Trossen Roboturret when running the object tracking.
Thank you
|
|
|
Steven from United States [1445 posts] |
7 year
|
William,
You are on the right track. If you add the Sparkfun_Arduino module and select that Rotate_Servo variable in one of the PWM servo channels that should change the servo value when a particular object is seen. I'm assuming that in the Rotate Left state tab in the state machine module you assign a different value to Rotate_Servo and then have it transition immediately (immediate transition selection) back to the State 1 tab? Likewise the other objects would need to be added below the Red Condition to go to the respective tabs. Essentially State 1 acts like a switch or select statement that will call other tabs to set the variable accordingly and then return back to state 1 in case other objects become in view.
As long as each state uses the correct servo position (typically 500 to 2500) you can use that variable directly in the Arduino module to control a particular channel.
STeven.
|
|