ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

jsoley's profile - activity

2018-06-15 17:33:09 -0500 received badge  Famous Question (source)
2017-11-23 00:36:00 -0500 received badge  Famous Question (source)
2017-03-29 08:01:42 -0500 received badge  Notable Question (source)
2017-03-28 09:37:37 -0500 received badge  Popular Question (source)
2017-03-27 02:47:58 -0500 received badge  Notable Question (source)
2017-03-25 04:39:14 -0500 received badge  Popular Question (source)
2017-03-24 11:32:45 -0500 asked a question Can't get data from topic

Hi, I am trying to get data from ar_pose_markers. I am running the package and I see the topic is refreshing with new data. I am using ar_tools and usb_cam.

I have to make a node that subscribe to this topic and it able to extract the information. I am subscribing to the topic but I can extract the position. This code give me a number but is the same number all the time.

The node code is the following one

#include "ros/ros.h"
#include "std_msgs/String.h"
#include <ar_pose/ARMarkers.h>



int yo=10;
int zo;
int i=0;
void ar_pose_markerCallback(const ar_pose::ARMarkers::ConstPtr& msg)
{
float xo=0;
ROS_INFO("hello world");
ar_pose::ARMarker ar_pose_marker;
xo=ar_pose_marker.pose.pose.orientation.x;
ROS_INFO("%d", xo);


}

int main(int argc, char **argv)
{
ROS_INFO("hello world");
ros::init(argc, argv, "node_sub");
ros::NodeHandle n;
ros::Rate loop_rate(1);
ros::Subscriber sub = n.subscribe("ar_pose_marker", 1, ar_pose_markerCallback);
while (ros::ok())

{

ros::spinOnce();
loop_rate.sleep();

} return 0; }

2017-03-24 11:32:44 -0500 asked a question Extract data from topic (ar_pose)

Hi, I am trying to get data from ar_pose_markers. I am running the package and I see the topic is refreshing with new data. I am using ar_tools and usb_cam.

I have to make a node that subscribe to this topic and it able to extract the information. I am subscribing to the topic but I can extract the position. This code give me a number but is the same number all the time.

The node code is the following one

#include "ros/ros.h"
#include "std_msgs/String.h"
#include <ar_pose/ARMarkers.h>



int yo=10;
int zo;
int i=0;
void ar_pose_markerCallback(const ar_pose::ARMarkers::ConstPtr& msg)
{
float xo=0;
ROS_INFO("hello world");
ar_pose::ARMarker ar_pose_marker;
xo=ar_pose_marker.pose.pose.orientation.x;
ROS_INFO("%d", xo);


}

int main(int argc, char **argv)
{
ROS_INFO("hello world");
ros::init(argc, argv, "node_sub");
ros::NodeHandle n;
ros::Rate loop_rate(1);
ros::Subscriber sub = n.subscribe("ar_pose_marker", 1, ar_pose_markerCallback);
while (ros::ok())

{

ros::spinOnce();
loop_rate.sleep();

} return 0; }