11 #include <jsk_interactive_marker/SetPose.h>
12 #include <jsk_interactive_marker/MarkerSetPose.h>
15 #include <jsk_interactive_marker/MarkerMenu.h>
16 #include <jsk_interactive_marker/MarkerPose.h>
18 #include <std_msgs/Int8.h>
23 #include <dynamic_tf_publisher/SetDynamicTF.h>
25 #include <kdl/frames_io.hpp>
32 visualization_msgs::InteractiveMarker int_marker;
33 int_marker.header = stamped.header;
34 int_marker.name = name;
35 int_marker.scale =
scale;
36 int_marker.pose = stamped.pose;
38 visualization_msgs::InteractiveMarkerControl control;
42 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED;
44 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::INHERIT;
47 control.orientation.w = 1;
48 control.orientation.x = 1;
49 control.orientation.y = 0;
50 control.orientation.z = 0;
51 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
52 int_marker.controls.push_back(control);
55 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED;
57 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::INHERIT;
60 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
61 int_marker.controls.push_back(control);
66 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED;
68 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::INHERIT;
70 control.orientation.w = 1;
71 control.orientation.x = 0;
72 control.orientation.y = 1;
73 control.orientation.z = 0;
74 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
75 int_marker.controls.push_back(control);
78 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED;
80 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::INHERIT;
83 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
84 int_marker.controls.push_back(control);
88 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED;
90 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::INHERIT;
93 control.orientation.w = 1;
94 control.orientation.x = 0;
95 control.orientation.y = 0;
96 control.orientation.z = 1;
97 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
98 int_marker.controls.push_back(control);
100 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED;
102 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::INHERIT;
104 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
105 int_marker.controls.push_back(control);
113 if(feedback->control_name.find(
"center_sphere") != std::string::npos){
114 proc_feedback(feedback, jsk_interactive_marker::MarkerPose::SPHERE_MARKER);
116 proc_feedback(feedback, jsk_interactive_marker::MarkerPose::GENERAL);
123 jsk_interactive_marker::MarkerPose mp;
124 mp.pose.header = feedback->header;
125 mp.pose.pose = feedback->pose;
126 mp.marker_name = feedback->marker_name;
131 control_state_.marker_pose_.pose = feedback->pose;
132 control_state_.marker_pose_.header = feedback->header;
134 pub_marker_tf(feedback->header, feedback->pose);
139 geometry_msgs::Transform
tf;
140 tf.translation.x =
pose.position.x;
141 tf.translation.y =
pose.position.y;
142 tf.translation.z =
pose.position.z;
143 tf.rotation =
pose.orientation;
145 dynamic_tf_publisher::SetDynamicTF SetTf;
146 SetTf.request.freq = 10;
148 SetTf.request.cur_tf.header.frame_id =
header.frame_id;
149 SetTf.request.cur_tf.child_frame_id =
"/moving_marker";
150 SetTf.request.cur_tf.transform =
tf;
151 dynamic_tf_publisher_client_.call(SetTf);
155 jsk_interactive_marker::MarkerPose mp;
158 mp.marker_name = name;
167 jsk_interactive_marker::MarkerMenu m;
168 m.marker_name = feedback->marker_name;
170 pub_move_.publish(m);
174 jsk_interactive_marker::MarkerMenu m;
175 m.marker_name = feedback->marker_name;
178 pub_move_.publish(m);
183 jsk_interactive_marker::MarkerMenu m;
187 pub_move_.publish(m);
195 geometry_msgs::PoseStamped
pose;
196 pose.header = feedback->header;
197 pose.pose = feedback->pose;
198 changeMarkerMoveMode(feedback->marker_name, 0, 0.5,
pose);
202 geometry_msgs::PoseStamped
pose;
203 pose.header = feedback->header;
204 pose.pose = feedback->pose;
205 changeMarkerMoveMode(feedback->marker_name, 0, 0.3,
pose);
209 geometry_msgs::PoseStamped
pose;
210 pose.header = feedback->header;
211 pose.pose = feedback->pose;
212 changeMarkerMoveMode(feedback->marker_name, 0, 0.1,
pose);
216 changeMarkerMoveMode(feedback->marker_name,0);
217 pub_marker_menu(feedback->marker_name,13);
221 changeMarkerMoveMode(feedback->marker_name,1);
222 pub_marker_menu(feedback->marker_name,13);
226 changeMarkerMoveMode(feedback->marker_name,2);
227 pub_marker_menu(feedback->marker_name,13);
231 ROS_INFO(
"%s changeForceMode",feedback->marker_name.c_str());
232 changeMarkerForceMode(feedback->marker_name,0);
233 pub_marker_menu(feedback->marker_name,12);
237 ROS_INFO(
"%s changeForceMode1",feedback->marker_name.c_str());
238 changeMarkerForceMode(feedback->marker_name,1);
239 pub_marker_menu(feedback->marker_name,12);
243 ROS_INFO(
"%s changeForceMode2",feedback->marker_name.c_str());
244 changeMarkerForceMode(feedback->marker_name,2);
245 pub_marker_menu(feedback->marker_name,12);
249 ROS_INFO(
"targetPointMenu callback");
251 control_state_.head_on_ ^=
true;
252 control_state_.init_head_goal_ =
true;
254 if(control_state_.head_on_){
256 control_state_.look_auto_on_ =
false;
258 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::HEAD_TARGET_POINT, jsk_interactive_marker::MarkerMenu::HEAD_MARKER);
262 menu_head_.reApply(*server_);
264 initControlMarkers();
268 ROS_INFO(
"targetPointMenu callback");
270 control_state_.head_on_ =
false;
271 control_state_.look_auto_on_ ^=
true;
272 control_state_.init_head_goal_ =
true;
274 if(control_state_.look_auto_on_){
277 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::PUBLISH_MARKER, jsk_interactive_marker::MarkerMenu::HEAD_MARKER);
280 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::HEAD_TARGET_POINT, jsk_interactive_marker::MarkerMenu::HEAD_MARKER);
282 menu_head_.reApply(*server_);
283 initControlMarkers();
290 h_mode_last2 = feedback->menu_entry_id;
293 switch(h_mode_last2-h_mode_constrained){
295 pub_marker_menu(feedback->marker_name,jsk_interactive_marker::MarkerMenu::MOVE_CONSTRAINT_T);
299 pub_marker_menu(feedback->marker_name,jsk_interactive_marker::MarkerMenu::MOVE_CONSTRAINT_NIL);
307 menu_handler.reApply( *server_ );
308 server_->applyChanges();
314 if(feedback->menu_entry_id == use_torso_t_menu_){
318 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::USE_TORSO_T);
319 }
else if(feedback->menu_entry_id == use_torso_nil_menu_){
323 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::USE_TORSO_NIL);
328 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::USE_FULLBODY);
330 menu_handler.reApply( *server_ );
331 server_->applyChanges();
337 if(feedback->menu_entry_id == start_ik_menu_){
340 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::PLAN);
341 }
else if(feedback->menu_entry_id == stop_ik_menu_){
344 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::CANCEL_PLAN);
346 menu_handler.reApply( *server_ );
347 server_->applyChanges();
354 if(menu_handler.getCheckState( start_ik_menu_ , check_state)){
360 pub_marker_menu(
"", jsk_interactive_marker::MarkerMenu::CANCEL_PLAN);
366 pub_marker_menu(
"" , jsk_interactive_marker::MarkerMenu::PLAN);
369 menu_handler.reApply( *server_ );
370 server_->applyChanges();
378 h_mode_last = feedback->menu_entry_id;
381 switch(h_mode_last - h_mode_rightarm){
383 changeMoveArm( feedback->marker_name, jsk_interactive_marker::MarkerMenu::SET_MOVE_RARM);
386 changeMoveArm( feedback->marker_name, jsk_interactive_marker::MarkerMenu::SET_MOVE_LARM);
389 changeMoveArm( feedback->marker_name, jsk_interactive_marker::MarkerMenu::SET_MOVE_ARMS);
395 menu_handler.reApply( *server_ );
396 server_->applyChanges();
401 case jsk_interactive_marker::MarkerMenu::SET_MOVE_RARM:
402 pub_marker_menu(m_name,jsk_interactive_marker::MarkerMenu::SET_MOVE_RARM);
403 control_state_.move_arm_ = ControlState::RARM;
405 changeMarkerMoveMode( marker_name.c_str(), 0, 0.5, control_state_.marker_pose_);
407 case jsk_interactive_marker::MarkerMenu::SET_MOVE_LARM:
408 pub_marker_menu(m_name,jsk_interactive_marker::MarkerMenu::SET_MOVE_LARM);
409 control_state_.move_arm_ = ControlState::LARM;
411 changeMarkerMoveMode( marker_name.c_str(), 0, 0.5, control_state_.marker_pose_);
413 case jsk_interactive_marker::MarkerMenu::SET_MOVE_ARMS:
414 pub_marker_menu(m_name,jsk_interactive_marker::MarkerMenu::SET_MOVE_ARMS);
415 control_state_.move_arm_ = ControlState::ARMS;
417 changeMarkerMoveMode( marker_name.c_str(), 0, 0.5, control_state_.marker_pose_);
427 control_state_.move_origin_state_ = ControlState::HAND_ORIGIN;
428 changeMarkerMoveMode( marker_name.c_str(), 0, 0.5, control_state_.marker_pose_);
429 if(control_state_.move_arm_ == ControlState::RARM){
430 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::SET_ORIGIN_RHAND);}
else{
431 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::SET_ORIGIN_LHAND);}
433 control_state_.move_origin_state_ = ControlState::DESIGNATED_ORIGIN;
434 changeMarkerMoveMode( marker_name.c_str(), 0, 0.5, control_state_.marker_pose_);
435 pub_marker_menuCb(feedback, jsk_interactive_marker::MarkerMenu::SET_ORIGIN);
448 if(feedback->menu_entry_id == rotation_t_menu_){
450 pub_marker_menu(feedback->marker_name,jsk_interactive_marker::MarkerMenu::IK_ROTATION_AXIS_T);
454 pub_marker_menu(feedback->marker_name ,jsk_interactive_marker::MarkerMenu::IK_ROTATION_AXIS_NIL);
461 menu_handler.reApply( *server_ );
462 server_->applyChanges();
469 if(menu_handler.getCheckState( rotation_t_menu_ , check_state)){
474 pub_marker_menu(
"", jsk_interactive_marker::MarkerMenu::IK_ROTATION_AXIS_NIL);
480 pub_marker_menu(
"" , jsk_interactive_marker::MarkerMenu::IK_ROTATION_AXIS_T);
483 menu_handler.reApply( *server_ );
484 server_->applyChanges();
490 case jsk_interactive_marker::MarkerMenu::SET_MOVE_RARM:
491 case jsk_interactive_marker::MarkerMenu::SET_MOVE_LARM:
492 case jsk_interactive_marker::MarkerMenu::SET_MOVE_ARMS:
493 changeMoveArm(
msg->marker_name,
msg->menu);
495 case jsk_interactive_marker::MarkerMenu::IK_ROTATION_AXIS_NIL:
496 case jsk_interactive_marker::MarkerMenu::IK_ROTATION_AXIS_T:
498 std_msgs::EmptyConstPtr empty;
499 toggleIKModeCb(empty);
502 case jsk_interactive_marker::MarkerMenu::PLAN:
503 case jsk_interactive_marker::MarkerMenu::CANCEL_PLAN:
505 std_msgs::EmptyConstPtr empty;
506 toggleStartIKCb(empty);
510 pub_marker_menu(
msg->marker_name ,
msg->menu,
msg->type);
520 switch ( feedback->event_type )
522 case visualization_msgs::InteractiveMarkerFeedback::BUTTON_CLICK:
525 case visualization_msgs::InteractiveMarkerFeedback::MENU_SELECT:
527 <<
" control " << feedback->control_name
528 <<
" menu_entry_id " << feedback->menu_entry_id);
530 case visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE:
538 switch ( feedback->event_type )
540 case visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE:
541 proc_feedback(feedback, jsk_interactive_marker::MarkerPose::BASE_MARKER);
550 switch ( feedback->event_type )
552 case visualization_msgs::InteractiveMarkerFeedback::BUTTON_CLICK:
554 control_state_.r_finger_on_ ^=
true;
555 }
else if(hand ==
"lhand"){
556 control_state_.l_finger_on_ ^=
true;
558 initControlMarkers();
559 ROS_INFO_STREAM( hand << feedback->marker_name <<
" was clicked on." );
561 case visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE:
562 ROS_INFO_STREAM( hand << feedback->marker_name <<
" was clicked on." );
564 proc_feedback(feedback, jsk_interactive_marker::MarkerPose::RFINGER_MARKER);
567 proc_feedback(feedback, jsk_interactive_marker::MarkerPose::LFINGER_MARKER);
579 ROS_INFO(
"changeMarkerForceMode marker:%s mode:%d\n",mk_name.c_str(),im_mode);
581 menu_handler_force = reset_handler;
582 menu_handler_force1 = reset_handler;
583 menu_handler_force2 = reset_handler;
585 geometry_msgs::PoseStamped
pose;
586 pose.header.frame_id = base_frame;
601 visualization_msgs::InteractiveMarker mk;
603 mk.name = mk_name.c_str();
605 mk.header =
pose.header;
611 visualization_msgs::InteractiveMarkerControl control;
617 control.orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED;
620 control.orientation.w = 1;
621 control.orientation.x = 1;
622 control.orientation.y = 0;
623 control.orientation.z = 0;
624 control.name =
"rotate_x";
625 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
626 mk.controls.push_back(control);
627 control.name =
"move_x";
628 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
629 mk.controls.push_back(control);
631 control.orientation.w = 1;
632 control.orientation.x = 0;
633 control.orientation.y = 1;
634 control.orientation.z = 0;
635 control.name =
"rotate_z";
636 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
637 mk.controls.push_back(control);
642 control.orientation.w = 1;
643 control.orientation.x = 0;
644 control.orientation.y = 0;
645 control.orientation.z = 1;
646 control.name =
"rotate_y";
647 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
648 mk.controls.push_back(control);
658 server_->insert( mk );
659 server_->setCallback( mk.name,
661 menu_handler_force.apply(*server_,mk.name);
663 server_->applyChanges();
669 server_->insert( mk );
670 server_->setCallback( mk.name,
672 menu_handler_force1.apply(*server_,mk.name);
674 server_->applyChanges();
680 server_->insert( mk );
681 server_->setCallback( mk.name,
683 menu_handler_force2.apply(*server_,mk.name);
685 server_->applyChanges();
694 std::list<visualization_msgs::InteractiveMarker>::iterator it = imlist.begin();
696 while( it != imlist.end() )
698 if(it->name == mk_name.c_str()){
704 imlist.push_back( mk );
724 geometry_msgs::PoseStamped ps;
727 double scale_factor = 1.02;
730 ps.header.frame_id = head_link_frame_;
731 visualization_msgs::InteractiveMarker im =
735 menu_head_.apply(*server_, head_link_frame_);
738 if(hand_type_ ==
"sandia_hand"){
739 geometry_msgs::PoseStamped ps;
742 ps.header.frame_id =
"/right_f0_base";
743 for(
int i=0;i<4;i++){
744 for(
int j=0;j<3;j++){
745 visualization_msgs::InteractiveMarker fingerIm =
747 makeIMVisible(fingerIm);
752 ps.header.frame_id =
"/left_f0_base";
753 for(
int i=0;i<4;i++){
754 for(
int j=0;j<3;j++){
755 visualization_msgs::InteractiveMarker fingerIm =
757 makeIMVisible(fingerIm);
764 for(
int i=0; i<rhand_mesh_.size(); i++){
765 ps.header.frame_id = rhand_mesh_[i].link_name;
766 ps.pose.orientation = rhand_mesh_[i].orientation;
767 visualization_msgs::InteractiveMarker handIm =
769 makeIMVisible(handIm);
770 server_->insert(handIm);
778 if(control_state_.head_on_ && control_state_.init_head_goal_){
779 control_state_.init_head_goal_ =
false;
780 head_goal_pose_.header.stamp =
ros::Time(0);
782 visualization_msgs::InteractiveMarker HeadGoalIm =
784 makeIMVisible(HeadGoalIm);
785 server_->insert(HeadGoalIm,
787 menu_head_target_.apply(*server_,
"head_point_goal");
789 if(!control_state_.head_on_){
790 server_->erase(
"head_point_goal");
794 if(control_state_.base_on_ ){
795 geometry_msgs::PoseStamped ps;
796 ps.pose.orientation.w = 1;
797 ps.header.frame_id = move_base_frame;
799 visualization_msgs::InteractiveMarker baseIm =
801 makeIMVisible(baseIm);
802 server_->insert(baseIm,
805 menu_base_.apply(*server_,
"base_control");
807 server_->erase(
"base_control");
811 if(use_finger_marker_ && control_state_.r_finger_on_){
812 geometry_msgs::PoseStamped ps;
814 ps.header.frame_id =
"/right_f0_base";
818 menu_finger_r_.apply(*server_,
"right_finger");
820 server_->erase(
"right_finger");
823 if(use_finger_marker_ && control_state_.l_finger_on_){
824 geometry_msgs::PoseStamped ps;
826 ps.header.frame_id =
"/left_f0_base";
830 menu_finger_l_.apply(*server_,
"left_finger");
832 server_->erase(
"left_finger");
835 server_->applyChanges();
841 visualization_msgs::InteractiveMarker mk;
842 mk.header = stamped.header;
845 mk.pose = stamped.pose;
847 visualization_msgs::InteractiveMarkerControl control;
849 control.orientation.w = 1;
850 control.orientation.x = 1;
851 control.orientation.y = 0;
852 control.orientation.z = 0;
854 control.name =
"move_x";
855 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
856 mk.controls.push_back(control);
858 control.orientation.w = 1;
859 control.orientation.x = 0;
860 control.orientation.y = 1;
861 control.orientation.z = 0;
862 control.name =
"rotate_z";
863 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
864 mk.controls.push_back(control);
866 control.orientation.w = 1;
867 control.orientation.x = 0;
868 control.orientation.y = 0;
869 control.orientation.z = 1;
870 control.name =
"move_y";
871 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
872 mk.controls.push_back(control);
883 pnh_.param(
"force_mode_menu", use_menu,
false );
888 pnh_.param(
"move_menu", use_menu,
false );
890 pnh_.param(
"move_safety_menu", use_menu,
false );
893 sub_menu_move_ = menu_handler.insert(
"Move" );
903 pnh_.param(
"change_using_ik_menu", use_menu,
false );
906 sub_menu_move_ = menu_handler.insert(
"Whether To Use IK" );
915 pnh_.param(
"touch_it_menu", use_menu,
false );
919 sub_menu_handle_touch_it = menu_handler.insert(
"Touch It" );
925 pnh_.param(
"look_hand_menu", use_menu,
false );
930 sub_menu_handle_look_hand = menu_handler.insert(
"Look hand" );
936 pnh_.param(
"force_move_menu", use_menu,
false );
941 pnh_.param(
"pick_menu", use_menu,
false );
946 pnh_.param(
"grasp_menu", use_menu,
false );
951 pnh_.param(
"harf_grasp_menu", use_menu,
false );
957 pnh_.param(
"stop_grasp_menu", use_menu,
false );
962 pnh_.param(
"set_origin_menu", use_menu,
false );
987 pnh_.param(
"reset_marker_pos_menu", use_menu,
false );
992 pnh_.param(
"manipulation_mode_menu", use_menu,
false );
1017 pnh_.param(
"select_arm_menu", use_menu,
false );
1019 sub_menu_handle = menu_handler.insert(
"SelectArm" );
1022 h_mode_rightarm = h_mode_last;
1027 h_mode_last = h_mode_rightarm;
1030 pnh_.param(
"ik_mode_menu", use_menu,
false );
1032 sub_menu_handle_ik = menu_handler.insert(
"IK mode" );
1040 pnh_.param(
"use_torso_menu", use_menu,
false );
1042 use_torso_menu_ = menu_handler.insert(
"Links To Use" );
1056 sub_menu_handle_im_size = menu_handler.insert(
"IMsize" );
1061 pnh_.param(
"publish_marker_menu", use_menu,
false );
1086 head_target_handle_ = menu_head_.insert(
"Target Point",
1094 menu_head_target_.insert(
"Look At",
1112 pnh_.param(
"use_base_marker", use_menu,
false );
1113 control_state_.base_on_ = use_menu;
1119 pnh_.param(
"use_finger_marker", use_finger_marker_,
false );
1130 if(urdf_vec.size() > 0){
1131 for(
int i=0; i<urdf_vec.size(); i++){
1134 KDL::Frame origin_frame;
1139 if(!hand_root_link){
1140 hand_root_link = up.
model->getRoot();
1143 for(
int j=0; j<im.controls.size(); j++){
1144 if(im.controls[j].interaction_mode == visualization_msgs::InteractiveMarkerControl::BUTTON){
1145 im.controls[j].interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_3D;
1146 im.controls[j].name =
"center_sphere";
1154 double center_marker_size = 0.2;
1156 std_msgs::ColorRGBA color;
1157 color.r = color.g = color.b = 0.7;
1159 addSphereMarker(im, center_marker_size, color);
1164 visualization_msgs::Marker sphereMarker;
1165 sphereMarker.type = visualization_msgs::Marker::SPHERE;
1167 sphereMarker.scale.x =
scale;
1168 sphereMarker.scale.y =
scale;
1169 sphereMarker.scale.z =
scale;
1171 sphereMarker.color = color;
1173 visualization_msgs::InteractiveMarkerControl sphereControl;
1174 sphereControl.name =
"center_sphere";
1176 sphereControl.markers.push_back(sphereMarker);
1177 sphereControl.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_3D;
1178 im.controls.push_back(sphereControl);
1183 std::vector < UrdfProperty > null_urdf;
1184 if(control_state_.move_origin_state_ == ControlState::HAND_ORIGIN){
1185 if(control_state_.move_arm_ == ControlState::RARM){
1186 addHandMarker(mk, rhand_urdf_);
1187 }
else if(control_state_.move_arm_ == ControlState::LARM){
1188 addHandMarker(mk, lhand_urdf_);
1190 addHandMarker(mk, null_urdf);
1193 addHandMarker(mk, null_urdf);
1205 changeMarkerMoveMode( mk_name, im_mode , 0.5);
1209 changeMarkerMoveMode( mk_name, im_mode , 0.3);
1212 changeMarkerMoveMode( mk_name, im_mode , 0.3);
1218 geometry_msgs::PoseStamped
pose;
1219 pose.header.frame_id = base_frame;
1220 pose.pose.orientation.w = 1.0;
1221 changeMarkerMoveMode( mk_name, im_mode , mk_size,
pose);
1225 ROS_INFO(
"changeMarkerMoveMode marker:%s mode:%d\n",mk_name.c_str(),im_mode);
1227 control_state_.marker_pose_ = dist_pose;
1231 geometry_msgs::PoseStamped
pose;
1250 visualization_msgs::InteractiveMarker mk;
1257 mk = make6DofControlMarker(mk_name.c_str(),
pose, mk_size,
1260 if(use_center_sphere_){
1261 makeCenterSphere(mk, mk_size);
1266 server_->insert( mk );
1267 server_->setCallback( mk.name,
1269 menu_handler.apply(*server_,mk.name);
1270 server_->applyChanges();
1275 mk.description = mk_name.c_str();
1277 server_->insert( mk );
1278 server_->setCallback( mk.name,
1280 menu_handler1.apply(*server_,mk.name);
1281 server_->applyChanges();
1287 mk.description = mk_name.c_str();
1290 server_->insert( mk );
1291 server_->setCallback( mk.name,
1293 menu_handler2.apply(*server_,mk.name);
1294 server_->applyChanges();
1299 mk.description = mk_name.c_str();
1301 server_->insert( mk );
1302 server_->setCallback( mk.name,
1304 server_->applyChanges();
1308 std::list<visualization_msgs::InteractiveMarker>::iterator it = imlist.begin();
1310 while( it != imlist.end() )
1312 if(it->name == mk_name.c_str()){
1318 imlist.push_back( mk );
1323 menu_handler = reset_handler;
1324 geometry_msgs::PoseStamped
pose;
1325 pose.header.frame_id = base_frame;
1340 visualization_msgs::InteractiveMarker mk =
1344 mk.description = mk_name.c_str();
1347 std::list<visualization_msgs::InteractiveMarker>::iterator it = imlist.begin();
1349 while( it != imlist.end() )
1351 if(it->name == mk_name.c_str()){
1357 imlist.push_back( mk );
1358 server_->insert( mk );
1360 server_->setCallback( mk.name,
1363 menu_handler.apply(*server_,mk.name);
1364 server_->applyChanges();
1407 pnh_.
param<std::string>(
"head_mesh",
head_mesh_,
"package://pr2_description/meshes/head_v0/head_tilt.dae");
1437 for(
int i=0; i< val[name].
size(); i++){
1442 std::string urdf_file = (std::string)nval[
"urdf_file"];
1443 std::cerr <<
"load urdf file: " << urdf_file << std::endl;
1446 std::string urdf_param = (std::string)nval[
"urdf_param"];
1447 std::string urdf_model;
1449 up.
model = parseURDF(urdf_model);
1453 std::string root_link_name = (std::string)nval[
"root_link"];
1454 std::cerr <<
"root link name: " << root_link_name << std::endl;
1460 up.
pose.orientation.w = 1.0;
1464 if(
pose.hasMember(
"position")){
1466 up.
pose.position.x = (double)position[
"x"];
1467 up.
pose.position.y = (double)position[
"y"];
1468 up.
pose.position.z = (double)position[
"z"];
1471 if(
pose.hasMember(
"orientation")){
1473 up.
pose.orientation.x = (double)orient[
"x"];
1474 up.
pose.orientation.y = (double)orient[
"y"];
1475 up.
pose.orientation.z = (double)orient[
"z"];
1476 up.
pose.orientation.w = (double)orient[
"w"];
1482 up.
color.r = (double)color[
"r"];
1483 up.
color.g = (double)color[
"g"];
1484 up.
color.b = (double)color[
"b"];
1485 up.
color.a = (double)color[
"a"];
1493 up.
scale = (double)nval[
"scale"];
1504 jsk_interactive_marker::MarkerSetPose::Response &res ) {
1505 bool setalready =
false;
1507 std::list<visualization_msgs::InteractiveMarker>::iterator it =
imlist.begin();
1508 while( it !=
imlist.end() )
1510 if( it->name == req.marker_name){
1518 server_->setPose(req.marker_name, req.pose.pose, req.pose.header);
1538 jsk_interactive_marker::MarkerSetPose::Response &res ) {
1540 server_->erase(req.marker_name);
1542 std::list<visualization_msgs::InteractiveMarker>::iterator it =
imlist.begin();
1543 while( it !=
imlist.end() )
1545 if( it->name == req.marker_name){
1567 jsk_interactive_marker::MarkerSetPose::Response &res ) {
1569 if ( req.markers.size() > 0 ) {
1570 visualization_msgs::InteractiveMarker mk;
1571 if (
server_->get(req.marker_name, mk) ) {
1572 visualization_msgs::InteractiveMarkerControl mkc;
1573 mkc.name =
"additional_marker";
1574 mkc.always_visible =
true;
1575 mkc.markers = req.markers;
1577 for ( std::vector<visualization_msgs::InteractiveMarkerControl>::iterator it
1578 = mk.controls.begin();
1579 it != mk.controls.end(); it++ ) {
1580 if ( it->name == mkc.name ){
1581 mk.controls.erase( it );
1585 mk.controls.push_back( mkc );
1588 std::string mName = req.marker_name;
1594 server_->setPose(mName, req.pose.pose, req.pose.header);
1601 jsk_interactive_marker::SetPose::Response &res ) {
1602 geometry_msgs::PoseStamped
pose;
1629 for(
int i=0; i<im.controls.size(); i++){
1630 im.controls[i].always_visible =
true;