• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TrajClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TrajClient的典型用法代码示例。如果您正苦于以下问题:C++ TrajClient类的具体用法?C++ TrajClient怎么用?C++ TrajClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TrajClient类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Sync

bool VirtualTrajClient::Sync(TrajClient& t)
{
  bool res;
  res=t.GetJointLimits(qmin,qmax);
  assert(res);
  res=t.GetVelocityLimits(vmax);
  assert(res);
  res=t.GetAccelerationLimits(amax);
  assert(res);
  res=t.GetDecelerationLimits(dmax);
  assert(res);
  qmin0=qmin;
  qmax0=qmax;
  vmax0=vmax;
  amax0=amax;
  dmax0=dmax;
  maxSegments = t.GetMaxSegments();
  
  maxRate = t.Rate();

  milestones.resize(maxSegments+1);
  times.resize(maxSegments+1);
  curSegment = 0;
  numSegments = 0;
  //get current status
  res = t.GetEndConfig(milestones[0]);
  assert(res);
  times[0] = t.GetTrajEndTime();
  return true;
}
开发者ID:jianqiaol,项目名称:RoboPuppet,代码行数:30,代码来源:VirtualClient.cpp


示例2: RobotArm

  //! Initialize the action client and wait for action server to come up
  RobotArm() 
  {
    // tell the action client that we want to spin a thread by default
    traj_client_r_ = new TrajClient("r_arm_controller/joint_trajectory_action", true);
    traj_client_l_ = new TrajClient("l_arm_controller/joint_trajectory_action", true);

    // wait for action server to come up
    while(!traj_client_l_->waitForServer(ros::Duration(5.0))){
      ROS_INFO("Waiting for the joint_trajectory_action server");
    }
    // wait for action server to come up
    while(!traj_client_r_->waitForServer(ros::Duration(5.0))){
      ROS_INFO("Waiting for the joint_trajectory_action server");
    }
  }
开发者ID:PR2,项目名称:pr2_props,代码行数:16,代码来源:repeat_high_five.cpp


示例3: IKTrajectoryExecutor

  IKTrajectoryExecutor()
  {

    //tell the joint trajectory action client that we want 
    //to spin a thread by default
    action_client = new TrajClient("joint_trajectory_action", true);

    //wait for the action server to come up
    while(ros::ok() && !action_client->waitForServer(ros::Duration(5.0)))
    {
      ROS_INFO("Waiting for the joint_trajectory_action action server to come up");
    }

    //register a service to input desired Cartesian trajectories
    service = node.advertiseService("execute_cartesian_ik_trajectory", 
        &IKTrajectoryExecutor::execute_cartesian_ik_trajectory, this);

    //have to specify the order of the joints we're sending in our 
    //joint trajectory goal, even if they're already on the param server
    goal.trajectory.joint_names.push_back("shoulder_pan_joint");
    goal.trajectory.joint_names.push_back("shoulder_lift_joint");
    goal.trajectory.joint_names.push_back("elbow_joint");
    goal.trajectory.joint_names.push_back("wrist_1_joint");
    goal.trajectory.joint_names.push_back("wrist_2_joint");
    goal.trajectory.joint_names.push_back("wrist_3_joint");

  }
开发者ID:saszaz,项目名称:boeing-project,代码行数:27,代码来源:ik_trajectory.cpp


