Beispiel #1
0
    def s_setdofpos(conn, data):
        modulename = str(data.pop('module_name', None))
        dofname = str(data.pop('dof_name', None))
        pos = float(data.pop('pos', 0.0))

        if modulename is None or dofname is None:
            conn.send_data('error', {'message': 'No valid dof name given.'})

        Robot.set_dof_value(modulename, dofname, pos, 0)
def robot_dof_data():
    module_name = request.form.get('module_name', type=str, default='')
    dof_name = request.form.get('dof_name', type=str, default='')
    dof_value = request.form.get('value', type=float, default=0.0)

    dof_value = constrain(dof_value, -1.0, 1.0)

    Robot.set_dof_value(module_name, dof_name, dof_value)

    return json.dumps({'success': True})