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

Modify source code of a pre-built Package(external)

asked 2013-03-03 06:32:53 -0500

nemesis gravatar image

updated 2013-03-21 21:01:42 -0500

Hi, so I am using a couple packages but the "output" that I get from the nodes isn't exactly what I need to work on.

I wanted to know -

  1. If the source code of these pre-built packages can be modified, and if it can then how do we go about "updating" the package after that?
  2. If I can't modify the source code, can I "manipulate" the output at the nodes before I forward it to other nodes if required?

Thank You!

edit retag flag offensive close merge delete

Comments

What kind of manipulation do you need to do?

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2013-03-03 16:08:21 -0500 )edit

The coordinates that I get from the package are not along the axes I require. That is, Z direction is Y and X is negative Z. So wanted to check if I can modify the code so that I get it right.

nemesis gravatar image nemesis  ( 2013-03-03 16:14:18 -0500 )edit
1

I'm sorry, I should've been clearer. Ignore the previous comment. What I require is - X,Y and Z What the package output is ('cause of the way it's in the code) - X, Z, (negative) Y So I wanted to modify the code to change that. (I hope you understood this time?)

nemesis gravatar image nemesis  ( 2013-03-03 16:27:34 -0500 )edit

Oh, that data format is wrong? Is it publishing a custom message type?

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2013-03-03 16:31:38 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-03-03 12:48:43 -0500

joq gravatar image

updated 2013-03-04 01:21:14 -0500

EDIT: to answer both questions:

  1. Check out sources into an overlay and modify that copy. See: http://answers.ros.org/question/47563/how-do-overlays-work/

  2. Write another node that subscribes to the original topic, modifies each message as desired, and republishes it on a different topic name. You'll probably need to remap some topic names for that to work properly.

edit flag offensive delete link more

Comments

I will give this a try. But I guess after modification, I just have to use "Make" inside that folder to compile it, right?

nemesis gravatar image nemesis  ( 2013-03-03 16:09:48 -0500 )edit

It's a good idea to run rosmake first. Later, you can run make, to save build time.

joq gravatar image joq  ( 2013-03-04 01:16:34 -0500 )edit

I will try out the second way later and let you know. But modifying the code worked. Note - I had to use "rosmake", "make" wasn't working. Will update once I figure out why. Thank you!

nemesis gravatar image nemesis  ( 2013-03-04 10:53:30 -0500 )edit
2

answered 2013-03-03 16:27:28 -0500

I think I see what you mean. It might be easier to just set up a static transform publisher that puts your coordinates in the right frame, and then add it to your tf tree: http://www.ros.org/wiki/tf#static_transform_publisher

You could also subscribe to the data, apply a transform manually, then republish it.

edit flag offensive delete link more

Comments

Normal modification did work and it's pretty straightforward too. I will look into your procedure and let you know asap. Thank you!

nemesis gravatar image nemesis  ( 2013-03-04 10:54:14 -0500 )edit

@jj56 Modifying it directly worked like I said, but I also wish to add some code to convert a Quaternion set of rotations to Roll Pitch and Yaw. Unfortunately this isn't as easy as I expected it to be. (The source code of the package is in C++ but I am not at all familiar with this part of coding)

nemesis gravatar image nemesis  ( 2013-03-20 10:15:08 -0500 )edit

Any input regarding that?

nemesis gravatar image nemesis  ( 2013-03-20 10:15:24 -0500 )edit

@nemesis ROS has some methods for converting back and forth between rotation representations, have a look here: http://www.ros.org/wiki/geometry/RotationMethods

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2013-03-20 10:22:23 -0500 )edit

@jj56 - Thank you! That's what I am referring to. I use the getRPY code to try and access the RPY, but that gives me errors/"Note"s when I am trying to actually publish those values. I think since I am not familiar with such codes I am having a hard time figuring out how exactly to show the output.

nemesis gravatar image nemesis  ( 2013-03-20 10:25:38 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2013-03-03 06:32:53 -0500

Seen: 1,594 times

Last updated: Mar 21 '13