da changes

modified:   .gitignore
	modified:   .vscode/tasks.json
	modified:   src/maintain/scripts/test.py
	modified:   src/vision_opencv/cv_bridge/python/cv_bridge/__pycache__/core.cpython-38.pyc
This commit is contained in:
wxchen
2023-05-08 10:03:17 +08:00
parent 11043f0a29
commit 231f5fc815
4 changed files with 14 additions and 13 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
.catkin_tools .catkin_tools
.vscode .vscode
.vscode/*
/build /build
/devel /devel
/logs /logs

4
.vscode/tasks.json vendored
View File

@@ -5,8 +5,8 @@
"command": "catkin", "command": "catkin",
"args": [ "args": [
"build", "build",
// "-DPYTHON_EXECUTABLE=/home/da/miniconda3/envs/gsmini/bin/python", "-DPYTHON_EXECUTABLE=/home/da/miniconda3/envs/gsmini/bin/python",
"-DPYTHON_EXECUTABLE=${HOME}/.conda/envs/gsmini/bin/python" //"-DPYTHON_EXECUTABLE=${HOME}/.conda/envs/gsmini/bin/python"
], ],
"problemMatcher": [ "problemMatcher": [
"$catkin-gcc" "$catkin-gcc"

View File

@@ -1,4 +1,4 @@
#! /home/wxchen/.conda/envs/gsmini/bin/python #! /home/da/miniconda3/envs/gsmini/bin/python
import numpy as np import numpy as np
import cv2 as cv import cv2 as cv
@@ -32,18 +32,18 @@ def box_callback(box, depth, color_info):
z = np.mean(depth_roi) * 0.001 z = np.mean(depth_roi) * 0.001
x = (screw_x - color_intrinsics[2]) * z / color_intrinsics[0] x = (screw_x - color_intrinsics[2]) * z / color_intrinsics[0]
y = (screw_y - color_intrinsics[5]) * z / color_intrinsics[4] y = (screw_y - color_intrinsics[5]) * z / color_intrinsics[4]
# print(x,y,z) print(x,y,z)
# calculate normal direction of screw area # calculate normal direction of screw area
X,Y = np.meshgrid(np.arange(depth_roi.shape[1]), np.arange(depth_roi.shape[0])) # X,Y = np.meshgrid(np.arange(depth_roi.shape[1]), np.arange(depth_roi.shape[0]))
X = X.reshape(-1) # X = X.reshape(-1)
Y = Y.reshape(-1) # Y = Y.reshape(-1)
Z = depth_roi.reshape(-1) # Z = depth_roi.reshape(-1)
points = np.vstack([X, Y, Z]).T # points = np.vstack([X, Y, Z]).T
center = np.mean(points, axis=0) # center = np.mean(points, axis=0)
points = points - center # points = points - center
U, S, V = np.linalg.svd(points) # U, S, V = np.linalg.svd(points)
normal = V[2] # normal = V[2]
# print(normal) # print(normal)
# publish screw pose # publish screw pose