示例4: IKTrajectoryExecutor

  IKTrajectoryExecutor(){

    //create a client function for the IK service
    ik_client = node.serviceClient<kinematics_msgs::GetPositionIK>
      (ARM_IK_NAME, true);    

    //wait for the various services to be ready
    ROS_INFO("Waiting for services to be ready");
    ros::service::waitForService(ARM_IK_NAME);
    ROS_INFO("Services ready");

    //tell the joint trajectory action client that we want 
    //to spin a thread by default
    action_client = new TrajClient("l_arm_controller/joint_trajectory_action", true);

    //wait for the action server to come up
    while(ros::ok() && !action_client->waitForServer(ros::Duration(5.0))){
      ROS_INFO("Waiting for the joint_trajectory_action action server to come up");
    }

    //register a service to input desired Cartesian trajectories
    service = node.advertiseService("left_execute_cartesian_ik_trajectory", 
        &IKTrajectoryExecutor::execute_cartesian_ik_trajectory, this);

    //have to specify the order of the joints we're sending in our 
    //joint trajectory goal, even if they're already on the param server
    goal.trajectory.joint_names.push_back("l_shoulder_pan_joint");
    goal.trajectory.joint_names.push_back("l_shoulder_lift_joint");
    goal.trajectory.joint_names.push_back("l_upper_arm_roll_joint");
    goal.trajectory.joint_names.push_back("l_elbow_flex_joint");
    goal.trajectory.joint_names.push_back("l_forearm_roll_joint");
    goal.trajectory.joint_names.push_back("l_wrist_flex_joint");
    goal.trajectory.joint_names.push_back("l_wrist_roll_joint");

  }
开发者ID:ashokzg,项目名称:cpb,代码行数:35,代码来源:left_ik_trajectory_tutorial.cpp


示例5: RobotArm

	// Initialize the action client and wait for the action server to come up
	RobotArm()
	{
		// tell the action client that we want to spin a thread by default
		traj_client_elbow_flex_ = new TrajClient("r_elbow_flex_controller/follow_joint_trajectory", true);
		traj_client_torso_ = new TrajClient("/torso_lift_controller/follow_joint_trajectory", true);
		
		// wait for action server to come up
		while (!traj_client_elbow_flex_->waitForServer(ros::Duration(5.0)))
		{
			ROS_INFO("Waiting for the r_elbow_flex_controller/follow_joint_trajectory server");
		}

		while (!traj_client_torso_->waitForServer(ros::Duration(5.0)))
		{
			ROS_INFO("Waiting for the r_elbow_flex_controller/follow_joint_trajectory server");
		}
		ROS_INFO("Works for now");
	}	
开发者ID:cristiiacob,项目名称:kdl_training,代码行数:19,代码来源:r_arm_test.cpp


示例6: MoveInJoints

   //! Initialize the action client and wait for action server to come up
	MoveInJoints() 
	{
		// tell the action client that we want to spin a thread by default
		traj_client_ = new TrajClient("/move_iri_wam", true);
		
		// wait for action server to come up
		while(!traj_client_->waitForServer(ros::Duration(5.0))){
		ROS_INFO("Waiting for the move_iri_wam server");
		}
	}
开发者ID:quimnuss,项目名称:ros_iri_wam,代码行数:11,代码来源:move_in_joints.cpp


示例7: RobotArm

        //! Initialize the action client and wait for action server to come up
        RobotArm():srv_name_("/iri_wam/iri_wam_controller/joints_move") {
            client = n.serviceClient<iri_common_drivers_msgs::QueryJointsMovement>(this->srv_name_.c_str());
            // tell the action client that we want to spin a thread by default
            traj_client_ = new TrajClient("/iri_wam/iri_wam_controller/follow_joint_trajectory", true);

            // wait for action server to come up
            while(!traj_client_->waitForServer(ros::Duration(5.0))){
                ROS_INFO("Waiting for the joint_trajectory_action server");
            }
        }
开发者ID:NicolaCovallero,项目名称:promps,代码行数:11,代码来源:test2.cpp


示例8: RobotArm

  //! Initialize the action client and wait for action server to come up
  RobotArm() 
  {
    // tell the action client that we want to spin a thread by default
    traj_client_ = new TrajClient("/wam_wrapper/DMPTracker", true);

    //initialize the topic to send new goals
    
    pub = nh.advertise<trajectory_msgs::JointTrajectoryPoint>("/wam_wrapper/DMPTrackerNewGoal", 1);

    // wait for action server to come up
    while(!traj_client_->waitForServer(ros::Duration(5.0))){
      ROS_INFO("Waiting for the joint_trajectory_action server");
    }
  }
开发者ID:quimnuss,项目名称:ros_iri_wam,代码行数:15,代码来源:dmp_simple_trajectory.cpp


