{"action":"created","comment":{"url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/comments/94205182","pull_request_review_id":14735811,"id":94205182,"diff_hunk":"@@ -1,81 +1,42 @@\n #include <AnalogGyro.h>\n-#include <CANTalon.h>\n #include <Joystick.h>\n #include <RobotDrive.h>\n-#include <SampleRobot.h>\n+#include <IterativeRobot.h>\n+#include <math.h>\n \n /**\n  * This is a sample program to demonstrate how to use a gyro sensor to make a robot drive\n  * straight. This program uses a joystick to drive forwards and backwards while the gyro\n  * is used for direction keeping.\n- *\n- * WARNING: While it may look like a good choice to use for your code if you're inexperienced,\n- * don't. Unless you know what you are doing, complex code will be much more difficult under\n- * this system. Use IterativeRobot or Command-Based instead if you're new.\n  */\n-class Robot: public SampleRobot {\n+class Robot: public IterativeRobot {\n public:\n-\t/**\n-\t * Runs during autonomous.\n-\t */\n-\tvoid Autonomous() {}\n-\n-\t/**\n-\t * Sets the gyro sensitivity and drives the robot when the joystick is\n-\t * pushed. The motor speed is set from the joystick while the RobotDrive\n-\t * turning value is assigned from the error between the setpoint and the\n-\t * gyro angle.\n-\t */\n-\tvoid OperatorControl() {\n-\t\tdouble turningValue;\n-\n-\t\t// Calibrates gyro values to equal degrees\n-\t\tgyro.SetSensitivity(voltsPerDegreePerSecond);\n-\n-\t\twhile (IsOperatorControl() && IsEnabled()) {\n-\t\t\tturningValue = (angleSetpoint - gyro.GetAngle()) * pGain;\n-\t\t\tif (joystick.GetY() <= 0) {\n-\t\t\t\t// Forwards\n-\t\t\t\tmyRobot.Drive(joystick.GetY(), turningValue);\n-\t\t\t}\n-\t\t\telse {\n-\t\t\t\t// Backwards\n-\t\t\t\tmyRobot.Drive(joystick.GetY(), -turningValue);\n-\t\t\t}\n-\t\t}\n+\tvoid robotInit() {\n+\t\tgyro.SetSensitivity(VOLTS_PER_DEGREE_PER_SECOND);\n \t}\n \n \t/**\n-\t * Runs during test mode.\n+\t * The motor speed is set from the joystick while the RobotDrive turning\n+\t * value is assigned from the error between the setpoint and the gyro angle.\n \t */\n-\tvoid Test() {}\n+\tvoid teleopPeriodic() {\n+\t\tdouble turningValue = (ANGLE_SETPOINT - gyro.GetAngle()) * KP;\n+\t\t// Invert the direction of the turn if we are going backwards\n+\t\tturningValue = std::copysign(turningValue, joystick.GetY());\n+\t\tmyRobot.Drive(joystick.GetY(), turningValue);\n+\t}\n \n private:\n-\tconstexpr int gyroChannel = 0;  // Analog input\n-\tconstexpr int joystickChannel = 0;  // USB number in DriverStation\n-\n-\t// Channels for motors\n-\tconstexpr int leftFontMotorChannel = 1;\n-\tconstexpr int rightFrontMotorChannel = 0;\n-\tconstexpr int leftRearMotorChannel = 3;\n-\tconstexpr int rightRearMotorChannel = 2;\n-\n-\tdouble angleSetpoint = 0.0;\n-\tconstexpr double pGain = 0.006;  // Propotional turning constant\n+\tstatic constexpr double ANGLE_SETPOINT = 0.0;\n+\tstatic constexpr double KP = 0.005;  // Propotional turning constant\n \n \t// Gyro calibration constant, may need to be adjusted\n \t// Gyro value of 360 is set to correspond to one full revolution\n-\tconstexpr double voltsPerDegreePerSecond = 0.0128;\n-\n-\t// Create the drivetrain from 4 CAN Talon SRXs.\n-\tRobotDrive myRobot{new CANTalon(leftFrontMotorChannel),\n-\t                   new CANTalon(leftRearMotorChannel),\n-\t                   new CANTalon(rightFrontMotorChannel),\n-\t                   new CANTalon(rightRearMotorChannel)};\n+\tstatic constexpr double VOLTS_PER_DEGREE_PER_SECOND = 0.0128;","path":"edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Gyro/src/Robot.cpp","position":90,"original_position":90,"commit_id":"93d09de324055bfe1d823c9477efedb235295906","original_commit_id":"93d09de324055bfe1d823c9477efedb235295906","user":{"login":"calcmogul","id":2748555,"avatar_url":"https://avatars.githubusercontent.com/u/2748555?v=3","gravatar_id":"","url":"https://api.github.com/users/calcmogul","html_url":"https://github.com/calcmogul","followers_url":"https://api.github.com/users/calcmogul/followers","following_url":"https://api.github.com/users/calcmogul/following{/other_user}","gists_url":"https://api.github.com/users/calcmogul/gists{/gist_id}","starred_url":"https://api.github.com/users/calcmogul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calcmogul/subscriptions","organizations_url":"https://api.github.com/users/calcmogul/orgs","repos_url":"https://api.github.com/users/calcmogul/repos","events_url":"https://api.github.com/users/calcmogul/events{/privacy}","received_events_url":"https://api.github.com/users/calcmogul/received_events","type":"User","site_admin":false},"body":"Naming.","created_at":"2016-12-30T06:23:46Z","updated_at":"2016-12-30T06:29:34Z","html_url":"https://github.com/wpilibsuite/EclipsePlugins/pull/78#discussion_r94205182","pull_request_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78","_links":{"self":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/comments/94205182"},"html":{"href":"https://github.com/wpilibsuite/EclipsePlugins/pull/78#discussion_r94205182"},"pull_request":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78","id":99712386,"html_url":"https://github.com/wpilibsuite/EclipsePlugins/pull/78","diff_url":"https://github.com/wpilibsuite/EclipsePlugins/pull/78.diff","patch_url":"https://github.com/wpilibsuite/EclipsePlugins/pull/78.patch","issue_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/issues/78","number":78,"state":"open","locked":false,"title":"Remove can talon","user":{"login":"AustinShalit","id":3799260,"avatar_url":"https://avatars.githubusercontent.com/u/3799260?v=3","gravatar_id":"","url":"https://api.github.com/users/AustinShalit","html_url":"https://github.com/AustinShalit","followers_url":"https://api.github.com/users/AustinShalit/followers","following_url":"https://api.github.com/users/AustinShalit/following{/other_user}","gists_url":"https://api.github.com/users/AustinShalit/gists{/gist_id}","starred_url":"https://api.github.com/users/AustinShalit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustinShalit/subscriptions","organizations_url":"https://api.github.com/users/AustinShalit/orgs","repos_url":"https://api.github.com/users/AustinShalit/repos","events_url":"https://api.github.com/users/AustinShalit/events{/privacy}","received_events_url":"https://api.github.com/users/AustinShalit/received_events","type":"User","site_admin":false},"body":"closes #75 \r\n\r\n~Still need to do the C++ version of UltrasonicPID.~","created_at":"2016-12-30T00:27:59Z","updated_at":"2016-12-30T06:29:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9d42914939e8679ee1a8b393c86bdede1043644","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78/commits","review_comments_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78/comments","review_comment_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/issues/78/comments","statuses_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/statuses/93d09de324055bfe1d823c9477efedb235295906","head":{"label":"AustinShalit:removeCANTalon","ref":"removeCANTalon","sha":"93d09de324055bfe1d823c9477efedb235295906","user":{"login":"AustinShalit","id":3799260,"avatar_url":"https://avatars.githubusercontent.com/u/3799260?v=3","gravatar_id":"","url":"https://api.github.com/users/AustinShalit","html_url":"https://github.com/AustinShalit","followers_url":"https://api.github.com/users/AustinShalit/followers","following_url":"https://api.github.com/users/AustinShalit/following{/other_user}","gists_url":"https://api.github.com/users/AustinShalit/gists{/gist_id}","starred_url":"https://api.github.com/users/AustinShalit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustinShalit/subscriptions","organizations_url":"https://api.github.com/users/AustinShalit/orgs","repos_url":"https://api.github.com/users/AustinShalit/repos","events_url":"https://api.github.com/users/AustinShalit/events{/privacy}","received_events_url":"https://api.github.com/users/AustinShalit/received_events","type":"User","site_admin":false},"repo":{"id":69594622,"name":"EclipsePlugins","full_name":"AustinShalit/EclipsePlugins","owner":{"login":"AustinShalit","id":3799260,"avatar_url":"https://avatars.githubusercontent.com/u/3799260?v=3","gravatar_id":"","url":"https://api.github.com/users/AustinShalit","html_url":"https://github.com/AustinShalit","followers_url":"https://api.github.com/users/AustinShalit/followers","following_url":"https://api.github.com/users/AustinShalit/following{/other_user}","gists_url":"https://api.github.com/users/AustinShalit/gists{/gist_id}","starred_url":"https://api.github.com/users/AustinShalit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustinShalit/subscriptions","organizations_url":"https://api.github.com/users/AustinShalit/orgs","repos_url":"https://api.github.com/users/AustinShalit/repos","events_url":"https://api.github.com/users/AustinShalit/events{/privacy}","received_events_url":"https://api.github.com/users/AustinShalit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AustinShalit/EclipsePlugins","description":null,"fork":true,"url":"https://api.github.com/repos/AustinShalit/EclipsePlugins","forks_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/forks","keys_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/teams","hooks_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/hooks","issue_events_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/issues/events{/number}","events_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/events","assignees_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/assignees{/user}","branches_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/branches{/branch}","tags_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/tags","blobs_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/statuses/{sha}","languages_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/languages","stargazers_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/stargazers","contributors_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/contributors","subscribers_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/subscribers","subscription_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/subscription","commits_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/contents/{+path}","compare_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/merges","archive_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/downloads","issues_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/issues{/number}","pulls_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/pulls{/number}","milestones_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/milestones{/number}","notifications_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/labels{/name}","releases_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/releases{/id}","deployments_url":"https://api.github.com/repos/AustinShalit/EclipsePlugins/deployments","created_at":"2016-09-29T18:12:11Z","updated_at":"2016-09-29T18:12:12Z","pushed_at":"2016-12-30T06:07:53Z","git_url":"git://github.com/AustinShalit/EclipsePlugins.git","ssh_url":"git@github.com:AustinShalit/EclipsePlugins.git","clone_url":"https://github.com/AustinShalit/EclipsePlugins.git","svn_url":"https://github.com/AustinShalit/EclipsePlugins","homepage":null,"size":26365,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"master"}},"base":{"label":"wpilibsuite:master","ref":"master","sha":"f4131c91ac01cd21bac36c8372d0ab7046d3c4b2","user":{"login":"wpilibsuite","id":19267233,"avatar_url":"https://avatars.githubusercontent.com/u/19267233?v=3","gravatar_id":"","url":"https://api.github.com/users/wpilibsuite","html_url":"https://github.com/wpilibsuite","followers_url":"https://api.github.com/users/wpilibsuite/followers","following_url":"https://api.github.com/users/wpilibsuite/following{/other_user}","gists_url":"https://api.github.com/users/wpilibsuite/gists{/gist_id}","starred_url":"https://api.github.com/users/wpilibsuite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wpilibsuite/subscriptions","organizations_url":"https://api.github.com/users/wpilibsuite/orgs","repos_url":"https://api.github.com/users/wpilibsuite/repos","events_url":"https://api.github.com/users/wpilibsuite/events{/privacy}","received_events_url":"https://api.github.com/users/wpilibsuite/received_events","type":"Organization","site_admin":false},"repo":{"id":59515587,"name":"EclipsePlugins","full_name":"wpilibsuite/EclipsePlugins","owner":{"login":"wpilibsuite","id":19267233,"avatar_url":"https://avatars.githubusercontent.com/u/19267233?v=3","gravatar_id":"","url":"https://api.github.com/users/wpilibsuite","html_url":"https://github.com/wpilibsuite","followers_url":"https://api.github.com/users/wpilibsuite/followers","following_url":"https://api.github.com/users/wpilibsuite/following{/other_user}","gists_url":"https://api.github.com/users/wpilibsuite/gists{/gist_id}","starred_url":"https://api.github.com/users/wpilibsuite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wpilibsuite/subscriptions","organizations_url":"https://api.github.com/users/wpilibsuite/orgs","repos_url":"https://api.github.com/users/wpilibsuite/repos","events_url":"https://api.github.com/users/wpilibsuite/events{/privacy}","received_events_url":"https://api.github.com/users/wpilibsuite/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wpilibsuite/EclipsePlugins","description":null,"fork":false,"url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins","forks_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/forks","keys_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/teams","hooks_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/hooks","issue_events_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/issues/events{/number}","events_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/events","assignees_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/assignees{/user}","branches_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/branches{/branch}","tags_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/tags","blobs_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/statuses/{sha}","languages_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/languages","stargazers_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/stargazers","contributors_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/contributors","subscribers_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/subscribers","subscription_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/subscription","commits_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/contents/{+path}","compare_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/merges","archive_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/downloads","issues_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/issues{/number}","pulls_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls{/number}","milestones_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/milestones{/number}","notifications_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/labels{/name}","releases_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/releases{/id}","deployments_url":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/deployments","created_at":"2016-05-23T20:19:55Z","updated_at":"2016-12-26T21:02:06Z","pushed_at":"2016-12-30T06:07:54Z","git_url":"git://github.com/wpilibsuite/EclipsePlugins.git","ssh_url":"git@github.com:wpilibsuite/EclipsePlugins.git","clone_url":"https://github.com/wpilibsuite/EclipsePlugins.git","svn_url":"https://github.com/wpilibsuite/EclipsePlugins","homepage":null,"size":26338,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":14,"forks":10,"open_issues":14,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78"},"html":{"href":"https://github.com/wpilibsuite/EclipsePlugins/pull/78"},"issue":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/issues/78"},"comments":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/wpilibsuite/EclipsePlugins/statuses/93d09de324055bfe1d823c9477efedb235295906"}}}}
{"actor":{"display_login":"calcmogul"}}