C# &引用;应使用双引号括起属性名称;当运行代理时

C# &引用;应使用双引号括起属性名称;当运行代理时,c#,unity3d,machine-learning,c#-4.0,ml-agent,C#,Unity3d,Machine Learning,C# 4.0,Ml Agent,总之,我有一对具有旋转轴点的腿,希望能够让计算机计算出腿的旋转方式,以使其自身保持平衡,并使“腰部”游戏对象保持大于某个高度(基本上是自我平衡)。如果腰围低于某一高度(即摔倒),代理人将获得奖励减免。当我运行Anaconda提示符并在其要求时运行Unity时,Unity将冻结,Anaconda显示如下所示的错误代码。很难找到最新的教程,因此我非常感谢您的支持发生了什么事?谢谢。(: ▄▄▄▓▓▓▓ ╓▓▓▓▓▓▓█▓▓▓▓▓ ,▄▄▄M▀▀▀' ,▓▓▓▀▓▓▄

总之,我有一对具有旋转轴点的腿,希望能够让计算机计算出腿的旋转方式,以使其自身保持平衡,并使“腰部”游戏对象保持大于某个高度(基本上是自我平衡)。如果腰围低于某一高度(即摔倒),代理人将获得奖励减免。当我运行Anaconda提示符并在其要求时运行Unity时,Unity将冻结,Anaconda显示如下所示的错误代码。很难找到最新的教程,因此我非常感谢您的支持发生了什么事?谢谢。(:

▄▄▄▓▓▓▓
╓▓▓▓▓▓▓█▓▓▓▓▓
,▄▄▄M▀▀▀'  ,▓▓▓▀▓▓▄                           ▓▓▓  ▓▓▌
▄▓▓▓▀'      ▄▓▓▀  ▓▓▓      ▄▄     ▄▄ ,▄▄ ▄▄▄▄   ,▄▄ ▄▓▓▌▄ ▄▄▄    ,▄▄
▄▓▓▓▀        ▄▓▓▀   ▐▓▓▌     ▓▓▌   ▐▓▓ ▐▓▓▓▀▀▀▓▓▌ ▓▓▓ ▀▓▓▌▀ ^▓▓▌  ╒▓▓▌
▄▓▓▓▓▓▄▄▄▄▄▄▄▄▓▓▓      ▓▀      ▓▓▌   ▐▓▓ ▐▓▓    ▓▓▓ ▓▓▓  ▓▓▌   ▐▓▓▄ ▓▓▌
▀▓▓▓▓▀▀▀▀▀▀▀▀▀▀▓▓▄     ▓▓      ▓▓▌   ▐▓▓ ▐▓▓    ▓▓▓ ▓▓▓  ▓▓▌    ▐▓▓▐▓▓
^█▓▓▓        ▀▓▓▄   ▐▓▓▌     ▓▓▓▓▄▓▓▓▓ ▐▓▓    ▓▓▓ ▓▓▓  ▓▓▓▄    ▓▓▓▓`
'▀▓▓▓▄      ^▓▓▓  ▓▓▓       └▀▀▀▀ ▀▀ ^▀▀    `▀▀ `▀▀   '▀▀    ▐▓▓▌
▀▀▀▀▓▄▄▄   ▓▓▓▓▓▓,                                      ▓▓▓▓▀
`▀█▓▓▓▓▓▓▓▓▓▌
¬`▀▀▀█▓
信息:mlagents.培训师:CommandLineOptions(debug=False,num_runs=1,seed=-1,env_path=None,run_id='testRun1',load_model=False,train_model=False,save_freq=50000,keep_checkpoints=5,base_port=5005,num_envs=1,courseum_文件夹='config/courseum/Balance/',lesson=0,slow=False,no_graphics=False,multi_gpu=False,trainer_-config_-path='config/trainer\u-config.yaml',sampler_-path=None,docker\u target\u name=None,env\u args=None,cpu=False)
信息:mlagents.envs:按Unity编辑器中的播放按钮开始训练。
信息:mlagents.envs:
“平衡学院”成功启动!
统一学院名称:平衡学院
重置参数:{}
回溯(最近一次呼叫最后一次):
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\columer.py”,第132行,在加载课程中
返回json.load(fp)
文件“C:\Users\Jaden Williams\.conda\envs\ml\u Balance01\lib\json\\uuu init\uuu.py”,第296行,已加载
parse_常量=parse_常量,object_pairs_hook=object_pairs_hook,**千瓦)
文件“C:\Users\Jaden Williams\.conda\envs\ml\u Balance01\lib\json\\uuu init\uuu.py”,第348行,加载
返回\u默认\u解码器。解码
文件“C:\Users\Jaden Williams\.conda\envs\ml\u Balance01\lib\json\decoder.py”,第337行,在decode中
obj,end=self.raw\u decode(s,idx=\u w(s,0.end())
原始解码中的文件“C:\Users\Jaden Williams\.conda\envs\ml\u Balance01\lib\json\decoder.py”,第353行
obj,end=self.scan_一次(s,idx)
json.decoder.JSONDecodeError:应为包含在双引号中的属性名:第6行第1列(字符112)
上述异常是以下异常的直接原因:
回溯(最近一次呼叫最后一次):
文件“C:\Users\Jaden Williams\.conda\envs\ml\u Balance01\Scripts\mlagents learn script.py”,第11行,在
加载入口点('mlagents','console脚本','mlagents learn')()
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py”,主文件第422行
运行\u培训(0,运行\u种子,选项,队列())
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py”,第232行,在run\u training中
课程文件夹,环境,选项.lesson
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py”,第300行,在try\u create\u meta\u课程中
元课程=元课程(课程文件夹,环境重置参数)
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\meta\u-courseum.py”,第43行,在\uu init中__
课程=课程(课程\文件路径、默认\重置\参数)
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\courseum.py”,第26行,在\uuu init中__
self.data=课程。加载课程文件(位置)
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\columer.py”,第119行,加载课程文件
返回课程。加载课程(数据文件)
文件“c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\columer.py”,第137行,在加载课程中
)从e
mlagents.trainers.exception.CoursulumLoadingError:解析JSON文件时出错。请检查格式错误。工具,如https://jsonlint.com/ 这可能会有帮助。
这是我的代理代码:

using MLAgents;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BalanceAgent : Agent
{
    private BalancingArea area;
    public GameObject waist;
    public GameObject buttR;
    public GameObject buttL;
    public GameObject thighR;
    public GameObject thighL;
    public GameObject legR;
    public GameObject legL;
    public GameObject footR;
    public GameObject footL;
    public GameObject goal;
    // private float buttR = 0f;


    public override void InitializeAgent() {
        base.InitializeAgent();
        area = GetComponentInParent<BalancingArea>();

    }

    public override void AgentAction(float[] vectorAction) {

        int buttRDir = 0;
        int buttRVec = (int)vectorAction[0];
        switch (buttRVec) {
            case 3:
                buttRDir = 0;
                break;
            case 1:
                buttRDir = -1;
                break;
            case 2:
                buttRDir = 1;
                break;
        }
        buttR.transform.Rotate(0, buttRDir, 0);

        int buttLDir = 0;
        int buttLVec = (int)vectorAction[1];
        switch (buttLVec) {
            case 3:
                buttLDir = 0;
                break;
            case 1:
                buttLDir = -1;
                break;
            case 2:
                buttLDir = 1;
                break;
        }
        buttL.transform.Rotate(0, buttLDir, 0);

        int thighRDir = 0;
        int thighRVec = (int)vectorAction[2];
        switch (thighRVec) {
            case 3:
                thighRDir = 0;
                break;
            case 1:
                thighRDir = -1;
                break;
            case 2:
                thighRDir = 1;
                break;
        }
        thighR.transform.Rotate(0, thighRDir, 0);

        int thighLDir = 0;
        int thighLVec = (int)vectorAction[3];
        switch (thighLVec) {
            case 3:
                thighLDir = 0;
                break;
            case 1:
                thighLDir = -1;
                break;
            case 2:
                thighLDir = 1;
                break;
        }
        thighL.transform.Rotate(0, thighLDir, 0);

        int legRDir = 0;
        int legRVec = (int)vectorAction[4];
        switch (legRVec) {
            case 3:
                legRDir = 0;
                break;
            case 1:
                legRDir = -1;
                break;
            case 2:
                legRDir = 1;
                break;
        }
        legR.transform.Rotate(0, legRDir, 0);

        int legLDir = 0;
        int legLVec = (int)vectorAction[5];
        switch (legLVec) {
            case 3:
                legLDir = 0;
                break;
            case 1:
                legLDir = -1;
                break;
            case 2:
                legLDir = 1;
                break;
        }
        legL.transform.Rotate(0, legLDir, 0);

        int footRDir = 0;
        int footRVec = (int)vectorAction[6];
        switch (footRVec) {
            case 3:
                footRDir = 0;
                break;
            case 1:
                footRDir = -1;
                break;
            case 2:
                footRDir = 1;
                break;
        }
        footR.transform.Rotate(0, footRDir, 0);

        int footLDir = 0;
        int footLVec = (int)vectorAction[7];
        switch (footLVec) {
            case 3:
                footLDir = 0;
                break;
            case 1:
                footLDir = -1;
                break;
            case 2:
                footLDir = 1;
                break;
        }
        footL.transform.Rotate(0, footLDir, 0);




        //buttR = vectorAction[0]; //Right or none
        //if (buttR == 2) buttR = -1f; //Left

        if (waist.transform.position.y > -1.3) {
            AddReward(.1f);
        }
        else {
            AddReward(-.02f);
        }

        if(waist.transform.position.y <= -3) {
            AddReward(-.1f);
            Done();
        }

    }

    public override void CollectObservations() {
        AddVectorObs(waist.transform.localRotation.y);
        AddVectorObs(buttR.transform.localRotation.x);
        AddVectorObs(buttL.transform.localRotation.x);
        AddVectorObs(thighR.transform.localRotation.y);
        AddVectorObs(thighL.transform.localRotation.y);
        AddVectorObs(legR.transform.localRotation.y);
        AddVectorObs(legL.transform.localRotation.y);
        AddVectorObs(footR.transform.localRotation.y);
        AddVectorObs(footL.transform.localRotation.y);

        AddVectorObs(waist.GetComponent<Rigidbody>().freezeRotation);
    }
}
使用mlagent;
使用制度;
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
公共类余额代理:代理
{
私人Balancingara区;
公共游戏对象;
公共游戏对象对撞机;
公共游戏对象;
公共游戏对象thighR;
公共游戏对象thighL;
公共游戏对象legR;
公共游戏对象法;
公众游戏者;
公共游戏对象足迹;
公开游戏
using MLAgents;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BalanceAgent : Agent
{
    private BalancingArea area;
    public GameObject waist;
    public GameObject buttR;
    public GameObject buttL;
    public GameObject thighR;
    public GameObject thighL;
    public GameObject legR;
    public GameObject legL;
    public GameObject footR;
    public GameObject footL;
    public GameObject goal;
    // private float buttR = 0f;


    public override void InitializeAgent() {
        base.InitializeAgent();
        area = GetComponentInParent<BalancingArea>();

    }

    public override void AgentAction(float[] vectorAction) {

        int buttRDir = 0;
        int buttRVec = (int)vectorAction[0];
        switch (buttRVec) {
            case 3:
                buttRDir = 0;
                break;
            case 1:
                buttRDir = -1;
                break;
            case 2:
                buttRDir = 1;
                break;
        }
        buttR.transform.Rotate(0, buttRDir, 0);

        int buttLDir = 0;
        int buttLVec = (int)vectorAction[1];
        switch (buttLVec) {
            case 3:
                buttLDir = 0;
                break;
            case 1:
                buttLDir = -1;
                break;
            case 2:
                buttLDir = 1;
                break;
        }
        buttL.transform.Rotate(0, buttLDir, 0);

        int thighRDir = 0;
        int thighRVec = (int)vectorAction[2];
        switch (thighRVec) {
            case 3:
                thighRDir = 0;
                break;
            case 1:
                thighRDir = -1;
                break;
            case 2:
                thighRDir = 1;
                break;
        }
        thighR.transform.Rotate(0, thighRDir, 0);

        int thighLDir = 0;
        int thighLVec = (int)vectorAction[3];
        switch (thighLVec) {
            case 3:
                thighLDir = 0;
                break;
            case 1:
                thighLDir = -1;
                break;
            case 2:
                thighLDir = 1;
                break;
        }
        thighL.transform.Rotate(0, thighLDir, 0);

        int legRDir = 0;
        int legRVec = (int)vectorAction[4];
        switch (legRVec) {
            case 3:
                legRDir = 0;
                break;
            case 1:
                legRDir = -1;
                break;
            case 2:
                legRDir = 1;
                break;
        }
        legR.transform.Rotate(0, legRDir, 0);

        int legLDir = 0;
        int legLVec = (int)vectorAction[5];
        switch (legLVec) {
            case 3:
                legLDir = 0;
                break;
            case 1:
                legLDir = -1;
                break;
            case 2:
                legLDir = 1;
                break;
        }
        legL.transform.Rotate(0, legLDir, 0);

        int footRDir = 0;
        int footRVec = (int)vectorAction[6];
        switch (footRVec) {
            case 3:
                footRDir = 0;
                break;
            case 1:
                footRDir = -1;
                break;
            case 2:
                footRDir = 1;
                break;
        }
        footR.transform.Rotate(0, footRDir, 0);

        int footLDir = 0;
        int footLVec = (int)vectorAction[7];
        switch (footLVec) {
            case 3:
                footLDir = 0;
                break;
            case 1:
                footLDir = -1;
                break;
            case 2:
                footLDir = 1;
                break;
        }
        footL.transform.Rotate(0, footLDir, 0);




        //buttR = vectorAction[0]; //Right or none
        //if (buttR == 2) buttR = -1f; //Left

        if (waist.transform.position.y > -1.3) {
            AddReward(.1f);
        }
        else {
            AddReward(-.02f);
        }

        if(waist.transform.position.y <= -3) {
            AddReward(-.1f);
            Done();
        }

    }

    public override void CollectObservations() {
        AddVectorObs(waist.transform.localRotation.y);
        AddVectorObs(buttR.transform.localRotation.x);
        AddVectorObs(buttL.transform.localRotation.x);
        AddVectorObs(thighR.transform.localRotation.y);
        AddVectorObs(thighL.transform.localRotation.y);
        AddVectorObs(legR.transform.localRotation.y);
        AddVectorObs(legL.transform.localRotation.y);
        AddVectorObs(footR.transform.localRotation.y);
        AddVectorObs(footL.transform.localRotation.y);

        AddVectorObs(waist.GetComponent<Rigidbody>().freezeRotation);
    }
}