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

Multiple initializazion of GPU-Voxels #82

Closed
giorgionicola opened this issue Sep 11, 2018 · 5 comments
Closed

Multiple initializazion of GPU-Voxels #82

giorgionicola opened this issue Sep 11, 2018 · 5 comments

Comments

@giorgionicola
Copy link

Hi,
I have an application where it would be very useful the possibility to initialize 2 different "collision scenes" with different resolutions (= voxels length), one for the collisions between the two robots bodies and another to check the collision between the two robots' tools.
Although at the moment this is impossible since there some static elements in the libraries. Does exist any method to overcome this limitation? Will it be possible in future to initialize multiple times GPU-Voxels? Those static elements are absolutely necessary?
thanks

@cjue
Copy link
Contributor

cjue commented Sep 12, 2018

Hi,

it is already possible to directly construct a GpuVoxelsMap with custom parameters, using the same API as the addMap function:

https://github.com/fzi-forschungszentrum-informatik/gpu-voxels/blob/master/packages/gpu_voxels/src/gpu_voxels/GpuVoxels.cpp#L189

voxellist::BitVectorVoxelList* orig_list = new voxellist::BitVectorVoxelList(m_dim, m_voxel_side_length, MT_BITVECTOR_VOXELLIST);

If you use this directly, your map will not be a "manged map" and you cannot interact with it through functions that take a map name.

Depending on your use-case this can still be useful, e.g. when performing collision checks:

https://github.com/fzi-forschungszentrum-informatik/gpu-voxels/blob/master/packages/gpu_voxels/src/gpu_voxels/test/testing_voxellist.cu#L44

Does this match your use-case?

@giorgionicola
Copy link
Author

giorgionicola commented Sep 12, 2018

Ok but it is not clear to how I can interact with this new custom maps created.
In my application the 2 robots tools have 2 urdf files and at every collision check I update their position with the command "setRobotConfiguration" giving the cartesian coordinates (x,y,z,roll,pitch,yaw) and I use the commend "insertRobotIntoMap" . Although as you said I should not be able to use it since it requires the "map_name".

So if i have understood correctly in my case it should work in this way:

  1. I initilaize my GPUVoxelsSharedPtr normally and I use the command "addRobot" for all 4 (2 robots and 2 tools) so i can parse my urdfs, but I use gvl->addMap only for the robots
  2. I add the tools maps as you have shown
  3. Then the commend "setRobotConfiguration" to update tools position does not change
  4. Then instead of using "insertRobotIntoMap" i do
    ManagedRobotsIterator rob_it = m_managed_robots.find(robot_name); insertMetaPointCloud(*rob_it->second->getTransformedClouds(), voxel_meaning);
  5. Then i should be able to do the collision checks similarly to the test file

Am I correct?

@giorgionicola
Copy link
Author

I have tried to implement what I have written in the previous post, although i was not successful since m_managed_robots is a private variable.

Do you have any suggestions @cjue ?

@Squelsh
Copy link
Contributor

Squelsh commented Sep 29, 2018

Hi,

almost correct. But instead of interacting with m_managed_robots you should use

RobotInterfaceSharedPtr GpuVoxels::getRobot(const std::string &rob_name)

which you call on gvl.

On the returned RobotInterfaceSharedPtr you can then call getTransformedClouds()

Hope that helps,
Andy

@giorgionicola
Copy link
Author

Hi,
it worked smoothly, thanks

@cjue cjue closed this as completed Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants