Ubuntu ros系統下,qt程式怎麼呼叫kdl運動學庫解析機械人整體的urdf?

時間 2021-07-13 19:02:30

1樓:百世經綸

KDL可以無需ros依賴,有原始碼可以用,正解逆解都很簡單。使用urdf檔案的話需要ros下的kdl_parser,複製一下出來載入用就可以了。

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

using

namespace

KDL;

using

namespace

std;

intmain

(int

argc

,char

**argv

)doublex,

y,z;

printf

("Enter the x: "

);scanf

("%lf",&

x);printf

("Enter the y: "

);scanf

("%lf",&

y);printf

("Enter the z: "

);scanf

("%lf",&

z);Vector

vector

=Vector(x

,y,z

);float

roll

,pitch

,yaw

;printf

("Enter the roll: "

);scanf

("%e",&

roll

);printf

("Enter the pitch: "

);scanf

("%e",&

pitch

);printf

("Enter the yaw: "

);scanf

("%e",&

yaw);

floatcy=

cos(

yaw);

floatsy=

sin(

yaw);

floatcp=

cos(

pitch

);floatsp=

sin(

pitch

);floatcr=

cos(

roll

);floatsr=

sin(

roll

);double

rot0=cy

*cp;double

rot1=cy

*sp*sr

-sy*cr

;double

rot2=cy

*sp*cr

+sy*sr

;double

rot3=sy

*cp;double

rot4=sy

*sp*sr

+cy*cr

;double

rot5=sy

*sp*cr

-cy*sr

;double

rot6=-

sp;double

rot7=cp

*sr;double

rot8=cp

*cr;Rotation

rot=

Rotation

(rot0

,rot1

,rot2

,rot3

,rot4

,rot5

,rot6

,rot7

,rot8

);Frame

cartpos

=Frame

(rot

,vector

);JntArray

jointpositions

=JntArray(nj

);bool

kinematics_status

;kinematics_status

=iksolver

.CartToJnt

(jointGuesspositions

,cartpos

,jointpositions

);if

(kinematics_status

>=0)

printf

("%s \n"

,"Success, thanks KDL!");}else}

能安利一下程瀟嗎

SvJo 16年就知道她了,因為不追星只覺得她好美好美但無感,但我是顏狗,從此成了她的路人粉。不會去刻意關注她的訊息,但是在網上看到有關她的新聞或者文章都會點進去看。好像從沒看到過罵她的哈哈 後來她在南韓綜藝宣傳中國文化我心想這個小姐姐針不戳。我一直覺得素人心疼明星是閒的沒事扯淡,明星過得滋潤得很還...

可否給我安利一下丁程鑫?

抱著小熊睡覺 時代少年團 丁程鑫 TNT唯一主舞日韓認證的國寶級美少年神顏數次 萬轉出圈 芭莎男士秒切 斷層 第一明星主頁 斷層 第一可鹽可甜的小年糕 ACE TOP 兼備的王牌 小宋可可愛愛 丁程鑫2002.02.24出生,今年十八歲 再過21天就19了哦 是團內的大哥,很照顧弟弟們,演技挺不錯的...

可以安利一下丁程鑫嗎

程味南瓜 首先顏值狐狸系的,眼睛很好看,各種比例很好實力跳舞不用說對內唯一主舞唱歌也一直在進步,很好聽玫瑰嗓音很有演戲天賦 身材偏薄但腹肌什麼的都有,腿長又細 性格善良有主見 拾遺 我最開始認識程程的時候是在師兄TFBOYS的物料裡,當時我對他的第一印象就是這個小朋友怎麼奶呼呼的樣子就很可愛 我是這...