-
Notifications
You must be signed in to change notification settings - Fork 35
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
software training #15
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,13 @@ | |||
# Catkin Tools Metadata |
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.
dont commit this file
@@ -0,0 +1 @@ | |||
0.6.1 |
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.
dont commit this file
blacklist: [] | ||
build_space: build | ||
catkin_make_args: [] | ||
cmake_args: [] |
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.
dont commit this file
@@ -0,0 +1,13 @@ | |||
/home/ariwasch/catkin_ws/src/software_training/build/catkin_tools_prebuild |
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.
dont commit this file
@@ -0,0 +1,10 @@ | |||
<package> |
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.
dont commit this file
@@ -0,0 +1 @@ | |||
|
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 should be used to ignore all the .catkin_tools stuff from commits
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.
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 |
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.
delete these comments
service.srv | ||
) | ||
|
||
## Generate actions in the 'action' folder |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#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" |
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.
same as above
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
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.
need to set this to a variable
success = spawnClient.call(req2,resp2); | ||
|
||
|
||
if(success){ |
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 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
@@ -17,15 +17,16 @@ int main (int argc, char **argv) | |||
= nh.advertise<geometry_msgs::Twist>("/moving_turtle/cmd_vel", 1000); | |||
// create the action client | |||
// true causes the client to spin its own thread | |||
|
|||
actionlib::SimpleActionClient<goemetry_msgs::Twist>("action", true); | |||
|
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be setting this equal to something??
turtlesim::Kill srv2; | ||
srv2.request.name = "turtle1"; | ||
|
||
reset.call(srv); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 { |
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 is commented out on purpose?
|
||
|
||
return true; | ||
}; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
remove comments
ros::spinOnce(); | ||
|
||
loop_rate.sleep(); | ||
++count; |
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.
count is never used
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; |
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 variable is never used
@@ -0,0 +1,91 @@ | |||
#include "Turtle.h" |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making it static and taking in the name defeats the purpose of the class, make it a member function
No description provided.