Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 committed Feb 13, 2025
1 parent 578a0c3 commit 86869f9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/yarpActionsPlayer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Here is an example of a trajectory file for two joints, with positions sampled a
11 0.110 9.823 9.823
12 0.120 9.980 9.980
```
This format is consistent with the output of the state port of a `controlBoard_nws_yarp`.
This format is consistent with the output of the state port of a `controlBoard_nws_yarp`.
The following command can be used to record the trajectory of a moving robot and obtain a trajectory file that can reproduced with `yarpActionsPlayer`.
```
yarp read ... /robot/part/state:o envelope > file.txt
Expand All @@ -34,7 +34,7 @@ The joints commands are assigned to the robot by using a `remoteControlBoardrema
The following file, configuration.ini (see the `example` folder) creates two different controllers, `controller1` and `controller2`. The first one will control the joints called `hjoint1` and `hjoint2` of the robot part `/robot/head`.
The second one will attach to two different parts of the robot, i.e. `/robot/head` `/robot/arm` and control the joints`hjoint1`,`ajoint1`,`ajoint3` which belong to these parts.
Please note that the number of joints described in the controller (and their order) must match the number of joints indicated in the trajectory file.
As shown in the following example, user has to associate a controller for each action file to correctly map the trajectories described in the file with the joints to actuate.
As shown in the following example, user has to associate a controller for each action file to correctly map the trajectories described in the file with the joints to actuate.
```
[CONTROLLERS]
controller1 (/robot/head) (hjoint1 hjoint2)
Expand All @@ -60,7 +60,7 @@ Another important parameter to consider is the trajectory sampling period. By de
When this option is enabled, all trajectories are resampled at the specified frequency using linear interpolation. This feature can help compensate for nonlinearities in the joint position controller’s response and reduce vibrations caused by overshoots (*)
It is generally recommended to keep this sampling period small, in the 0.005 - 0.0010 seconds range to avoid overshoots of the controller when performing a direct position control of the joint. Small values will also guarantee that the difference in position between two subsequent frames is small.
---
(*) The response of the controller for the following two set of trajectories is generally different, event if the final position is reached in the same amount of time:
(*) The response of the controller for the following two set of trajectories is generally different, event if the final position is reached in the same amount of time:
```
q2(t2=0.1) = 1
q1(t1=0.0) = 0
Expand Down
2 changes: 1 addition & 1 deletion src/yarpActionsPlayer/example/trajectory_file3.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0.000 0.000 0.000
0.000 0.000 0.000
1.253 1.253 1.253
2.487 2.487 2.487
3.681 3.681 3.681
Expand Down
2 changes: 1 addition & 1 deletion src/yarpActionsPlayer/example/trajectory_file4.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0.000 0.000 0.000
0.000 0.000 0.000
1.253 1.253 1.253
2.487 2.487 2.487
3.681 3.681 3.681
Expand Down
6 changes: 3 additions & 3 deletions src/yarpActionsPlayer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class scriptModule: public yarp::os::RFModule
std::string m_current_action_id;

public:
scriptModule()
scriptModule()
{
m_verbose=true;
}
Expand Down Expand Up @@ -189,7 +189,7 @@ class scriptModule: public yarp::os::RFModule
tmpAction.action_name = action_name;
tmpAction.controller_name = controller_name;
size_t njoints = m_robotControllers[controller_name]->getNJoints();

if (!tmpAction.openFile(action_file_name, njoints, 0.010))
{
yError() << "Unable to parse file";
Expand Down Expand Up @@ -520,6 +520,6 @@ int main(int argc, char *argv[])
}

scriptModule mod;

return mod.runModule(rf);
}
2 changes: 1 addition & 1 deletion src/yarpActionsPlayer/robotAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void action_class::interpolate_action_frames(double timestep)

// Generates new timestamps with the given constant time step
size_t c = 0;
for (double t = t_min; t <= t_max; t += timestep)
for (double t = t_min; t <= t_max; t += timestep)
{
// Find the closest frames on the left and on the right
auto it = std::lower_bound(action_frames_vector.begin(), action_frames_vector.end(), t,
Expand Down

0 comments on commit 86869f9

Please sign in to comment.