ROS Kinetic on Ubuntu 16.04 (Mac Parallels)




http://wiki.ros.org/Installation/Ubuntu

Installation


$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

$ sudo apt-get update

$ sudo apt-get install ros-kinetic-desktop-full
....


Initialize

$ sudo rosdep init


Add the source of Kinetic setp.bash to ~/.bashrc


$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc


Install ROS Install tools

$ sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential


$ printenv | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros



$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make


~/catkin_ws/src$ cat CMakeLists.txt


~/catkin_ws$ source devel/setup.bash


Finding ROS packages on your system


$ rospack find roscpp
/opt/ros/kinetic/share/roscpp


$ roscd roscpp/cmake
parallels@parallels-vm:/opt/ros/kinetic/share/roscpp/cmake


$ rosls roscpp_tutorials
cmake  launch  package.xml  srv



Creating a ROS (catkin) Package

~/catkin_ws/src$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
Created file beginner_tutorials/CMakeLists.txt
Created file beginner_tutorials/package.xml
Created folder beginner_tutorials/include/beginner_tutorials
Created folder beginner_tutorials/src
Successfully created files in /home/parallels/catkin_ws/src/beginner_tutorials. Please adjust the values in package.xml.


Building catkin

~/catkin_ws/src$ cd ~/catkin_ws
parallels@parallels-vm:~/catkin_ws$ catkin_make

$ . ~/catkin_ws/devel/setup.bash
$ rospack depends1 beginner_tutorials
roscpp
rospy
std_msgs


$ rospack depends1 rospy
genpy
roscpp
rosgraph
rosgraph_msgs
roslib
std_msgs




$ source /opt/ros/kinetic/setup.bash 


~/catkin_ws$ catkin_make
~/catkin_ws$ catkin_make install



$ cd ~/catkin_ws/
~/catkin_ws$ ls src
beginner_tutorials  CMakeLists.txt

catkin_make

ROS Nodes 


http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes


$ sudo apt-get install ros-kinetic-ros-tutorials


Starting ROS Core Service


$ roscore
... logging to /home/parallels/.ros/log/4127ad4c-c430-11e8-97ed-001c42291ef9/roslaunch-parallels-vm-17556.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1gb .="" p="">
started roslaunch server http://parallels-vm:39325/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

auto-starting new master
process[master]: started with pid [17567]
ROS_MASTER_URI=http://parallels-vm:11311/

setting /run_id to 4127ad4c-c430-11e8-97ed-001c42291ef9
process[rosout-1]: started with pid [17583]
started core service [/rosout]


NEW TERMINAL

~/catkin_ws$ rosnode list
/rosout

Running Turtle Simulator Node

$ rosrun turtlesim turtlesim_node

in new terminal window
$ rosnode list
/rosout
/turtlesim

~/catkin_ws$ rosnode ping turtlesim
rosnode: node is [/turtlesim]
pinging /turtlesim with a timeout of 3.0s
xmlrpc reply from http://parallels-vm:38047/ time=0.795841ms


ROS Topics

http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics

$ rosrun turtlesim turtlesim_node


$ sudo apt-get install ros-kinetic-rqt
$ sudo apt-get install ros-kinetic-rqt-common-plugins



$ rosrun rqt_graph rqt_graph



$ rostopic -h
rostopic is a command-line tool for printing information about ROS Topics.

Commands:
rostopic bw display bandwidth used by topic
rostopic delay display delay of topic from timestamp in header
rostopic echo print messages to screen
rostopic find find topics by type
rostopic hz display publishing rate of topic
rostopic info print information about active topic
rostopic list list active topics
rostopic pub publish data to topic
rostopic type print topic or field type

Type rostopic -h for more detailed usage, e.g. 'rostopic echo -h'



parallels@parallels-vm:~/catkin_ws$ rostopic list
/rosout
/rosout_agg
/turtle1/cmd_vel
/turtle1/color_sensor

/turtle1/pose



$ rostopic echo /turtle1/cmd_vel
linear:
  x: -2.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0
---

$ rostopic list -v

Published topics:
 * /turtle1/color_sensor [turtlesim/Color] 1 publisher
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 publisher
 * /rosout [rosgraph_msgs/Log] 3 publishers
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /turtle1/pose [turtlesim/Pose] 1 publisher

Subscribed topics:
 * /turtle1/cmd_vel [geometry_msgs/Twist] 2 subscribers
 * /rosout [rosgraph_msgs/Log] 1 subscriber



$ rostopic type /turtle1/cmd_vel

geometry_msgs/Twist


$ rosmsg show geometry_msgs/Twist
geometry_msgs/Vector3 linear
  float64 x
  float64 y
  float64 z
geometry_msgs/Vector3 angular
  float64 x
  float64 y

  float64 z



$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
parallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
^[[Aparallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
^[[A
parallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
publishing and latching message for 3.0 seconds
^[[Aparallels@parallels-vm:~/catkin_ws$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'

publishing and latching message for 3.0 seconds






$ rosrun rqt_plot rqt_plot






http://wiki.ros.org/ROS/Tutorials/UnderstandingServicesParams


$ rosservice list
/clear
/kill
/reset
/rosout/get_loggers
/rosout/set_logger_level
/spawn
/turtle1/set_pen
/turtle1/teleport_absolute
/turtle1/teleport_relative
/turtlesim/get_loggers
/turtlesim/set_logger_level

$ rosservice call /clear

Create another turtle


rosservice call /spawn 2 2 0.2 ""



$ rosparam list
/background_b
/background_g
/background_r
/rosdistro
/roslaunch/uris/host_parallels_vm__40367
/rosversion
/run_id

$ rosparam get /rosdistro
'kinetic

  '

$ rosparam get /rosversion
'1.12.14



$ rosparam dump ros_params_dump.yaml

background_b: 255
background_g: 86
background_r: 69
rosdistro: 'kinetic

  '
roslaunch:
  uris: {host_parallels_vm__40367: 'http://parallels-vm:40367/'}
rosversion: '1.12.14

  '
run_id: d19c2fd2-c4d6-11e8-a520-001c42291ef9

http://wiki.ros.org/ROS/Tutorials/UsingRqtconsoleRoslaunch







No comments:

Post a Comment