0
$\begingroup$

Rosanswers logo

Hi guys,

I'm trying to broadcast moving joint states using my robot state publisher. I echoed the topic on which I broadcast my state, all I get is :

transforms: []
---

Here's my code section responsible for broadcasting the state :

auto transforms = std::map<std::string, double>();
        while (publish) {
            transforms.insert(std::make_pair("base_link", controller->getJointCurrentAngle(
                    Controller::JOINT_ID(Controller::JOINT::BASE_JOINT_ID))));
            transforms.insert(std::make_pair("joint_1", controller->getJointCurrentAngle(
                    Controller::JOINT_ID(Controller::JOINT::SHOULDER_JOINT_ID))));
            transforms.insert(std::make_pair("joint_2", controller->getJointCurrentAngle(
                    Controller::JOINT_ID(Controller::JOINT::ELBOW_JOINT_ID))));
            transforms.insert(std::make_pair("joint_3", controller->getJointCurrentAngle(
                    Controller::JOINT_ID(Controller::JOINT::WRIST_JOINT_ID))));
            publisher.get()->publishTransforms(transforms,ros::Time::now(),"");
            transforms.clear();
            usleep(1000);
        }

When I use publishFixedTransform("") instead of publishTransforms, I get my transforms correctly published to the topic, but I cannot move them since I use a KDL tree from an URDF file to create my robot model.

Do you guys have any tip of what I'm doing wrong ?

Thanks !


Originally posted by kritchie on ROS Answers with karma: 15 on 2015-09-12

Post score: 1


Original comments

Comment by Solenoid on 2016-08-19:
Did you find an answer to your issue, I am in the same situation and cannot figure this out... Joints are published, but transforms are empty, subscriptions are all correct: robot->joints->robot_state_publisher->tf.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Out of curiosity (and not an answer): any particular reason that you are trying to directly publish TF frames in this way? Typical setups publish JointState msgs, and the robot_state_publisher then does all the hard work. That would seem to make things much easier (but adds a node).


Originally posted by gvdhoorn with karma: 86574 on 2015-09-13

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.