Please check this page and install ROS to your PC that is installed ubuntu.
Please create a working directory to develop with ROS. After that, initialize the working directory environment as follows:
$ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace $ cd ~/catkin_ws $ catkin_make
There is a setup script to initialize the environment. Please enter command below.
$ source ~/catkin_ws/devel/setup.bash
This process needs at first time whenever use ROS. Thus, I recommend to add script to .bashrc file.
#source /opt/ros/indigo/setup.bash source ~/catkin_ws/devel/setup.bash
Please change directory and create a package.
$ cd ~/catkin_ws/src
$ catkin_create_pkg <YOUR_PACKAGE_NAME> rospy roscpp std_msgs
And then, run
$ cd ~/catkin_ws $ catkin_make $ source ~/catkin_ws/devel/setup.bash
Now, your package can be available. Please check it with following command:
catkin_ws$ roscd <YOUR_PACKAGE_NAME> catkin_ws/src/<YOUR_PACKAGE_NAME>$
If you can do it, creating a package is succeeded.
Since time of the shipment, PLEN2 has been access point mode (You could connect PLEN2 as WiFi). Also PLEN2 has been set different SSID and common password.
SSID: PLEN2dev<PLEN2_MAC_ADDRESS> Password: plenproject
After connect your PC to PLEN2, please check IP address of your PC with
Then, change ROS environment parameters as follows:
export ROS_IP=<PC_IP_ADDRESS> export ROS_HOSTNAME=<PC_IP_ADDRESS> export ROS_MASTER_URI=http://192.168.42.1:11311
Now, your PC can communicate other ROS setuped devices.
Let you blink LED of PLEN2's eyes. Please create following sample program.
#!/usr/bin/env python # -*- coding: utf-8 -*- import rospy from std_msgs.msg import String def talker(): rospy.init_node('PCNode', anonymous=True) p = rospy.Publisher('PcToControl', String, queue_size=10) r = rospy.Rate(1) led_command = String() led_command.data = 'gpio,w,off' while ( not rospy.is_shutdown() ): if ( 'on' in led_command.data ): led_command.data = 'gpio,w,off' elif ( 'off' in led_command.data ): led_command.data = 'gpio,w,on' rospy.loginfo('%s', led_command.data) p.publish(led_command) r.sleep() if __name__ == '__main__': try: talker() except rospy.ROSInterruptException: pass
This script blink PLEN2's eye at every seconds. PLEN2 subscribe topic which name is PcToControl.
You need to run following command to be availabel the python script:
$ chmod 755 <CREATED_SCRIPT_NAME> $ python <CREATED_SCRIPT_NAME>
In addition, You could control PLEN2 with command below. See also...
For example, if you would like to play the motion that is placed slot 4, send command below: