KDL Trajectory_Segment

Is there a way to modify a KDL::Trajectory_Segment once it is created?

I would like to re-use the same object everytime I generate a new
trajectory. I try to re-assign it like this:
segment = KDL::Trajectory_Segment(path, &velocityProfile);
This gives me a segmentation fault.

I can make it work using dynamic memory allocation:
delete segment;
segment = new KDL::Trajectory_Segment(path, &velocityProfile);

I also have the same problem with KDL::Path_Line (segmentation fault
when re-assigning).

I want to avoid using dynamic memory allocation because it could affect
the real-time behavior of my application.
Is there another way to do what I am trying to do?

KDL Trajectory_Segment

2010/8/19 poirier-demers [dot] alexis [..] ... <poirier-demers [dot] alexis [..] ...>:
> Is there a way to modify a KDL::Trajectory_Segment once it is created?

This functionality is not implemented at the moment (but should be
straightforward to add). It needs for every VelocityProfile and every
Path, functions to set the VelocityProfile / Path variables.
Afterwards you can adjust these by calling the pointer to the
corresponding objects.
This is however dangerous to implement as there will be no checks on
whether the variables you adjust still combine to a feasible Profile /
Path!

>
> I would like to re-use the same object everytime I generate a new
> trajectory. I try to re-assign it like this:
> segment = KDL::Trajectory_Segment(path, &velocityProfile);
> This gives me a segmentation fault.
>
> I can make it work using dynamic memory allocation:
> delete segment;
> segment = new KDL::Trajectory_Segment(path, &velocityProfile);
>
> I also have the same problem with KDL::Path_Line (segmentation fault when
> re-assigning).
>
> I want to avoid using dynamic memory allocation because it could affect the
> real-time behavior of my application.
> Is there another way to do what I am trying to do?

Can you tell us more about what you want to do?

Steven

KDL Trajectory_Segment

I have a command named moveTo with parameters desiredPosition(x,y,z),
maxSpeed and maxAcceleration.
In this command I create a Trajectory_Segment with a Path_Line from the
current position to desiredPosition and a VelocityProfile_Trap
calculated from the path length and the maxSpeed and maxAcceleration
parameters.

In the updateHook(), I use the Trajectory_Segment.Pos() function to
output the positions for the x,y,z axes.

KDL Trajectory_Segment

I found a solution to my problem. I just need to set the optional
parameter _aggregate for Path_Line and Trajectory_Segment to false.
Otherwise it will try to delete the path, VelocityProfile, etc you pass
as parameters.

It works now.

Thanks for your help.