Cozmo人工智能机器人SDK使用笔记(9)-判断部分if_this_then_that

【项目实战】闲鱼IFTTT是闲鱼平台基于IFTTT(If This Then That)理念设计的一套无侵入、可扩展的服务编排系统,旨在解决用户关系层次单一、互动实时性不足的问题。 闲鱼IFTTT是闲鱼平台基于IFTTT(If This Then That)理念设计的一套无侵入、可扩展的服务编排系统,旨在解决用户关系层次单一、互动实时性不足的问题,并通过自动化触发机制提升消息点击率。 阅读详情

Cozmo判断部分有3个主题:

  1. gmail
  2. sport
  3. stock

1. gmail

此示例演示了如何使用“If This Then That”(http://ifttt.com)使Cozmo在Gmail帐户收到电子邮件时作出回应。以下说明将引导您在IFTTT网站上设置小程序。当调用applet触发器(发送在此示例中启动的Web服务器收到的Web请求)时,Cozmo将播放动画,说出电子邮件发件人的姓名并在他的脸上显示邮箱图像。

If This Then That" Gmail example

This example demonstrates how "If This Then That" (http://ifttt.com) can be used
make Cozmo respond when a Gmail account receives an email. Instructions below
will lead you through setting up an applet on the IFTTT website. When the applet
trigger is called (which sends a web request received by the web server started
in this example), Cozmo will play an animation, speak the email sender's name and
show a mailbox image on his face.

Please place Cozmo on the charger for this example. When necessary, he will be
rolled off and back on.

Follow these steps to set up and run the example:
    1) Provide a a static ip, URL or similar that can be reached from the If This
        Then That server. One easy way to do this is with ngrok, which sets up
        a secure tunnel to localhost running on your machine.

        To set up ngrok:
        a) Follow instructions here to download and install:
            https://ngrok.com/download
        b) Run this command to create a secure public URL for port 8080:
            ./ngrok http 8080
        c) Note the HTTP forwarding address shown in the terminal (e.g., http://55e57164.ngrok.io).
            You will use this address in your applet, below.

        WARNING: Using ngrok exposes your local web server to the internet. See the ngrok
        documentation for more information: https://ngrok.com/docs

    2) Set up your applet on the "If This Then That" website.
        a) Sign up and sign into https://ifttt.com
        b) Create an applet: https://ifttt.com/create
        c) Set up your trigger.
            1. Click "this".
            2. Select "Gmail" as your service. If prompted, click "Connect",
                select your Gmail account, and click “Allow” to provide permissions
                to IFTTT for your email account. Click "Done".
            3. Under "Choose a Trigger", select “Any new email in inbox".
        d) Set up your action.
            1. Click “that".
            2. Select “Maker Webhooks" to set it as your action channel. Connect to the Maker channel if prompted.
            3. Click “Make a web request" and fill out the fields as follows. Remember your publicly
                accessible URL from above (e.g., http://55e57164.ngrok.io) and use it in the URL field,
                followed by "/iftttGmail" as shown below:

                 URL: http://55e57164.ngrok.io/iftttGmail
                 Method: POST
                 Content Type: application/json
                 Body: {"FromAddress":"{{FromAddress}}"}

            5. Click “Create Action" then “Finish".

    3) Test your applet.
        a) Run this script at the command line: ./ifttt_gmail.py
        b) On ifttt.com, on your applet page, click “Check now”. See that IFTTT confirms that the applet
            was checked.
        c) Send an email to the Gmail account in your recipe
        d) On your IFTTT applet webpage, again click “Check now”. This should cause IFTTT to detect that
            the email was received and send a web request to the ifttt_gmail.py script.
        e) In response to the ifttt web request, Cozmo should roll off the charger, raise and lower
            his lift, announce the email, and then show a mailbox image on his face.

import asyncio
import re
import sys


try:
    from aiohttp import web
except ImportError:
    sys.exit("Cannot import from aiohttp. Do `pip3 install --user aiohttp` to install")

import cozmo

from common import IFTTTRobot


app = web.Application()


async def serve_gmail(request):
    '''Define an HTTP POST handler for receiving requests from If This Then That.

    You may modify this method to change how Cozmo reacts to the email
    being received.
    '''

    json_object = await request.json()

    # Extract the name of the email sender.
    from_email_address = json_object["FromAddress"]

    # Use a regular expression to break apart pieces of the email address
    match_object = re.search(r'([\w.]+)@([\w.]+)', from_email_address)
    email_local_part = match_object.group(1)

    robot = request.app['robot']
    async def read_name():
        try:
            async with robot.perform_off_charger():
                '''If necessary, Move Cozmo's Head and Lift to make it easy to see Cozmo's face.'''
                await robot.get_in_position()

                # First, have Cozmo play an animation
                await robot.play_anim_trigger(cozmo.anim.Triggers.ReactToPokeStartled).wait_for_completed()

                # Next, have Cozmo speak the name of the email sender.
                await robot.say_text("Email from " + email_local_part).wait_for_completed()

                # Last, have Cozmo display an email image on his face.
                robot.display_image_file_on_face("../face_images/ifttt_gmail.png")

        except cozmo.RobotBusy:
            cozmo.logger.warning("Robot was busy so didn't read email address: "+ from_email_address)

    # Perform Cozmo's task in the background so the HTTP server responds immediately.
    asyncio.ensure_future(read_name())

    return web.Response(text="OK")

