Announcement

Collapse
No announcement yet.

Robotino3-RESTAPI-odometry keine Reaktion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Robotino3-RESTAPI-odometry keine Reaktion

    Wir versuchen zur Zeit eine Robotino ueber die RESTAPI anzusteuern. Wir sind in der Lage gewisse dinge abzurufen (/cam0 | data/distancesensorarray | data/bumper usw.) Wenn wir versuchen den Robot zu bewegen (data/omnidrive [vx,vy,omega]) nichts bewegt sich. Der service log scheint keinen error zu produzieren. Wir sind ziemlich ratlos was genau das Problem sein koennte. (Wir koennen den Robot mittels Robotino View bewegen).

    Die Befehle werden mittels ROS robotino_rest_node omnidrive.py uebermittelt (produziert ebenfals keinen Fehler).

    Robot:

    Model: Robotino3 \ Basic
    OS: Image 4.0.3 | Ubuntu 18.04

    Vielen Dank fuer jeden Hinweis!!

    Edit: omnidrive nicht odometry
    Last edited by DB_ROB; 01-22-2021, 03:35 PM.

  • #2
    Hello,

    First, my apologies for not replying in German.

    I had the same problem as you today. I used the web interface at 127.0.0.1 and viewed the payload at the "control" section. Here you can see that the payload has the following format: "[x, y, theta]". I confirmed this by executing the following command: curl -X POST http://127.0.0.1/data/omnidrive -d "[0,0,0.1]". This makes the Robotino turn around for a 200ms. You should try this command to see if it makes the Robotino move.


    Next, if you go to /home/robotino/<workspace>/src/robotino_rest_node/scripts/omnidrive.py, you can see the variable called pdata that has a structure like {'vx':data.linear.x, 'vy':data.linear.y, 'omega' data.angular.z}. This does not seem to be the same as what the manual suggests (see: https://wiki.openrobotino.org/index.php?title=Rest_api).

    I changed the code in omnidrive.py to the following:

    Code:
    def callback(data):
        rospy.loginfo("%f %f %f" % (data.linear.x, data.linear.y, data.angular.z) )
        #pdata = {'vx':data.linear.x, 'vy':data.linear.y, 'omega':data.angular.z}
        try:
            # r = requests.post(url = URL, params = PARAMS, data = json.dumps(pdata) )
            r = requests.post(url = URL, params = PARAMS, data = "[{},{},{}]".format(data.linear.x, data.linear.y, data.angular.z))
            if r.status_code != requests.codes.ok:
                rospy.logwarn("post to %s with params %s failed", URL, PARAMS)
        except requests.exceptions.RequestException as e:
            rospy.logerr("%s", e)
            pass
    This seems to make it work! Hope that helps, let me know.

    Click image for larger version

Name:	2021-03-22_15-24.png
Views:	135
Size:	102.7 KB
ID:	12799

    Comment

    Working...
    X