6 #include "sensor_msgs/JointState.h" 7 #include "hebiros/AddGroupFromURDFSrv.h" 20 int main(
int argc,
char **argv) {
23 ros::init(argc, argv,
"example_gazebo_node");
27 std::string group_name =
"x_demo";
32 "/hebiros/add_group_from_urdf");
41 "/hebiros/"+group_name+
"/command/joint_state", 100);
43 AddGroupFromURDFSrv add_group_srv;
46 add_group_srv.request.group_name = group_name;
49 while(!add_group_client.
call(add_group_srv)) {}
53 sensor_msgs::JointState command_msg;
54 command_msg.name.push_back(
"HEBI/base");
55 command_msg.name.push_back(
"HEBI/elbow");
56 command_msg.name.push_back(
"HEBI/shoulder");
57 command_msg.effort.resize(3);
61 double spring_constant = -10;
66 command_msg.effort[0] = spring_constant *
feedback.position[0];
67 command_msg.effort[1] = spring_constant *
feedback.position[1];
68 command_msg.effort[2] = spring_constant *
feedback.position[2];
69 command_publisher.
publish(command_msg);
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
sensor_msgs::JointState feedback
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void feedback_callback(sensor_msgs::JointState data)
ROSCPP_DECL void spinOnce()