# Attach the function as an HTTP handler.
app.router.add_post('/iftttGmail', serve_gmail)


if __name__ == '__main__':
    cozmo.setup_basic_logging()
    cozmo.robot.Robot.drive_off_charger_on_connect = False

    # Use our custom robot class with extra helper methods
    cozmo.conn.CozmoConnection.robot_factory = IFTTTRobot

    try:
        app_loop = asyncio.get_event_loop()  
        sdk_conn = cozmo.connect_on_loop(app_loop)

        # Wait for the robot to become available and add it to the app object.
        app['robot'] = app_loop.run_until_complete(sdk_conn.wait_for_robot())
    except cozmo.ConnectionError as e:
        sys.exit("A connection error occurred: %s" % e)

    web.run_app(app)

2. sport

此示例演示了如何使用“If This Then That”(http://ifttt.com)使Cozmo在您指定的团队进行游戏内或最终分数更新时做出响应。 以下说明将引导您在IFTTT网站上设置小程序。 当调用applet触发器(发送在此示例中启动的Web服务器接收的Web请求)时,Cozmo将播放动画,在他的脸上显示图像,并说出游戏内更新。

If This Then That" sports example

This example demonstrates how "If This Then That" (http://ifttt.com) can be used
make Cozmo respond when there is an in-game or final score update for the team
you specify. Instructions below will lead you through setting up an applet on
the IFTTT website. When the applet trigger is called (which sends a web request
received by the web server started in this example), Cozmo will play an animation,
show an image on his face, and speak the in-game update.

Please place Cozmo on the charger for this example. When necessary, he will be
rolled off and back on.

Follow these steps to set up and run the example:
    1) Provide a a static ip, URL or similar that can be reached from the "If This
        Then That" server. One easy way to do this is with ngrok, which sets up
        a secure tunnel to localhost running on your machine.

        To set up ngrok:
        a) Follow instructions here to download and install:
            https://ngrok.com/download
        b) Run this command to create a secure public URL for port 8080:
            ./ngrok http 8080
        c) Note the HTTP forwarding address shown in the terminal (e.g., http://55e57164.ngrok.io).
            You will use this address in your applet, below.

        WARNING: Using ngrok exposes your local web server to the internet. See the ngrok
        documentation for more information: https://ngrok.com/docs

    2) Set up your applet on the "If This Then That" website.
        a) Sign up and sign into https://ifttt.com
        b) Create an applet: https://ifttt.com/create
        c) Set up your trigger.
            1. Click "this".
            2. Select "ESPN" as your service.
            3. Under "Choose a Trigger", select “New in-game update".
            4. In section "Complete Trigger Fields", enter your sport and team and click “Create Trigger".

        d) Set up your action.
            1. Click “that".
            2. Select “Maker Webhooks" to set it as your action channel. Connect to the Maker channel if prompted.
            3. Click “Make a web request" and fill out the fields as follows. Remember your publicly
                accessible URL from above (e.g., http://55e57164.ngrok.io) and use it in the URL field,
                followed by "/iftttSports" as shown below:

                 URL: http://55e57164.ngrok.io/iftttSports
                 Method: POST
                 Content Type: application/json
                 Body: {"AlertBody":"{{AlertBody}}"}

            5. Click “Create Action" then “Finish".

    3) Test your applet.
        a) Run this script at the command line: ./ifttt_sports.py
        b) On ifttt.com, on your applet page, click “Check now”. See that IFTTT confirms that the applet
            was checked.
        c) Wait for new in-game updates for your team and see Cozmo react! Cozmo should roll off the charger, raise
            and lower his lift, show an image on his face and speak the in-game update.

import asyncio
import sys


try:
    from aiohttp import web
except ImportError:
    sys.exit("Cannot import from aiohttp. Do `pip3 install --user aiohttp` to install")

import cozmo

from common import IFTTTRobot


app = web.Application()


