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

Action client initialization problem cpp #11

Open
DavidYaonanZhu opened this issue Feb 12, 2021 · 1 comment
Open

Action client initialization problem cpp #11

DavidYaonanZhu opened this issue Feb 12, 2021 · 1 comment

Comments

@DavidYaonanZhu
Copy link

Hi, thanks for your wonderful driver.

I want to include action client to a moveit code, I want to call the server after excuting motion command.

I do not know how to instantiate the client using RobotiqActionClient gripper = new RobotiqActionClient(action_name, wait_for_server);

When I put this inside main(), or outside of any function, the error says:

conversion from ‘RobotiqActionClient* {aka robotiq_2f_gripper_control::RobotiqActionClient*}’ to non-scalar type ‘RobotiqActionClient {aka robotiq_2f_gripper_control::RobotiqActionClient}’ requested

Could you give any hint?

@Danfoa
Copy link
Owner

Danfoa commented Feb 25, 2021

Hi @DavidYaonanZhu, Sorry for the late answer I no longer support these packages often.

Your error is more C++ related than to the Class itself. The new operator in C++ returns a pointer to an instance object, that is why the non-scalar casting error pops up. You are trying to fit a pointer into a structure or class instance which is wrong.

You can instantiate the object and keep it referenced through a pointer:

RobotiqActionClient* your_gripper = new RobotiqActionClient(...)

Or through direct initialization by:

RobotiqActionClient your_gripper(...)

PS: I realized the example code in the README has an error that led you to this problem. Sorry, my bad!

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

2 participants