From cd4127e17a268903b38f62e8a4dd752d5152adbb Mon Sep 17 00:00:00 2001 From: Rudolph Peter z003n7ht Date: Sun, 19 Feb 2017 12:50:47 +0100 Subject: [PATCH] Updated readme and license notices. --- LICENSE | 4 ++++ README.md | 30 ++++++++++++++++++++++-------- nodes/cozmo_driver.py | 22 +++++++++++++++++++--- nodes/head_lift_joy.py | 14 ++++++++++++++ 4 files changed, 59 insertions(+), 11 deletions(-) diff --git a/LICENSE b/LICENSE index 8dada3e..b75fd2b 100644 --- a/LICENSE +++ b/LICENSE @@ -199,3 +199,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + + +nodes/transformation.py: + See license notice at head of "nodes/transformation.py". \ No newline at end of file diff --git a/README.md b/README.md index 1a06213..dc5bc3f 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ This is **unofficial** ROS node for Anki cozmo. ## Requirements -This is tested on Kinetic/Ubuntu16.04 and Android only. +This is tested on Kinetic/Ubuntu16.04 and Android only. Latest version is tested on Indigo/Ubuntu14.04. - * Ubuntu 16.04 - * ROS Kinetic + * Ubuntu 14.04/16.04 + * ROS Indigo/Kinetic * Python3.5 * (Android) * (Cozmo SDK 0.10) @@ -18,6 +18,8 @@ Cozmo SDK will become idle mode if the message is not sent to cozmo for a few mi ## Super hack to run rospy from python3 +**Note: Be careful installing python3, you should update python3 alternative to python3.5 before installing and using pip3!** + This is not recommended as usual, but it seems difficult to run rospy from python3 normally. (It requires full recompile of all ROS packages.) Below hack will allow run python3, at least for cozmo_driver.py. I don't know the true risk to do that. @@ -27,32 +29,44 @@ sudo apt-get install python3-yaml sudo pip3 install rospkg catkin_pkg ``` +Note: To get further python3 compat a local version of "transformations.py" is included! + ## TODO * use trajectory_msgs to command head angle and lift height. * control and get states of cubes -## Pub/Sub +## Pub / Sub / Tf ### Publish - * /image (sensor_msgs/Image) : camera image from cozmo. This is gray scale, but the format is rgb8. + * /cozmo_camera/image (sensor_msgs/Image) : camera image from cozmo. This is gray scale, but the format is rgb8. + * /cozmo_camera/camera_info (sensor_msgs/CameraInfo) : The camera info from Cozmo's camera ( **Note: I did a very poor calibration!** ). * /joint_states (sensor_msgs/JointState) : This contains the head angle [rad] and the lift height [m] - * /tf (tf2_msgs/TFMessage) : poses of visialbe cubes and cozmo. * /imu (sensor_msgs/Imu) : Imu mounted on cozmo head * /battery (sensor_msgs/BatteryState) : battery voltage and charging status ### Subscribe - * /cmd_vel (geometry_msgs/Twist) : command velocity as usual. (velocity is not correct) + * /cmd_vel (geometry_msgs/Twist) : command velocity as usual. ( **Note: velocity is correct now!** ) * /say (std_msgs/String) : cozmo says this text * /head_angle (std_msgs/Float64) : command head angle [rad] - * /lift_height (std_msgs/Float64) : command lift height [m] + * /lift_height (std_msgs/Float64) : command lift height (value between 0 and 1, which is autoscaled by Cozmo SDK) [float] * /backpack_led (std_msgs/ColorRGBA) : led color on backpack +### Transformations provided + + * odom_frame -> footprint_frame + * footprint_frame -> base_frame + * base_frame -> head_frame + * head_frame -> camera_frame + * camera_frame -> camera_optical_frame + * odom_frame -> cube_xx (for detected cubes) ## Install cozmo SDK on Ubuntu16.04 and Android +**Note: The current driver whas tested on Ubuntu14.04 with ROS Indigo.** + Please follow the [original document](http://cozmosdk.anki.com/docs/install-linux.html#install-linux). Below is a quick hacky installation for only me. ```bash diff --git a/nodes/cozmo_driver.py b/nodes/cozmo_driver.py index 87b08a1..f000289 100755 --- a/nodes/cozmo_driver.py +++ b/nodes/cozmo_driver.py @@ -9,6 +9,21 @@ to this node. Also the TransformBroadcaster is taken from ROS tf ones. +Copyright {2016} {Takashi Ogura} +Copyright {2017} {Peter Rudolph} + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + """ # system import sys @@ -120,8 +135,6 @@ def __init__(self, coz): camera_info_url = rospy.get_param('~camera_info_url', '') # pubs - self._backpack_led_sub = rospy.Subscriber( - 'backpack_led', ColorRGBA, self._set_backpack_led, queue_size=1) self._joint_state_pub = rospy.Publisher('joint_states', JointState, queue_size=1) self._imu_pub = rospy.Publisher('imu', Imu, queue_size=10) self._battery_pub = rospy.Publisher('battery', BatteryState, queue_size=1) @@ -130,6 +143,8 @@ def __init__(self, coz): self._camera_info_pub = rospy.Publisher('/cozmo_camera/camera_info', CameraInfo, queue_size=10) # subs + self._backpack_led_sub = rospy.Subscriber( + 'backpack_led', ColorRGBA, self._set_backpack_led, queue_size=1) self._twist_sub = rospy.Subscriber('cmd_vel', Twist, self._twist_callback, queue_size=1) self._say_sub = rospy.Subscriber('say', String, self._say_callback, queue_size=1) self._head_sub = rospy.Subscriber('head_angle', Float64, self._move_head, queue_size=1) @@ -156,7 +171,8 @@ def _move_lift(self, cmd): Move lift to given height. :type cmd: Float64 - :param cmd: The height in millimeters. + :param cmd: A value between [0 - 1], the SDK auto + scales it to the according height. """ action = self._cozmo.set_lift_height(height=cmd.data, diff --git a/nodes/head_lift_joy.py b/nodes/head_lift_joy.py index 731151e..e62e058 100755 --- a/nodes/head_lift_joy.py +++ b/nodes/head_lift_joy.py @@ -4,6 +4,20 @@ This script implements a ROS node, which is used to control cozmo's head angle and lift height via joy-pad. +Copyright {2017} {Peter Rudolph} + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + """ import rospy