async def serve_sports(request):
    '''Define an HTTP POST handler for receiving requests from If This Then That.

    You may modify this method to change how Cozmo reacts to
    an in-game update from IFTTT.
    '''

    json_object = await request.json()

    # Extract the text for the in-game update.
    alert_body = json_object["AlertBody"]

    robot = request.app['robot']
    async def read_name():
        try:
            async with robot.perform_off_charger():
                '''If necessary, Move Cozmo's Head and Lift to make it easy to see Cozmo's face.'''
                await robot.get_in_position()

                # First, have Cozmo play an animation
                await robot.play_anim_trigger(cozmo.anim.Triggers.ReactToPokeStartled).wait_for_completed()

                # Next, have Cozmo speak the text from the in-game update.
                await robot.say_text(alert_body).wait_for_completed()

                # Last, have Cozmo display a sports image on his face.
                robot.display_image_file_on_face("../face_images/ifttt_sports.png")

        except cozmo.RobotBusy:
            cozmo.logger.warning("Robot was busy so didn't read update: '" + alert_body +"'")

    # Perform Cozmo's task in the background so the HTTP server responds immediately.
    asyncio.ensure_future(read_name())

    return web.Response(text="OK")

# Attach the function as an HTTP handler.
app.router.add_post('/iftttSports', serve_sports)


if __name__ == '__main__':
    cozmo.setup_basic_logging()
    cozmo.robot.Robot.drive_off_charger_on_connect = False

    # Use our custom robot class with extra helper methods
    cozmo.conn.CozmoConnection.robot_factory = IFTTTRobot

    try:
        app_loop = asyncio.get_event_loop()  
        sdk_conn = cozmo.connect_on_loop(app_loop)

        # Wait for the robot to become available and add it to the app object.
        app['robot'] = app_loop.run_until_complete(sdk_conn.wait_for_robot())
    except cozmo.ConnectionError as e:
        sys.exit("A connection error occurred: %s" % e)

    web.run_app(app)

 


此IFTTT示例使用Flask Web框架并且是同步的,与其他异步的IFTTT示例不同并使用aiohttp。在此示例中,IFTTT Web请求由函数receive_ifttt_web_request接收。进入该方法的每个Web请求都会添加到Queue ifttt_queue,并且HTTP状态代码200或503会立即返回到IFTTT。该队列由worker函数检查,该函数在后台线程上运行(由run函数启动)。当worker函数在队列中找到新请求时,请求将从队列中删除并在方法then_that_action中处理。

与ifttt_sports.py示例一样,此示例演示了如何使用“If This Then That”(http://ifttt.com)使Cozmo在您指定的团队有游戏内或最终得分更新时做出响应。以下说明将引导您完成设置
在IFTTT网站上发布一个applet。当调用applet触发器(发送在此示例中启动的烧瓶服务器接收的Web请求)时,Cozmo将播放动画,在他的脸上显示图像,并说出游戏内更新。

If This Then That" sports example

This IFTTT example uses the Flask web framework and is synchronous, unlike the other
IFTTT examples which are asynchronous and use aiohttp. In this example, IFTTT web
requests are received by function receive_ifttt_web_request. Each web request that comes
into that method is added to Queue ifttt_queue and an HTTP status code of 200 or 503 is
immediately returned to IFTTT. The queue is checked by the worker function, which is
running on a background thread (started by the run function). When a new request is
found on the queue by the worker function, the request is removed from the queue and
processed in method then_that_action.

Like the ifttt_sports.py example, this example demonstrates how "If This Then That"
(http://ifttt.com) can be used make Cozmo respond when there is an in-game or final
score update for the team you specify. Instructions below will lead you through setting
up an applet on the IFTTT website. When the applet trigger is called (which sends a web
request received by the flask server started in this example), Cozmo will play an
animation, show an image on his face, and speak the in-game update.

Please place Cozmo on the charger for this example. When necessary, he will be
rolled off and back on.

Follow these steps to set up and run the example:
    1) Provide a a static ip, URL or similar that can be reached from the "If This
        Then That" server. One easy way to do this is with ngrok, which sets up
        a secure tunnel to localhost running on your machine.

        To set up ngrok:
        a) Follow instructions here to download and install:
            https://ngrok.com/download
        b) Run this command to create a secure public URL for port 8080:
            ./ngrok http 8080
        c) Note the HTTP forwarding address shown in the terminal (e.g., http://55e57164.ngrok.io).
            You will use this address in your applet, below.

        WARNING: Using ngrok exposes your local web server to the internet. See the ngrok
        documentation for more information: https://ngrok.com/docs

    2) Set up your applet on the "If This Then That" website.
        a) Sign up and sign into https://ifttt.com
        b) Create an applet: https://ifttt.com/create
        c) Set up your trigger.
            1. Click "this".
            2. Select "ESPN" as your service.
            3. Under "Choose a Trigger", select “New in-game update".
            4. In section "Complete Trigger Fields", enter your sport and team and click “Create Trigger".

        d) Set up your action.
            1. Click “that".
            2. Select “Maker" to set it as your action channel. Connect to the Maker channel if prompted.
            3. Click “Make a web request" and fill out the fields as follows. Remember your publicly
                accessible URL from above (e.g., http://55e57164.ngrok.io) and use it in the URL field,
                followed by "/iftttSports" as shown below:

                 URL: http://55e57164.ngrok.io/iftttSports
                 Method: POST
                 Content Type: application/json
                 Body: {"AlertBody":"{{AlertBody}}"}

            5. Click “Create Action" then “Finish".

    3) Test your applet.
        a) Run this script at the command line: ./ifttt_sports.py
        b) On ifttt.com, on your applet page, click “Check now”. See that IFTTT confirms that the applet
            was checked.
        c) Wait for new in-game updates for your team and see Cozmo react! Cozmo should roll off the charger, raise
            and lower his lift, show an image on his face and speak the in-game update.

