浏览代码

Tutorials updated

/laurie-Ros2Update
LaurieCheers 3 年前
当前提交
d5ecedfe
共有 14 个文件被更改,包括 375 次插入198 次删除
  1. 126
      tutorials/ros_unity_integration/images/ros2_icon.png
  2. 90
      tutorials/ros_unity_integration/publisher.md
  3. 2
      tutorials/ros_unity_integration/ros2_packages/unity_robotics_demo/unity_robotics_demo/color_publisher.py
  4. 47
      tutorials/ros_unity_integration/service.md
  5. 60
      tutorials/ros_unity_integration/setup.md
  6. 55
      tutorials/ros_unity_integration/subscriber.md
  7. 7
      tutorials/ros_unity_integration/unity_scripts/RosPublisherExample.cs
  8. 1
      tutorials/ros_unity_integration/unity_scripts/RosServiceExample.cs
  9. 39
      tutorials/ros_unity_integration/unity_scripts/RosSubscriberExample.cs
  10. 10
      tutorials/ros_unity_integration/unity_scripts/RosUnityServiceExample.cs
  11. 50
      tutorials/ros_unity_integration/unity_service.md
  12. 86
      tutorials/ros_unity_integration/images/settings_ros_ip.png
  13. 0
      /tutorials/ros_unity_integration/ros2_packages/unity_robotics_demo/unity_robotics_demo

126
tutorials/ros_unity_integration/images/ros2_icon.png

之前 之后
宽度: 128  |  高度: 80  |  大小: 15 KiB

90
tutorials/ros_unity_integration/publisher.md


