-
Notifications
You must be signed in to change notification settings - Fork 373
User_App_DotNet_Urdf_Transfer
Mehmet Emre Çakal edited this page Oct 10, 2024
·
1 revision
URDF (Unified Robot Description Format) files are XML files that describe the physical configuration of a robot. In this section, we'll cover how to transfer URDF files between ROS and your .NET application using ROS#.
Steps:
-
Initialize the URDF Transfer: Create an instance of the
UrdfTransferFromRos
class to handle the transfer. - Specify the ROS Topics: Define the topics for the URDF and robot name.
- Start the Transfer: Execute the transfer and wait for completion.
Code Example:
using RosSharp.RosBridgeClient.UrdfTransfer;
public static void TransferUrdfFromRosExample(RosSocket rosSocket)
{
// Initialize the URDF transfer from ROS
UrdfTransferFromRos urdfTransferFromRos = new UrdfTransferFromRos(
rosSocket,
System.IO.Directory.GetCurrentDirectory(),
"robot_state_publisher:robot_description", // "/robot_description" for ROS1
"robot_name:pacakge_name" // "/robot/name" for ROS1
);
// Start the transfer
urdfTransferFromRos.Transfer();
// Wait for the transfer to complete
urdfTransferFromRos.Status["robotNameReceived"].WaitOne();
Console.WriteLine("Received URDF for robot: " + urdfTransferFromRos.RobotName);
}
- UrdfTransferFromRos: A class that handles downloading URDF files from a ROS system to a local directory.
- robot_description: The ROS topic typically used to publish the robot's URDF.
- WaitOne: Waits for the URDF transfer to complete before continuing.
Steps:
-
Initialize the URDF Transfer: Create an instance of the
UrdfTransferToRos
class. - Specify the Local URDF File: Provide the path to the URDF file you wish to upload to ROS.
- Start the Transfer: Execute the transfer and wait for completion.
Code Example:
public static void TransferUrdfToRosExample(RosSocket rosSocket)
{
string urdfFilePath = "path/to/your/urdf/file.urdf";
// Initialize the URDF transfer to ROS
UrdfTransferToRos transferor = new UrdfTransferToRos(
rosSocket,
"Robot",
"robot_name",
urdfFilePath,
"urdf_export_test" // Package name to be exported. This package has to exist beforehand.
);
// Start the transfer
transferor.Transfer();
// Wait for the transfer to complete
transferor.Status["robotNamePublished"].WaitOne();
Console.WriteLine("Published URDF for robot: " + transferor.RobotName);
}
In the ROS# .NET solution you will see the RosBridgeClientTest project. For executable implementation examples, see the console examples in this project.
© Siemens AG, 2017-2024
-
- 1.3.1 R2D2 Setup
- 1.3.2 Gazebo Setup on VM
- 1.3.3 TurtleBot Setup (Optional for ROS2)
-
- 2.1 Quick Start
- 2.2 Transfer a URDF from ROS to Unity
- 2.3 Transfer a URDF from Unity to ROS
- 2.4 Unity Simulation Scene Example
- 2.5 Gazebo Simulation Scene Example
- 2.6 Fibonacci Action Client
- 2.7 Fibonacci Action Server
- 3.1 Import a URDF on Windows
- 3.2 Create, Modify and Export a URDF Model
- 3.3 Animate a Robot Model in Unity
- Message Handling: Readers & Writers
- Thread Safety for Message Reception
- File Server Package
- ROS-Unity Coordinate System Conversions
- Post Build Events
- Preprocessor Directives in ROS#
- Adding New Message Types
- RosBridgeClient Protocols
- RosBridgeClient Serializers
- Action Server State Machine Model
© Siemens AG, 2017-2024