示例9: init

  void init (ros::NodeHandle* nh) {

    ik_client = nh->serviceClient<moveit_msgs::GetPositionIK>
      (ARM_IK_NAME, true);    

    ROS_INFO("Waiting for services to be ready");
    ros::service::waitForService(ARM_IK_NAME);
    ROS_INFO("Services ready");

//    action_client = new TrajClient("joint_trajectory_action", true);
    action_client = new TrajClient("follow_joint_trajectory", true);

    while(ros::ok() && !action_client->waitForServer(ros::Duration(5.0)))
    {
      ROS_INFO("Waiting for the joint_trajectory_action action server to come up");
    }

 //   service = node.advertiseService("execute_cartesian_ik_trajectory", 
 //       &IKTrajectoryExecutor::execute_cartesian_ik_trajectory, this);

    const std::string input_topic = "execute_cartesian_ik_trajectory";

    joint_states_sub = nh->subscribe( "joint_states", 1, 
        &IKTrajectoryExecutor::set_current_joint_angles, this);

    ros::Duration(1.0).sleep();    

    trajectory_sub = nh->subscribe( input_topic, 1, 
        &IKTrajectoryExecutor::execute_cartesian_ik_trajectory, this);

    ros::spinOnce();

    goal.trajectory.joint_names.push_back("shoulder_pan_joint");
    goal.trajectory.joint_names.push_back("shoulder_lift_joint");
    goal.trajectory.joint_names.push_back("elbow_joint");
    goal.trajectory.joint_names.push_back("wrist_1_joint");
    goal.trajectory.joint_names.push_back("wrist_2_joint");
    goal.trajectory.joint_names.push_back("wrist_3_joint");

  }
开发者ID:saszaz,项目名称:boeing-project,代码行数:40,代码来源:service_ik_trajectory.cpp


示例10: startTrajectory

	void startTrajectory(control_msgs::FollowJointTrajectoryGoal goal_elbow, control_msgs::FollowJointTrajectoryGoal goal_torso)
	{
		// When to start the trajectory: 'duration' from now
		goal_elbow.trajectory.header.stamp = ros::Time::now() + ros::Duration(1.0);
		goal_torso.trajectory.header.stamp = ros::Time::now() + ros::Duration(1.0);
		traj_client_elbow_flex_->sendGoal(goal_elbow);
		traj_client_torso_->sendGoal(goal_torso);
	}
开发者ID:cristiiacob,项目名称:kdl_training,代码行数:8,代码来源:r_arm_test.cpp


示例11: startTrajectory

  //! Sends the command to start a given trajectory
  void startTrajectory(pr2_controllers_msgs::JointTrajectoryGoal goal,bool right_arm)
  {
    //Start the trjaectory immediately
    goal.trajectory.header.stamp = ros::Time::now();

    if(right_arm)
      traj_client_r_->sendGoal(goal);
    else
      traj_client_l_->sendGoal(goal);
  }
开发者ID:PR2,项目名称:pr2_props,代码行数:11,代码来源:repeat_high_five.cpp


示例12: startTrajectory

 //! Sends the command to start a given trajectory
 void startTrajectory(control_msgs::FollowJointTrajectoryGoal goal)
 {
     // When to start the trajectory: 1s from now
     goal.trajectory.header.stamp = ros::Time::now() + ros::Duration(1.0);
     traj_client_->sendGoal(goal);
     if (!traj_client_->waitForResult(ros::Duration(10.0)))
     { 
         traj_client_->cancelGoal();
         ROS_INFO("Action did not finish before the time out.\n"); 
     }
 }
开发者ID:NicolaCovallero,项目名称:promps,代码行数:12,代码来源:test2.cpp


