{"action":"created","comment":{"url":"https://api.github.com/repos/ros/ros_comm/pulls/comments/28084213","id":28084213,"diff_hunk":"@@ -428,11 +428,36 @@ void TimerManager<T, D, E>::setPeriod(int32_t handle, const D& period)\n   {\n     return;\n   }\n+  \n+  if(reset)\n+  {\n+    info->next_expected = T::now() + period;\n+  }\n+  \n+  // If called in a callback, last_real has not been updated yet so (now - last_real) > period\n+  // In this case, let next_expected be updated only in updateNext","path":"clients/roscpp/include/ros/timer_manager.h","position":null,"original_position":29,"commit_id":"5bf6f3a5d3cb3ddce2f10f84c3bd755cf1032c8b","original_commit_id":"cacb5769ddd62695f9cec05336f7e8d85509fe12","user":{"login":"dirk-thomas","id":1335366,"avatar_url":"https://avatars.githubusercontent.com/u/1335366?v=3","gravatar_id":"","url":"https://api.github.com/users/dirk-thomas","html_url":"https://github.com/dirk-thomas","followers_url":"https://api.github.com/users/dirk-thomas/followers","following_url":"https://api.github.com/users/dirk-thomas/following{/other_user}","gists_url":"https://api.github.com/users/dirk-thomas/gists{/gist_id}","starred_url":"https://api.github.com/users/dirk-thomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirk-thomas/subscriptions","organizations_url":"https://api.github.com/users/dirk-thomas/orgs","repos_url":"https://api.github.com/users/dirk-thomas/repos","events_url":"https://api.github.com/users/dirk-thomas/events{/privacy}","received_events_url":"https://api.github.com/users/dirk-thomas/received_events","type":"User","site_admin":false},"body":"A problem here might be that it is not clear that the callback from which `setPeriod` has been called is triggered by the same timer or if they are unrelated. Only if they are the same the assumption that `last_real` is not up-to-date holds.","created_at":"2015-04-09T17:40:33Z","updated_at":"2015-04-09T17:40:33Z","html_url":"https://github.com/ros/ros_comm/pull/590#discussion_r28084213","pull_request_url":"https://api.github.com/repos/ros/ros_comm/pulls/590","_links":{"self":{"href":"https://api.github.com/repos/ros/ros_comm/pulls/comments/28084213"},"html":{"href":"https://github.com/ros/ros_comm/pull/590#discussion_r28084213"},"pull_request":{"href":"https://api.github.com/repos/ros/ros_comm/pulls/590"}}},"pull_request":{"url":"https://api.github.com/repos/ros/ros_comm/pulls/590","id":32193670,"html_url":"https://github.com/ros/ros_comm/pull/590","diff_url":"https://github.com/ros/ros_comm/pull/590.diff","patch_url":"https://github.com/ros/ros_comm/pull/590.patch","issue_url":"https://api.github.com/repos/ros/ros_comm/issues/590","number":590,"state":"open","locked":false,"title":"Added a parameter to setPeriod to enable changing a Timer's period while taking into account the current cycle's elapsed time","user":{"login":"sterlingm","id":812985,"avatar_url":"https://avatars.githubusercontent.com/u/812985?v=3","gravatar_id":"","url":"https://api.github.com/users/sterlingm","html_url":"https://github.com/sterlingm","followers_url":"https://api.github.com/users/sterlingm/followers","following_url":"https://api.github.com/users/sterlingm/following{/other_user}","gists_url":"https://api.github.com/users/sterlingm/gists{/gist_id}","starred_url":"https://api.github.com/users/sterlingm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sterlingm/subscriptions","organizations_url":"https://api.github.com/users/sterlingm/orgs","repos_url":"https://api.github.com/users/sterlingm/repos","events_url":"https://api.github.com/users/sterlingm/events{/privacy}","received_events_url":"https://api.github.com/users/sterlingm/received_events","type":"User","site_admin":false},"body":"Currently, when you call setPeriod for a Timer, it starts the new cycle at the time setPeriod is called. So the next time the callback function is called will be current_elapsed_time + new_period_time. In my research project, it would be extremely useful for me to able to change the period for a Timer and have that change take effect on the immediate next cycle, rather than \"starting over\" each time I call setPeriod.\r\n\r\nIn terms of code changes, I just added a parameter to setPeriod to indicate whether or not you want the Timer to \"reset\". I put in a default value of true so any existing code using that function should not be affected.","created_at":"2015-03-30T02:05:41Z","updated_at":"2015-04-09T17:40:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12272c121ec0530b46860ee37199411dbc28c568","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ros/ros_comm/pulls/590/commits","review_comments_url":"https://api.github.com/repos/ros/ros_comm/pulls/590/comments","review_comment_url":"https://api.github.com/repos/ros/ros_comm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros/ros_comm/issues/590/comments","statuses_url":"https://api.github.com/repos/ros/ros_comm/statuses/5bf6f3a5d3cb3ddce2f10f84c3bd755cf1032c8b","head":{"label":"sterlingm:indigo-devel","ref":"indigo-devel","sha":"5bf6f3a5d3cb3ddce2f10f84c3bd755cf1032c8b","user":{"login":"sterlingm","id":812985,"avatar_url":"https://avatars.githubusercontent.com/u/812985?v=3","gravatar_id":"","url":"https://api.github.com/users/sterlingm","html_url":"https://github.com/sterlingm","followers_url":"https://api.github.com/users/sterlingm/followers","following_url":"https://api.github.com/users/sterlingm/following{/other_user}","gists_url":"https://api.github.com/users/sterlingm/gists{/gist_id}","starred_url":"https://api.github.com/users/sterlingm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sterlingm/subscriptions","organizations_url":"https://api.github.com/users/sterlingm/orgs","repos_url":"https://api.github.com/users/sterlingm/repos","events_url":"https://api.github.com/users/sterlingm/events{/privacy}","received_events_url":"https://api.github.com/users/sterlingm/received_events","type":"User","site_admin":false},"repo":{"id":33093960,"name":"ros_comm","full_name":"sterlingm/ros_comm","owner":{"login":"sterlingm","id":812985,"avatar_url":"https://avatars.githubusercontent.com/u/812985?v=3","gravatar_id":"","url":"https://api.github.com/users/sterlingm","html_url":"https://github.com/sterlingm","followers_url":"https://api.github.com/users/sterlingm/followers","following_url":"https://api.github.com/users/sterlingm/following{/other_user}","gists_url":"https://api.github.com/users/sterlingm/gists{/gist_id}","starred_url":"https://api.github.com/users/sterlingm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sterlingm/subscriptions","organizations_url":"https://api.github.com/users/sterlingm/orgs","repos_url":"https://api.github.com/users/sterlingm/repos","events_url":"https://api.github.com/users/sterlingm/events{/privacy}","received_events_url":"https://api.github.com/users/sterlingm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sterlingm/ros_comm","description":"ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).","fork":true,"url":"https://api.github.com/repos/sterlingm/ros_comm","forks_url":"https://api.github.com/repos/sterlingm/ros_comm/forks","keys_url":"https://api.github.com/repos/sterlingm/ros_comm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sterlingm/ros_comm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sterlingm/ros_comm/teams","hooks_url":"https://api.github.com/repos/sterlingm/ros_comm/hooks","issue_events_url":"https://api.github.com/repos/sterlingm/ros_comm/issues/events{/number}","events_url":"https://api.github.com/repos/sterlingm/ros_comm/events","assignees_url":"https://api.github.com/repos/sterlingm/ros_comm/assignees{/user}","branches_url":"https://api.github.com/repos/sterlingm/ros_comm/branches{/branch}","tags_url":"https://api.github.com/repos/sterlingm/ros_comm/tags","blobs_url":"https://api.github.com/repos/sterlingm/ros_comm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sterlingm/ros_comm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sterlingm/ros_comm/git/refs{/sha}","trees_url":"https://api.github.com/repos/sterlingm/ros_comm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sterlingm/ros_comm/statuses/{sha}","languages_url":"https://api.github.com/repos/sterlingm/ros_comm/languages","stargazers_url":"https://api.github.com/repos/sterlingm/ros_comm/stargazers","contributors_url":"https://api.github.com/repos/sterlingm/ros_comm/contributors","subscribers_url":"https://api.github.com/repos/sterlingm/ros_comm/subscribers","subscription_url":"https://api.github.com/repos/sterlingm/ros_comm/subscription","commits_url":"https://api.github.com/repos/sterlingm/ros_comm/commits{/sha}","git_commits_url":"https://api.github.com/repos/sterlingm/ros_comm/git/commits{/sha}","comments_url":"https://api.github.com/repos/sterlingm/ros_comm/comments{/number}","issue_comment_url":"https://api.github.com/repos/sterlingm/ros_comm/issues/comments{/number}","contents_url":"https://api.github.com/repos/sterlingm/ros_comm/contents/{+path}","compare_url":"https://api.github.com/repos/sterlingm/ros_comm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sterlingm/ros_comm/merges","archive_url":"https://api.github.com/repos/sterlingm/ros_comm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sterlingm/ros_comm/downloads","issues_url":"https://api.github.com/repos/sterlingm/ros_comm/issues{/number}","pulls_url":"https://api.github.com/repos/sterlingm/ros_comm/pulls{/number}","milestones_url":"https://api.github.com/repos/sterlingm/ros_comm/milestones{/number}","notifications_url":"https://api.github.com/repos/sterlingm/ros_comm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sterlingm/ros_comm/labels{/name}","releases_url":"https://api.github.com/repos/sterlingm/ros_comm/releases{/id}","created_at":"2015-03-29T23:35:18Z","updated_at":"2015-04-09T17:33:26Z","pushed_at":"2015-04-09T17:33:25Z","git_url":"git://github.com/sterlingm/ros_comm.git","ssh_url":"git@github.com:sterlingm/ros_comm.git","clone_url":"https://github.com/sterlingm/ros_comm.git","svn_url":"https://github.com/sterlingm/ros_comm","homepage":"http://wiki.ros.org/ros_comm","size":11494,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"indigo-devel"}},"base":{"label":"ros:indigo-devel","ref":"indigo-devel","sha":"91f4a452c00d6fece236d3739517c958ccf2f14f","user":{"login":"ros","id":547448,"avatar_url":"https://avatars.githubusercontent.com/u/547448?v=3","gravatar_id":"","url":"https://api.github.com/users/ros","html_url":"https://github.com/ros","followers_url":"https://api.github.com/users/ros/followers","following_url":"https://api.github.com/users/ros/following{/other_user}","gists_url":"https://api.github.com/users/ros/gists{/gist_id}","starred_url":"https://api.github.com/users/ros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros/subscriptions","organizations_url":"https://api.github.com/users/ros/orgs","repos_url":"https://api.github.com/users/ros/repos","events_url":"https://api.github.com/users/ros/events{/privacy}","received_events_url":"https://api.github.com/users/ros/received_events","type":"Organization","site_admin":false},"repo":{"id":5474834,"name":"ros_comm","full_name":"ros/ros_comm","owner":{"login":"ros","id":547448,"avatar_url":"https://avatars.githubusercontent.com/u/547448?v=3","gravatar_id":"","url":"https://api.github.com/users/ros","html_url":"https://github.com/ros","followers_url":"https://api.github.com/users/ros/followers","following_url":"https://api.github.com/users/ros/following{/other_user}","gists_url":"https://api.github.com/users/ros/gists{/gist_id}","starred_url":"https://api.github.com/users/ros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros/subscriptions","organizations_url":"https://api.github.com/users/ros/orgs","repos_url":"https://api.github.com/users/ros/repos","events_url":"https://api.github.com/users/ros/events{/privacy}","received_events_url":"https://api.github.com/users/ros/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros/ros_comm","description":"ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).","fork":false,"url":"https://api.github.com/repos/ros/ros_comm","forks_url":"https://api.github.com/repos/ros/ros_comm/forks","keys_url":"https://api.github.com/repos/ros/ros_comm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros/ros_comm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros/ros_comm/teams","hooks_url":"https://api.github.com/repos/ros/ros_comm/hooks","issue_events_url":"https://api.github.com/repos/ros/ros_comm/issues/events{/number}","events_url":"https://api.github.com/repos/ros/ros_comm/events","assignees_url":"https://api.github.com/repos/ros/ros_comm/assignees{/user}","branches_url":"https://api.github.com/repos/ros/ros_comm/branches{/branch}","tags_url":"https://api.github.com/repos/ros/ros_comm/tags","blobs_url":"https://api.github.com/repos/ros/ros_comm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros/ros_comm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros/ros_comm/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros/ros_comm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros/ros_comm/statuses/{sha}","languages_url":"https://api.github.com/repos/ros/ros_comm/languages","stargazers_url":"https://api.github.com/repos/ros/ros_comm/stargazers","contributors_url":"https://api.github.com/repos/ros/ros_comm/contributors","subscribers_url":"https://api.github.com/repos/ros/ros_comm/subscribers","subscription_url":"https://api.github.com/repos/ros/ros_comm/subscription","commits_url":"https://api.github.com/repos/ros/ros_comm/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros/ros_comm/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros/ros_comm/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros/ros_comm/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros/ros_comm/contents/{+path}","compare_url":"https://api.github.com/repos/ros/ros_comm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros/ros_comm/merges","archive_url":"https://api.github.com/repos/ros/ros_comm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros/ros_comm/downloads","issues_url":"https://api.github.com/repos/ros/ros_comm/issues{/number}","pulls_url":"https://api.github.com/repos/ros/ros_comm/pulls{/number}","milestones_url":"https://api.github.com/repos/ros/ros_comm/milestones{/number}","notifications_url":"https://api.github.com/repos/ros/ros_comm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros/ros_comm/labels{/name}","releases_url":"https://api.github.com/repos/ros/ros_comm/releases{/id}","created_at":"2012-08-19T22:26:34Z","updated_at":"2015-04-04T00:03:11Z","pushed_at":"2015-04-09T17:33:25Z","git_url":"git://github.com/ros/ros_comm.git","ssh_url":"git@github.com:ros/ros_comm.git","clone_url":"https://github.com/ros/ros_comm.git","svn_url":"https://github.com/ros/ros_comm","homepage":"http://wiki.ros.org/ros_comm","size":27034,"stargazers_count":35,"watchers_count":35,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":148,"mirror_url":null,"open_issues_count":137,"forks":148,"open_issues":137,"watchers":35,"default_branch":"indigo-devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ros/ros_comm/pulls/590"},"html":{"href":"https://github.com/ros/ros_comm/pull/590"},"issue":{"href":"https://api.github.com/repos/ros/ros_comm/issues/590"},"comments":{"href":"https://api.github.com/repos/ros/ros_comm/issues/590/comments"},"review_comments":{"href":"https://api.github.com/repos/ros/ros_comm/pulls/590/comments"},"review_comment":{"href":"https://api.github.com/repos/ros/ros_comm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros/ros_comm/pulls/590/commits"},"statuses":{"href":"https://api.github.com/repos/ros/ros_comm/statuses/5bf6f3a5d3cb3ddce2f10f84c3bd755cf1032c8b"}}}}