diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..53cb85a313c9508931bfbf1fbbed426cc3d27911 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.8.3) +project(omniwheels_controller) + +## Find catkin and any catkin packages +find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg) + +## Declare a catkin package +catkin_package() + +## Build talker and listener +include_directories(include ${catkin_INCLUDE_DIRS}) + +add_executable(talker src/talker.cpp) +target_link_libraries(talker ${catkin_LIBRARIES}) + + diff --git a/README.md b/README.md index ac74000690a96ac34440288bce1bceb8fdc5938b..d45d20fb178f7231bf67f2f68281158745ff0d90 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ # Omniwheels controller -This project contains a simply velocity controller for the omniwheels. It publisher topic that enable the user to control the velocity and the rotatio of the robot \ No newline at end of file +This project contains a simply velocity controller for the omniwheels. It publisher topic that enable the user to control the velocity and the rotatio of the robot + +configuration for ssh ros +https://github.com/ut-ims-robotics/tutorials/wiki/Running-ROS-over-multiple-computers + + + +Doubts that occured during coding + +make sure that the most main computer is the ros master and and source the +configure_ros_master.bash file +the file is in the utills important \ No newline at end of file diff --git a/package.xml b/package.xml new file mode 100644 index 0000000000000000000000000000000000000000..8cf772f58d55d0d1cb95ad6ebbdfa9ae337a5f1e --- /dev/null +++ b/package.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<package> + <name>omniwheels_controller</name> + <version>0.10.2</version> + <description> + This package attempts to show the features of ROS step-by-step, + including using messages, servers, parameters, etc. + </description> + <maintainer email="mabel@openrobotics.org">Mabel Zhang</maintainer> + <maintainer email="sloretz@openrobotics.org">Shane Loretz</maintainer> + <license>BSD</license> + + <url type="website">http://www.ros.org/wiki/roscpp_tutorials</url> + <url type="bugtracker">https://github.com/ros/ros_tutorials/issues</url> + <url type="repository">https://github.com/ros/ros_tutorials</url> + <author>Morgan Quigley</author> + <author email="dthomas@osrfoundation.org">Dirk Thomas</author> + + <buildtool_depend>catkin</buildtool_depend> + + <build_depend>libboost-date-time-dev</build_depend> + <build_depend>libboost-thread-dev</build_depend> + <build_depend>message_generation</build_depend> + <build_depend>rosconsole</build_depend> + <build_depend>roscpp</build_depend> + <build_depend>roscpp_serialization</build_depend> + <build_depend>rostime</build_depend> + <build_depend>std_msgs</build_depend> + + <run_depend>libboost-date-time-dev</run_depend> + <run_depend>libboost-thread-dev</run_depend> + <run_depend>message_runtime</run_depend> + <run_depend>rosconsole</run_depend> + <run_depend>roscpp</run_depend> + <run_depend>roscpp_serialization</run_depend> + <run_depend>rostime</run_depend> + <run_depend>std_msgs</run_depend> +</package> diff --git a/src/talker.cpp b/src/talker.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f0899ac0dffd16eac09d2961de436b22d14d5468 --- /dev/null +++ b/src/talker.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2008, Morgan Quigley and Willow Garage, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +// %Tag(FULLTEXT)% +// %Tag(ROS_HEADER)% +#include "ros/ros.h" +// %EndTag(ROS_HEADER)% +// %Tag(MSG_HEADER)% +#include "std_msgs/String.h" +// %EndTag(MSG_HEADER)% + +#include <sstream> + +/** + * This tutorial demonstrates simple sending of messages over the ROS system. + */ +int main(int argc, char **argv) +{ + /** + * The ros::init() function needs to see argc and argv so that it can perform + * any ROS arguments and name remapping that were provided at the command line. + * For programmatic remappings you can use a different version of init() which takes + * remappings directly, but for most command-line programs, passing argc and argv is + * the easiest way to do it. The third argument to init() is the name of the node. + * + * You must call one of the versions of ros::init() before using any other + * part of the ROS system. + */ +// %Tag(INIT)% + ros::init(argc, argv, "talker"); +// %EndTag(INIT)% + + /** + * NodeHandle is the main access point to communications with the ROS system. + * The first NodeHandle constructed will fully initialize this node, and the last + * NodeHandle destructed will close down the node. + */ +// %Tag(NODEHANDLE)% + ros::NodeHandle n; +// %EndTag(NODEHANDLE)% + + /** + * The advertise() function is how you tell ROS that you want to + * publish on a given topic name. This invokes a call to the ROS + * master node, which keeps a registry of who is publishing and who + * is subscribing. After this advertise() call is made, the master + * node will notify anyone who is trying to subscribe to this topic name, + * and they will in turn negotiate a peer-to-peer connection with this + * node. advertise() returns a Publisher object which allows you to + * publish messages on that topic through a call to publish(). Once + * all copies of the returned Publisher object are destroyed, the topic + * will be automatically unadvertised. + * + * The second parameter to advertise() is the size of the message queue + * used for publishing messages. If messages are published more quickly + * than we can send them, the number here specifies how many messages to + * buffer up before throwing some away. + */ +// %Tag(PUBLISHER)% + ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000); +// %EndTag(PUBLISHER)% + +// %Tag(LOOP_RATE)% + ros::Rate loop_rate(10); +// %EndTag(LOOP_RATE)% + + /** + * A count of how many messages we have sent. This is used to create + * a unique string for each message. + */ +// %Tag(ROS_OK)% + int count = 0; + while (ros::ok()) + { +// %EndTag(ROS_OK)% + /** + * This is a message object. You stuff it with data, and then publish it. + */ +// %Tag(FILL_MESSAGE)% + std_msgs::String msg; + + std::stringstream ss; + ss << "hello world " << count; + msg.data = ss.str(); +// %EndTag(FILL_MESSAGE)% + +// %Tag(ROSCONSOLE)% + ROS_INFO("%s", msg.data.c_str()); +// %EndTag(ROSCONSOLE)% + + /** + * The publish() function is how you send messages. The parameter + * is the message object. The type of this object must agree with the type + * given as a template parameter to the advertise<>() call, as was done + * in the constructor above. + */ +// %Tag(PUBLISH)% + chatter_pub.publish(msg); +// %EndTag(PUBLISH)% + +// %Tag(SPINONCE)% + ros::spinOnce(); +// %EndTag(SPINONCE)% + +// %Tag(RATE_SLEEP)% + loop_rate.sleep(); +// %EndTag(RATE_SLEEP)% + ++count; + } + + + return 0; +} +// %EndTag(FULLTEXT)% diff --git a/utils/configure_ros_master.bash b/utils/configure_ros_master.bash new file mode 100644 index 0000000000000000000000000000000000000000..e8838a3de655ac8254c2ebf5d208462df467d0c2 --- /dev/null +++ b/utils/configure_ros_master.bash @@ -0,0 +1,2 @@ +export ROS_MASTER_URI=http://192.168.1.3:11311 +# this configures the ros master and makes the main compute the ros master