示例13: execute_joint_trajectory

  bool execute_joint_trajectory(std::vector<double *> joint_trajectory, double req_time, double msg_time)
    
  {
    int i, j; 
    int trajectorylength = joint_trajectory.size();

    goal.trajectory.points.resize(trajectorylength);

    goal.trajectory.points[0].positions.resize(6);
    goal.trajectory.points[0].velocities.resize(6);

    double time_from_start = 0.0;

    goal.trajectory.points[0].positions.resize(6);
    goal.trajectory.points[0].velocities.resize(6);

    // Velocities not used by UR5 servoj command
    for(j=0; j<6; j++)
    {
      goal.trajectory.points[0].positions[j] = joint_trajectory[0][j];
      goal.trajectory.points[0].velocities[j] = 0.0;
    }

    double max_joint_move = 0;
    for(j=0; j<6; j++)
    {
      double joint_move = fabs(goal.trajectory.points[0].positions[j] 
                               - current_angles[j]);
      if(joint_move > max_joint_move) max_joint_move = joint_move;
    }

    double limit_time = max_joint_move/MAX_JOINT_VEL;
  //  ROS_INFO("max_joint_move: %0.3f, seconds: %0.3f", max_joint_move, seconds);
    if (req_time < limit_time){
      time_from_start += limit_time;
    }
    else {
      time_from_start += req_time;
    }

    goal.trajectory.points[0].time_from_start = 
      ros::Duration(time_from_start);

    //when to start the trajectory
//    goal.trajectory.header.stamp = ros::Time::now();

//    ROS_INFO("Sending goal to joint_trajectory_action");

    double time2 = ros::Time::now().toSec();
    ROS_INFO_STREAM("Time elapsed: " << (time2 - msg_time ));
    action_client->sendGoal(goal);

    // Servoing: need interrupt commands
//    action_client->waitForResult();

    return 1;
  }
开发者ID:saszaz,项目名称:boeing-project,代码行数:57,代码来源:service_ik_trajectory.cpp


示例14: startTrajectory

 //! Sends the command to start a given trajectory
 void startTrajectory()
 {
   iri_wam_common_msgs::DMPTrackerGoal DMPgoal;
   
   DMPgoal.initial.positions.resize(7);   
   DMPgoal.initial.positions[0] = -0.11976;
   DMPgoal.initial.positions[1] = -1.84794;
   DMPgoal.initial.positions[2] = 0.285349;
   DMPgoal.initial.positions[3] = 2.84315;
   DMPgoal.initial.positions[4] = -0.310117;
   DMPgoal.initial.positions[5] = -1.21896;
   DMPgoal.initial.positions[6] = 0.0192133;
    
   DMPgoal.goal.positions.resize(7); 
   DMPgoal.goal.positions[0] = 0.160557;
   DMPgoal.goal.positions[1] = -1.91039;
   DMPgoal.goal.positions[2] = -0.664568;
   DMPgoal.goal.positions[3] = 2.9184;
   DMPgoal.goal.positions[4] = -0.5448;
   DMPgoal.goal.positions[5] = -0.812694;
   DMPgoal.goal.positions[6] = -0.471291;
    
   // When to start the trajectory: 1s from now
   //goal.trajectory.header.stamp = ros::Time::now() + ros::Duration(1.0);
   traj_client_->sendGoal(DMPgoal);
   
   for (int i=0;i<10;i++) {
     sleep(0.5);
     trajectory_msgs::JointTrajectoryPoint DMPnew_goal;
     DMPnew_goal.positions.resize(7);   
     DMPnew_goal.positions[0] = -0.11976;
     DMPnew_goal.positions[1] = -1.84794;
     DMPnew_goal.positions[2] = 0.285349-i*0.02;
     DMPnew_goal.positions[3] = 2.84315;
     DMPnew_goal.positions[4] = -0.310117;
     DMPnew_goal.positions[5] = -1.21896;
     DMPnew_goal.positions[6] = 0.0192133;
     
     pub.publish(DMPnew_goal);
   }     
 }
开发者ID:quimnuss,项目名称:ros_iri_wam,代码行数:42,代码来源:dmp_simple_trajectory.cpp


示例15: getState

 //! Returns the current state of the action
 actionlib::SimpleClientGoalState getState()
 {
  return traj_client_->getState();
 }	  
开发者ID:quimnuss,项目名称:ros_iri_wam,代码行数:5,代码来源:move_in_joints.cpp


示例16: startTrajectory

	//! Sends the command to start a given trajectory
    void startTrajectory(arm_navigation_msgs::MoveArmGoal& goal)
    {
        traj_client_->sendGoal(goal);
    }
