Comments (8)
Just to be clear, what I'm doing here is using the following script to publish frames on /tf
and then visualizing that with RViz.
import rospy
import rostopic
import geometry_msgs.msg
import tf2_ros
class Listener:
def __init__(self, topic):
self.msg = None
msg_type = rostopic.get_topic_class(topic)[0]
self.sub = rospy.Subscriber(topic, msg_type, self.set_msg)
def set_msg(self, msg):
self.msg = msg
def wait_for_message(topic):
msg_type = rostopic.get_topic_class(topic)[0]
return rospy.wait_for_message(topic, msg_type)
def pose_to_transform(pose):
tf = geometry_msgs.msg.Transform()
tf.translation.x = pose.position.x
tf.translation.y = pose.position.y
tf.translation.z = pose.position.z
tf.rotation.w = pose.orientation.w
tf.rotation.x = pose.orientation.x
tf.rotation.y = pose.orientation.y
tf.rotation.z = pose.orientation.z
return tf
rospy.init_node('ambf_state_publisher')
ambf_static = {
'psm1/baselink': wait_for_message('/ambf/env/psm1/baselink/State'),
'psm2/baselink': wait_for_message('/ambf/env/psm2/baselink/State'),
}
ambf_moving = {
'Needle': Listener('/ambf/env/Needle/State'),
'CameraFrame': Listener('/ambf/env/CameraFrame/State'),
'cameraL': Listener('/ambf/env/cameras/cameraL/State'),
'cameraR': Listener('/ambf/env/cameras/cameraR/State'),
'Entry1': Listener('/ambf/env/Entry1/State'),
'Entry2': Listener('/ambf/env/Entry2/State'),
'Entry3': Listener('/ambf/env/Entry3/State'),
'Entry4': Listener('/ambf/env/Entry4/State'),
'Exit1': Listener('/ambf/env/Exit1/State'),
'Exit2': Listener('/ambf/env/Exit2/State'),
'Exit3': Listener('/ambf/env/Exit3/State'),
'Exit4': Listener('/ambf/env/Exit4/State'),
# 'psm1/toolyawlink': Listener('/ambf/env/psm1/toolyawlink/State'),
# 'psm2/toolyawlink': Listener('/ambf/env/psm2/toolyawlink/State'),
}
tf_static_broadcaster = tf2_ros.StaticTransformBroadcaster()
tf_broadcaster = tf2_ros.TransformBroadcaster()
transforms = []
for k, v in ambf_static.items():
tf = geometry_msgs.msg.TransformStamped()
tf.header.stamp = rospy.Time.now()
tf.header.frame_id = 'world'
tf.child_frame_id = k
tf.transform = pose_to_transform(v.pose)
transforms.append(tf)
tf_static_broadcaster.sendTransform(transforms)
rate = rospy.Rate(30)
while not rospy.is_shutdown():
transforms = []
for k, v in ambf_moving.items():
if v.msg is None:
continue
tf = geometry_msgs.msg.TransformStamped()
tf.header.stamp = rospy.Time.now()
try:
tf.header.frame_id = v.msg.parent_name.data.replace('BODY ', '')
except AttributeError:
tf.header.frame_id = 'world'
tf.child_frame_id = k
tf.transform = pose_to_transform(v.msg.pose)
transforms.append(tf)
tf_broadcaster.sendTransform(transforms)
rate.sleep()
from surgical_robotics_challenge.
Hi Kim,
Thanks for bringing this up. Hmm, The frames for cameraL and cameraR appear correct to me in the camera_conventions.md doc. @jabarragann what do you think?
from surgical_robotics_challenge.
Thanks for posting the code for visualizing the frames. I want to check what specific part of the camera_conventions.md do you think is incorrect.
This one?
from surgical_robotics_challenge.
Yes, if I'm not mistaken, the one you posted is rotated 180 deg about the Z axis compared to the actual one from the simulator.
from surgical_robotics_challenge.
Umm, just so that we are on the same page, the conventions depicted in the two images are not related. This image:
shows the image plane
with respect to any AMBF camera, i.e. it is along the camera's negative X axis. It also shows the difference between the OpenCV
and AMBF camera conventions with respect to the image plane
.
On the other hand, this image that you shared shows the cameraR
and cameraL
with respect to an empty kinematic body which is called CameraFrame
. This kinematic body is placed similar to the dVRK endoscopes end-effector frame and does not have anything to do with the OpenCV
frame.
from surgical_robotics_challenge.
Maybe I'm completely misunderstanding something or I'm not explaining myself very well 😅
To be clear, I'm talking about how cameraL
and cameraR
are oriented -- not the OpenCV frame convention or the CameraFrame
frame.
from surgical_robotics_challenge.
Oooohhh, wait! I now realize I was reading the figure wrong. Stupid me. Sorry to have you spend time on this :|
from surgical_robotics_challenge.
No problem, happy to help. :)
from surgical_robotics_challenge.
Related Issues (20)
- TypeError: 'tuple' object does not support item assignment in joint_errors_model.py
- project_needle_pts.py script not working and throwing error HOT 3
- AMBF client not updating the pose of cameras and Camera frame HOT 5
- Weird oscillations in simulator HOT 5
- Joint errors model HOT 2
- Cannot import surgical robotics challenge modules HOT 2
- The Python control/examples scripts do not terminate cleanly
- Incorrect joint angles being set HOT 17
- Is the image displayed in the simulator rendered?
- ROS package source conflict HOT 2
- Geomagic teleoperation control not working HOT 5
- How to enable gravity compensation for MTM teleoperation control HOT 2
- PSMs don't reach commanded set-points HOT 10
- Unable to grasp needle, proximity not detected HOT 3
- Instruction on running simulation with ROS topic wrappers
- Error running gui_based_control.py HOT 2
- No force feedback using Geomagic & PHANToM Omni (Single Device Configuration)
- Extra offset at PSM Tip for FK and IK compared to the dVRK
- Non blocking move_jp command for PSM arm
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from surgical_robotics_challenge.