update
This commit is contained in:
@@ -242,8 +242,7 @@ function v3dBuildRobot(r) {
|
||||
|
||||
// LiDAR: tru nho o dung vi tri trong robot.yaml.
|
||||
const lidar = new THREE.Mesh(
|
||||
// To hon ban goc (0.035 x 0.06): phai nhin ro xuyen qua than trong suot.
|
||||
new THREE.CylinderGeometry(0.055, 0.055, 0.09, 16),
|
||||
new THREE.CylinderGeometry(0.045, 0.045, 0.06, 16),
|
||||
new THREE.MeshLambertMaterial({ color: 0xe2574c }));
|
||||
lidar.position.copy(toScene(r.laser_x, r.laser_y, r.laser_z));
|
||||
g.add(lidar);
|
||||
@@ -258,37 +257,46 @@ function v3dBuildRobot(r) {
|
||||
const cam = new THREE.Mesh(new THREE.BoxGeometry(0.03, 0.05, 0.10), darkMat);
|
||||
camG.add(cam);
|
||||
|
||||
// TANG 2: MOT TAM tren BON COT, camera dat tren tam.
|
||||
// BA TANG, moi tam dat tren BON COT manh.
|
||||
//
|
||||
// Khong dung khoi hop dac: LiDAR nam o noc tang 1 va quet 270 do quanh no,
|
||||
// nen bat cu thu gi dac phia tren deu che mat tia. Bon cot manh o GOC de
|
||||
// chua khoang trong quanh LiDAR -- day cung la cach robot that duoc dung.
|
||||
// tang 1 than robot
|
||||
// tang 2 tam co LiDAR TREO DUOI (LiDAR gan up nguoc -- xem robot.yaml)
|
||||
// tang 3 tam co camera DAT TREN
|
||||
//
|
||||
// Chieu cao suy THANG tu cam_z trong robot.yaml, khong them tham so cau
|
||||
// hinh nao: doi vi tri cam bien thi hinh ve tu di theo, khong con mot con
|
||||
// so thu hai phai nho sua cho khop.
|
||||
const tier1TopB = clear + bodyH - r.wheel_radius; // z so voi base_link
|
||||
const plateTh = 0.012;
|
||||
const plateTopB = r.cam_z - 0.045; // chua cho hop camera
|
||||
const postH = (plateTopB - plateTh) - tier1TopB;
|
||||
if (postH > 0.02) {
|
||||
// Cot o goc, dat ra xa tam de khong chan LiDAR (ban kinh marker 0.055).
|
||||
// Khong dung khoi hop dac o tang tren: LiDAR quet 270 do quanh no, mat dac
|
||||
// se che tia. Bon cot manh o goc chua khoang trong -- cung la cach robot
|
||||
// that duoc dung.
|
||||
//
|
||||
// Moi chieu cao suy THANG tu laser_z / cam_z trong robot.yaml. Doi vi tri
|
||||
// cam bien thi ca ba tang tu di theo, khong co con so thu hai phai nho sua
|
||||
// cho khop -- dung cai bay ma robot.yaml ton tai de tranh.
|
||||
const deck = (topB, thick, lenF, widF, fromB) => {
|
||||
const h = (topB - thick) - fromB;
|
||||
if (h <= 0.015) return;
|
||||
const px = bodyL * 0.42, py = bodyW * 0.40;
|
||||
for (const sx of [-1, 1]) {
|
||||
for (const sy of [-1, 1]) {
|
||||
const post = new THREE.Mesh(
|
||||
new THREE.CylinderGeometry(0.012, 0.012, postH, 10), darkMat);
|
||||
post.position.set((r.body_off_x || 0) + sx * px,
|
||||
tier1TopB + postH / 2,
|
||||
sy * py);
|
||||
new THREE.CylinderGeometry(0.011, 0.011, h, 10), darkMat);
|
||||
post.position.set((r.body_off_x || 0) + sx * px, fromB + h / 2, sy * py);
|
||||
g.add(post);
|
||||
}
|
||||
}
|
||||
const plate = new THREE.Mesh(
|
||||
new THREE.BoxGeometry(bodyL * 0.92, plateTh, bodyW * 0.88), bodyMat);
|
||||
plate.position.set((r.body_off_x || 0), plateTopB - plateTh / 2, 0);
|
||||
new THREE.BoxGeometry(bodyL * lenF, thick, bodyW * widF), bodyMat);
|
||||
plate.position.set((r.body_off_x || 0), topB - thick / 2, 0);
|
||||
g.add(plate);
|
||||
}
|
||||
};
|
||||
|
||||
const plateTh = 0.012;
|
||||
const tier1TopB = clear + bodyH - r.wheel_radius; // z so voi base_link
|
||||
// Tam tang 2: DAY tam nam ngay tren LiDAR, de LiDAR treo duoi no.
|
||||
const t2TopB = r.laser_z + 0.030 + 0.004 + plateTh;
|
||||
// Tam tang 3: NOC tam nam ngay duoi camera, de camera dat len tren.
|
||||
const t3TopB = r.cam_z - 0.025 - 0.004;
|
||||
|
||||
deck(t2TopB, plateTh, 0.92, 0.88, tier1TopB);
|
||||
deck(t3TopB, plateTh, 0.80, 0.78, t2TopB);
|
||||
|
||||
// Frustum camera: hinh chop cut, ve bang duong vien de khong che mat cloud.
|
||||
// Frustum va vanh cliff la OVERLAY kieu RViz, khong phai mot phan robot.
|
||||
|
||||
Reference in New Issue
Block a user