import json
import queue
import sys
import threading

import cozmo
sys.path.append('../lib/')
import flask_helpers

from common import IFTTTRobot


try:
    from flask import Flask, request
except ImportError:
    sys.exit("Cannot import from flask: Do `pip3 install --user flask` to install")


flask_app = Flask(__name__)
ifttt_queue = queue.Queue()
robot = None


@flask_app.route('/iftttSports', methods=['POST'])
def receive_ifttt_web_request():
    '''Web request endpoint named "iftttSports" for IFTTT to call when a new in-game
        update for your team is posted on ESPN.

        In the IFTTT web request, in the URL field, specify this method
        as the endpoint. For instance, if your public url is http://my.url.com,
        then in the IFTTT web request URL field put the following:
        http://my.url.com/iftttSports. Then, this endpoint will be called when
        IFTTT checks and discovers that a new in-game update for your team is
        posted on ESPN.
    '''

    # Retrieve the data passed by If This Then That in the web request body.
    json_object = json.loads(request.data.decode("utf-8"))

    # Extract the text for the in-game update.
    alert_body = json_object["AlertBody"]

    # Add this request to the queue of in-game updates awaiting Cozmo's reaction.
    ifttt_queue.put((then_that_action, alert_body))

    # Return promptly so If This Then That knows that the web request was received
    # successfully.
    return ""


def then_that_action(alert_body):
    '''Controls how Cozmo responds to the in-game update.

    You may modify this method to change how Cozmo reacts to
    the update from IFTTT.
    '''

    try:
        with robot.perform_off_charger():
            '''If necessary, Move Cozmo's Head and Lift to make it easy to see Cozmo's face.'''
            robot.get_in_position()

            # First, have Cozmo play an animation
            robot.play_anim_trigger(cozmo.anim.Triggers.ReactToPokeStartled).wait_for_completed()

            # Next, have Cozmo speak the text from the in-game update.
            robot.say_text(alert_body).wait_for_completed()

            # Last, have Cozmo display a sports image on his face.
            robot.display_image_file_on_face("../face_images/ifttt_sports.png")

    except cozmo.exceptions.RobotBusy:
        pass


def worker():
    while True:
        item = ifttt_queue.get()
        if item is None:
            break
        queued_action, action_args = item
        queued_action(action_args)


def run(sdk_conn):
    global robot
    robot = sdk_conn.wait_for_robot()

    threading.Thread(target=worker).start()

    # Start flask web server so that /iftttSports can serve as endpoint.
    flask_helpers.run_flask(flask_app, "127.0.0.1", 8080, False, False)

    # Putting None on the queue stops the thread. This is called when the
    # user hits Control C, which stops the run_flask call.
    ifttt_queue.put(None)


if __name__ == '__main__':
    cozmo.setup_basic_logging()
    cozmo.robot.Robot.drive_off_charger_on_connect = False

    # Use our custom robot class with extra helper methods
    cozmo.conn.CozmoConnection.robot_factory = IFTTTRobot

    try:
        cozmo.connect(run)
    except cozmo.ConnectionError as e:
        sys.exit("A connection error occurred: %s" % e)

3. stock

