【问题标题】:WbCmd Movesense: Trouble With Putting ObjectsWbCmd Movesense:放置对象的麻烦
【发布时间】:2020-04-28 18:14:02
【问题描述】:

我正在使用 PowerShell 在 Windows 上进行测试。

当我输入像 bool 这样的简单类型时,WbCmd 会像预期的那样工作。

PS> wbcmd --port TCP7044 --path /Component/Led --op put --opdatatype bool --opdata true
WbCmd Movesense:
{
  "response": 200,
  "responsestring": "HTTP_CODE_OK",
  "operation": "put",
  "uri": "/net/ECSI00000000/Component/Led",
  "querytimems": 0,
  "querytimens": 536100
}

但是当我尝试放置一个对象时,它“找不到数据类型”。

PS> wbcmd --port TCP7044 --path /Component/Leds/0 --op get
WbCmd Movesense:
{
  "response": 200,
  "responsestring": "HTTP_CODE_OK",
  "operation": "get",
  "uri": "/net/ECSI00000000/Component/Leds/0",
  "content": {
    "IsOn": true,
    "LedColor": [
      0,
      "Red"
    ]
  },
  "querytimems": 0,
  "querytimens": 613500
}

PS> wbcmd --port TCP7044 --path /Component/Leds/0 --op put --opdatatype LedState --opdata '{ "LedState":
{ "IsOn": false, "LedColor": 0 } }'
WbCmd Movesense:
{
  "response": 404,
  "responsestring": "Failed to find data type LedState",
  "operation": "put",
  "uri": "/net/ECSI00000000/Component/Leds/0",
  "querytimems": 3,
  "querytimens": 3526200
}

我该如何解决这个问题或获取有关后台发生的事情的更多信息?

【问题讨论】:

  • 我认为你必须删除包装,只包含对象的内部部分
  • ... 这样 wbcmd 的工作方式与 MDS 有点不同。在 MDS 中,需要有具有正确属性名称(=参数名称)的包装器。在 wbcmd 中,您只需提供参数对象
  • @user1987093 不管--opdata的内容是什么,只要它存在。

标签: movesense


【解决方案1】:

Movesense 传感器中有两个 LED API。具有真/假值的简单 /Component/Led(与当前 Movesense 传感器中的单个 LED 匹配)。添加了第二个 LED API 以支持其他 Movesense 兼容设备中的多个/多色 LED。

对于 Movesense 传感器,我建议使用简单的 API。但是,要使用 wbcmd 放入复杂的 API,请使用以下命令(我已经测试过,它可以工作,在 Mac 中也可以,这就是端口看起来像这样的原因):

wbcmd --port /dev/cu.usbserial-AL01XHQC --path /component/leds/0 --op put --opdata '{"IsOn":true}'

全面披露:我在 Movesense 团队工作

【讨论】:

  • 这给了我错误HTTP_CODE_BAD_REQUEST。通常,这可能是 WbCmd 在 Windows 上的问题。但是因为模拟器只运行在Windows上,所以我不能轻易改变我的开发系统。
猜你喜欢
  • 2013-12-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-22
  • 1970-01-01
  • 2015-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多