Create a simple Unity scene which publishes a GameObject's position and rotation to a [ROS topic](http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics#ROS_Topics).
## Setting Up ROS
These instructions cover the setup for both ROS1 and ROS2. If you're using ROS2, start with the [Setting Up ROS2](publisher.md#setting-up-ros2) section. Instructions for ROS2 users are marked with this icon: <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/>.
- If using ROS (melodic or noetic), copy the contents of `tutorials/ros_unity_integration/ros_packages` from this repo into the `src` folder in your Catkin workspace. (If using ROS2, instead go to the [Setting Up ROS2](publisher.md#setting-up-ros2) section.)
## Setting Up ROS
- Follow the [ROS–Unity Initial Setup](setup.md) guide.
- Follow the [ROS–Unity Initial Setup](setup.md#ros2-environment) guide.
- Open a new terminal window and run the following commands:
## Start the Echo monitor
```bash
source devel/setup.bash
rosrun unity_robotics_demo server_endpoint.py
```
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
- Open another new terminal window, navigate to your ROS workspace, and run the following commands:
```bash
source devel/setup.bash
rostopic echo pos_rot
```
- Now proceed to [Setting Up Unity Scene](publisher.md#setting-up-unity-scene).
- For this tutorial we will run the rostopic echo command, which watches the topic we're going to publish messages on, to prove they are being received.
## Setting Up ROS2
- <img src="images/ros2_icon.png" alt="ros2" width="16" height="16"/> If using ROS2, copy the contents of `tutorials/ros_unity_integration/ros2_packages` from this repo into the `src` folder in your Colcon workspace.
- Follow the [ROS–Unity Initial Setup](setup.md) guide.
- The `server_endpoint` script we'll be using has a parameter ROS_IP. You will need to know the IP address of your ROS machine; the command `hostname -I` can be used to find it. Or, if you're using Docker, the IP address to use is `0.0.0.0`.
- Open a new terminal window and run the following commands:
```bash
source install/setup.bash
ros2 run unity_robotics_demo server_endpoint --ros-args -p ROS_IP:=127.0.0.1
```
Or if you need the server to listen on a port that's different from the default 10000, you can set the ROS_TCP_PORT parameter too:
```bash
ros2 run unity_robotics_demo server_endpoint --ros-args -p ROS_IP:=127.0.0.1 -p ROS_TCP_PORT:=10000
```
Once the server_endpoint has started, if everything worked ok, it will print something similar to `[INFO] [1622239914.040931500] [TCPServer]: Starting server on 127.0.0.1:10000`.
- Open a new terminal window, navigate to your ROS workspace, and run the following commands:
```bash
source devel/setup.bash
rostopic echo pos_rot
```
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> In ROS2, the commands to run are
```bash
source install/setup.bash
ros2 topic echo pos_rot
```
- Open another new terminal window, navigate to your ROS workspace, and run the following commands:
```bash
source install/setup.bash
ros2 topic echo pos_rot
```
- If it's working correctly it will print nothing and wait for a message to be published.
- In the menu bar, find and select `Robotics` -> `Generate ROS Messages...`
- Set the ROS message path to `PATH/TO/Unity-Robotics-Hub/tutorials/ros_unity_integration/ros_packages/unity_robotics_demo_msgs`.(The version in the ros2_packages folder is equivalent; Ros2 users can feel free to use it, or not.)
- In the message browser, expand the unity_robotics_demo_msgs subfolder and click "Build 2 msgs" to generate new C# scripts from the ROS .msg files.
![](images/generate_messages_1.png)
- The generated files will be saved in the default directory `Assets/RosMessages/UnityRoboticsDemo/msg`.
- Create a new directory in `Assets` and name it `Scripts`
- Create a new script in the `Scripts` directory and name it `RosPublisherExample.cs`
- Open `RosPublisherExample.cs` and paste the following code:
- (Alternatively, you can copy the script file from `tutorials/ros_unity_integration/unity_scripts/RosPublisherExample.cs`)
- In the Project tab, create a new C# script and name it `RosPublisherExample`. Paste the following code into the new script file.
- (Alternatively, you can drag the script file into Unity from `tutorials/ros_unity_integration/unity_scripts/RosPublisherExample.cs`)
using RosMessageTypes.UnityRoboticsDemo;
using RosMessageTypes.UnityRoboticsDemo;
///
///
/// </summary>
public class RosPublisherExample : MonoBehaviour
{

// The game object
// The game object
public GameObject cube;
// Publish the cube's position and rotation every N seconds
public float publishMessageFrequency = 0.5f;

{
// start the ROS connection
ros = ROSConnection.instance;
ros.RegisterPublisher<PosRotMsg>(topicName);
}
private void Update()

if (timeElapsed > publishMessageFrequency)
{
cube.transform.rotation = Random.rotation;
PosRotMsg cubePos = new PosRotMsg(
cube.transform.position.x,
cube.transform.position.y,

- Move the cube a little ways up so it is hovering above the plane
- In the main menu bar, open `Robotics/ROS Settings`.
- Set the ROS IP address and port to match the ROS IP and port variables defined when you started the ROS endpoint.
- If using ROS2, select the ROS2 protocol.
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> If using ROS2, switch the protocol to ROS2.
![](images/ros2_protocol.png)

- Pressing play in the Editor should publish a message every 0.5 seconds to the terminal running the `echo` command.
- Press play in the Editor. You should see the connection lights at the top left corner of the Game window turn blue, and something like `[INFO] [1622242057.562860400] [TCPServer]: Connection from 172.17.0.1` appear in the terminal running your server_endpoint.
In the window running your echo monitor, you should see the contents of your messages from Unity appearing every 0.5 seconds.
> Please reference [networking troubleshooting](network.md) doc if any errors are thrown.

2
tutorials/ros_unity_integration/ros2_packages/unity_robotics_demo/unity_robotics_demo/color_publisher.py


from rclpy.node import Node
from unity_interfaces.msg import UnityColor
from unity_robotics_demo_msgs.msg import UnityColor
class ColorPublisher(Node):

47
tutorials/ros_unity_integration/service.md


## Setting Up ROS
(Skip to [Start the Position service](service.md#start-the-position-service) if you already did the [ROS–Unity Integration Publisher](publisher.md) or [Subscriber](subscriber.md) tutorials.)
- Copy the `tutorials/ros_unity_integration/ros_packages/unity_robotics_demo` folder of this repo into the `src` folder in your Catkin workspace.
- Follow the [ROS–Unity Initial Setup](setup.md) guide.
- Follow the [ROS–Unity Initial Setup](setup.md) guide if you haven't already done so.
- Open a new terminal window, navigate to your ROS workspace, and run the following commands:
## Start the Position service
- For this tutorial we will start the position_service executable, which runs a ros service. Open a new terminal window, navigate to your ROS workspace, and run the following commands:
rosrun robotics_demo server_endpoint.py
rosrun unity_robotics_demo position_service.py
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> In ROS2, instead run
```bash
source install/setup.bash
ros2 run unity_robotics_demo position_service
```
## Start the Position service
- Open a new terminal window, navigate to your ROS workspace, and run the following commands:
```bash
source devel/setup.bash
rosrun robotics_demo position_service.py
```
- Generate the C# code for `PositionService`'s messages by going to `Robotics` -> `Generate ROS Messages...`
- Set the input file path to `PATH/TO/Unity-Robotics-Hub/tutorials/ros_unity_integration/ros_packages/robotics_demo`, expand the robotics_demo folder and click `Build 2 srvs`.
![](images/generate_messages_2.png)
- The generated files will be saved in the default directory `Assets/RosMessages/RoboticsDemo/srv`.
- **Note:** This script can be found at `tutorials/ros_unity_integration/unity_scripts`.
- (Alternatively, you can drag the script file into Unity from `tutorials/ros_unity_integration/unity_scripts`).
using RosMessageTypes.RoboticsDemo;
using RosMessageTypes.UnityRoboticsDemo;
public class RosServiceExample : MonoBehaviour
{

float awaitingResponseUntilTimestamp = -1;
void Start()
void Start()
ros.RegisterRosService<PositionServiceRequest>(serviceName);
// Move our position a step closer to the target.
// M ove our position a step closer to the target.
{
{
Debug.Log("Destination reached.");
PosRotMsg cubePos = new PosRotMsg(

// Send message to ROS and return the response
ros.SendServiceMessage<PositionServiceResponse>(serviceName, positionServiceRequest, Callback_Destination);
awaitingResponseUntilTimestamp = Time.time+1.0f; // don't send again for 1 second, or until we receive a response
awaitingResponseUntilTimestamp = Time.time + 1.0f; // don't send again for 1 second, or until we receive a response
}
}

}
```
- From the main menu bar, open `Robotics/ROS Settings`, and change the `ROS IP Address` variable to the ROS IP.
- Create an empty GameObject and name it `RosService`.
- Attach the `RosServiceExample` script to the `RosService` GameObject. Drag the cube GameObject onto its `cube` parameter.
- Pressing play in the Editor should start communication with the `position_service` script, running as a ROS node, causing the cube to move to random positions in the scene.

![](images/tcp_3.gif)
Continue to the [ROS–Unity Integration Unity Service](unity_service.md).

60
tutorials/ros_unity_integration/setup.md


# ROS–Unity Initial Setup
The minimum requirements for a ROS–Unity integration.
The minimum requirements for a ROS–Unity integration. These instructions cover both ROS1 and ROS2.
<img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> This symbol indicates instructions for ROS2 users. If using ROS2, you should skip to [ROS2 Environment](setup.md#-ros2-environment).
## ROS Environment

>
> Read more about the ROS Parameter Server [here](http://wiki.ros.org/Parameter%20Server).
## ROS2 Environment
## <img src="images/ros2_icon.png" alt="ros2" width="46" height="28"/> ROS2 Environment
1. Follow these steps if using ROS2:

Ensure there are no errors.
## Unity Scene
1. Launch Unity and create a new scene.
1. Launch Unity and create a new project.
![](images/add_package.png)
![](images/add_package.png)
![](images/add_package_2.png)
3. For this step you'll need to know the incoming IP address of your ROS machine; if you don't know it, the command `hostname -I` will print it. Or, if you're using Docker, the default IP address to use is `0.0.0.0`.
![](images/add_package_2.png)
From the Unity menu bar, open `Robotics/ROS Settings`, and set the `ROS IP Address` variable to your ROS IP.
![](images/settings_ros_ip.png)
4. <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> If you're using ROS2, still in the ROS Settings window, switch the protocol to ROS2.
![](images/ros2_protocol.png)
## Setting up the Ros-Unity Integration tutorials
The instructions so far have set up the ROS-TCP-Connector package for general use. If you are specifically following one of the [Ros-Unity-Integration tutorials](README.md), you'll need to do the following additional steps:
1. Copy `unity_robotics_demo` and `unity_robotics_demo_msgs` from the `tutorials/ros_unity_integration/ros_packages` folder of this repo into the `src` folder in your Catkin workspace, and run `catkin_make` again.
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> If using ROS2, instead copy them from`tutorials/ros_unity_integration/ros2_packages` into the `src` folder of your Colcon workspace, and run `colcon build` again.
2. Open a new terminal window and run the following commands, replacing the IP address 127.0.0.1 with the IP or hostname you set in Unity earlier. (If using Docker, the IP to use is 127.0.0.1.)
```bash
source devel/setup.bash
rosparam set ROS_IP 127.0.0.1
rosrun ros_tcp_endpoint default_server_endpoint.py
```
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> If using ROS2, use these commands instead:
```bash
source install/setup.bash
ros2 run ros2_tcp_endpoint default_server_endpoint --ros-args -p ROS_IP:=127.0.0.1
```
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
3. (Optional) If you need the server to listen on a port that's different from the default 10000, you can also set the ROS_TCP_PORT parameter with the command `rosparam set ROS_TCP_PORT 20000` (or whatever port you want.)
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> In ROS2 the command becomes `ros2 run unity_robotics_demo server_endpoint --ros-args -p ROS_IP:=127.0.0.1 -p ROS_TCP_PORT:=20000`
4. In the Unity menu bar, go to `Robotics` -> `Generate ROS Messages...`. In the Message Browser window, click the Browse button at the top right to set the ROS message path to `tutorials/ros_unity_integration/ros_packages/unity_robotics_demo_msgs` in whatever path you downloaded the Unity-Robotics-Hub repo into.
(Note: The version in the ros2_packages folder is equivalent; Ros2 users can feel free to use it, or not.)
5. In the message browser, expand the unity_robotics_demo_msgs subfolder and click "Build 2 msgs" and "Build 2 srvs" to generate C# scripts from the ROS .msg and .srv files.
![](images/generate_messages_1.png)
The generated files will be saved in the default directories `Assets/RosMessages/UnityRoboticsDemo/msg` and `Assets/RosMessages/UnityRoboticsDemo/srv`.

55
tutorials/ros_unity_integration/subscriber.md


## Setting Up ROS
(Skip to [Setting Up Unity Scene](subscriber.md#setting-up-unity-scene) if you already did the [Publisher](publisher.md) tutorial.)
- Copy the `tutorials/ros_unity_integration/ros_packages/robotics_demo` folder of this repo into the `src` folder in your Catkin workspace.
- Follow the [ROS–Unity Initial Setup](setup.md) guide.
- Open a new terminal window, navigate to your Catkin workspace, and run the following commands:
```bash
source devel/setup.bash
rosrun robotics_demo server_endpoint.py
```
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
## Setting Up ROS2
(Skip to [Setting Up Unity Scene](subscriber.md#setting-up-unity-scene) if you already did the [Publisher](publisher.md) tutorial.)
- Copy the `tutorials/ros_unity_integration/ros2_packages/robotics_demo` folder of this repo into the `src` folder in your Colcon workspace.
- Follow the [ROS–Unity Initial Setup](setup.md) guide.
- Open a new terminal window, navigate to your Colcon workspace, and run the following commands:
```bash
source install/setup.bash
ros2 run robotics_demo server_endpoint.py
```
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
- Follow the [ROS–Unity Initial Setup](setup.md) guide if you haven't already done so.
- In Unity, we need to generate the C# code for the `UnityColor` message. Open `Robotics` -> `Generate ROS Messages...`.
- Set the ROS message path to `PATH/TO/Unity-Robotics-Hub/tutorials/ros_unity_integration/ros_packages/robotics_demo/`, expand the robotics_demo subfolder and click `Build 2 msgs`.
![](images/generate_messages_1.png)
- The generated files will be saved in the default directory `Assets/RosMessages/RoboticsDemo/msg`.
- Create a script and name it `RosSubscriberExample.cs`
- Paste the following code into `RosSubscriberExample.cs`
- Alternatively, copy the script file from `tutorials/ros_unity_integration/unity_scripts/RosSubscriberExample.cs`
- In Unity, create a new C# script and name it `RosSubscriberExample`. Paste the following code into the new script file.
(Alternatively, you can drag the script file into Unity from `tutorials/ros_unity_integration/unity_scripts/RosSubscriberExample.cs`.)
```csharp
using UnityEngine;

public class RosSubscriberExample : MonoBehaviour
{
ROSConnection ros;
ROSConnection.instance.Subscribe<RosColor>("color", ColorChange);
ros = ROSConnection.instance;
ros.RegisterSubscriber<RosColor>("color");
ros.Subscribe<RosColor>("color", ColorChange);
}
void ColorChange(RosColor colorMessage)

- Create an empty GameObject and name it `RosSubscriber`
- Attach the `RosSubscriberExample` script to the `RosSubscriber` GameObject and drag the cube GameObject onto the `cube` parameter in the Inspector window.
- From the Unity menu bar, open `Robotics/ROS Settings`, and set the `ROS IP Address` variable to your ROS IP.
- If using ROS2, also switch the protocol to ROS2.
- After the scene has entered Play mode, run the following command: `rosrun robotics_demo color_publisher.py` to change the color of the cube GameObject in Unity to a random color.
- Run the following command: `rosrun robotics_demo color_publisher.py` to change the color of the cube GameObject in Unity to a random color.
- In ROS2, instead run `ros2 run unity_robotics_demo color_publisher`.
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> In ROS2, instead run `ros2 run unity_robotics_demo color_publisher`.
> Please reference [networking troubleshooting](network.md) doc if any errors are thrown.

7
tutorials/ros_unity_integration/unity_scripts/RosPublisherExample.cs


using RosMessageTypes.UnityRoboticsDemo;
using RosMessageTypes.UnityRoboticsDemo;
/// <summary>
///

{
// start the ROS connection
ros = ROSConnection.instance;
ros.RegisterPublisher<PosRotMsg>(topicName);
}
private void Update()

if (timeElapsed > publishMessageFrequency)
{
cube.transform.rotation = Random.rotation;
PosRotMsg cubePos = new PosRotMsg(
cube.transform.position.x,
cube.transform.position.y,

timeElapsed = 0;
}
}
}
}

1
tutorials/ros_unity_integration/unity_scripts/RosServiceExample.cs


void Start()
{
ros = ROSConnection.instance;
ros.RegisterRosService<PositionServiceRequest>(serviceName);
destination = cube.transform.position;
}

39
tutorials/ros_unity_integration/unity_scripts/RosSubscriberExample.cs


using UnityEngine;
using Unity.Robotics.ROSTCPConnector;
using RosColor = RosMessageTypes.UnityRoboticsDemo.UnityColorMsg;
public class RosSubscriberExample : MonoBehaviour
{
public GameObject cube;
void Start()
{
ROSConnection.instance.Subscribe<RosColor>("color", ColorChange);
}
void ColorChange(RosColor colorMessage)
{
cube.GetComponent<Renderer>().material.color = new Color32((byte)colorMessage.r, (byte)colorMessage.g, (byte)colorMessage.b, (byte)colorMessage.a);
}
}
using UnityEngine;
using Unity.Robotics.ROSTCPConnector;
using RosColor = RosMessageTypes.UnityRoboticsDemo.UnityColorMsg;
public class RosSubscriberExample : MonoBehaviour
{
ROSConnection ros;
public GameObject cube;
void Start()
{
ros = ROSConnection.instance;
ros.RegisterSubscriber<RosColor>("color");
ros.Subscribe<RosColor>("color", ColorChange);
}
void ColorChange(RosColor colorMessage)
{
cube.GetComponent<Renderer>().material.color = new Color32((byte)colorMessage.r, (byte)colorMessage.g, (byte)colorMessage.b, (byte)colorMessage.a);
}
}

10
tutorials/ros_unity_integration/unity_scripts/RosUnityServiceExample.cs


/// </summary>
public class RosUnityServiceExample : MonoBehaviour
{
ROSConnection ros;
[SerializeField]
string m_ServiceName = "obj_pose_srv";

ROSConnection.instance.ImplementService<ObjectPoseServiceRequest>(m_ServiceName, GetObjectPose);
ros = ROSConnection.instance;
ros.RegisterUnityService<ObjectPoseServiceRequest>(m_ServiceName);
ros.ImplementService<ObjectPoseServiceRequest>(m_ServiceName, GetObjectPose);
}
/// <summary>

/// <returns>service response containing the object pose (or 0 if object not found)</returns>
private MObjectPoseServiceResponse GetObjectPose(ObjectPoseServiceRequest request)
private ObjectPoseServiceResponse GetObjectPose(ObjectPoseServiceRequest request)
{
// process the service request
Debug.Log("Received request for object: " + request.object_name);

return objectPoseResponse;
}
}
}

50
tutorials/ros_unity_integration/unity_service.md


## Setting Up ROS
(Skip to [Setting Up the Unity Scene](unity_service.md#setting-up-the-unity-scene) if you already did the [ROS–Unity Integration Publisher](publisher.md) or [Subscriber](subscriber.md) tutorials.)
- Copy the `tutorials/ros_unity_integration/ros_packages/robotics_demo` folder of this repo into the `src` folder in your Catkin workspace.
- Follow the [ROS–Unity Initial Setup](setup.md) guide.
- Open a new terminal window, navigate to your ROS workspace, and run the following commands:
```bash
source devel/setup.bash
rosrun robotics_demo server_endpoint.py
```
Once the server_endpoint has started, it will print something similar to `[INFO] [1603488341.950794]: Starting server on 192.168.50.149:10000`.
- Follow the [ROS–Unity Initial Setup](setup.md) guide if you haven't already done so.
- Generate the C# code for `ObjectPoseService`'s messages by going to `Robotics` -> `Generate ROS Messages...`
- Set the input file path to `PATH/TO/Unity-Robotics-Hub/tutorials/ros_unity_integration/ros_packages/robotics_demo`, expand the robotics_demo folder and click `Build 2 srvs` (Note that you may skip this step if you have already done it in the previous tutorial).
![](images/generate_messages_2.png)
- The generated files will be saved in the default directory `Assets/RosMessages/RoboticsDemo/srv`.
- **Note:** This script can be found at `tutorials/ros_unity_integration/unity_scripts`.
- (Alternatively, you can drag the script file into Unity from `tutorials/ros_unity_integration/unity_scripts`).
using RosMessageTypes.RoboticsDemo;
using RosMessageTypes.UnityRoboticsDemo;
using UnityEngine;
using Unity.Robotics.ROSTCPConnector;
using Unity.Robotics.ROSTCPConnector.ROSGeometry;

/// </summary>
public class RosUnityServiceExample : MonoBehaviour
{
ROSConnection ros;
[SerializeField]
string m_ServiceName = "obj_pose_srv";

ROSConnection.instance.ImplementService<ObjectPoseServiceRequest>(m_ServiceName, GetObjectPose);
ros = ROSConnection.instance;
ros.RegisterUnityService<ObjectPoseServiceRequest>(m_ServiceName);
ros.ImplementService<ObjectPoseServiceRequest>(m_ServiceName, GetObjectPose);
}
/// <summary>

```bash
source devel/setup.bash
rosrun robotics_demo object_pose_client.py Cube
rosrun unity_robotics_demo object_pose_client.py Cube
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> If using ROS2, the command is:
```bash
source install/setup.bash
ros2 run unity_robotics_demo object_pose_client Cube
```
- This wil print an output similar to the following with the current pose information of the game object (note that the coordinates are converted to the ROS coordinate system in our Unity Service):
```bash

```bash
rosservice call /obj_pose_srv Cube
```
```bash
- <img src="images/ros2_icon.png" alt="ros2" width="23" height="14"/> If using ROS2, the command is:
```bash
ros2 service call obj_pose_srv unity_robotics_demo_msgs/ObjectPoseService "{object_name: Cube}"
```
```bash
object_pose:
position:
x: 0.0

y: -0.0
z: 0.0
w: -1.0
```
```

86
tutorials/ros_unity_integration/images/settings_ros_ip.png

之前 之后
宽度: 631  |  高度: 343  |  大小: 36 KiB

/tutorials/ros_unity_integration/ros2_packages/unity_robotics_demo/robotics_demo → /tutorials/ros_unity_integration/ros2_packages/unity_robotics_demo/unity_robotics_demo

正在加载...
取消
保存