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.
  • dnilsson said:
    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.

    Thank you for the video. However, if I choose HTTP, I get 415 - unsupported media. If I choose HTTPS, I either get " read ECONNRESET" or sometimes an error with the self.cert not being accepted, despite having uncommented said lines in the appweb.conf.

    Unsupported Media:

    25 ms
    ▶Network
      ▶Request Headers
      accept: application/json
      Content-Type: application/x-www-form-urlencoded:v=2.0
      Authorization: Basic RGVmYXVsdCBVc2VyOnJvYm90aWNz
      User-Agent: PostmanRuntime/7.42.0
      Postman-Token: 00d3749f-aa33-4717-98e8-e948a2fca50a
      Host: 127.0.0.1:665
      Accept-Encoding: gzip, deflate, br
      Connection: keep-alive
      Content-Length: 16
      Cookie: -http-session-=2::http.session::5065521dce46b62598c276c4a32442f5; ABBCX=655370
      ▶Request Body
      ▶Response Headers
      Set-Cookie: -http-session-=10::http.session::14c123960cc5e9dec5a4bdf70106ef31; path=/; domain=127.0.0.1; httponly; SameSite=None
      Set-Cookie: ABBCX=1179666; path=/; domain=127.0.0.1; httponly; SameSite=None
      Vary: Accept-Encoding
      Keep-Alive: timeout=300, max=2147483646
      Content-Type: application/xhtml+xml;v=2.0
      X-Content-Type-Options: nosniff
      Date: Mon, 14 Oct 2024 10:54:35 GMT
      Cache-Control: no-cache="set-cookie", max-age=0, no-cache, no-store
      Content-Length: 376
      X-XSS-Protection: 1; mode=block
      Connection: Keep-Alive
      Pragma: no-cache
      Expires: -1
      Accept-Ranges: bytes

      Self signed: 
      Error: self signed certificate
      ▶Request Headers
      accept: application/json
      Content-Type: application/x-www-form-urlencoded:v=2.0
      Authorization: Basic RGVmYXVsdCBVc2VyOnJvYm90aWNz
      User-Agent: PostmanRuntime/7.42.0
      Postman-Token: 8c325c27-fd5c-4f71-8381-09c696ae6804
      Host: 127.0.0.1:666
      Accept-Encoding: gzip, deflate, br
      Connection: keep-alive
      ▶Request Body



      If I connect to the real controller, I either get "ECONNECTION refused" or an issue with the self.cert once again: 

      Error: self signed certificate
      ▶Request Headers
      accept: application/json
      Content-Type: application/x-www-form-urlencoded:v=2.0
      User-Agent: PostmanRuntime/7.42.0
      Postman-Token: 3155218c-535c-4a27-88db-525f52862695
      Host: 192.168.125.1
      Accept-Encoding: gzip, deflate, br
      Connection: keep-alive





    1. rogerFRAUAS
      edited October 16
      Not really getting anywhere, if I use HTTP I get a 415 on the VC and Connection Refused on the real controller (RC). Using HTTPS, both VC and RC complain about self.certificate even if the appweb.conf is changed accordingly. 

      How can I add a certificate to my controller? I tried writing to /system on the RC and got a permission error even though I am logging in as admin and have write access. 

      Edit:

      GETting the user login info as described in the first video works flawless with the same accept header.

      Post edited by rogerFRAUAS on

    2. How can I add a certificate to my controller?
      This is described in the controller manual. I'm sure if you use Copilot or Google you can find the relevant manual/chapter/page.

      Maxim Riabichev
      PC Software Support Engineer
    3. Apparently, I am not the only one hoping for ABBs support to be replaced by AI. Next time, consider not answering at all instead of mocking a paying customer.

      Maxim Riabichev said:

      How can I add a certificate to my controller?
      This is described in the controller manual. I'm sure if you use Copilot or Google you can find the relevant manual/chapter/page.
      The answer is wrong, of course. The controller manual does not mention how to update a certificate and chatgpt hallucinates, even suggests contacting ABB support - oh the irony. You'll find references on how to manage certificates in the "Integrator's guide OmniCore", section 10.7. This refers you to the RobotStudio manual, which has two low-resolution-screenshots and refers you back to the integrator's guide. Maybe written by AI aswell, who knows.

      Anyways, for those playing along at home (or struggling with ABBs awful documentation), this is how you do it: 

      1. Connect to your controller using RobotStudio.
      2. Under "Controller"-tab, select your controller listed either under "Management Port" or "Current Station". 
      3. Right-click on the controllers name, go to "Properties" -> "Manage Certificates". 




    4. Maxim Riabichev
      edited October 24
      Hi,

      I apologize for making you feel mocked. That wasn't my intention. 

      I Googled the terms "manage certificate abb controller omnicore" and the first hit contained relevant information: https://forums.robotstudio.com/discussion/13065/rws-with-a-real-controller-omnicore

      I knew I've seen that info somewhere, but I wasn't sure where..

      Oh the irony, indeed :)

      One thing I'd like to add is that providing support on these forums is not part of my work as ABB support. These forums are not an official ABB support channel. The Forum Guidelines and FAQ mention this fact as well.

      I do it on my spare time. I do it for fun. Sometimes I am able to help and sometimes not so much.

      By the way, thanks for pointing out the back and forth referrals in the manuals. I've created a work item for R&D to have this fixed (the information on how to handle certificates in OmniCore will be available in the OM Integrators Guide OmniCore).
      Post edited by Maxim Riabichev on

      Maxim Riabichev
      PC Software Support Engineer