当前位置: 首页>>代码示例>>C++>>正文


C++ Arm::get_joint_values方法代码示例

本文整理汇总了C++中Arm::get_joint_values方法的典型用法代码示例。如果您正苦于以下问题:C++ Arm::get_joint_values方法的具体用法?C++ Arm::get_joint_values怎么用?C++ Arm::get_joint_values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arm的用法示例。


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

示例1: test_figtree

void test_figtree() {
	Vector3d object(3.35, -1.11, 0.8);
	Arm::ArmType arm_type = Arm::ArmType::right;
	bool view = true;
	PR2System sys(object, arm_type, view);

	PR2* brett = sys.get_brett();
	Arm* arm = sys.get_arm();
	rave::EnvironmentBasePtr env = brett->get_env();
	arm->set_posture(Arm::Posture::mantis);
	sleep(1);

	MatrixP P = setup_particles(env);
	std::vector<ParticleGaussian> particle_gmm;

	tc.start("figtree");
	sys.fit_gaussians_to_pf(P, particle_gmm);
	tc.stop("figtree");

	std::cout << "particle_gmm size: " << particle_gmm.size() << "\n";
	for(int i=0; i < particle_gmm.size(); ++i) {
		std::cout << "mean: " << particle_gmm[i].mean.transpose() << "\n";
		std::cout << "cov diag: " << particle_gmm[i].cov.diagonal().transpose() << "\n";
		std::cout << "pct: " << particle_gmm[i].pct << "\n";
	}

	tc.print_all_elapsed();
	sys.display(arm->get_joint_values(), particle_gmm);
}
开发者ID:gkahn13,项目名称:bsp,代码行数:29,代码来源:old-test-pr2-system.cpp

示例2: test_particle_update

void test_particle_update() {
	Vector3d object(3.35, -1.11, 0.8);
	Arm::ArmType arm_type = Arm::ArmType::right;
	bool view = true;
	PR2System sys(object, arm_type, view);

	PR2* brett = sys.get_brett();
	Arm* arm = sys.get_arm();
	rave::EnvironmentBasePtr env = brett->get_env();
	sleep(2);

	arm->set_posture(Arm::Posture::mantis);

	// setup scenario
	VectorJ j_t_real = arm->get_joint_values(), j_tp1_real;
	VectorJ j_t = j_t_real, j_tp1; // i.e. no belief == actual
	VectorU u_t = VectorU::Zero();
	MatrixP P_t = setup_particles(env), P_tp1;

	LOG_INFO("Origin particles");
	std::vector<ParticleGaussian> particle_gmm_t;
	sys.fit_gaussians_to_pf(P_t, particle_gmm_t);
	sys.display(j_t, particle_gmm_t);

	sys.execute_control_step(j_t_real, j_t, u_t, P_t, j_tp1_real, j_tp1, P_tp1);

	LOG_INFO("New particles")
	std::vector<ParticleGaussian> particle_gmm_tp1;
	sys.fit_gaussians_to_pf(P_tp1, particle_gmm_tp1);
	sys.display(j_tp1, particle_gmm_tp1);
}
开发者ID:gkahn13,项目名称:bsp,代码行数:31,代码来源:old-test-pr2-system.cpp

示例3: test_fk

void test_fk() {
	Vector3d object(3.35, -1.11, 0.8);
	Arm::ArmType arm_type = Arm::ArmType::right;
	bool view = true;
	PR2System sys(object, arm_type, view);

	PR2* brett = sys.get_brett();
	Arm* arm = sys.get_arm();
	Camera* cam = sys.get_camera();
	rave::EnvironmentBasePtr env = brett->get_env();

	arm->set_posture(Arm::Posture::mantis);
	sleep(1);

	VectorJ j = arm->get_joint_values();

	Matrix4d actual_arm_pose = rave_utils::transform_from_to(brett->get_robot(), Matrix4d::Identity(), "r_gripper_tool_frame", "world");
	Matrix4d fk_arm_pose = arm->get_pose(j);

	std::cout << "actual_arm_pose:\n" << actual_arm_pose << "\n\n";
	std::cout << "fk_arm_pose:\n" << fk_arm_pose << "\n\n";

	Matrix4d actual_cam_pose = rave_utils::rave_to_eigen(cam->get_sensor()->GetTransform());
	Matrix4d fk_cam_pose = cam->get_pose(j);

	std::cout << "actual_cam_pose:\n" << actual_cam_pose << "\n\n";
	std::cout << "fk_cam_pose:\n" << fk_cam_pose << "\n\n";
}
开发者ID:gkahn13,项目名称:bsp,代码行数:28,代码来源:old-test-pr2-system.cpp