此示例演示了如何使用“If This Then That”(http://ifttt.com)使Cozmo在股票代码符号增加1%或更多时作出响应。 以下说明将引导您在IFTTT网站上设置小程序。 当调用applet触发器(发送在此示例中启动的Web服务器接收的Web请求)时,Cozmo将播放动画,说出公司名称和增加的百分比,并在他的脸上显示股票市场图像。

If This Then That" Stock example

This example demonstrates how "If This Then That" (http://ifttt.com) can be used
make Cozmo respond when a stock ticker symbol increases by 1% or more. Instructions
below will lead you through setting up an applet on the IFTTT website. When the applet
trigger is called (which sends a web request received by the web server started
in this example), Cozmo will play an animation, speak the company name and the
percentage increase, and show a stock market image on his face.

Please place Cozmo on the charger for this example. When necessary, he will be
rolled off and back on.

Follow these steps to set up and run the example:
    1) Provide a a static ip, URL or similar that can be reached from the If This
        Then That server. One easy way to do this is with ngrok, which sets up
        a secure tunnel to localhost running on your machine.

        To set up ngrok:
        a) Follow instructions here to download and install:
            https://ngrok.com/download
        b) Run this command to create a secure public URL for port 8080:
            ./ngrok http 8080
        c) Note the HTTP forwarding address shown in the terminal (e.g., http://55e57164.ngrok.io).
            You will use this address in your applet, below.

        WARNING: Using ngrok exposes your local web server to the internet. See the ngrok
        documentation for more information: https://ngrok.com/docs

    2) Set up your applet on the "If This Then That" website.
        a) Sign up and sign into https://ifttt.com
        b) Create an applet: https://ifttt.com/create
        c) Set up your trigger.
            1. Click "this".
            2. Select "Stocks" as your service.
            3. Under "Choose a Trigger", select “Today's price rises by percentage".
            4. In section "Complete Trigger Fields", enter your ticker symbol and desired percentage,
                for instance:

                Ticker symbol: HOG
                Percentage increase: 1

            5. Click “Create Trigger".

        d) Set up your action.
            1. Click “that".
            2. Select “Maker Webhooks" to set it as your action channel. Connect to the Maker channel if prompted.
            3. Click “Make a web request" and fill out the fields as follows. Remember your publicly
                accessible URL from above (e.g., http://55e57164.ngrok.io) and use it in the URL field,
                followed by "/iftttStocks" as shown below:

                 URL: http://55e57164.ngrok.io/iftttStocks
                 Method: POST
                 Content Type: application/json
                 Body: {"PercentageChange":"{{PercentageChange}}","StockName":"{{StockName}}"}

            5. Click “Create Action" then “Finish".

    3) Test your applet.
        a) Run this script at the command line: ./ifttt_stocks.py
        b) On ifttt.com, on your applet page, click “Check now”. See that IFTTT confirms that the applet
            was checked.
        c) Wait for your stock to increase and see Cozmo react! Cozmo should roll off the charger, raise
            and lower his lift, announce the stock increase, and then show a stock market image on his face.

import asyncio
import sys


try:
    from aiohttp import web
except ImportError:
    sys.exit("Cannot import from aiohttp. Do `pip3 install --user aiohttp` to install")

import cozmo

from common import IFTTTRobot


app = web.Application()


async def serve_stocks(request):
    '''Define an HTTP POST handler for receiving requests from If This Then That.

    Controls how Cozmo responds to stock notification. You may modify this method
    to change how Cozmo reacts to the stock price increasing.
    '''

    json_object = await request.json()

    # Extract the company name for the stock ticker symbol.
    stock_name = json_object["StockName"]

    # Extract the percentage increase.
    percentage = str(json_object["PercentageChange"])

    robot = request.app['robot']
    async def read_name():
        try:
            async with robot.perform_off_charger():
                '''If necessary, Move Cozmo's Head and Lift to make it easy to see Cozmo's face.'''
                await robot.get_in_position()

                # First, have Cozmo play an animation
                await robot.play_anim_trigger(cozmo.anim.Triggers.ReactToPokeStartled).wait_for_completed()

                # Next, have Cozmo say that your stock is up by x percent.
                await robot.say_text(stock_name + " is up " + percentage + " percent").wait_for_completed()

                # Last, have Cozmo display a stock market image on his face.
                robot.display_image_file_on_face("../face_images/ifttt_stocks.png")

        except cozmo.RobotBusy:
            cozmo.logger.warning("Robot was busy so didn't read stock update: '"+ stock_name + " is up " + percentage + " percent'.")

    # Perform Cozmo's task in the background so the HTTP server responds immediately.
    asyncio.ensure_future(read_name())

    return web.Response(text="OK")

# Attach the function as an HTTP handler.
app.router.add_post('/iftttStocks', serve_stocks)


if __name__ == '__main__':
    cozmo.setup_basic_logging()
    cozmo.robot.Robot.drive_off_charger_on_connect = False

    # Use our custom robot class with extra helper methods
    cozmo.conn.CozmoConnection.robot_factory = IFTTTRobot

    try:
        app_loop = asyncio.get_event_loop()  
        sdk_conn = cozmo.connect_on_loop(app_loop)

        # Wait for the robot to become available and add it to the app object.
        app['robot'] = app_loop.run_until_complete(sdk_conn.wait_for_robot())
    except cozmo.ConnectionError as e:
        sys.exit("A connection error occurred: %s" % e)

    web.run_app(app)

Fin


 

