Skip to content

Software Challenge Urban Pistek#11

Open
UrbanPistek wants to merge 9 commits intouwrobotics:masterfrom
UrbanPistek:master
Open

Software Challenge Urban Pistek#11
UrbanPistek wants to merge 9 commits intouwrobotics:masterfrom
UrbanPistek:master

Conversation

@UrbanPistek
Copy link
Copy Markdown

Hello here is my code for the software challenge, let me know what you think, thanks!

Comment thread software_training_assignment/CMakeLists.txt Outdated
Comment thread software_training_assignment/package.xml Outdated
Comment thread software_training_assignment/src/main.cpp
Comment thread software_training_assignment/src/resetTurtle.cpp
Comment thread software_training_assignment/src/moveTurtle.cpp Outdated
Comment thread software_training_assignment/src/moveTurtle.cpp Outdated
Comment thread software_training_assignment/src/moveTurtle.cpp Outdated
Comment thread software_training_assignment/src/moveTurtle.cpp Outdated
Comment thread software_training_assignment/src/moveTurtle.cpp Outdated
} else {
ROS_INFO("Action Failed");
//Infinite loop to run
while(true){
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you look at the tutorials we want all loops to kill if the ros master is killed so we usually use while (ros::ok())

ROS_INFO("Action Finished");
} else {
ROS_INFO("Action Failed");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're missing the ros::spinOnce function, this is the function that checks for new msgs, service calls, actions and other. its what lets us communicate between many applications running ros

int main(int argc, char **argv) {
ros::init(argc, argv, "moveTurtle");
ros::NodeHandle nh;
MoveTurtleAction(std::string name) :
Copy link
Copy Markdown

@azumnanji azumnanji Nov 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy nodehandle to class nodehandle

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to put nodehandle in its own class?
Currently nodehandle is in the MoveTurtleActionClass:
class MoveTurtleAction { protected: ros::NodeHandle nh;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants