Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_collision.cpp除了自身碰撞,它不能检测与障碍物之间的碰撞吗 #7

Open
ZEUP330 opened this issue Mar 19, 2019 · 0 comments

Comments

@ZEUP330
Copy link

ZEUP330 commented Mar 19, 2019

你好,我运行了你的check_collision.cpp的代码,我可以做到自身碰撞的检测。
Screenshot from 2019-03-19 22:56:58
Screenshot from 2019-03-19 22:57:06
但是我无法做到碰撞到障碍物的检测:在旁边增加一个书柜,让机械臂planning去碰撞那个书柜,我使用带参数的rosservice call规划去碰撞书柜,但是并不会返回碰撞到。请问是这个check_collision.cpp本来就没有检测和其他物体的碰撞吗
Screenshot from 2019-03-19 22:58:01

Screenshot from 2019-03-19 22:58:05
请问如果我需要做什么才能改成能够检测障碍物,我参考了古月的代码进行修改,但是没有任何帮助。我的修改如下:
bool CheckCollisionNode::CheckCollision(vector<double>& values) { RobotState& robot_state = this->m_planScene->getCurrentStateNonConst(); collision_detection::AllowedCollisionMatrix acm = this->m_planScene->getAllowedCollisionMatrixNonConst(); robot_state::RobotState copied_state = this->m_planScene->getCurrentState(); collision_detection::CollisionResult::ContactMap::const_iterator it2; int k=0; for(it2=this->m_collResult.contacts.begin(); it2!=this->m_collResult.contacts.end(); ++it2,k++){ acm.setEntry(it2->first.first,it2->first.second,true); } // format Float64MultiArray to vector<double> printf("\nhere is the %d joint state:\n",k); for (int i = 0; i < this->m_jointNames.size(); i++) { this->m_jointValues[i] = values[i]; robot_state.setJointPositions(this->m_jointNames[i], &this->m_jointValues[i]); printf("\t%f\n",this->m_jointValues[i]); } // check m_collResult.clear();//Self m_planScene->checkCollision(this->m_collRequest, this->m_collResult, copied_state, acm); return this->m_collResult.collision; }
Screenshot from 2019-03-19 22:55:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant