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

Possible to have different namespace for control.yaml and hardware_interface.cpp? [Question] #514

Open
Doctor-N0 opened this issue Feb 9, 2023 · 0 comments

Comments

@Doctor-N0
Copy link

For several reasons, it is necessary that my control.yaml has no namespace and thus looks like:

    my_joint_publisher:
       type: "joint_state_controller/JointStateController"
       publish_rate: 50

    my_velocity_controller:
       type: "diff_drive_controller/DiffDriveController"

    hardware_interface:
       joints:
         - front_left_wheel
         - rear_left_wheel
         - front_right_wheel
         - rear_right_wheel

As in this tutorial, I create the JointHandle in my_hardware_interface.cpp. However, I don't receive the DiffDriveController's output when I register to the JointHandle. I assume that this is due to the fact, that the JointHandle is called in my_namespace while my_velocity_controller is assigned to no namespace.

Therefore my question: Is there any possibility to create a JointHandle if it is not in the same namespace as it's controller? Here's an minimal working example of the my_hardware_interface.cpp.

    namespace my_namespace {
        bool MyHWInterface::init(ros::NodeHandle & root_nh, ros::NodeHandle & robot_hw_nh) {
            [...]
            for (unsigned int i = 0; i < num_joints_; i++) {
                // Create JointStateHandle
                hardware_interface::JointStateHandle joint_state_handle(joint_names_[i], & joint_positions_[i], & joint_velocities_[i], & joint_efforts_[i]);

                // Register with JointStateInterface.
                joint_state_interface_.registerHandle(joint_state_handle);

                // Can I create a JointHandle if the DiffDriveController is NOT in my_namespace???
                hardware_interface::JointHandle joint_handle(joint_state_handle, & joint_velocity_commands_[i]);
                velocity_joint_interface_.registerHandle(joint_handle);
            }
        }
    }
@Doctor-N0 Doctor-N0 changed the title Possible to have different namespace for control.yaml and hardware_interface.cpp? Possible to have different namespace for control.yaml and hardware_interface.cpp? [Question] Feb 9, 2023
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