總體模型
將以上兩組單獨(dú)的測(cè)量結(jié)果疊加起來,形成卡爾曼濾波器中使用的觀測(cè)向量。 同樣,每個(gè)度量的協(xié)方差矩陣形成一個(gè)整體塊 對(duì)角線協(xié)方差矩陣如下:

目前,我們使用的卡爾曼濾波用實(shí)現(xiàn),這一融合過程其實(shí)可以通過貝葉斯定律的靜態(tài)似然最大化得到。
然而,上述過程是一個(gè)嵌入在標(biāo)準(zhǔn)卡爾曼更新中的過程,大概是因?yàn)樵?a target="_blank">機(jī)器人學(xué)中更容易實(shí)現(xiàn)。
完整代碼
import math
import numpy as np
import matplotlib.pyplot as plt
# 設(shè)定周期為2
T = 2
# 根據(jù)相位計(jì)算當(dāng)前接觸狀態(tài)
def get_contact_state(phi):
if phi < 0.5*T:
state = 1
else:
state = 0
return state
# 預(yù)測(cè)模型
def prediction_model(phi, state, params):
"""
Given the gait schedule and the current phase, φ, of a leg,
the gait scheduler provides an expected contact state s φ of
each leg
:param phi: phase
:param state: contact state
:param params: [mu, mu_bar, sigma, sigma_bar]
mu = [mu1, mu2] and so on
:return: the probability of contact
"""
mu0, mu1 = params[0]
mu0_bar, mu1_bar = params[1]
sigma0, sigma1 = params[2]
sigma0_bar, sigma1_bar = params[3]
a = math.erf((phi-mu0)/(sigma0*np.sqrt(2)))
+ math.erf((mu1-phi)/(sigma1*np.sqrt(2)))
b = 2+math.erf((mu0_bar-phi)/(sigma0_bar*np.sqrt(2)))
+ math.erf((phi-mu1_bar)/(sigma1_bar*np.sqrt(2)))
if state == 1:
prob = 0.5 * (state * a)
else:
prob = 0.5 * (state * b)
return prob
# 測(cè)量模型-離地高度
def ground_height(pz, params):
"""
The probability of contact given foot heigh
:param pz: ground height
:param params: [mu_z, sigma_z]
:return: The probability of contact
"""
mu_z, sigma_z = params
prob_ground_height = 0.5 * (1 + math.erf((mu_z-pz) / (sigma_z*np.sqrt(2))))
return prob_ground_height
# 測(cè)量模型-反作用力
def contact_force(f, params):
"""
the probability of contact given the estimated foot force
:param f: contact force
:param params: [mu_z, sigma_z]
:return: The probability of contact
"""
mu_f, sigma_f = params
prob_force = 0.5 * (1 + math.erf((f-mu_f) / (sigma_f*np.sqrt(2))))
return prob_force
# 概率分布繪圖
def test_predict():
Mu = [0, 1]
Mu_bar = [0, 1]
Sigma = [0.025, 0.025]
Sigma_bar = [0.025, 0.025]
t = np.linspace(0, 0.999, 1000)
prediction_prob = []
prediction_prob2 = []
prediction_prob3 = []
for time in t:
phi = time % T
state = get_contact_state(phi)
p = prediction_model(phi, state, [Mu, Mu_bar, Sigma, Sigma_bar])
p2 = prediction_model(phi, state, [Mu, Mu_bar, [0.05, 0.05], [0.05, 0.05]])
p3 = prediction_model(phi, state, [Mu, Mu_bar, [0.01, 0.01], [0.01, 0.01]])
prediction_prob.append(p)
prediction_prob2.append(p2)
prediction_prob3.append(p3)
fig = plt.figure()
plt.subplot(211)
plt.title('contact phase')
plt.grid()
plt.plot(t, prediction_prob, label='$mu=[0, 1],sigma=[0.025, 0.025]$')
plt.plot(t, prediction_prob2, label='$mu=[0, 1],sigma=[0.05, 0.05]$')
plt.plot(t, prediction_prob3, label='$mu=[0, 1],sigma=[0.01, 0.01]$')
plt.legend()
plt.subplot(212)
plt.title('swing phase')
plt.grid()
plt.plot(t, 1-np.array(prediction_prob), label='$mu=[0, 1],sigma=[0.025, 0.025]$')
plt.plot(t, 1-np.array(prediction_prob2), label='$mu=[0, 1],sigma=[0.05, 0.05]$')
plt.plot(t, 1-np.array(prediction_prob3), label='$mu=[0, 1],sigma=[0.01, 0.01]$')
plt.legend()
fig.tight_layout()
plt.show()
def test_ground_height():
height = np.linspace(-0.3, 0.3, 1000)
ground_height_prob = []
ground_height_prob2 = []
ground_height_prob3 = []
params = [0, 0.025]
params2 = [0, 0.05]
params3 = [0, 0.1]
for h in height:
ground_height_prob.append(ground_height(h, params))
ground_height_prob2.append(ground_height(h, params2))
ground_height_prob3.append(ground_height(h, params3))
fig2 = plt.figure()
plt.plot(height, ground_height_prob, label='$mu=0,sigma=0.025$')
plt.plot(height, ground_height_prob2, label='$mu=0,sigma=0.05$')
plt.plot(height, ground_height_prob3, label='$mu=0,sigma=0.1$')
fig2.tight_layout()
plt.legend()
plt.grid()
plt.show()
def test_contact_force():
force = np.linspace(-50, 200, 1000)
contact_force_prob = []
contact_force_prob2 = []
contact_force_prob3 = []
params = [35, 10]
params2 = [35, 25]
params3 = [35, 50]
for f in force:
contact_force_prob.append(contact_force(f, params))
contact_force_prob2.append(contact_force(f, params2))
contact_force_prob3.append(contact_force(f, params3))
fig3 = plt.figure()
plt.plot(force, contact_force_prob, label='$mu=25,sigma=10$')
plt.plot(force, contact_force_prob2, label='$mu=25,sigma=25$')
plt.plot(force, contact_force_prob3, label='$mu=25,sigma=50$')
fig3.tight_layout()
plt.grid()
plt.legend()
plt.show()
# test_predict()
# test_ground_height()
test_contact_force()
聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請(qǐng)聯(lián)系本站處理。
舉報(bào)投訴
-
機(jī)器人
+關(guān)注
關(guān)注
213文章
31093瀏覽量
222358 -
測(cè)量
+關(guān)注
關(guān)注
10文章
5638瀏覽量
116746 -
模型
+關(guān)注
關(guān)注
1文章
3755瀏覽量
52125 -
四足機(jī)器人
+關(guān)注
關(guān)注
1文章
99瀏覽量
15695
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
熱點(diǎn)推薦
雙足機(jī)器人
第三章、雙足機(jī)器人的硬件結(jié)構(gòu)與框圖一、雙足機(jī)器人的硬件框圖圖1. 雙足機(jī)器人結(jié)構(gòu)框圖
發(fā)表于 11-25 11:30
stm32紅外六足機(jī)器人
六足爬行機(jī)器人畢業(yè)時(shí)的作品,當(dāng)時(shí)還處于入門狀態(tài),c程序?qū)懙谋容^菜(程序?qū)懙谋容^亂,僅作參考),一直想把這個(gè)六足機(jī)器人作品優(yōu)化一下,可惜,一直在忙,現(xiàn)借助電路城這個(gè)平臺(tái)開源給大家,希望大
發(fā)表于 03-27 18:51
【OK210申請(qǐng)】四足輪式機(jī)器人
申請(qǐng)理由:我正在做這樣一個(gè)機(jī)器人,遇到了很多問題,非常想學(xué)習(xí)一下這款板子!我相信利用它能幫我解決難題!項(xiàng)目描述:可利用四足機(jī)械結(jié)構(gòu)仿生行進(jìn),也可利用車輪進(jìn)行行進(jìn),集四
發(fā)表于 06-25 19:38
【Embedded Pi申請(qǐng)】六足機(jī)器人的創(chuàng)新研發(fā)
申請(qǐng)理由:關(guān)于六足機(jī)器人,基本上是用18個(gè)舵機(jī)一起使用來驅(qū)動(dòng)六足完成相應(yīng)的動(dòng)作組,而一般的89C52以及STC12系列的單片機(jī)只能讓六足機(jī)器人
發(fā)表于 11-25 15:35
四足仿生機(jī)器人
本帖最后由 紅塵。破 于 2016-8-19 14:59 編輯
今天整理資料時(shí)發(fā)現(xiàn)了一年前做的四足仿生機(jī)器人,當(dāng)時(shí)買了一個(gè)四足仿生
發(fā)表于 08-19 14:59
四足機(jī)器人
`這是創(chuàng)客集結(jié)號(hào)的作品四足機(jī)器人身體和四足都是通過3D打印技術(shù)打印出來的,通過自己安裝連接上超聲波傳感器,制作成功的
發(fā)表于 09-29 09:55
求六足機(jī)器人的圖紙
`業(yè)余,想想做一做六足機(jī)器人。但是苦于無大致圖紙,卡在建模的問題上。求六足機(jī)器人的圖紙,有清晰的尺寸就行(主要是腿)。`
發(fā)表于 03-26 18:43
四足機(jī)器人的機(jī)構(gòu)設(shè)計(jì)
四足機(jī)器人屬于復(fù)雜機(jī)電系統(tǒng),需要綜合生物、機(jī)械、電子、控制等學(xué)科內(nèi)容,具體涉及仿生機(jī)構(gòu)設(shè)計(jì)、靈巧運(yùn)動(dòng)機(jī)構(gòu)設(shè)計(jì)、高性能驅(qū)動(dòng)器制造,行走穩(wěn)定性控制、強(qiáng)化學(xué)習(xí)等在內(nèi)的多個(gè)研究方向。其中,機(jī)構(gòu)設(shè)計(jì)是保障
發(fā)表于 09-15 06:54
四足機(jī)器人遍地開花,四足機(jī)器人的市場(chǎng)有多大
幽靈公主的坐騎在現(xiàn)實(shí)中被造出來了? 日本川崎重工3月9日首次公開了旗下開發(fā)的全新四足機(jī)器人,外形類似宮崎駿《幽靈公主》中主角的坐騎——酷似山羊的雅酷兒。這款四
四足機(jī)器人步態(tài)規(guī)劃與接觸狀態(tài)
0、步態(tài)規(guī)劃 四足機(jī)器人控制當(dāng)中,步態(tài)是至關(guān)重要的一項(xiàng)。我們可以簡(jiǎn)單理解成四足機(jī)器人運(yùn)動(dòng)過程中各
四足機(jī)器人足端接觸檢測(cè)完整代碼
評(píng)論