Cozmo机器人开发全部资源(Ubuntu版) Cozmo机器人开发全部资源(Ubuntu版) 包括Cozmo机器人ROS驱动,Cozmo_SDK开发包1.4.6,Linux的adb工具,iOS的usbmuxd工具,CozmoV3.0的xapk以及相应安装使用工具等! 立即下载

相关推荐

AI影像组学在结直肠癌诊疗中的应用:从特征提取到临床决策

影像组学通过高通量计算从医学影像中提取定量特征,揭示肿瘤内部的微观生物学行为,这些特征反映了纹理异质性、形状不规则度等影像表型。其核心原理在于将图像数据转化为可分析的数字特征,结合机器学习算法进行模式识别,从而实现对疾病状态的精准预测。这一技术的价值在于能够无创、定量地评估肿瘤特性,为精准医疗提供关键支持。在临床实践中,AI驱动的影像组学模型广泛应用于结直肠癌的诊疗全链条,包括肿瘤良恶性鉴别、基因突变预测、治疗反应评估和预后分析等场景。通过整合影像组学特征与临床数据,可以构建预测模型,辅助医生进行更准确的诊

weixin_28295799的博客 413

物联网设备安全1.5 If This Then That

1.5 If This Then That If This Then That(IFTTT)是一种服务,这种服务可以让用户创建遵循“(IF)如果满足你设定的条件(This),那么(Then)触发你指定的操作(That)”这种简单逻辑指令的流程。用户可以创建跨越多个云服务的流程,如Gmail、Dropbox、LinkedIn、Twitter,等等。例如,...

weixin_33716557的博客 273

红外通信不止遥控器:手把手教你用2ASK调制实现语音+温度数据同传

本文详细介绍了如何利用2ASK调制技术实现红外通信系统,同时传输语音和温度数据。通过STM32F103C8T6微控制器和DS18B20温度传感器的硬件设计,结合2ASK调制原理,展示了系统的完整实现方案。文章还提供了调试优化建议,适合电子爱好者和通信工程学生实践学习。

weixin_42531588的博客 392

关于this指向的问题

是继承而来的,默认指向在定义它时所处的对象(宿主对象),所以在使用箭头函数时,应判断一下上下文。若回调函数为匿名函数,非严格模式下指向。指向的是调用者,而箭头函数。若回调函数为自定义方法,则。若回调函数为 箭头函数,则。解决办法:定义变量保存。的指向这么不确定呢?首先说明在两种方式中。的写法,在函数内部,

qq_46020268的博客 683

ABB机器人常见的几大数据类型

ABB机器人数据存储描述了机器人控制器内部的各项属性,ABB机器人控制器数据类型多达100余种,其中常见的数据类型包括基本数据、i/o数据、运动相关数据。 1、基本数据 基本数据: bool 逻辑值:逻辑状态下赋予的真或者假。逻辑值有两种情况:成立和不成立则逻辑值为真使用true或1表示不成立则逻辑值为假使用false或0表示 byte 字节值:用于计量存储容量的一种计量单位,取值范围为(0-255) num 数值:变量、可存储整数或小数整数取值范围(-8388607~8388608) dnum

soinlove36的专栏 1万+

解题报告-美团点评2017秋招笔试编程题--常见动态规划问题

晚上就要美团笔试了,在牛客上刷套美团的题练练手,四道题目全都是典型题目,经典的连题面都懒得改那种,也都不难,很基础的动态规划问题。[编程题] 大富翁游戏时间限制:1秒空间限制:32768K大富翁游戏,玩家根据骰子的点数决定走的步数,即骰子点数为1时可以走一步,点数为2时可以走两步,点数为n时可以走n步。求玩家走到第n步(n<=骰子最大点数且是方法的唯一入参)时,总共有多少种投骰子的方法。 输...

聂小白的专栏 1723

IF this THEN that

国外有一款软件IFTTT,软件主旨是IF this THEN that,让互联网帮你做事.例如:如果家里是智能灯具的话,可以在你快到家门口时自动开灯。如果微波炉智能的话,可以在你起床之前半小时开始烤面包。腹黑一下,我怎么忽然觉得”死神来了”在现实中是可以实现的呢。

Hiwork2015的博客 867

滑模控制算法——基本原理(附MATLAB程序)

选择一个滑模面和是设计参数。是滑模面函数,通常我们希望系统状态在的面上滑动。我们以一个简单的二阶系统作为示例,其状态空间方程为:是系统矩阵是输入矩阵是输出矩阵假设我们的系统如下:滑模控制算法的核心在于设计合适的滑模面和控制律,并分析系统在滑模面上的稳定性。通过上述公式和步骤,可以有效地设计滑模控制器,以处理具有非线性和不确定性的动态系统。总的来说,滑模控制算法因其鲁棒性和灵活性在处理复杂控制问题中表现出色,但在实际应用中需要精心设计以克服抖振现象和其他潜在问题。BuxuABDC。

