naoqi_bridge_msgs::JointAnglesWithSpeed() error

asked 2021-10-01 07:46:10 -0600

SciGuy gravatar image

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.

edit retag flag offensive close merge delete

Comments

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:

# A list of joint names, corresponding to their names in the Nao docs.
# This must either have the same length as joint_angles or 
# length 1 if it's a keyword such as 'Body' (for all angles)
string[] joint_names
float32[] joint_angles

# fraction of max joint velocity [0:1]
float32 speed

# Absolute angle (=0, default) or relative change
uint8 relative

As you are using Melodic, this may be the issue with std or boost library as this naobridge was tested with Kinetic.

osilva gravatar image osilva  ( 2021-10-04 07:22:23 -0600 )edit

Since the driver can be installed directly for Melodic.

try:

sudo apt-install ros-melodic-naoqi-bridge-msgs
sudo apt-install ros-melodic-naoqi-driver
osilva gravatar image osilva  ( 2021-10-04 07:43:58 -0600 )edit