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

kp3509's profile - activity

2012-12-22 19:39:40 -0500 received badge  Famous Question (source)
2012-12-22 19:39:40 -0500 received badge  Popular Question (source)
2012-12-22 19:39:40 -0500 received badge  Notable Question (source)
2012-12-07 09:39:08 -0500 received badge  Famous Question (source)
2012-12-07 09:39:08 -0500 received badge  Notable Question (source)
2012-09-03 15:25:50 -0500 received badge  Famous Question (source)
2012-09-03 15:25:50 -0500 received badge  Notable Question (source)
2012-07-06 12:24:17 -0500 received badge  Taxonomist
2012-06-01 19:06:41 -0500 received badge  Popular Question (source)
2012-04-16 12:48:39 -0500 received badge  Popular Question (source)
2011-08-03 17:45:05 -0500 marked best answer Problem using subscribed motor position topic

ax12_driver_core::MotorStateList contains an array of ax12_driver_core::MotorState messages. In C++, ROS arrays are converted to C++ std::vector.

To print the motor position of the first MotorState in the array you might use something like:

ROS_INFO("I heard : %d", msg->motor_states[0].position;);

You might want to also check that motor_states vector has at least 1 element :

if (msg->motor_states.size() > 0)
2011-06-05 13:50:56 -0500 marked best answer Laser Assembler with Hokuyo Utm-30lx

A simple launch file that starts the Hokuyo driver and the assembler would look something like this. First, launch the Hokuyo laser:

  <node type="hokuyo_node" pkg="hokuyo_node" name="hokuyo_node/>

Verify that you are getting correct laser data. To do that, you can run rviz, add a LaserScan display, and set the fixed frame option to "laser".

The second step is launching the assembler. Both the hokuyo node and the assembler use scan as the default topic, so no need to remap.

  <node type="laser_scan_assembler" pkg="laser_assembler" name="my_assembler"> 
    <param name="fixed_frame" type="string" value="base_link"/> 
  </node>

The last step is to add something that is publishing the correct transform between the base_link and the laser frames.

2011-05-29 17:30:07 -0500 asked a question Laser Assembler with Hokuyo Utm-30lx

Hi, I have successfully run the laser_assembler tutorial at: http://www.ros.org/wiki/laser_assembl... The tutorial uses a bag file containing the laser data. How can I change the parameters of this tutorial to work with real time hokuyo laser topic that is being published?

Changing parameters in the launch file below does not seem to help.

<launch> <node type="laser_scan_assembler" pkg="laser_assembler" name="my_assembler"> <remap from="scan" to="tilt_scan"/> </node> </launch>

2011-05-27 03:25:40 -0500 received badge  Student (source)
2011-05-23 11:11:24 -0500 asked a question Problem using subscribed motor position topic

Hi, I am new to ROS and I am trying to get access to my servo motor position to use in broadcasting a transform. I have done the listener tutorial and my listen program below runs and compiles fine, it even triggers the void function when the motor publishes a position topic. How can I get pull the position variable that I am subscribed to in order to use it in a program? Specifically what do I need to change "sg->data.c_str()" to in order for it to say the motor position integer in the message?

======================listener.cpp==============

#include "ros/ros.h"

#include "ax12_driver_core/MotorStateList.h"

void motorchatterCallback(const ax12_driver_core::MotorStateList::ConstPtr&)
{

 // ROS_INFO("I heard: [%s]", msg->data.c_str());

}

int main(int argc, char **argv)
{
   ros::init(argc, argv, "listener");

  ros::NodeHandle n;

  ros::Subscriber sub = n.subscribe("motor_states/ttyUSB0", 1000, motorchatterCallback);

ros::spin();

  return 0;

}
2011-05-23 06:05:27 -0500 marked best answer Problem subscribing to ax12_controller_core topic

Well, you are trying to subscribe to a topic that publishes ax12_driver_core/MotorStateList, so your callback needs to accept that instead of std_msgs/String type. For that you need to have include "ax12_driver_core/MotorStateList" and replace const std_msgs::String::ConstPtr& in callback function with const ax12_driver_core::MotorStateList::ConstPtr&. Also make sure that your manifest.xml has a dependency on ax12_driver_core package.

2011-05-22 18:09:21 -0500 commented answer Problem subscribing to ax12_controller_core topic
Thank you, that was a big help, I am able to compile the code now. I have one more question, how do I use the position value that I am subscribing to in my code? So far I have: void motorchatterCallback(const ax12_driver_core::MotorStateList::ConstPtr& msg) { //ROS_INFO("I heard: [%s]", msg->data.c_str()); } The commented part in void would display the data that it got from the subribed topic, but I am unsure of what to replace "msg->data.c_str()" with.
2011-05-21 13:35:00 -0500 received badge  Editor (source)
2011-05-21 13:32:58 -0500 asked a question Problem subscribing to ax12_controller_core topic

Hi, I am new to ros and I have a dynamixel ax12 driver publishing position information and I want to access that info and put into a variable that I can use for a transform. I have done the publisher and listener tutorial successfully, but I am having trouble getting it to work with the dynamixel. Specifically I am unsure of how to change the paramaters in void since the motor doesnt seem to use std_msgs. Any suggestions? Below are the topic data and what I have for my listener.cpp program so far.

rostopic list= /motor_states/ttyUSB0

/motor_states/ttyUSB0 [ax12_driver_core/MotorStateList] 1 publisher

rosmsg show ax12_driver_core/MotorStateList

ax12_driver_core/MotorState[] motor_states

float64 timestamp

int32 id

int32 goal

int32 position

int32 error

int32 speed

float64 load

float64 voltage

int32 temperature

bool moving

============Begin Listener.cpp=================

#include "ros/ros.h"

#include "std_msgs/String"

void motorCallback(const std_msgs::String::ConstPtr& msg)

{ ROS_INFO("I heard: [%s]", msg->data.c_str()); }

int main(int argc, char **argv) {

ros::init(argc, argv, "listener");

ros::NodeHandle n;

ros::Subscriber sub = n.subscribe("motor_states/ttyUSB0", 1000, motorCallback);

ros::spin();

return 0; }