naoqi_bridge_msgs::JointAnglesWithSpeed() error
Hello, everyone.
Recently, I have been trying to build a (custum) package to connect to a Pepper (nao) robot, but to no avail, as it keeps yielding an error which I cannot seem to solve. The error is as depicted below.
error: cannot convert ‘naoqi_bridge_msgs::JointAnglesWithSpeed_<std::allocator<void> >*’ to ‘boost::shared_ptr<const sensor_msgs::JointState_<std::allocator<void> > >::element_type* {aka const sensor_msgs::JointState_<std::allocator<void> >*}’ in initialization
explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete
The code that yields that error, is as depicted below.
inline float getNeckPitch() const noexcept
{
return static_cast<float>(message->position[1]);
}
JointHandler( std::string subTopic = "/joint_states"
, std::string pubTopic = "/joint_angles"
, naoqi_bridge_msgs::JointAnglesWithSpeed defaultJointState = naoqi_bridge_msgs::JointAnglesWithSpeed()
, std::function<void(float, float)> callback = nullptr )
: jointSub( nodeHandle.subscribe(subTopic, 1, &JointHandler::callback, this) )
, jointPub( nodeHandle.advertise< naoqi_bridge_msgs::JointAnglesWithSpeed >(pubTopic, 1 ) )
, function( callback )
, message( &defaultJointState )
{
std::cout << "Awaiting first joint message to construct handler...\n";
while( !receivedFirstMessage() )
{
}
}
Suspected is that line
naoqi_bridge_msgs::JointAnglesWithSpeed defaultJointState = naoqi_bridge_msgs::JointAnglesWithSpeed()
is responsible for the error, especially the method: JointAnglesWithSpeed()
The system that the package is build onto, is Ubuntu 18.04LTS, with ROS1 Melodic. The GCC version used is 7.5. The error gets yielded when building the concerning packge using catkin_make. I already tried to first clean everything and build it within a new, empty ROS workspace.
Does anyone has encountered this error before, or perhaps knows what the cause might be?
Thank you for reading this post.
B.
I think you are right in suspecting
JointAnglesWithSpeed
method is creating the issue.If you look at the header for
JointAnglesWithSpeed
you need make sure the msg received has the same structure as the msg sent. Below the structure:As you are using Melodic, this may be the issue with
std
orboost
library as thisnaobridge
was tested with Kinetic.Since the driver can be installed directly for Melodic.
try: