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

alexvs's profile - activity

2018-10-11 16:22:55 -0500 received badge  Enlightened (source)
2018-09-26 05:54:29 -0500 received badge  Good Answer (source)
2016-08-16 15:44:24 -0500 commented question error when catkin_make package

Can you post the source code to controller.cpp?

2016-07-27 04:42:01 -0500 received badge  Nice Answer (source)
2016-07-26 16:57:22 -0500 answered a question tf.LookupException: "base_link" passed to lookupTransform argument target_frame does not exist.

At first glance, your frames are different in the first node than the second node. 'Baselink' in the first node became '/base_link' in the second node and 'One' became '/one'. The strings identify the frames and when you lookup the transform you need to look for the frames with the same string that you publish them with.

2016-07-25 16:53:33 -0500 received badge  Nice Answer (source)
2016-07-25 15:56:57 -0500 received badge  Supporter (source)
2016-07-25 15:43:41 -0500 received badge  Teacher (source)
2016-07-25 15:42:06 -0500 answered a question catkin is not creating package.

roscd will not know where to locate your package until you have sourced your setup.bash. After you have compiled, in the catkin_ws directory in the terminal enter 'source devel/setup.bash'.

2015-05-02 09:34:20 -0500 commented answer Read on a topic and act when difference occurs?

Another issue you will run into after it compiles is that you are only checking the first joint in the array (the zero index). You should make the velocity and position variables std::vectors of doubles instead of a single double and then check every joint to see if it moved using a loop.

2015-05-02 09:33:22 -0500 commented answer Read on a topic and act when difference occurs?

There are lots of C++ errors in your code. The ROS topic logic looks alright. First of all, you are missing a semicolon on line 15. Second, you are defining your variables after you are using them. Try moving them above the callback.

2015-05-01 19:38:37 -0500 commented answer Read on a topic and act when difference occurs?

could you post some code and the error?

2015-05-01 19:00:52 -0500 answered a question Read on a topic and act when difference occurs?

This is a lot of coding to be answered in one question. Try to be more specific with your question. For how to respond to changes in a topic, see the tutorial on writing a subscriber . If you know how to do that part, all you need to do is write the callback method for the topic that you are subscribing to.

Make a global variable that is the previous joint state. In the callback method use a simple for loop to check if the velocity vector in the current Jointstate (the one that is received by the callback method) has changed from the velocity vector in the previous Jointstate. It looks like the velocity is an array of float64. In C++ this will be interpreted as a std::vector of type double. So you can just traverse both vectors and see if the components have changed to some tolerance. If it has, then traverse the positions the same way and subtract them and save that off. At the end of your callback method, be sure to save the current Jointstate off as the previous Jointstate. If you know how many times its going to happen.. just add a global count variable that counts and run the program until the count is at 100.