0
$\begingroup$

Rosanswers logo

I have the following error message:

/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:52: error: ‘class pr2_mechanism_model::JointState’ has no member named ‘position_1’

/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:53: error: ‘class pr2_mechanism_model::JointState’ has no member named ‘position_2’

I think it mean I have to delare "position_1" and "position_2" in the "joint.h" file, but this header file belongs to ROS stack so that it will not be changed. Is anybody who know how to modify the C++ header file belonged to ROS stack?


Originally posted by maruchi on ROS Answers with karma: 157 on 2011-12-01

Post score: 0


Original comments

Comment by tfoote on 2011-12-01:
Please edit your question instead of replying with a "answer". Also I recommend using the preformatted blocks for code. Highlight the code and press the 101010 button.

Comment by maruchi on 2011-12-01:
Please find the attached below header file "my_controller_pkg.h". Thanks dornhege.

Comment by dornhege on 2011-12-01:
It's better to update your original post for readabilty.

Comment by maruchi on 2011-12-01:
I think your suggestion will be the right solution. I am trying to working it out with still learning C++. Could you give more detail instructions for the below C++ header file?

Comment by dornhege on 2011-12-01:
Are you sure, you need to do that. Can't you create two instances of JointState?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It is advised not to do this because every update to the ROS stacks will wipe your changes. If you need to make modifications to the ROS stacks, it's generally advised that you check out the source from SVN so that you have control over all updates to the stack.

For the pr2_mechanism_model, you could check out the stack with:

hg clone https://kforge.ros.org/pr2mechanism/hg

(you must have Mercurial installed to do this. sudo apt-get install mercurial).

This is the generally accepted method for making modifications to ROS stacks.


Originally posted by DimitriProsser with karma: 11163 on 2011-12-01

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by dornhege on 2011-12-01:
Actually it should be enough to put the source version in front of the base version in the ROS_PACKAGE_PATH. I've used that with a hacked openni_kinect driver.

Comment by DimitriProsser on 2011-12-01:
You would have to uninstall your current pr2_mechanism stack and do this instead. Then you can modify joint.h.

Comment by dornhege on 2011-12-01:
With the method of this answer you can do that.

Comment by maruchi on 2011-12-01:
In my created package, C++ header file includes "joint.h" which belongs to ROS stack. But I need to declare additional variables.

$\endgroup$

Your Answer

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