ROS learn the installation and use of RoboWare Studio

preface

RoboWare Studio is a ROS integrated development environment Make ROS development more intuitive, simple and easy to operate It can manage ROS workspace and package, code editing, construction and debugging. Unfortunately, it has been stopped at present...

1, Installation

The RoboWare Studio I use is RoboWare Studio_ 1.1.0-1514335284_ In the AMD64 version, the deb file has been uploaded to the resource, roboware-studio_1.1.0-1514335284_amd64.deb , please download it yourself. After downloading, double-click to complete the installation. The effect is as follows:

2, Characteristics

  • 1. RoboWare Studio can automatically detect and load ROS environment without additional configuration.
  • 2. Compatible with indigo, jade, kinetic and other versions.
  • 3. Create ROS workspace and package, add source code, create message, service and action files, and display package and node list in a graphical way.
  • 4. Cmakellists Txt file and package Automatic update of XML file.
  • 5. Release, debug and Isolated compilation options are provided. Debug C + + and Python code in the way of interface interaction, set breakpoints, display call stack, step-by-step operation, and support interactive terminals. ROS package and node list can be displayed in the user interface.
  • 6. The local code can be deployed to the remote machine, which can be X86 architecture or ARM architecture. The deployment, construction and real-time debugging of remote code can be realized on the local machine.
  • 7. Built in Git function, easier to use. You can perform variance comparison, file temporary storage, modification and submission in the editor interface. You can push and pull any git service warehouse.
  • 8. From code creation, message definition to file storage path creation and selection, RoboWare Studio will guide developers to operate in accordance with ROS specifications and assist developers to write high-quality and standardized ROS packages.

3, Preliminary use

1. New workspace (create workspace)

Here I created a new workspace robo_catkin_ws, and catkin created during previous learning_ Ws distinguish. This step is equivalent to creating a workspace.

Fill in the workspace name as follows:
Click the "save" button in the lower right corner to complete the creation of workspace.

2. Build (workspace initialization)

Set the explorer to release mode, click build in the ROS option in the menu to complete the build, which is equivalent to completing workspace initialization. Therefore, this operation is equivalent to catkin_ init_ From the workspace operation, you can see that there will be one more cmakelists in the src directory Txt file.

3. Compile

On the console under the IDE, you can see the terminal column. Enter the following commands to complete the compilation.

catkin_make

Then, add the path of the workspace to the environment variable ROS_ PACKAGE_ In path, i.e. setup. In devel under this workspace Bash added to the home directory bashrc file.
Enter the following commands in sequence:

gedit ~/.bashrc
source /home/zt/robo_catkin_ws/devel/setup.bash

4. New ROS package (create function package)

Click the src folder, right-click, select new ROS package, and enter the function package name learning_topic to complete the creation of the function package in the src directory of the workspace.

You can see that cmakelist is automatically generated under this function package Txt and package XML file.

5. Configure function pack dependencies

Select the function package, right-click and select Edit dependent ROS package list, as follows:

Enter roscpp STD in the pop-up configuration field_ Msgs, as follows:

6. Add node file

Right click learning_topic function pack. Create a new src folder. You can see that the src folder will be generated in the sub file

Right click the src folder to create a new cpp source file:

Named talker After CPP, select Add to new executable:

Similarly, name listener CPP, as we can see from the file directory, RoboWare Studio also modified cmakelist while getting two files Txt and package XML file.
talker.cpp source code is as follows:

#include <ros/ros.h>
#include <geometry_msgs/Twist.h>

int main(int argc, char **argv)
{
    ros::init(argc, argv, "velocity_publisher");
     
    ros::NodeHandle n;
    
    ros::Publisher turtle_vel_pub = n.advertise<geometry_msgs::Twist>("/turtle1/cmd_vel", 10);
	
    ros::Rate loop_rate(10);

    int count = 0;
	
    while(ros::ok())
    {
		geometry_msgs::Twist vel_msg;
		vel_msg.linear.x = 0.5;
		vel_msg.angular.z = 0.2;
		turtle_vel_pub.publish(vel_msg);
		ROS_INFO("Publish turtle velocity command [%0.2f m/s, %0.2f rad/s]", vel_msg.linear.x, vel_msg.angular.z);
		loop_rate.sleep();
}
    return 0;
}

listener.cpp source code is as follows:

#include <ros/ros.h>
#include "turtlesim/Pose.h"

void poseCallback(const turtlesim::Pose::ConstPtr& msg)
{
    ROS_INFO("Turtle pose: x:%0.6f, y:%0.6f", msg->x, msg->y);
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "pose_subscriber");

    ros::NodeHandle n;

    ros::Subscriber pose_sub = n.subscribe("/turtle1/pose", 10, poseCallback);

    ros::spin();

    return 0;
}

7. Compilation and operation

On the IDE console, open a new terminal and enter the following command to complete the compilation:

catkin_make

Start roscore with the following command:

roscore

Run the little turtle node. The command is as follows:

rosrun turtlesim turtlesim_node

Run the talker node. The command is as follows:

rosrun learning_topic talker

Run the listener node. The command is as follows:

rosrun learning_topic listener

8. Custom message

Right click learning_topic function pack, new Msg folder

Right click the generated MSG folder and create a new MSG file named person msg

The contents of the document are as follows:

string name
uint8 sex
uint8 age

uint8 unknown = 0
uint8 male = 1
uint8 female = 2

Create person as described above_ publisher. CPP and person_subscriber.cpp file.

person_publisher.cpp file contents are as follows:

#include <ros/ros.h>
#include "learning_topic/Person.h"

int main(int argc, char **argv)
{
	ros::init(argc, argv, "person_publisher");
	ros::NodeHandle n;
	
	ros::Publisher person_info_pub = n.advertise<learning_topic::Person>("/person_info", 10);
	ros::Rate loop_rate(1);
	int count = 0;
	while(ros::ok())
	{
		learning_topic::Person person_msg;
		person_msg.name = "Tom";
		person_msg.age = 18;
		person_msg.sex = learning_topic::Person::male;
		
		person_info_pub.publish(person_msg);
		ROS_INFO("Publish Person Info: name:%s  age:%d  sex:%d",
				  person_msg.name.c_str(), person_msg.age, person_msg.sex);
		loop_rate.sleep();
	}
	return 0;
}

person_subscriber.cpp file contents are as follows:

#include <ros/ros.h>
#include "learning_topic/Person.h"

void personInfoCallback(const learning_topic::Person::ConstPtr& msg)
{
	ROS_INFO("Subscribe Person Info: name:%s  age:%d  sex:%d", msg->name.c_str(), msg->age, msg->sex);
}

int main(int argc, char **argv)
{
	ros::init(argc, argv, "person_subscriber");
	ros::NodeHandle n;
	ros::Subscriber person_info_sub = n.subscribe("/person_info", 10, personInfoCallback);
	ros::spin();
	return 0;
}

9. Compilation and operation

On the IDE console, open a new terminal and enter the following command to complete the compilation:

catkin_make

Start roscore with the following command:

roscore

Run person_subcriber node. The command is as follows:

rosrun learning_topic person_subcriber


Run person_publisher node, the command is as follows:

rosrun learning_topic person_publisher


Similarly, you can also complete the implementation of custom services.

4, Summary

Personally, the biggest convenience of RoboWare Studio is that it can realize cmakelists Txt file and package Automatic update of XML file, which greatly reduces the configuration work. However, in the process of using it, we still need to manually input commands to complete some places, such as compiling catkin_make, start roscore or node, etc.

Tags: ROS

Posted by Chris16962 on Thu, 05 May 2022 05:06:24 +0300