qq_35623594的博客 2万+

流畅的信息处理:采用“If This Then That“模型优化时间管理

通过将任务自动化,我们可以将更多的精力集中在那些需要创造性思维和人际交往的任务上,从而提升我们的工作和生活质量。在未来,随着人工智能和机器学习技术的发展,我们可以预见到IFTTT模型将会变得更加智能和强大,为我们带来更加无缝和高效的工作体验。这种模型的魅力在于,它可以将我们的工作流从严格的时间限制中解放出来,转而依赖于任务之间的因果关系。当然,要实现这种自动化的工作流,我们需要一些工具和平台的支持。在项目管理中,你可以将这一模型应用于项目的里程碑管理,确保每个阶段的任务完成后,自动触发下一阶段的工作。

hutx0924的博客 734

中兴OLT配置实战:从零开始,手把手教你完成一个HGU的完整业务开通(含DBA模板、限速与远程升级)

本文详细介绍了中兴OLT配置实战,从零开始手把手教你完成HGU的完整业务开通,包括DBA模板设计、限速与远程升级等关键步骤。通过实际案例和详细命令,帮助工程师快速掌握GPON网络配置技巧,提升运维效率。

weixin_30599769的博客 361

爬虫反爬:一文掌握 BotBrowser 的原理和使用(能绕过很多验证码的指纹浏览器)

BotBrowser是使用经过修改的Chromium内核(修改Chromium的C++源代码)的隐形浏览器,可靠地绕过Cloudflare、Shape、PerimeterX、Datadome、Akamai、Kasada、hCaptcha和reCAPTCHA。BotBrowser是一个跨平台的自动化工具,它重新定义了web自动化。专为爬虫、RPA(机器人流程自动化)和 Web 测试设计。与 Puppeteer/Selenium 不同,它通过无头模式(Headless)和API 级控制。

数据知道的博客 1万+

[置顶]IFTTT与Google+是什么?ifttt怎么玩?

求ifttt邀请码的信息今天在网络上满处可见,ifttt是什么? ifttt = if this then that,是一个简单的逻辑触发网站。你可以创建任务,如果(If)某个网站比如新浪博客有一篇新文章发布(this),然后(then)将文章的标题和摘要发送到我的邮箱(that)。 ifttt目前支持多达33个事件频道,包括facebook、workdpre...

ajwh64482的博客 352

华为OD机试真题 新系统2026-04-01 Python&JS 实现【勇攀数字高峰】

请你在给定的数字地形图中寻找登山路径,数字代表当前位置的海拔高度,要求从最低海拔出发,不断攀登,最终到达最高山峰。你需要寻找所有满足条件的登山路径。地图已经保证最低海拔和最高山峰都只有一个。

MISAYAONE的博客 873

Cozmo人工智能机器人SDK使用笔记(7)-补充说明

Anki Cozmo Python SDK的示例程序 有关示例程序的教程,请参考tutorials文件夹,从01_basics子目录中的hello_world到更高级的场景和操作示例。 查看apps目录,了解一些有趣的全功能程序,如遥控器和桌面监控。 有关Cozmo使用“If This Then That”服务的一些示例,请参阅if_this_then_that目录。 有关如何将SDK连接...

zhangrelay的专栏 1688

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Vector人工智能机器人SDK使用笔记

Cozmo是2016年推出的,2两年后的2018年Vector上市,具备语音助手和更多功能,元件数由300+升级到700+。 Vector的SDK具体说明在:developer.anki.com/vector/docs/。目前是测试版本 Vector人工智能机器人SDK使用笔记 首先下载Vector的SDK(github): docs是文档,examples是示例,还有一些说明文档...

zhangrelay的专栏 1万+

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Cozmo人工智能机器人SDK使用笔记(X)-总结- |人工智能基础(中小学版)实践平台|

|人工智能基础(中小学版)实践平台| Cozmo人工智能机器人SDK使用笔记(X)-总结- Cozmo的SDK包括了使用其开发的大部分功能示例,全部内容参考如下链接: ----https://blog.csdn.net/zhangrelay/article/category/7739166---- 更多精彩的开发内容参考forums.anki.com,例如:Vector机器人的Scratch...

zhangrelay的专栏 3986

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

zhangrelay老师的cozmo相关博客整理

从ros暑期学校知道了cozmo,zhangrelay老师的博客有大量教程,但是都很分散,有时候想找一个东西就只记得自己看到过,但是不知道在哪篇,所以整理一下方便找。 zhangrelay的专栏:https://blog.csdn.net/ZhangRelay 1.综述类 Cozmo人工智能机器人玩具/教具完整版中文说明书和介绍(附应用下载链接) ROS2GO之手机连接Cozmo人工智能机...

