Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
6f34752df7
|
|
@ -132,7 +132,7 @@ include_directories(
|
|||
## Declare a C++ executable
|
||||
## With catkin_make all packages are built within a single CMake context
|
||||
## The recommended prefix ensures that target names across packages don't collide
|
||||
# add_executable(${PROJECT_NAME}_node src/test_node.cpp)
|
||||
add_executable(commander src/project_file.cpp)
|
||||
|
||||
## Rename C++ executable without prefix
|
||||
## The above recommended prefix causes long target names, the following renames the
|
||||
|
|
@ -145,9 +145,7 @@ include_directories(
|
|||
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
|
||||
## Specify libraries to link a library or executable target against
|
||||
# target_link_libraries(${PROJECT_NAME}_node
|
||||
# ${catkin_LIBRARIES}
|
||||
# )
|
||||
target_link_libraries(commander ${catkin_LIBRARIES})
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
|
|
|
|||
|
|
@ -10,6 +10,39 @@ Context: This cpp file is part of the second lab of the Advanced_Robotics course
|
|||
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <geometry_msgs/Twist.h>
|
||||
|
||||
//max values for lin vel 0.22 and angular vel 2.84
|
||||
|
||||
void walk(geometry_msgs::Twist& twist, float speed_input){
|
||||
|
||||
//intialisation of the values for the twist messages
|
||||
twist.linear.x=0.0;
|
||||
twist.linear.y=0.0;
|
||||
twist.linear.z=0.0;
|
||||
twist.angular.x=0.0;
|
||||
twist.angular.y=0.0;
|
||||
twist.angular.z=0.0;
|
||||
|
||||
//use of the speed input
|
||||
twist.linear.x=speed_input;
|
||||
|
||||
}
|
||||
|
||||
void turn_random(geometry_msgs::Twist& twist, float random_angular_speed){
|
||||
|
||||
//initialisation of the values for the twist messages
|
||||
twist.linear.x=0.0;
|
||||
twist.linear.y=0.0;
|
||||
twist.linear.z=0.0;
|
||||
twist.angular.x=0.0;
|
||||
twist.angular.y=0.0;
|
||||
twist.angular.z=0.0;
|
||||
|
||||
//randomise the angle
|
||||
twist.angular.z=random_angular_speed;
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
|
@ -20,10 +53,15 @@ int main(int argc, char** argv)
|
|||
ros::Rate loopRate(10);
|
||||
|
||||
while(ros::ok()){
|
||||
commanderPublisher.publish();
|
||||
|
||||
geometry_msgs::Twist twist;
|
||||
|
||||
turn_random(twist, 1);
|
||||
|
||||
commanderPublisher.publish(twist);
|
||||
ros::spinOnce();
|
||||
loopRate.sleep();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue