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

Retrieve interpolated desired positions from JointTrajectoryController without execution?

asked 2019-04-14 10:14:10 -0600

Isha Dijcks gravatar image

Is it possible to get the result of the interpolation that the JTC does without executing it?

I have checked most of the source of the JointTrajectoryController but so far I haven't found anything related to the interpolation.

When sending the following trajectory:

header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
joint_names:
- 'joint1'
points:
- positions: [0.6]
  velocities: [-0.1]
  time_from_start: {secs: 0, nsecs: 800000000}
- positions: [0.4]
  velocities: [0]
  time_from_start: {secs: 1, nsecs: 200000000}

If I send these commands I can monitor the state/desired topic to see the result, however I'd like to get the result of the interpolation and check what the calculated desired positions will be before actually executing them on my robot.

Is this possible or am I misunderstanding something about the JointTrajectoryController?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2019-04-15 02:23:33 -0600

gvdhoorn gravatar image

As in #q320899, I'm not entirely sure why you are doing this, but sampling of the trajectory is done here, as part of JointTrajectoryController<..>::update(..).

This makes use of QuinticSplineSegment::sample(..) to do the actual sampling.

You could instantiate your own JointTrajectoryController::Trajectory and populate it with a trajectory_msgs/JointTrajectory (using joint_trajectory_controller::internal::initJointTrajectory(..)) and then perform the iteration and sampling directly.

Note: most of this is in the internal namespace of joint_trajectory_controller, so not part of the public API, meaning it could change at any time and without prior notice or bw-compatibility.

edit flag offensive delete link more

Comments

I'm not entirely sure why you are doing this

The goal is to create a human-like walking pattern. I want to show the visualization to experts to give feedback on the walking pattern.

Isha Dijcks gravatar image Isha Dijcks  ( 2019-04-15 02:32:39 -0600 )edit

Going the way I described in my answer would embed knowledge about this being "for a visualisation" into this/these component(s). It would perhaps be better to create a visualisation/simulation configuration/variant of your application and use that (next to a configuration that runs your application with the real robot) instead of creating new components.

That should/would allow you to reuse much more of your software than creating custom components for these things at this level (or at least: that is my experience).

gvdhoorn gravatar image gvdhoorn  ( 2019-04-15 02:35:44 -0600 )edit

I have a simulation which can be interacted the exact same way as the physical hardware, so I could definitely use that instead. The main component of my question is to get the planned trajectory as fast as possible. I assume that running the trajectory through a simulation will only slow that down, and should have no effect on the desired trajectory, but I might be wrong on that one.

Isha Dijcks gravatar image Isha Dijcks  ( 2019-04-15 02:46:08 -0600 )edit
1

answered 2019-04-14 17:16:14 -0600

AndyZe gravatar image

One way you could do this is to remap the outgoing command to a different topic, so it doesn't go to the ROS controller. See here.

edit flag offensive delete link more

Comments

Which topic would need to be remapped exactly? And is it possible to retrieve the calculated trajectory instantly or would you still have to wait for the execution time to finish?

Isha Dijcks gravatar image Isha Dijcks  ( 2019-04-14 17:23:06 -0600 )edit

I don't recall exactly what the topic is. Probably state/desired. And yes, you would be able to see the whole trajectory instantly because it's published as one big message.

AndyZe gravatar image AndyZe  ( 2019-04-14 17:24:55 -0600 )edit

I was wondering because I usually plot the state/desired and it doesn't show up as one big message, or maybe it is timestamped in the future? I'll check it out, thanks!

Isha Dijcks gravatar image Isha Dijcks  ( 2019-04-14 17:34:39 -0600 )edit

Maybe the topic has 'goal' in it, because it's sending a goal to the action server

AndyZe gravatar image AndyZe  ( 2019-04-14 18:23:00 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-04-14 10:14:10 -0600

Seen: 380 times

Last updated: Apr 15 '19