回到上一個問題,我正在嘗試使用 Flexsim 與物理機械臂進行連接。目前,我想使用 Rest API 方法。我想知道模型運行時如何向機械臂發送信號。
回到上一個問題,我正在嘗試使用 Flexsim 與物理機械臂進行連接。目前,我想使用 Rest API 方法。我想知道模型運行時如何向機械臂發送信號。
Via Google Translate:
Going back to the previous question, I'm trying to connect with a physical robotic arm using FlexSim. Currently, I want to use Rest API methods. I would like to know how to send a signal to the robotic arm when the model is running.
FlexSim versions 20.1 and greater include an Http API.
For version 20.0 and earlier you'll need to use sendhttprequest (synchronous) or downloadhttprequest (async) application commands.
You can use a model trigger like On Run Start to send a request when the model starts executing.
我現在有一個需要執行的 URL 以使物理對象執行操作
http://192.168.168.100:1880/relativeP?info=[50,0,0,0,0,0]&speed=0.5
我應該如何在 Flexsim 中編寫和執行
In version 20.0:
//specify a text node in the tree where the server's response will be written treenode result = model.find("/Tools").subnodes.assert("response"); result.value=""; //send http request applicationcommand("sendhttpreqeust", "POST", "192.168.168.100", "/relativeP", "?&info=[50,0,0,0,0,0]&speed=0.5", 0, result);
You could also try keeping your parameters within the URL, rather than using the data param:
applicationcommand("sendhttpreqeust", "POST", "192.168.168.100", "/relativeP?info=[50,0,0,0,0,0]&speed=0.5", "", 0, result);
Please check this answer which explains in detail each parameter, and its comment with more detail on the data param.
@Ben Wilson Thank you for helping me solve some problems
I also want to do an experiment. I want to write a printf (result) in Code and write the printed result to Global Talbe. How to implement
You can realize it with a light detector. You stick sensor on your screen and you connect his electric circuit to an input port of your robot plc. FlexSim sets an area under for your detector accordingly to get a signal for your robot.
You can get to a similar physical result by using a gateway interface to your robot controller BUS like DeviceNet, ModBus, ASi, … Then you would communicate by HTTP and your gateway would set a routed input port in your robot plc.
if you try do it by an internet protocol directly, you have to provide us with much more information, because a standard robot language does not have an interface to communicate over TCP/IP with HTTP. Some robot controller support higher programming languages like java, c#, c++, but this depends on your robot firmware version. Then you can listen on an Ethernet port in your PLC directly.
Some Corporations don’t allow a physical connection of PLCs in manufacturing plants with the World Wide Web called internet. Then you have to check if you are allowed to communicate with a robot over Layer-2 Connection of OSI Model. If you don’t, then you can only get data from one ethernet device to a different Ethernet Network by my first suggested approach. You can replace a screen area by any device that emits any light you can control from FlexSim.
14 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved