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

error when I try to read a ros msg composite by another msg file into a node subscriber calback

asked 2012-11-02 14:35:12 -0600

LeonardoLeottau gravatar image

updated 2012-11-03 04:16:06 -0600

Error when I try to read a ros msg composite by another msg file into a node subscriber callback.

I have this ROS msgs.

WalkingRequest.msg
uint32 mode  #/**< The walking mode. */
Pose2D speed 
Pose2D target 

Pose2D.msg
float32 theta
float32 x
float32 y

Within the callback of my suscriber node I use:

void myCallBack(const naoros1::WalkRequest::ConstPtr& walkRequest_)
{
    walkRequest.mode = walkRequest_->mode;

Which works fine. But when I try to access to the embedded Pose2D msg like that:

walkRequest.speed.x = walkRequest_->speed->x;

I have this error:

   /home/nao/ros-nao/workspace_nao/sandbox/naoros1/src/src/UChProcess/UChCognitionExecutor.cpp: In member function ‘void UChCognitionExecutor::runModules(const boost::shared_ptr<const naoros1::WalkRequest_<std::allocator<void> > >&)’:
    /home/nao/ros-nao/workspace_nao/sandbox/naoros1/src/src/UChProcess/UChCognitionExecutor.cpp:47: error: base operand of ‘->’ has non-pointer type ‘const naoros1::Pose2D_<std::allocator<void> >’

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2012-11-03 16:54:33 -0600

jbohren gravatar image

`walkRequest_` is a pointer type, `walkRequest_->speed` is a value type, so you want: walkRequest.speed.x = walkRequest_->speed.x;

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-11-02 14:35:12 -0600

Seen: 414 times

Last updated: Nov 03 '12