Support multiple attachment frames#75
Conversation
| inline constexpr auto less_than(typename S::ScalarT s) const noexcept -> D | ||
| { | ||
| return greater_than(broadcast_scalar(s)); | ||
| return less_than(broadcast_scalar(s)); |
There was a problem hiding this comment.
this has been annoying me for a while
| } | ||
|
|
||
| template <size_t N, typename DataT> | ||
| inline static auto to_isometries(const DataT *buf) -> std::array<Eigen::Transform<DataT, 3, Eigen::Isometry>, N> |
There was a problem hiding this comment.
if there are multiple EEFs, then each FK is a 12 ele array
| e.attachments->pose(p_tf); | ||
| for(auto i=0U; i < N; i++){ | ||
| if(e.attachments.find(i) != e.attachments.end()) | ||
| e.attachments.at(i).pose(p_tfs[i]); |
There was a problem hiding this comment.
at() to modify in place
src/impl/vamp/collision/validity.hh
Outdated
| } | ||
| } | ||
|
|
||
| // now treat the other attachments also as potential collision objects |
There was a problem hiding this comment.
seems pretty clunky to me, but idk if there's a better way
|
Disabled clang-format for now. It modifies too many files |
|
Well looking at other PRs, I should probably remove |
| namespace vamp::collision | ||
| { | ||
| template <typename DataT> | ||
| struct EEFAttachment { |
There was a problem hiding this comment.
for attachments, we need to keep track of both the attachment object, and the end effector it is attached to. custom struct to support it
There was a problem hiding this comment.
I think this might not actually be the right approach -- actually, including attachment state in the environment is almost certainly "wrong," since environments should ideally be immutable in the planning process.
Instead, would it make sense to refactor into having an AttachedRobot<R> that stores the poses for attachment frames? I did this in my own Rust reimplementation and it worked very well.
zkingston
left a comment
There was a problem hiding this comment.
LGTM overall, some notes:
- Does BimanualPanda work with the random_dance.py script? If not we may need to change the logic so it can find the URDF/SRDF for Bullet rendering.
- Does the current attachment.py script still work?
There was a problem hiding this comment.
Lots of commented code here, please clean up.
There was a problem hiding this comment.
Can you remove and keep only with the Viser add PR?
There was a problem hiding this comment.
Same, remove and keep only with Viser PR.
| return ; | ||
| } | ||
| eef_attachments.emplace_back(eef_idx, a); | ||
| } |
There was a problem hiding this comment.
Spacing between functions? Surprised clang-format didn't catch this.
There was a problem hiding this comment.
Actually, a number of formatting things, please update.
| // TODO: Fix the sphere representation to allow to store float radii even with vector | ||
| // centers | ||
| if (sphere_environment_in_collision(e, s.x, s.y, s.z, s.r[{0, 0}])) | ||
| for (const auto &eef_attachment: e.eef_attachments){ |
There was a problem hiding this comment.
As the EEs are indexed, may be better to just do i=0...N and j=i+1...N rather than the != iter check.
| const std::size_t n = std::max(std::ceil(distance / static_cast<float>(rake) * resolution), 1.F); | ||
|
|
||
| bool valid = (environment.attachments) ? Robot::template fkcc_attach<rake>(environment, block) : | ||
| bool valid = (environment.eef_attachments.size()) ? Robot::template fkcc_attach<rake>(environment, block) : |
There was a problem hiding this comment.
Did you add multiple EEs to baxter?
| option(VAMP_INSTALL_CPP_LIBRARY "Install VAMP C++ library (disable for Python wheel builds)" ON) | ||
|
|
||
| option(VAMP_BUILD_CPP_DEMO "Build VAMP C++ Demo Scripts" OFF) | ||
| option(VAMP_BUILD_CPP_DEMO "Build VAMP C++ Demo Scripts" ON) |
There was a problem hiding this comment.
this should be off by default for python wheels
claytonwramsey
left a comment
There was a problem hiding this comment.
main thoughts:
- factor out changes not related to bimanual manipulation
- make sure to not bust up the formatting to keep the diff small
- bimanual panda should probably not be a robot
| namespace vamp::collision | ||
| { | ||
| template <typename DataT> | ||
| struct EEFAttachment { |
There was a problem hiding this comment.
I think this might not actually be the right approach -- actually, including attachment state in the environment is almost certainly "wrong," since environments should ideally be immutable in the planning process.
Instead, would it make sense to refactor into having an AttachedRobot<R> that stores the poses for attachment frames? I did this in my own Rust reimplementation and it worked very well.
| std::vector<HeightField<DataT>> heightfields; | ||
| std::vector<CAPT> pointclouds; | ||
| std::optional<Attachment<DataT>> attachments; | ||
| std::vector<EEFAttachment<DataT>> eef_attachments; // eef_id to attachment |
There was a problem hiding this comment.
should eef_attachments instead be a std::vector<std::optional<EEFAttachment<DataT>>> as our key set is fixed when the robot is fixed? this means the attachment also doesn't need to track its own index.
| if (eef_attachment.eef_idx == i) | ||
| eef_attachment.attachment.pose(p_tfs[i]); | ||
| } | ||
| } |
There was a problem hiding this comment.
see my comment on changing the structure of eef_attachments
| } | ||
|
|
||
| // now treat the other attachments also as potential collision objects | ||
| // This is probably expensive, find a more efficient way. |
There was a problem hiding this comment.
Attachment collision checking is comparatively cheap; I think it is ok to stay.
Maybe adding a coarse phase check would be an improvement to perf but generally I think it is not going to be a big issue.
There was a problem hiding this comment.
It is probably not the best idea to add a bimanual panda robot, since it's a lot to support and doesn't really reflect areal robot. Instead maybe we use Baxter as our demo for a bimanual robot?
There was a problem hiding this comment.
did clang-format do something to this poor beast?
There was a problem hiding this comment.
cherry-pick this out maybe since it belongs in its own PR
Add support for multiple end effectors. This PR is in tandem with CoMMALab/cricket#4.
Major changes callout
to_isometries(), that returns an array of EEF FKs. This is nice, as it can directly be fed into std::map for attachment (as follows)std::optional, it is now astd::map<eef_id, attachment e>. This has some effects0perhaps.eef_name->eef_names,to_isometry->to_isometriesbimanual_franka.hhTODO