So I have a Kawasaki FC006N I recently restored and an now trying to use for a project. What I need the robot to do is just follow motion commands sent over the RS232 connection at full program speeds. So using the DO command wouldn't work. I've installed and looked into K-Roset but it doesn't look like it will do what I need it to do without a license. Basically I have a program that interfaces with a camera and determines pick locations for parts based off of the camera and belt encoder and finds an intelligent/optimized place to stack the part on a pallet. So I figured its easier/possible to do this part with a different PC program and just have it send motion commands to the robot. Any Ideas? Thanks in advance
Send Motion Commands to Kawasaki C Controller over RS232
-
CoyBeard -
July 3, 2023 at 10:49 PM -
Thread is marked as Resolved.
-
-
So I have a Kawasaki FC006N I recently restored and an now trying to use for a project. What I need the robot to do is just follow motion commands sent over the RS232 connection at full program speeds. So using the DO command wouldn't work. I've installed and looked into K-Roset but it doesn't look like it will do what I need it to do without a license. Basically I have a program that interfaces with a camera and determines pick locations for parts based off of the camera and belt encoder and finds an intelligent/optimized place to stack the part on a pallet. So I figured its easier/possible to do this part with a different PC program and just have it send motion commands to the robot. Any Ideas? Thanks in advance
Maybe not as easy as you think................so before you go down this rabbit hole......
Fundamentally the robot executes a motion instruction and looks/processes/queues the next 2 motion instructions in order to achieve fluid motion.
If one of those advanced instructions is not available or it finds a problem with it, it will error out before moving to the previous position.
If you are intended to send literal LMOVE and JMOVE commands including coordinate data, this may be a deep rabbit hole.
Fundamentally RS232 protocol will:
- Encode each character and send it one character at a time.......L then M, then O then V then E.
- It is decoded the other end and just creates a string of LMOVE.
- As far as the robot is concerned, this is just a string......not a command.
- So the issue is to get that string into a motion instruction.
- Something I cannot advise if this is possible at all without some sort of processing first to generate a syntactically correctly formatted command from the received string which will require some sort of side loading in between motion instructions.
It is standard practice to just send coordinate values as opposed to actual instructions.
So the robot is moving to a position that just has difference coordinate values.
This does not include any motion instructions such as JMOVE or LMOVE.
Those instructions are usually already present in the executable program.
Attached is the host communication manual which even though is for D and E controllers, is also valid for C controllers too.
In section 4.0 are some program examples of coordinate data exchange that should assist you, but be warned there are many pitfalls.
I would also advise to obtain hercules application.
You may be able to connect that to K-Roset in order to test the RS232 (although I have never tried it).
However, I would consider obtaining a 2nd user 1HA board (may also require a firmware upgrade too) which has ethernet capability on it, so that you could use TCPIP instead (if your camera has this capability) as doing this using TCPIP is a lot simpler to achieve.
-
Thank you . I read through the document you attached, made a test program, and attempted to execute: it errors at step 3, the RECEIVE function, returning an error code (-896) which means according to the manuals: Option not set up, can't execute and it says to contact customer service.. Then I tried TERMON and TERMOFF with still the same error:
I shouldn't need more than an RS232 connection right? No special board in the controller, firmware? The manual does say (Option) in the title.
I would also advise to obtain hercules application.
You may be able to connect that to K-Roset in order to test the RS232 (although I have never tried it).
How exactly do I do this?
Thanks
-
Now I am by no means an RS232 expert, so the following is just based on my opinion and if you already know the following, ignore it, or can see errors in my statements, please correct me as I'm always open to being corrected in areas I don't quite understand.
When looking at RS232 you have a world of variety and not something you can just take out of the box, plug in, press a button for it to work..
Firstly you need to understand that you are looking at connecting 2 devices together to communicate.
RS232 has many different ways to communicate and not all devices match each other.
You should assume, even though both are using RS232, they will be speaking in different tongues.
This could also impact on the applicable cable required.
Yes, just because it said RS232 on the packet and/or connectors fit, doesn't mean it is correct.
So fundamentally you have:
- Kawasaki
- Camera
- RS232 configurations and software settings needed (this can be a mine field to non experts like me).
- The correct RS232 cable to use as the interface.
- Suitable communication interface (driver/communication program).
- This program will likely need to be specifically written to accommodate both device RS232 structures.
My first recommendation is to:
- Find out if any specific setup/configuration documents exist, relative to Kawasaki and your Camera.
- If not then you should study both devices RS232 communication protocols very carefully.
- The results of this will probably dictate the type of cable you require.
- Try and establish a baseline of communication from 1 device first.
- This is where Hercules (love this application) comes in.
- Use Hercules to either establish communication with Kawasaki or the Camera first.
- This will assist in setting up the correct hardware and software configurations.
- Go here to download Hercules: Hercules SETUP utility | HW-group.com
Now I can assist with setting up a simple RECEIVING setup between your live robot and Hercules.
You need to get your Kawasaki initially configured and hardware setup first..
1. Kawasaki HOST COMMS option needs to be enabled (Check your conversation).
2. Kawasaki CPU board has 2 serial ports available.
3. Depending on controller type, both ports may be populated.
4. As default, the top port is dedicated for programming connection and is available on the front panel.
5. The lower port will either by empty or populated (depending on your controller).
6. If the lower port is populated, you likely have a controller with a FDD installed.
7. If both ports are populated, then you need 1 for programming, 1 for the host communication.
8. Which will mean you should disconnect the FDD and have to lose it's functionality.
So your setup should be:
- Top port, RS232 lead to your PC to use KRTerm or KCWin32 with.
- Lower port, RS232 lead to connect to your external device or PC with Hercules application on it.
- This cable must be a NULL MODEM or RS232C cable and can be used via an RS232=>USB adapter.
-
I successfully set up the HOST COMMS option and I have the second port connected to my PC with Hercules installed. How should I establish a connection?
-
You now need to write a program in the Kawasaki so that you can either read the data from Hercules Serial mode or send data from the Kawasaki to Hercules in Serial mode.
-
Thanks for the help enabling HOSTCOM btw . When I launch Hercules in the serial tab on the computer which is connected to the second port on the controller, the correct COM port selected according to device manager (COM6), 9600 Baud, Data size of 8, Parity: None, Handshake: OFF, Mode: Free, when I click Open it returns "Serial port COM6 opened" in all green. That makes me believe Hercules is properly connected to HOST COM...
As seen in the image I have two programs loaded on the controller for communications testing. One for sending to the controller "pccomtest" and one for receiving from the controller "sndtst". Both I nearly copy pasted from the HOSTCOM manual you previously attached.
First thing I tried was:
- Connecting Hercules to the controller (green text)
- Executing pccomtest (through the pendant)
- In the top send box in Hercules sending: 196,553,390,-36,180,-82 (Which is a point proven solvable)
- but nothing happened, Hercules didn't return anything at all, and the robot program seemed to have paused at the RECEIVE command...
Second thing I tried was to receive from the controller:
- Connected Hercules to the controller (green text)
- Executed sndtst (through the pendant)
- but same thing happened.. Hercules didn't return anything and the program seemed to be stuck at the SEND command. But this time really stuck, I couldn't abort the program and even the ESop didn't work..
Here is what the terminal looked like when I loaded the file: (Looks fine to me)
I read in the manual: "When RECEIVE instruction is executed, the program does not proceed to the next step until the communication is complete" (same for the SEND instruction). So I assume this is a communication error?
-
As I mentioned in my previous post:
When looking at RS232 you have a world of variety and not something you can just take out of the box, plug in, press a button for it to work..
Firstly you need to understand that you are looking at connecting 2 devices together to communicate.RS232 has many different ways to communicate and not all devices match each other.
You should assume, even though both are using RS232, they will be speaking in different tongues.
This could also impact on the applicable cable required.
Yes, just because it said RS232 on the packet and/or connectors fit, doesn't mean it is correct.
1. Just enabling the HOST COMMS is not enough.
2. Firm understanding of the Kawasaki manual is required.
3. You will then see that the examples are not copy and paste examples without additional commands.
4. Examples in Kawasaki manuals are very rarely copy and paste examples, especially RS232 ones.
5. YOU SHOULD ALWAYS ASSUME no 2 devices use the same handshaking and control codes.
6. Firm understanding of what you are connecting to regarding software or hardware handshaking.
7. Your cable needs to be correct for any software or hardware handshaking.
8. Hercules may not be setup correctly for software or hardware handshaking.
9. FUNDAMENTALLY RS232 INTERFACING IS NOT PLUG AND PLAY FOR ALL THE REASONS ABOVE.
RS232 INTEFRACING BETWEEN DEVICES CAN BE A NIGHTMARE
Your Kawasaki code is unlikely to work for several reasons.
Fundamentally you have not setup the Kawasaki port settings for the port the Kawasaki is going to use.
You need to set in your program, port settings for the port your using for your application.
This is explained in the manual, check out PROTRESET, SETSIO
I read in the manual: "When RECEIVE instruction is executed, the program does not proceed to the next step until the communication is complete" (same for the SEND instruction). So I assume this is a communication error?
Correct, it basically waits for the transmission to be correct, or times out (receiving) or a transmission error.
Depending on the error, the program may stop or can be managed in the code.
I have never got RECEIVE/SEND to work with Hercules and I believe this is just down to the cable I'm using and also other settings within Hercules. not the Kawasaki code.
So I have never investigated this any further to find a solution - maybe one day I will.
However, Kawasaki has a work around (alternative commands) to ignore certain hardware or software handshaking lines and control codes, to make it more flexible to interface to peripherals.
Unfortunately these commands are not publicly known (unless you are a Kawasaki veteran like me).
The alternatives to use are: ZRECEIVE and ZSEND.
I have attached the command syntax documents.
Also attached is a file which contains a basic program for just demonstrating receiving from Hercules:
1. Kawasaki is just sat in a continuous receiving loop.
2. Data from Hercules must be terminated with a colon, for example Hello World:
3. Kawasaki will not read anything in if no terminator is seen.
4. If data is sent without a terminator, Kawasaki will not read it.
5. But the data will still be in the pipeline.
6. When terminator is seen, it will then be read and will be added to the data without the terminator.
7. This highlights that my program looks for a specific formatted message (something to consider).
8. Kawasaki needs to be ONLINE via KRTerm or KCWIN to display the received messages.
9. Attached is a video using my C controller connected to PC using NULL MODEM Cable and Hercules.
10. The port I am connected to is the host communication port CN2 on the CPU board.
11. I am using ZRECEIVE command.
12. My program uses advanced coding techniques (local variables and subroutine parameters).
13. It can be loaded on any controller without creating/defining/overwriting existing variables.
Please use my program as an example to try and replicate the video.
When you understand what's going and get some data transfer happening, you then know you have a valid configuration and hardware is correct for Hercules at least.
Your next hurdle will be to make it work with your camera and this may involve either:
- Using the correct cable the camera manufacturer stipulates.
- Using the correct hardware or software handshaking configuration.
- If the received data is very specific, program the Kawasaki to only look for that specific message.
- Setting the Kawasaki port setting correct to communicate with the camera.
- Using SEND and RECEIVE or ZSEND and ZRECEIVE commands.
Hope this helps..................
-
I might have messed up..
So I tried putting the program you attached in the same file as KCWin and sent "LOAD rcvdata.txt" to the controller over the PC Programing port and it errored out: The red error light on the controller was red and the controller was unresponsive until a reboot..
After the reboot everything worked as expected: The "Where" command worked and the "list/P" command worked. So I tried to manually type in the program instead by sending "EDIT newprogramname". Then I got a CPU error (-1100)!! The controller completely froze up with the red error light until I rebooted the controller. The same thig occurs every time I try to write data in any sort of way, though I tried reloading the host coms file again to see if that works and it seemed to load fine. Reading data seems to be fine as I can edit an existing program up until I change something then the error occurs:
-
With CPU errors, it is common for the teach pendant to freeze as the CPU has crashed and is no longer operating.
As to why this has occurred, it's hard to say as CPU errors are difficult to diagnose.
So sometimes you have to reverse what you were doing in order to fix or find the problem.
CPU errors can be generated for many reasons:
- 1GA/1HA failure (bad/corrupt memory or other component failures).
- Other boards on the VME bus failing.
- Data being loaded in maybe corrupt or incorrect format.
- AS/SV firmware failure.
- RAM battery exhausted.
I can't see anything in my file (as it loads in fine and was created by my C Controller).
Maybe your firmware does not accept the ZRECEIVE command during load and crashes.
It is conceivable during the parsing and compiling, the CPU didn't like something and crashed.
What I would do in these circumstances as a first instance is:
- Power on the Controller.
- Attempt 2 backups - 1. via PCMCIA card and 2. via RS232.
- If backup is achievable using both mediums.
- Carry out re-initialisation procedure attached and check if robot fully operational afterwards.
- Then do a DIR command and see if the programs from the file load are still there and delete them.
- Then try again.
- Probably replace RAM battery as a matter of precaution if unknown condition.
If you can get a backup, can you post it, I can load it into my C Controller and see if it reacts the same?
-
I did the backups and reinitialization successfully '(File is attached)
I'm now able to edit programs! I'm going to attempt to use the ZSEND and ZRECIEVE here soon. For now here is the backup if you wanted to poke at it.
For confirmation I did the final steps of reassuring a proper reinitialization and confirmed Zeros, moved the robot around, and looked at the software version which looked good :
-
Good man, glad it worked out for you.
Something got screwed up, but as she's getting old a little Alzheimer's could be creeping in.
Controller file save all looks good.
This is why on 2nd user systems, I backup and completely dump the legacy data and start from a clean controller as you can inherit some nasties from the previous application data and setup configurations.
You can see though the Kawasaki is easily recovered by way of ALWAYS having a most recent backup prior to any issues to hand and using that procedure to recover from if the issue is not hardware related.
Always good practice to confirm things afterwards though......
You're on a real journey of discovery at the moment and building up some good experience.
Already having a recovery under your belt should give you good confidence going forward should it ever occur again.
Key point - to always have a recent backup made prior to any issues.
-
I manually typed in the rs232.pc program, I got rid of the subroutine CALL and just typed the subroutine program in the main program for the sake of my ignorance in not knowing how to make a subroutine yet. And the controller is now talking to Hercules just as it was in your video! Thank you
I've attached the program that's working for me as a txt document:
Now its a matter of putting this in a motion program. I'll keep you posted..
-
Fantastic, you're on your way now and thanks for the update...........
-
I successfully put together a test program : There is a PC program (rs232.pc), built off of kwakisaki 's, that's running along side a Robot Control Program(sndmtn). When the PC program receives a six axis point it sets a precision point and also sets a boolean variable to trigger the robot control program to run the point.
Since I'm a noob at programing old Kawasaki robots, there is probably a much better way to do this so I'm open to suggestions.
Thank you kwakisaki for all the help and resources
-
Well Done.......
Since I'm a noob at programing old Kawasaki robots, there is probably a much better way to do this so I'm open to suggestions.
AS Language allows for many variations of code to produce the same results.
Due to this there are 'many' suggestions available.
If the robot is performing exactly how you intended, ANY programming technique/code used is valid.
Fundamentally with what your doing is 100% correct:
- The main routine executes the result based on a 'trigger' from the background task.
- Your moving to a positional register that is being adjusted by the background task.
Some points to explore:
- Ensuring correct BASE and TOOL coordinates are used.
- Pre-check to ensure 'none ridiculous' values are rejected (range/distance achievable).
- Consider using a robot configuration to ensure the robot posture does not change.
- eg. POINT xxxxx = (x,x,x,x,x,x,), #posture_ref.
But fundamentally you have a 'core' program to build on which functions as intended.
Just a case of 'building' your application to suit and adding to it.
-
Those are good points. Thank you for the help! I'm going to mark this resolved.