示例4: test_pr2_system

void test_pr2_system() {
	Vector3d object(3.35, -1.11, 0.8);
	Arm::ArmType arm_type = Arm::ArmType::right;
	bool view = true;
	PR2System sys(object, arm_type, view);

	PR2* brett = sys.get_brett();
	Arm* arm = sys.get_arm();
	rave::EnvironmentBasePtr env = brett->get_env();
	sleep(2);

	arm->set_posture(Arm::Posture::mantis);

	// setup particles
	MatrixP P = setup_particles(env);

	// test plotting
	VectorJ j = arm->get_joint_values();

	std::vector<ParticleGaussian> particle_gmm;
	particle_gmm.push_back(ParticleGaussian(Vector3d::Zero(), Matrix3d::Identity(), P.leftCols(M_DIM/2), 1));
	particle_gmm.push_back(ParticleGaussian(Vector3d::Zero(), Matrix3d::Identity(), P.rightCols(M_DIM/2), 1));

	sys.display(j, particle_gmm);
}
开发者ID:gkahn13,项目名称:bsp,代码行数:25,代码来源:old-test-pr2-system.cpp

示例5: test_camera

void test_camera() {
	Vector3d object(3.35, -1.11, 0.8);
	Arm::ArmType arm_type = Arm::ArmType::right;
	bool view = true;
	PR2System sys(object, arm_type, view);

	PR2* brett = sys.get_brett();
	Arm* arm = sys.get_arm();
	Camera* cam = sys.get_camera();
	rave::EnvironmentBasePtr env = brett->get_env();

	MatrixP P = setup_particles(env);

	arm->set_posture(Arm::Posture::mantis);
	sleep(2);

	VectorJ j = arm->get_joint_values();
	StdVector3d pcl = cam->get_pcl(j);
	cam->plot_pcl(pcl);

//	std::cout << "Displaying env mesh. Teleop and then get FOV\n";

	arm->teleop();

	std::vector<std::vector<Beam3d> > beams = cam->get_beams(j, pcl);
	rave_utils::clear_plots();
	cam->plot_fov(beams);

	std::vector<Triangle3d> border = cam->get_border(beams);

//	tc.start("sd");
//	for(int m=0; m < M_DIM; ++m) {
//		double sd = cam->signed_distance(P.col(m), beams, border);
//	}
//	tc.stop("sd");

	Vector3d p(3.35, -2.5, 0.8);
	rave_utils::plot_point(env, p, Vector3d(1,0,0));

	while(true) {
		VectorU grad = cost_grad(sys, j, p, VectorU::Zero(), .01);
		std::cout << "grad:\n" << grad << "\n";

		if (grad.norm() < epsilon) {
			std::cout << "crap\n";
			exit(0);
		}

		VectorJ j_new = j - (M_PI/32)*grad/grad.norm();
//		arm->set_joint_values(j_new);

		beams = cam->get_beams(j_new, pcl);
		rave_utils::clear_plots();
		rave_utils::plot_transform(env, rave_utils::eigen_to_rave(arm->get_pose(j_new)));
		cam->plot_fov(beams);
		rave_utils::plot_point(env, p, Vector3d(1,0,0));

		j = j_new;

		std::cin.ignore();
	}

	tc.print_all_elapsed();
	std::cout << "Displaying current fov beams. Press enter to exit\n";
	std::cin.ignore();
}
开发者ID:gkahn13,项目名称:bsp,代码行数:66,代码来源:old-test-pr2-system.cpp


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