开发者ID:quimnuss,项目名称:ros_iri_wam,代码行数:5,代码来源:move_in_joints.cpp


示例17: getArmState

	actionlib::SimpleClientGoalState getArmState()
	{
		return traj_client_elbow_flex_->getState();
	}
开发者ID:cristiiacob,项目名称:kdl_training,代码行数:4,代码来源:r_arm_test.cpp


示例18: execute_joint_trajectory

//send a desired joint trajectory to the joint trajectory action
  //and wait for it to finish
  bool execute_joint_trajectory(std::vector<double *> joint_trajectory)
  {
    int i, j; 
    int trajectorylength = joint_trajectory.size();

    //get the current joint angles
    double current_angles[6];    
    get_current_joint_angles(current_angles);

    //fill the goal message with the desired joint trajectory
    goal.trajectory.points.resize(trajectorylength+1);

    //set the first trajectory point to the current position
    goal.trajectory.points[0].positions.resize(6);
    goal.trajectory.points[0].velocities.resize(6);
    for(j=0; j<6; j++)
    {
      goal.trajectory.points[0].positions[j] = current_angles[j];
      goal.trajectory.points[0].velocities[j] = 0.0; 
    }

   //make the first trajectory point start 0.25 seconds from when we run
    goal.trajectory.points[0].time_from_start = ros::Duration(0.25);     

    //fill in the rest of the trajectory
    double time_from_start = 0.25;
    for(i=0; i<trajectorylength; i++)
    {
      goal.trajectory.points[i+1].positions.resize(6);
      goal.trajectory.points[i+1].velocities.resize(6);

      //fill in the joint positions (velocities of 0 mean that the arm
      //will try to stop briefly at each waypoint)
      for(j=0; j<6; j++)
      {
        goal.trajectory.points[i+1].positions[j] = joint_trajectory[i][j];
        goal.trajectory.points[i+1].velocities[j] = 0.0;
      }

      //compute a desired time for this trajectory point using a max 
      //joint velocity
      double max_joint_move = 0;
      for(j=0; j<6; j++)
      {
        double joint_move = fabs(goal.trajectory.points[i+1].positions[j] 
                                 - goal.trajectory.points[i].positions[j]);
        if(joint_move > max_joint_move) max_joint_move = joint_move;
      }
      double seconds = max_joint_move/MAX_JOINT_VEL;
      ROS_INFO("max_joint_move: %0.3f, seconds: %0.3f", max_joint_move, seconds);
      time_from_start += seconds;
      goal.trajectory.points[i+1].time_from_start = 
        ros::Duration(time_from_start);
    }

    //when to start the trajectory
    goal.trajectory.header.stamp = ros::Time::now() + ros::Duration(0.25);

    ROS_INFO("Sending goal to joint_trajectory_action");
    action_client->sendGoal(goal);

    action_client->waitForResult();

    //get the current joint angles for debugging
    get_current_joint_angles(current_angles);
//    ROS_INFO("joint angles after trajectory: %0.3f %0.3f %0.3f %0.3f %0.3f %0.3f %0.3f\n",current_angles[0],current_angles[1],current_angles[2],current_angles[3],current_angles[4],current_angles[5]);

    if(action_client->getState() == actionlib::SimpleClientGoalState::SUCCEEDED){
      ROS_INFO("Hooray, the arm finished the trajectory!");
      return 1;
    }
    ROS_INFO("The arm failed to execute the trajectory.");
    return 0;
  }
开发者ID:saszaz,项目名称:boeing-project,代码行数:76,代码来源:ik_trajectory.cpp


示例19: startTrajectory

 //! Sends the command to start a given trajectory
 void startTrajectory(pr2_controllers_msgs::JointTrajectoryGoal goal)
 {
   // When to start the trajectory: 1s from now
   goal.trajectory.header.stamp = ros::Time::now() + ros::Duration(1.0);
   traj_client_->sendGoal(goal);
 }
开发者ID:SankarNatarajan,项目名称:JacoROS,代码行数:7,代码来源:open_gripper.cpp



注:本文中的TrajClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Trajectory类代码示例发布时间:2022-05-31
下一篇:
C++ Traits类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap