Putting robotics at your service™

Free shipping on orders over $200

Goal-Successfully Send Command and Speed To Waiting Pro28

Print view Share :
Previous topicNext topic

Page 1 of 1 [ 6 posts ]

New ( offline )
Posts: 5
Posted: 2011-01-15 03:02 
I would greatly appreciate any help to get me moving again. My near-term goal is to transition from terminal program macros to Flowstone so that when I press a key of my choosing, the two motors, connected to a RoboClaw, turn. Basically, my progress to get a working Flowstone system is slow.

To this point, I have successfully turned motors by sending RoboClaw commands with a terminal program connected to a BBII (w/ Pro 28) via serial cable (Com 1). I have functioning code which uses a Serin command to receive RoboClaw command (2 digits) and speed (3 digits). These values are stored in variables and used in a Hserout command.

Now, I am trying to switch to Flowstone so I can eventually use a key of my choosing to send certain command/speed combinations via a virtural serial port (currently set to Com3) instead of serial cable (Com 1).

To move both motors forward, the data to send is 08084; command = 08 and speed = 084.

I am attaching the code for a Pro28/RoboClaw combination that will receive the commands being sent. Again, this code works to control two motors using a terminal program macro (Br@yy).

Once I was able to send the command and speed values successfully, I switched to Flowstone. I modified a servo control configuration so it might just send 08084 repeatedly (streaming?) as if I were holding down the F2 which activates the macro in the terminal program. Later I would like to customize key assignments for each action (forward, turn right, turn left, backward).

I don't feel confident that inputting 08084000 is what is needed to feed it 8 bytes? Or is it something else.

Thank you.
Mike

Configuration:
BBII (w/ AtomPro28) connected via (P14 and P15) to RoboClaw 2x10 (set for packet serial).
Serial Cable Connection (for now)
RoboClaw is in Mixed Mode


Attachment:
macro_keypad_control1.bas [504 Bytes]
Downloaded 106 times
Attachment:
Test for Commands to AtomPro28 Via Virtual Com.fsm [9.16 KiB]
Downloaded 122 times
User avatar
Guru ( offline )
Posts: 9257
Posted: 2011-01-17 17:52 
So you are basically using the Atom Pro as a servo controller. Send it values that get converted to servo pulses for the motor controller. Do you need the programmability of the Atom Pro for this? I'm working on your other questions.

_________________
Jim Frye, the Robot Guy
http://www.lynxmotion.com
I've always tried to do my best...


User avatar
Expert ( offline )
Posts: 253
Posted: 2011-01-17 18:25 
On the flowstone side of things you can use the Is Key Pressed module to detect a keypress from the keyboard. This will give you a true/false status of the key that you can use to send your data to the comport. The fsm i attached should give you the general idea for the key detection.


Attachment:
Button press.fsm [8.49 KiB]
Downloaded 124 times

_________________
Devon Simmons, Former Programmer for Lynxmotion.
I can try to help, but I can only offer you my best effort.
User avatar
Rookie ( offline )
Posts: 12
Posted: 2011-01-17 23:21 
Why not use a slider to control the speed?

Here's an example, i'm not sure if the Atom Pro needs a terminator or not but if not disconnect the NL (New Line Component).


Attachment:
Test for Commands to AtomPro28 Via Virtual Com2.fsm [16.83 KiB]
Downloaded 121 times
New ( offline )
Posts: 5
Posted: 2011-01-18 03:32 
Jim,

Does the following flow of commands qualify the Pro28 as a Servo Controller?

Terminal Program --> thru Virtural Com Port (Com 3) --> thru Cat5e --> thru RS232 Converter --> thru Serial Cable to BBII (w/ Pro28) --> Pro28 passess on RoboClaw commands via packet serial setup --> RoboClaw turns two track motors accordingly