Jiali Zhang的博客 1504

Cozmo人工智能机器人SDK使用笔记(2)-显示部分face

这篇博文针对SDK教程中的第二部分cozmo_face进行简单介绍,如下: face是cozmo显示的核心部分: 来学习一下,如何操作吧~ 分为3个文件,如上图所示。 1. face image cozmo面部显示png图片信息。 #!/usr/bin/env python3 # Copyright (c) 2016 Anki, Inc. # # Lic...

zhangrelay的专栏 2116

Cozmo人工智能机器人SDK使用笔记(3)-视觉部分vision

关于机器人感知-视觉部分,有过一次公开分享,讲稿全文和视屏实录,参考如下CSDN链接: 机器人感知-视觉部分(Robotic Perception-Vision Section): https://blog.csdn.net/ZhangRelay/article/details/81352622 Cozmo视觉Vision也可以完成很多功能,宠物、方块、人脸等识别和跟踪等,非常有趣。 ...

zhangrelay的专栏 2820

Cozmo人工智能机器人SDK使用笔记(4)-任务部分cubes_and_objects

先简单总结一下使用笔记1-3: 基础部分介绍了一些常用功能,比如运动控制、LED显示和扬声器交互等 人机接口显示部分--输出,cozmo面部显示屏输出一些基本信息 人机接口视觉部分--输入,cozmo摄像头获取环境信息并处理等 接着,就自然过渡到第四部分----立方体和物体任务部分,共有13个项目专题,非常有趣。 Cozmo环顾四周,找寻充电底座图标,然后行驶到附近,任务完成。 ...

zhangrelay的专栏 2174

Cozmo人工智能机器人SDK使用笔记(6)-并行部分Parallel_Action

Cozmo并行动作示例。 此示例演示如何并行(而不是按顺序)执行动作。 import sys import time try: from PIL import Image except ImportError: sys.exit("Cannot import from PIL: Do `pip3 install --user Pillow` to install") im...

zhangrelay的专栏 1328

Cozmo人工智能机器人SDK使用笔记(5)-时序部分async_sync

Cozmo首先寻找一个立方体。 找到立方体后,立方体的灯以循环方式绿色闪烁,然后等待轻敲立方体。 此时,程序分别为同步和异步两种类型,注意区分。 1. 同步 立方体闪烁同步示例 import asyncio import sys import cozmo class BlinkyCube(cozmo.objects.LightCube): '''Subclass LightC...

zhangrelay的专栏 1317

Anki Cozmo(Vector)人工智能机器人玩具部分文档

Cozmo人工智能机器人SDK使用笔记(X)-总结- |人工智能基础(中小学版)实践平台| https://blog.csdn.net/ZhangRelay/article/details/86675539 仿真: ROS Melodic的迷失与救赎::https://blog.csdn.net/column/details/28058.html GitChat::沉迷...

zhangrelay的专栏 1万+

ifttt

ifttt介绍 ifttt是“if this then that”的缩写,事实上是让你的网络行为能够引发连锁反应、让你使用更为方便,其宗旨是“Put the internet to work for you”(让互联网为你服务)。ifttt旨在帮助人们利用各网站的开放API,将Facebook、Twitter等各个网站或应用衔接,完成任务,使 “每个人都可以成为整个互联网不用编程的程序员”。i...

老焦的blog-奋斗12年IT虫子所思所想所感 443

触发你的生活:IFTTT

在什么都讲究「智能」的今天,互联网服务日新月异的变化可能会使你眼花缭乱。社交网络、云服务、网络媒体、电子商务,这些都无不穿插着你的生活。在现在更友好的 Open API 时代,双赢变成了多赢,一个用户每天都需要面对着多种社交媒体,他们在各种媒介上都有着不同的目的。而在后 Web 2.0 时代,人们更为渴望碎片化的网络信息得到疏导与整合,能够集中处理每天信息的组织与收发,于是,一个更被看好且具有跨时...

键盘的起始页 1775

Cozmo人工智能机器人SDK使用笔记(8)-应用部分apps

Cozmo应用部分有7个项目示例。 1. 3d viewer 3d Viewer示例并可以远程遥控。 这是一个如何将3D查看器与程序配合使用的示例,3D查看器和控件将自动运行。 注意asyncio! import asyncio import cozmo async def cozmo_program(robot: cozmo.robot.Robot): while Tr...

zhangrelay的专栏 2453
上一篇: Cozmo人工智能机器人SDK使用笔记(8)-应用部分apps
下一篇: Cozmo人工智能机器人SDK使用笔记(X)-总结- |人工智能基础(中小学版)实践平台|
zhangrelay
zhangrelay 领域专家: 人工智能技术领域 领域专家: 人工智能技术领域
博客等级 码龄22年 5万+粉丝 1870原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhangrelay

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值