-
Notifications
You must be signed in to change notification settings - Fork 0
Group motors #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Group motors #6
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #include "ControlGroup.h" | ||
| #include "ControlGroupRosHandler.h" | ||
| #include "Group.h" | ||
| #include "MockMotor.h" | ||
| #include "ros/node_handle.h" | ||
| #include <cstdint> | ||
| #include <iostream> | ||
| #include <memory> | ||
| #include <vector> | ||
|
|
||
| auto main(int32_t argc, char **argv) -> int32_t { | ||
| std::cout << "wrevolution ROS test start..." << std::endl; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This print can be removed. |
||
|
|
||
| // motors 1 - 3 | ||
| auto motor1{std::make_shared<Hardware::Motor>(1, "LeftBackMotor_1")}; | ||
| auto motor2{std::make_shared<Hardware::Motor>(2, "LeftMiddleMotor_2")}; | ||
| auto motor3{std::make_shared<Hardware::Motor>(3, "LeftFrontMotor_3")}; | ||
|
|
||
| // motors 4 - 6 | ||
| auto motor4{std::make_shared<Hardware::Motor>(4, "RightBackMotor_4")}; | ||
| auto motor5{std::make_shared<Hardware::Motor>(5, "RightMiddleMotor_5")}; | ||
| auto motor6{std::make_shared<Hardware::Motor>(6, "RightFrontMotor_6")}; | ||
|
Comment on lines
+15
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The number can be dropped to avoid duplicating ID information. |
||
|
|
||
| // motor group 1 | ||
| auto motorGroup1{std::make_shared<Hardware::Group>("LeftGroupMotors")}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For compatibility reasons, this group should be called |
||
| motorGroup1->addControlGroup(motor1); | ||
| motorGroup1->addControlGroup(motor2); | ||
| motorGroup1->addControlGroup(motor3); | ||
|
|
||
| // motor group 2 | ||
| auto motorGroup1{std::make_shared<Hardware::Group>("RightGroupMotors")}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For compatibility reasons, this group should be called
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already a motor group called |
||
| motorGroup2->addControlGroup(motor4); | ||
| motorGroup2->addControlGroup(motor5); | ||
| motorGroup2->addControlGroup(motor6); | ||
|
|
||
| std::cout << "Motor setup complete!" << std::endl; | ||
|
|
||
| // Setup ROS Interface | ||
| ros::init(argc, argv, "RosControlTest"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The node name should change, since this would not be a test node. |
||
| ros::NodeHandle node{}; | ||
|
|
||
| std::vector<std::unique_ptr<RosHandler::ControlGroupRosHandler>> controlGroupHandlers{}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are only 2 groups of motors, so we probably don't need a dynamic list. |
||
|
|
||
| controlGroupHandlers.reserve(testingGroups.size()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think |
||
|
|
||
| for (const auto &controlGroup : testingGroups) { | ||
| controlGroupHandlers.push_back(std::make_unique<RosHandler::ControlGroupRosHandler>(node, controlGroup)); | ||
| } | ||
|
Comment on lines
+46
to
+48
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be converted to 2 separate constructions. |
||
|
|
||
| std::cout << "ROS Setup complete!" << std::endl; | ||
|
|
||
| // Spin ROS comms | ||
| ros::spin(); | ||
|
|
||
| std::cout << "Shutting down..." << std::endl; | ||
|
|
||
| return 0; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file needs to move to its own folder with its own
CMakeLists.txtto respect the structure of the project.