Conversation
| @@ -0,0 +1,13 @@ | |||
| # Catkin Tools Metadata | |||
| @@ -0,0 +1 @@ | |||
| 0.6.1 No newline at end of file | |||
| blacklist: [] | ||
| build_space: build | ||
| catkin_make_args: [] | ||
| cmake_args: [] |
| @@ -0,0 +1,13 @@ | |||
| /home/ariwasch/catkin_ws/src/software_training/build/catkin_tools_prebuild | |||
| @@ -0,0 +1,10 @@ | |||
| <package> | |||
| @@ -0,0 +1 @@ | |||
|
|
|||
There was a problem hiding this comment.
this file should be used to ignore all the .catkin_tools stuff from commits
There was a problem hiding this comment.
you won't have to worry about this for the software repo but just for future reference
software_training/CMakeLists.txt
Outdated
| cmake_minimum_required(VERSION 3.0.2) | ||
| project(software_training) | ||
|
|
||
| ## Compile as C++11, supported in ROS Kinetic and newer |
| service.srv | ||
| ) | ||
|
|
||
| ## Generate actions in the 'action' folder |
There was a problem hiding this comment.
you should be adding the action file for building
software_training/src/action.cpp
Outdated
| @@ -0,0 +1,49 @@ | |||
| #include <ros/ros.h> | |||
| #include <actionlib/client/simple_action_client.h> | |||
| #include <actionlib/> | |||
There was a problem hiding this comment.
| #include <actionlib/> | |
| #include <actionlib> |
software_training/src/action.cpp
Outdated
| #include <ros/ros.h> | ||
| #include <actionlib/client/simple_action_client.h> | ||
| #include <actionlib/> | ||
| #include "std_msgs/String.h" |
There was a problem hiding this comment.
| #include "std_msgs/String.h" | |
| #include <std_msgs/String.h> |
software_training/src/action.cpp
Outdated
| #include <actionlib/client/simple_action_client.h> | ||
| #include <actionlib/> | ||
| #include "std_msgs/String.h" | ||
| #include "geometry_msgs/Twist.h" |
software_training/CMakeLists.txt
Outdated
|
|
||
| add_executable(service src/service.cpp) | ||
| target_link_libraries(service ${catkin_LIBRARIES}) | ||
| add_dependencies(service software_training_generate_cpp) |
There was a problem hiding this comment.
| add_dependencies(service software_training_generate_cpp) | |
| add_dependencies(service software_training_generate_messages_cpp) |
software_training/src/action.cpp
Outdated
|
|
||
| ROS_INFO("Waiting for action server to start."); | ||
| // wait for the action server to start | ||
| ac.waitForServer(); //will wait for infinite time |
There was a problem hiding this comment.
ac should be the simple action client, here its not defined so this won't compile
software_training/src/action.cpp
Outdated
| // create the action client | ||
| // true causes the client to spin its own thread | ||
|
|
||
| actionlib::SimpleActionClient<goemetry_msgs::Twist>("action", true); |
| success = spawnClient.call(req2,resp2); | ||
|
|
||
|
|
||
| if(success){ |
There was a problem hiding this comment.
this is good but if the first turtle does not spawn but the second one does this will be true.
better to evaluate individually and use the response msg
| // true causes the client to spin its own thread | ||
|
|
||
| actionlib::SimpleActionClient<goemetry_msgs::Twist>("action", true); | ||
|
|
There was a problem hiding this comment.
sorry forgot to mention this, action Client and Server should never be in the same node, it defeats the purpose of having an action server.
| // send a goal to the action | ||
| actionlib_tutorials::FibonacciGoal goal; | ||
| goal.order = 20; | ||
| ac.sendGoal(goal); |
There was a problem hiding this comment.
it looks like you didn't build this because it does not compile, this should be actionClient. the client sends the goal to the server. make sure to run catkin build so that you can catch these mistakes in the code
|
you need to delete the .catkin_tools folder completely |
| ros::ServiceClient spawnClient | ||
| = nh.serviceClient<turtlesim::Spawn>("spawn"); | ||
| std_srvs::Empty srv; | ||
| srv.request; |
There was a problem hiding this comment.
should be setting this equal to something??
| turtlesim::Kill srv2; | ||
| srv2.request.name = "turtle1"; | ||
|
|
||
| reset.call(srv); |
There was a problem hiding this comment.
should also be waiting for each service before these calls
| * is the number of messages that will be buffered up before beginning to throw | ||
| * away the oldest ones. | ||
| */ | ||
| ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback); |
There was a problem hiding this comment.
not sure what this is doing, this is a copy of the code from the tutorial? why is it included?
| #include <software_training/service.h> | ||
| #include "turtlesim/TeleportAbsolute.h" | ||
|
|
||
| /*class Service { |
|
|
||
|
|
||
| return true; | ||
| }; |
There was a problem hiding this comment.
compile errors, no semicolon and 2 returns for true? please compile your code!
| turtlesim::Pose pos1 | ||
| turtlesim::Pose pos2 | ||
|
|
||
| void chatterCallBack(const std_msgs::String::ConstPtr& msg) |
There was a problem hiding this comment.
should name these functions based on what they are doing
| int main(int argc, char **argv) | ||
| { | ||
| /** | ||
| * The ros::init() function needs to see argc and argv so that it can perform |
| ros::spinOnce(); | ||
|
|
||
| loop_rate.sleep(); | ||
| ++count; |
| msg.x = pos1.x - pos2.x; | ||
| msg.y = pos1.y - pos2.y; | ||
| msg.distance = sqrt(pow(msg.x,2) + pow(msg.y, 2)); | ||
| std::stringstream ss; |
| @@ -0,0 +1,91 @@ | |||
| #include "Turtle.h" | |||
There was a problem hiding this comment.
not sure what is going on with this file, it replicates functionality from other files. did you mean to commit the other files or this one? only one of these files needs to be committed
| Turtle(ros::NodeHandle &n, float x, float y, std::string name); | ||
|
|
||
| // kill `name` turtle | ||
| static bool kill(ros::NodeHandle &n, std::string name); |
There was a problem hiding this comment.
making it static and taking in the name defeats the purpose of the class, make it a member function
No description provided.