本文整理汇总了C++中eigen::Vector4d::array方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector4d::array方法的具体用法?C++ Vector4d::array怎么用?C++ Vector4d::array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Vector4d
的用法示例。
在下文中一共展示了Vector4d::array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendMarkers
void sendMarkers(ros::Publisher pub_marker, ros::Publisher pub_marker_array , node_map& nodes)
{
visualization_msgs::MarkerArray m_array;
if (pub_marker_array.getNumSubscribers() > 0)
{
for (node_map::iterator nm_it = nodes.begin(); nm_it !=nodes.end(); ++nm_it)
{
visualization_msgs::Marker marker;
visualization_msgs::Marker marker_text;
Eigen::Vector4d P = Eigen::Vector4d::Zero();
P.array()[3] = 1;
Eigen::Vector4d start = nm_it->second.pose*P;
P.array()[2] = 0.2; // 20cm in z-direction
Eigen::Vector4d end = nm_it->second.pose*P;
// cerr << "node " << nm_it->second.node_id << " at: " << start << endl;
marker.header.frame_id = "/openni_rgb_optical_frame";
marker.header.stamp = ros::Time();
marker.ns = "cam_positions_ns";
marker.id = nm_it->first*2;
marker.type = visualization_msgs::Marker::ARROW;
marker.action = visualization_msgs::Marker::MODIFY; // same as add
geometry_msgs::Point p,p2;
p.x = start.array()[0]; p.y = start.array()[1]; p.z = start.array()[2];
marker.points.push_back(p);
p2.x = end.array()[0]; p2.y = end.array()[1]; p2.z = end.array()[2];
marker.points.push_back(p2);
marker.scale.x = 0.01; // radius in m
marker.scale.y = 0.03; // head radius in m
marker.color.a = 1;
// ROS_INFO("drawing node with cluster %i ( mod 3 = %i)",nm_it->second.cluster_id, nm_it->second.cluster_id%3 );
// cout << "at " << nm_it->second.pose << endl;
marker.color.r = marker.color.g = marker.color.b = 0;
switch (nm_it->second.cluster_id%3) {
case 0: marker.color.b = 1; break;
case 1: marker.color.g = 1; break;
case 2: marker.color.r = 1; break;
default:
break;
}
m_array.markers.push_back(marker);
marker_text.header.frame_id = "/openni_rgb_optical_frame";//"/fixed_frame";
//marker_text.header.frame_id = "/fixed_frame";
marker_text.header.stamp = ros::Time();
marker_text.ns = "cam_positions_ns";
marker_text.id = nm_it->first*2+1;
marker_text.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
marker_text.action = visualization_msgs::Marker::MODIFY; // same as add
char buff[20]; sprintf(buff, "%i", nm_it->first);
marker_text.text = string(buff);
marker_text.color = marker.color;
marker_text.scale.z = 0.02;
marker_text.pose.position.x = nm_it->second.pose(0,3);
marker_text.pose.position.y = nm_it->second.pose(1,3);
marker_text.pose.position.z = nm_it->second.pose(2,3)-0.1;
m_array.markers.push_back(marker_text);
}
// ROS_ERROR("published %i arrows", (int) m_array.markers.size());
pub_marker_array.publish(m_array);
}
if (pub_marker.getNumSubscribers() > 0)
{
// publish connections between cameras
visualization_msgs::Marker m_cam_edge_list;
m_cam_edge_list.header.frame_id = "/openni_rgb_optical_frame"; //"/fixed_frame";
m_cam_edge_list.header.stamp = ros::Time();
m_cam_edge_list.ns = "cam_matches_ns";
m_cam_edge_list.id++;
m_cam_edge_list.type = visualization_msgs::Marker::LINE_LIST;
m_cam_edge_list.action = visualization_msgs::Marker::MODIFY;
m_cam_edge_list.color.a =1;
m_cam_edge_list.color.g = 1;
//.........这里部分代码省略.........