RobotStudio event

How to get started with Robot Web Services and jog a robot via REST API requests

Maxim Riabichev
edited February 2021 in Developer Tools
Hello everyone,

In this video I show the basic requirements for getting up and running with ABB Robot Web Services and RobotWare 6.x controllers.

You will be using the documentation to find valid REST API requests as curl, import it into Postman and send them to the Virtual Controller. No programming knowledge is required.

https://youtu.be/YoEUEmNL5s4

The headers:
Accept: application/json
Content-Type: application/x-www-form-urlencoded;v=2.0

Remember to change Authorization from Basic Auth to Digest Auth.


Let me know if I missed something or if something is unclear.

Also, this post might be interesting for you to read: https://forums.robotstudio.com/discussion/12177/how-to-change-the-listening-port-of-the-virtual-controller-robotware-6-x-and-7-x


Thanks!

Maxim Riabichev
PC Software Support Engineer
Post edited by Maxim Riabichev on

Comments

  • This is really informative, thank you Maxim. This works seamlessly on a new VC in a station with an IRB 120 but when testing it on a previous station I receive the following 400 Bad Request error when sending the jog request:
    c:\agent\agent2\_work\2\s\areas\robapi2\components\rws_motionsystem\rws_resource_motionsystem.cpp[405] Change count mismatch code:-1073436652 icode:-1073436652
    I am guessing "Change count" is the full name of the "ccount" parameter but I'm not sure what that value actually represents and when I should adjust it to anything from 0. Is there any additional insight about that parameter (or error) that you can share?
    Thanks,
    Sebastian
  • After a little digging I found a little more information.

    https://developercenter.robotstudio.com/api/rwsApi/ms_motionsystem_get_page.html

    "change_count = counter to keep count for every change in the motion system(domain)"


    We need to find the correct change count which we need to send to the controller with the jog request.


    So first we GET this resource: http://localhost/rw/motionsystem?resource=change-count


    This will return a <span class="change-count">0</span> which is the value we use in the jog request.


    I think this should help you jog your older stations.


    Maxim Riabichev
    PC Software Support Engineer
  • Here is a description of how to perform a curl request on OmniCore (RW7).

    For http (Without the need of certificate) we first need to disable the default setting that says that the omnicore controller requires a safe connection. This setting is located in the appweb.conf file for the specific robotware you are targeting.
    On my default path installation it located: C:\Users\<YOUR_USERNAME>\AppData\Local\ABB\RobotWare\RobotControl_7.0.4\system

    Change the first parameters from:
    #Listen -1
    ListenSecure -1

    to

    Listen -1
    #ListenSecure -1

    Now you are ready to send the request:
    More info about the requests and their parameters can be found here: https://developercenter.robotstudio.com/api/RWS

    I have used postman to send these requests manually just to prove a working example as in the video above. These are the parameters in order to toggle IO's:

    POST http://localhost/rw/iosystem/signals/none/none/do_00/set-value

    This URL says /rw/iosystem/signals/<NETWORK>/<DEVICE>/<NAME_OF_THE_IO>/set-value


    Authorization:

    Type: Basic Auth
    Username: Default User
    Password: robotics

    Headers:
    Accept: application/hal+json;v=2.0
    Content-type: application/x-www-form-urlencoded;v=2.0
     

    Body:

    Type =  x-www-form-urlencoded (or RAW)

    lvalue: 1 (for True) / 0 (For False)


    Now by hitting send The IO should toggle to the state you defined above as lvalue.

  • Hi! 
    Great video tutorial. In the video it is mentioned that WebService for VC listens to a different port (8881). 
    How can the port be configured and does it support more than one VC on the localhost?
  • Hello,

    Your first question is answered here: https://forums.robotstudio.com/discussion/12177/how-to-change-the-listening-port-of-the-virtual-controller-robotware-6-x-and-7-x

    Regarding your second question, yes you can host multiple VC's on one PC, but you'd have to configure different ports for them. See the thread above how to do it.

    Maxim Riabichev
    PC Software Support Engineer
  • Here's an additional video to cover HTTPS, certificates, WebServices API 2.0, Swagger, Omnicore, and some quick tips for troubleshooting. 
    We will write to RAPID variables from Robot WebServices API 2.0.


    https://www.youtube.com/watch?v=ehmZEmf7GwE
  • Hello, 
    Your video is very useful. I have a question, to Login as Local User it is necessary to press and release the enabling button after sending the request. But I'm working with a Yumi IRB 14000 and this button is not active, so what should I do instead of pressing the enabling button to be able to login as a local user?
    Thanks,
    Ana
  • @annie184
    You don't need to press the enabling button when using register user.

  • Hello,

    Thank you for the tutorial.

    I followed each of your steps but at the part at which your error ouput becomes "bad request" (at 4:13), I still have error 401 although headers have been set and authorization type modified. I tried for both VC and real controller cases.

    I checked at the User Authorization System of the real controller in Robotstudio under Controller tab > Access > Authenticate > view user grants, and realized there is no sort of "manual jog" possibility.

    Did you have a specific group of possible grants for this tutorial ?
    Where can this error difference come from ?

    I tried to repeat the process with another action to check if that was the issue. I tried to update a digital I/O signal state previously created in the controller configuration and I reused the command given in the developer center
    curl --digest -u "Default User":robotics -d "lstate=simulated" -X POST "http://localhost/rw/iosystem/signals/Local/DRV_1/DRV1K1?action=set"

    (with the appropriate IP address instead of localhost, or localhost:80 in the VC case, as explained in the topic your topic "How to change the listening port of the Virtual Controller (RobotWare 6.x and 7.x)", with and without the headers, with and without the same authorization type.

     Still the same error 401 each time. Do I need to first go through "login as local user" or "request mastership" or anything else to deal with I/O's ?


    Thank you in advance for your assistance.

    Best

  • Hello there,

    How did you setup your Authorization settings? Type and credentials?

    Maxim Riabichev
    PC Software Support Engineer
  • Daper
    Daper
    edited March 2023
    Hi,

    Thank you for your reply.
    I actually never went into thes kinds of settings, except at the time I left my comment, only to have a look at the user grants... The credentials I used were the classical "Default User " and "robotics"
  • Well at minute 3 in the video I mention the importance of setting up correct authorization.. :)

    Maxim Riabichev
    PC Software Support Engineer
  • Yes, sorry for this misunderstanding, I did try with Digest Auth, exactly the way you explained in the video, and then tried different alternatives since it was not conclusive...
  • How can one change the appweb.conf file on a real controller?  Access grants, even as admin, do not allow changes the folder this is located in.