From 86869f9c587d9741acba100536995da5c2acf5c6 Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Thu, 13 Feb 2025 17:54:50 +0100 Subject: [PATCH] style fixes --- src/yarpActionsPlayer/README.md | 6 +++--- src/yarpActionsPlayer/example/trajectory_file3.txt | 2 +- src/yarpActionsPlayer/example/trajectory_file4.txt | 2 +- src/yarpActionsPlayer/main.cpp | 6 +++--- src/yarpActionsPlayer/robotAction.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/yarpActionsPlayer/README.md b/src/yarpActionsPlayer/README.md index 7f89b4abfb..9b6ff9a006 100644 --- a/src/yarpActionsPlayer/README.md +++ b/src/yarpActionsPlayer/README.md @@ -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 @@ -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) @@ -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 diff --git a/src/yarpActionsPlayer/example/trajectory_file3.txt b/src/yarpActionsPlayer/example/trajectory_file3.txt index 5076c94a5d..223721d6c3 100644 --- a/src/yarpActionsPlayer/example/trajectory_file3.txt +++ b/src/yarpActionsPlayer/example/trajectory_file3.txt @@ -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 diff --git a/src/yarpActionsPlayer/example/trajectory_file4.txt b/src/yarpActionsPlayer/example/trajectory_file4.txt index 27d772dda1..c307d8664e 100644 --- a/src/yarpActionsPlayer/example/trajectory_file4.txt +++ b/src/yarpActionsPlayer/example/trajectory_file4.txt @@ -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 diff --git a/src/yarpActionsPlayer/main.cpp b/src/yarpActionsPlayer/main.cpp index 40c17692d4..c4e31e66f3 100644 --- a/src/yarpActionsPlayer/main.cpp +++ b/src/yarpActionsPlayer/main.cpp @@ -42,7 +42,7 @@ class scriptModule: public yarp::os::RFModule std::string m_current_action_id; public: - scriptModule() + scriptModule() { m_verbose=true; } @@ -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"; @@ -520,6 +520,6 @@ int main(int argc, char *argv[]) } scriptModule mod; - + return mod.runModule(rf); } diff --git a/src/yarpActionsPlayer/robotAction.cpp b/src/yarpActionsPlayer/robotAction.cpp index ba6a9296e4..f938b992b4 100644 --- a/src/yarpActionsPlayer/robotAction.cpp +++ b/src/yarpActionsPlayer/robotAction.cpp @@ -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,