Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed camera failling to start and say text fixed #8

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions launch/driver.launch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<rosparam param="source_list">["/vector/joint_states"]</rosparam>
</node>

<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ROS was complaining about a deprecation for this publisher

<param name="rate" value="10.0"/>
</node>

Expand Down Expand Up @@ -53,4 +53,4 @@
<param name="~forwardMovementOnly" value="false" />
<remap from="cmd_vel" to="/vector/cmd_vel" />
</node>
</launch>
</launch>
7 changes: 5 additions & 2 deletions nodes/vector_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@

else:
async_robot = anki_vector.AsyncRobot()
async_robot.camera.init_camera_feed()
# async_robot.camera.init_camera_feed()

# connect to Vector
async_robot.connect()

# Camera feed?
async_robot.camera.init_camera_feed()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the client was not able to connect with the robot, it said that the client was doing something else and blocks after this.


# start all using shared AsyncRobot object
Vector(async_robot)
Animation(async_robot)
Expand All @@ -45,4 +48,4 @@
tf_thread = threading.Thread(target=JointStatesPublisher, args=(async_robot,))
tf_thread.start()

rospy.spin()
rospy.spin()
6 changes: 5 additions & 1 deletion src/vector_ros_driver/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import cv_bridge
import numpy

import cv2

from sensor_msgs.msg import Image

class Camera(object):
Expand All @@ -19,7 +21,9 @@ def publish_camera_feed(self):
bridge = cv_bridge.CvBridge()

while not rospy.is_shutdown():
image = bridge.cv2_to_imgmsg(numpy.asarray(self.async_robot.camera.latest_image), encoding="rgb8") # convert PIL.Image to ROS Image
raw_image = numpy.asarray(self.async_robot.camera.latest_image.raw_image)
# image = bridge.cv2_to_imgmsg(numpy.asarray(self.async_robot.camera.latest_image), encoding="rgb8") # convert PIL.Image to ROS Image
image = bridge.cv2_to_imgmsg(raw_image, encoding="rgb8") # convert PIL.Image to ROS Image
image.header.stamp = rospy.Time.now()
image.header.frame_id = self.image_frame_id
self.image_publisher.publish(image)
Expand Down
2 changes: 1 addition & 1 deletion src/vector_ros_driver/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def battery_state_service_cb(self, request):
return response

def say_text_cb(self, request):
self.robot.say_text(request.text)
self.robot.behavior.say_text(request.text)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, "behavior" was missing.


return SayTextResponse()

Expand Down