iT邦幫忙

2022 iThome 鐵人賽

DAY 29
0

部署Apply pretrained model至edge device的部份,目前FRC車子上一樣仍還沒有完成。先用以下內容說明,與成大學生嘉軒討論的內容。

當Jenkins trigger greengrass的deployment指令後,會更新local server的component code(透過更新greengrass的recipe.yaml)與docker-compose設定(包含不同entrypoint指令執行),並執行新的deployment.json產生新的部署,讓其去拉取指定的model與AI程式(gg_frc_controller)。

version: "3"
services:
  gg_frc_controller:
    build: 
        context: ./
    image: gg-frc-controller:latest
    command: python main.py --file ./AI --model ./model
  greengrass_bridge:
    image: $ECR_COMPONENT:$VERSION
    command: ros2 launch greengrass_bridge greengrass_bridge.launch.py ros_topics:="['initialpose','clicked_point']" iot_topics:="['initialpose','clicked_point']" thing_name:="$THING_NAME"
    environment:
      - AWS_REGION
      - SVCUID
      - AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT
      - AWS_CONTAINER_AUTHORIZATION_TOKEN
      - AWS_CONTAINER_CREDENTIALS_FULL_URI
    volumes: 
      - "/greengrass/v2/ipc.socket:/greengrass/v2/ipc.socket"

deployment.json如下:

{
    "targetArn": "arn:aws:iot:$AWS_REGION:$AWS_ACCOUNT_ID:thing/$THING_NAME",
    "deploymentName": "Deployment for $THING_NAME",
    "components": {
        "$ECR_COMPONENT": {
            "componentVersion": "$VERSION"
        },
        "aws.greengrass.Cli": {
            "componentVersion": "2.7.0"
        }
    },
    "deploymentPolicies": {
        "failureHandlingPolicy": "DO_NOTHING",
        "componentUpdatePolicy": {
            "timeoutInSeconds": 60,
            "action": "NOTIFY_COMPONENTS"
        },
        "configurationValidationPolicy": {
            "timeoutInSeconds": 60
        }
    },
    "iotJobConfiguration": {}
}

https://ithelp.ithome.com.tw/upload/images/20221014/20005722BjpLtd7RHc.png
上圖的流程透過Unity pretrained model預測出來的馬達轉速(.pickle),會傳到之前篇章提到的subscribe_from_iot那隻python程式, python再透過pynetworktables寫進networktables, java controller程式再讀取networktables的值,來驅動FRC馬達,完成model的Apply。


上一篇
[部署]Deploy Model trainning to Cloud service
下一篇
[總結]-不可能的任務
系列文
IoT Cloud Computing on robotic vehicle30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言