NFU-MDE-40823108-cd2021

Created by 40823108

Date today:

Webots基本操作

基礎小車

Webots基本Python避障程式


                           from controller import Robot

                        TIME_STEP = 1
                        robot = Robot()
                        ds = []
                        dsNames = ['ds_right', 'ds_left', 'ds_in']
                        for i in range(3):
                            ds.append(robot.getDevice(dsNames[i]))
                            ds[i].enable(TIME_STEP)
                        wheels = []
                        wheelsNames = ['wheel1', 'wheel2', 'wheel3', 'wheel4']
                        for i in range(4):
                            wheels.append(robot.getDevice(wheelsNames[i]))
                            wheels[i].setPosition(float('inf'))
                            wheels[i].setVelocity(0.0)
                        avoidObstacleCounter = 0
                        while robot.step(TIME_STEP) != -1:
                            leftSpeed = 10.0
                            rightSpeed = 10.0
                            if avoidObstacleCounter > 0:
                                avoidObstacleCounter -= 1
                                leftSpeed = 1.0
                                rightSpeed = -1.0
                            else:  # read sensors
                                for i in range(3):
                                    if ds[i].getValue() < 900.0:
                                        avoidObstacleCounter = 90
                            wheels[0].setVelocity(leftSpeed)
                            wheels[1].setVelocity(rightSpeed)
                            wheels[2].setVelocity(leftSpeed)
                            wheels[3].setVelocity(rightSpeed)
                           

Webots匯入EV3

將EV3STL黨匯入webots嘗試讓EV3避障

問題

將EV3 STL黨匯入webots,全部的零件會變成整塊實體,所以將需要做動的輪胎部分先拆除,在webots中重建,但在webots中重建的輪胎顯示不出來,問題尚在解決當中

W2進度

主題

分組後與組員討論決定製作機械手臂夾爪,下圖為設計之概念圖。

主題修改

經過設計思考機械手臂夾爪過於複雜,模擬上可能無法順利進行,決定更改主題。

討論後決定製作Lego-EV3可以透過各種不同的連桿組成所需之形狀。

理想模型

下圖為參考Lego-EV3,所繪製之概念圖

Lego-EV3

開始繪製有關Lego-EV3所需之模組,首先繪製控制馬達與感測器之主機本體。

  • ARM9處理器
  • 內建16MB記憶體,64MB內存
  • Linux作業系統
  • 具有4個輸入端與4個輸出端
  • 可與iOS/Android/Windows裝置遙控或互動

主機繪製

下圖為Lego-EV3主機繪製過程圖

馬達繪製

下圖為Lego-EV3馬達繪製與主機配合樣圖

W3進度

連桿繪製

將所需之連桿繪製出來,可依想組裝之方式做組裝及設計連桿

組裝

完成所需之物件後,將連桿、主機、馬達、輪胎裝上就能夠完成一台可程式控制的小車

渲染

使用Inventor內建功能,將模型擬真,更能呈現產品之真實性

簡化零件

為了能夠方便模擬,我們將部分零件做簡化,讓模擬時不會因為過多的零件導致模擬失敗

模擬1

第一次模擬因為零件過多,需要調整許多參數,導致在模擬過程中遇到許多問題,也導致模擬失敗

模擬2

在經過零件簡化後,模擬上的問題也減少了,需要設定的參數也相對變少,最後成功讓小車可以移動

W4進度

2D 工程圖

主機工程圖

3D 爆炸圖

爆炸圖包含BOM

3D 模型

完成模型

模擬1

因零件過多導致模擬失敗

模擬1

因零件過多導致模擬失敗

Lego-EV3產品設計報告書

Pretty Code


                import React, { useState } from 'react';

                function Example() {
                  const [count, setCount] = useState(0);

                  return (
                    ...
                  );
                }
            

Code syntax highlighting courtesy of highlight.js.

With animations


                import React, { useState } from 'react';

                function Example() {
                  const [count, setCount] = useState(0);

                  return (
                    <div>
                      <p>You clicked {count} times</p>
                      <button onClick={() => setCount(count + 1)}>
                        Click me
                      </button>
                    </div>
                  );
                }

                function SecondExample() {
                  const [count, setCount] = useState(0);

                  return (
                    <div>
                      <p>You clicked {count} times</p>
                      <button onClick={() => setCount(count + 1)}>
                        Click me
                      </button>
                    </div>
                  );
                }
            

Point of View

Press ESC to enter the slide overview.

Hold down the alt key (ctrl in Linux) and click on any element to zoom towards it using zoom.js. Click again to zoom back out.

(NOTE: Use ctrl + click in Linux.)

Auto-Animate

Automatically animate matching elements across slides with Auto-Animate.

Auto-Animate

Auto-Animate

Touch Optimized

Presentations look great on touch devices, like mobile phones and tablets. Simply swipe through your slides.

Fragments

Hit the next arrow...

... to step through ...

... a fragmented slide.

Fragment Styles

There's different types of fragments, like:

grow

shrink

fade-out

fade-right, up, down, left

fade-in-then-out

fade-in-then-semi-out

Highlight red blue green

Transition Styles

You can select from different transitions, like:
None - Fade - Slide - Convex - Concave - Zoom

Themes

reveal.js comes with a few themes built in:
Black (default) - White - League - Sky - Beige - Simple
Serif - Blood - Night - Moon - Solarized

Slide Backgrounds

Set data-background="#dddddd" on a slide to change the background color. All CSS color formats are supported.

Down arrow

Image Backgrounds

<section data-background="image.png">

Tiled Backgrounds

<section data-background="image.png" data-background-repeat="repeat" data-background-size="100px">

Video Backgrounds

<section data-background-video="video.mp4,video.webm">

... and GIFs!

Background Transitions

Different background transitions are available via the backgroundTransition option. This one's called "zoom".

Reveal.configure({ backgroundTransition: 'zoom' })

Background Transitions

You can override background transitions per-slide.

<section data-background-transition="zoom">

Iframe Backgrounds

Since reveal.js runs on the web, you can easily embed other web content. Try interacting with the page in the background.

Marvelous List

  • No order here
  • Or here
  • Or here
  • Or here

Fantastic Ordered List

  1. One is smaller than...
  2. Two is smaller than...
  3. Three!

Tabular Tables

Item Value Quantity
Apples $1 7
Lemonade $2 18
Bread $3 2

Clever Quotes

These guys come in two forms, inline: The nice thing about standards is that there are so many to choose from and block:

“For years there has been a theory that millions of monkeys typing at random on millions of typewriters would reproduce the entire works of Shakespeare. The Internet has proven this theory to be untrue.”

Intergalactic Interconnections

You can link between slides internally, like this.

Speaker View

There's a speaker view. It includes a timer, preview of the upcoming slide as well as your speaker notes.

Press the S key to try it out.

Export to PDF

Presentations can be exported to PDF, here's an example:

Global State

Set data-state="something" on a slide and "something" will be added as a class to the document element when the slide is open. This lets you apply broader style changes, like switching the page background.

State Events

Additionally custom events can be triggered on a per slide basis by binding to the data-state name.


        Reveal.on( 'customevent', function() {
        console.log( '"customevent" has fired' );
        } );
            

Take a Moment

Press B or . on your keyboard to pause the presentation. This is helpful when you're on stage and want to take distracting slides off the screen.

Much more

THE END

- Try the online editor
- Source code & documentation