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

‘ConfigureControlMode’ is not a member of ‘iiwa_msgs’ #290

Open
PavanMantripragada opened this issue Jul 21, 2022 · 1 comment
Open

Comments

@PavanMantripragada
Copy link

Hi,

I'm trying to run a "ConfigureControlMode" service to change my control mode. I've written a cpp code to call the service. However, my code doesn't compile. The error I get is : ‘ConfigureControlMode’ is not a member of ‘iiwa_msgs’. Isn't this a member of iiwa_msgs class? Do I need to add any extra header files? please let me know. I'm attaching my code for your reference.


#include "iiwa_ros/conversions.hpp"
#include "iiwa_ros/service/iiwa_services.hpp"

int main(int argc, char **argv)
{
  ros::init(argc, argv, "tool_gc");

  ros::NodeHandle nh;
  ros::ServiceClient client = nh.serviceClient<iiwa_msgs::ConfigureControlMode>("/iiwa/configuration/configureControlMode");
  iiwa_msgs::ConfigureControlMode config;

  config.control_mode = iiwa_msgs::ControlMode::DESIRED_FORCE; // This is equal to config.control_mode = 3.
  config.desired_force. cartesian_dof = iiwa_msgs::DOF::Z; // This is equal to config.desired_force.cartesian_dof = 3.
  config.desired_force.desired_force = 2.0; // 2 Newtons
  config.desired_force. desired_stiffness = 100; // stiffness to 100 N/m

  if (client.call(config)) {
      if(!config.response.success)
          ROS_ERROR_STREAM("Config failed, Java error: " << config.response.error);
      else
          ROS_INFO_STREAM("SmartServo Service successfully called.");
  }
  else {
      ROS_ERROR_STREAM("Config failed - service could not be called - QUITTING NOW !");
  }
}
@jkaniuka
Copy link

Hi @PavanMantripragada, you need to add header file generated from the ConfigureControlMode.srv file. At the top of the file, simply add

#include "iiwa_msgs/ConfigureControlMode.hpp"

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