Content-Length: 200702 | pFad | http://github.com/RobotecAI/ros2-for-unity/issues/111
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
Could you please provide an example on how to listen the topic /joint_states and print individual joint positions in Unity Debugger.log?
Tero
The text was updated successfully, but these errors were encountered:
`using System; using UnityEngine; using sensor_msgs.msg;
namespace ROS2 {
public class JointStateListener : MonoBehaviour {
private ROS2UnityComponent ros2Unity; private ROS2Node ros2Node; private ISubscription<JointState> jointStateSub; void Start() { // Find the ROS2UnityComponent in the scene ros2Unity = GetComponent<ROS2UnityComponent>(); } void Update() { if (ros2Node == null && ros2Unity.Ok()) { // Create a node ros2Node = ros2Unity.CreateNode("joint_state_listener_node"); // Subscribe to the /joint_states topic jointStateSub = ros2Node.CreateSubscription<JointState>( "/joint_states", msg => { for (int i = 0; i < msg.Position.Length; i++) { Debug.Log($"Joint {i}: Position {msg.Position[i]}"); } }); } }
} }`
Sorry, something went wrong.
No branches or pull requests
Fetched URL: http://github.com/RobotecAI/ros2-for-unity/issues/111
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy
Hi,
Could you please provide an example on how to listen the topic /joint_states and print individual joint positions in Unity Debugger.log?
Tero
The text was updated successfully, but these errors were encountered: