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

separated the initialize() method fixes #79 #81

Open
wants to merge 1 commit into
base: kinetic-devel
Choose a base branch
from

Conversation

sonelu
Copy link

@sonelu sonelu commented Nov 15, 2019

In robotis_controller the initialize() method automatically creates a Robot instance with the information provided in the configuration files. There is no way for the user to provide additional functionality before the rest of the function interrogates the communication ports and completes the initialisation process.

I have created a second initialize() method that uses a Robot * and now the original initialize() method simply creates the new Robot instance and calls the new method that contains all the original code from after the robot instance creation.

With this structure it is now possible in a custom controller node to perform this:

robotis_framework::Robot *robot = new robotis_framework::Robot(robot_file, dev_desc_dir_path);
/* Do some config on the robot instance.
   For example I am configuring the ports_ in RS485 mode.
*/
// Now call the rest of robot initialization
if(controller->initialize(robot, init_file) == false)
 {
    ROS_ERROR("ROBOTIS Controller Initialize Fail!");
    return -1;
 }

Of course other scenarios are possible like creating a subclass of robotis_framework::Robot with some special functionality that is not included in the original class and using that in the creation of the robot instance, then passing it to the initialize(robot, init_file).

@sonelu sonelu changed the title separated the initialize() method to allow custom robot configuration… separated the initialize() method fixes #79 Nov 15, 2019
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

Successfully merging this pull request may close these issues.

1 participant