I have successfully tested all of the following functions and I believe I need the microcontroller to perform these functions.
    Read Registry for Two Encoders from RoboClaw
    Perform basic calculations (encoder pulses --> distance in feet)
    Output distance to 7-segment display
    (optional) Control bit switch to turn on/off 12V DC power to LED light and IP camera
    (optional) Attached PS2 wireless transmitter to PS2 ports...just in case I want to upload the PS2 control code and use the PS2 instead of the Cat5e tether

I feel I have been getting strange behavior from Flowstone. After my last post, I did something (not exactly sure what) and as soon as I input 08100, the motors turned (command = 8, speed = 100). If I hit backspace, it stopped. As long as there were 2 valid digits for the command and 3 valid digits for the speed, the motors would turn as they should. It was awesome, but short-lived. Then, after making no changes to the Flowstone configuration, it stopped working. I started tweaking the virtual com port and wondered if I got even further from the working configuration I had. The port was open. Using a terminal program worked fine. I am also modifying sample Flowstone files to see if I can make a connection. Now I can't even get the port to open in Flowstone, while using a terminal program works instantly.

    Should MicroStudio 2.0.0.7 work with a virtual com port? I have to use a serial cable to upload code.

    Does Flowstone support virtual com ports (specifically for a Wiznet RS323/RJ45 converter)? Bummer if it doesn't.

    Are there any common erros I should be looking for when configuring the virtural com port? Beside the obvious like baud, port 5000, stopbits, etc.

At this point, I would settle for a terminal program that can send macros over virtual com ports. Terminal by Br@yy said somewhere that it was compatible with virtual com ports, but I have had no success.

Key Press
Dev5994, I modified a sample Flowstone program (arrows.fsm) to take advantage of the 'is key pressed' component. I am playing around with the sample you provided. Com 1 (serial cable) opened fine.

    What is the format of the Key string?
I have a virtural key code table and can convert to hex, etc. if necessary.

I changed the baud to 38400 and triggered 'send' with the button. The following was output to the log.

    Sent 5 bytes : "08084"
    Received 1 byte : "0"
    Received 1 byte : "8"
    Received 1 byte : "0"
    Received 1 byte : "8"
    Received 1 byte : "4"
    Received 1 byte : ""

The flowstone doesn't continue to repeat the output in the log. I have to press, in this case, the middle mouse key (key code is 04).

I have no idea if the New Line component is need to follow the command, but I recall it worked without it. With the New Line module connected, it add two boxes after 08084. Not sure what the boxes mean.

Slider
DSPRobotics, I like the idea to use the slider as a speed control. Unfortunately, Flowstone crash as soon as I increased the slider. Any thoughts? Laptop has 3GB of memory. I could get by with low, med, high gear using three particular speeds.

I feel more comfortable controlling the rover with 4 keys (forward, backward, right, left) or joystick.

Ultimately, I need the rover to restore to a stopped condition as soon as communication is lost or I release a key. I believe this means the code to hault the rover needs to reside in the AtomPro28. Until consistent communication between Flowstone and the AtomPro28 is established (com then virtual com), the attached code is set up to receive commands (serin), but won't hault automatically.

I am also attaching my attempt to intregrate assisgnable buttons to send four basic commands and speed to rover.
Getting any of these programs to work would be great.

I apologize for writing so much, but I assume it values all of your time in guessing what's happening on my end.

Thanks.

Mike


Attachment:
comand command button test.fsm [12.98 KiB]
Downloaded 113 times
Attachment:
macro_keypad_control_play2.bas [513 Bytes]
Downloaded 129 times
Attachment:
Button press_play.fsm [8.46 KiB]
Downloaded 148 times
User avatar
Guru ( offline )
Posts: 9257
Posted: 2011-01-18 11:18 
mmelendez73 wrote:
Jim,

Does the following flow of commands qualify the Pro28 as a Servo Controller?


Nope! Sorry I misread it as using hservo outputs not hserial outputs. ;)

_________________
Jim Frye, the Robot Guy
http://www.lynxmotion.com
I've always tried to do my best...


 

All times are UTC - 5 hours [ DST ]. It is currently 2014-10-31 00:48
Feedback Form
Feedback Form