Skip to content

Commit 53216d8

Browse files
Updating tutorials for ROS2 (#247)
1 parent b4ce10e commit 53216d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+813
-579
lines changed

tutorials/pick_and_place/PickAndPlaceProject/Assets/DemoScripts/Demo.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ public class Demo : MonoBehaviour
5959
string rosConnectName = "ROSConnect";
6060
string publisherName = "Publisher";
6161
int hostPort = 10000;
62-
int unityPort = 5005;
63-
int awaitDataMaxRetries = 10;
64-
int awaitDataSleepSeconds = 1;
6562

6663
string trajectoryPlannerType = "TrajectoryPlanner";
6764
string rosServiceName = "niryo_moveit";

tutorials/pick_and_place/Scripts/SourceDestinationPublisher.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void Start()
5252

5353
public void Publish()
5454
{
55-
MNiryoMoveitJoints sourceDestinationMessage = new MNiryoMoveitJoints();
55+
NiryoMoveitJointsMsg sourceDestinationMessage = new NiryoMoveitJointsMsg();
5656

5757
sourceDestinationMessage.joint_00 = jointArticulationBodies[0].xDrive.target;
5858
sourceDestinationMessage.joint_01 = jointArticulationBodies[1].xDrive.target;
@@ -62,14 +62,14 @@ public void Publish()
6262
sourceDestinationMessage.joint_05 = jointArticulationBodies[5].xDrive.target;
6363

6464
// Pick Pose
65-
sourceDestinationMessage.pick_pose = new MPose
65+
sourceDestinationMessage.pick_pose = new PoseMsg
6666
{
6767
position = target.transform.position.To<FLU>(),
6868
orientation = Quaternion.Euler(90, target.transform.eulerAngles.y, 0).To<FLU>()
6969
};
7070

7171
// Place Pose
72-
sourceDestinationMessage.place_pose = new MPose
72+
sourceDestinationMessage.place_pose = new PoseMsg
7373
{
7474
position = targetPlacement.transform.position.To<FLU>(),
7575
orientation = pickOrientation.To<FLU>()

tutorials/pick_and_place/Scripts/TrajectoryPlanner.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ private void OpenGripper()
7878
/// Get the current values of the robot's joint angles.
7979
/// </summary>
8080
/// <returns>NiryoMoveitJoints</returns>
81-
MNiryoMoveitJoints CurrentJointConfig()
81+
NiryoMoveitJointsMsg CurrentJointConfig()
8282
{
83-
MNiryoMoveitJoints joints = new MNiryoMoveitJoints();
83+
NiryoMoveitJointsMsg joints = new NiryoMoveitJointsMsg();
8484

8585
joints.joint_00 = jointArticulationBodies[0].xDrive.target;
8686
joints.joint_01 = jointArticulationBodies[1].xDrive.target;
@@ -101,28 +101,28 @@ MNiryoMoveitJoints CurrentJointConfig()
101101
/// </summary>
102102
public void PublishJoints()
103103
{
104-
MMoverServiceRequest request = new MMoverServiceRequest();
104+
MoverServiceRequest request = new MoverServiceRequest();
105105
request.joints_input = CurrentJointConfig();
106106

107107
// Pick Pose
108-
request.pick_pose = new MPose
108+
request.pick_pose = new PoseMsg
109109
{
110110
position = (target.transform.position + pickPoseOffset).To<FLU>(),
111111
// The hardcoded x/z angles assure that the gripper is always positioned above the target cube before grasping.
112112
orientation = Quaternion.Euler(90, target.transform.eulerAngles.y, 0).To<FLU>()
113113
};
114114

115115
// Place Pose
116-
request.place_pose = new MPose
116+
request.place_pose = new PoseMsg
117117
{
118118
position = (targetPlacement.transform.position + pickPoseOffset).To<FLU>(),
119119
orientation = pickOrientation.To<FLU>()
120120
};
121121

122-
ros.SendServiceMessage<MMoverServiceResponse>(rosServiceName, request, TrajectoryResponse);
122+
ros.SendServiceMessage<MoverServiceResponse>(rosServiceName, request, TrajectoryResponse);
123123
}
124124

125-
void TrajectoryResponse(MMoverServiceResponse response)
125+
void TrajectoryResponse(MoverServiceResponse response)
126126
{
127127
if (response.trajectories.Length > 0)
128128
{
@@ -149,7 +149,7 @@ void TrajectoryResponse(MMoverServiceResponse response)
149149
/// </summary>
150150
/// <param name="response"> MoverServiceResponse received from niryo_moveit mover service running in ROS</param>
151151
/// <returns></returns>
152-
private IEnumerator ExecuteTrajectories(MMoverServiceResponse response)
152+
private IEnumerator ExecuteTrajectories(MoverServiceResponse response)
153153
{
154154
if (response.trajectories != null)
155155
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
source /opt/ros/melodic/setup.bash
4-
echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/niryo_moveit/config/params.yaml
4+
echo "ROS_IP: $(hostname -i)" > $ROS_WORKSPACE/src/ros-tcp-endpoint/config/params.yaml
55
cd $ROS_WORKSPACE
6-
catkin_make
6+
catkin_make

tutorials/ros_packages/robotics_demo/scripts/color_publisher.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

tutorials/ros_packages/robotics_demo/scripts/object_pose_client.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

tutorials/ros_packages/robotics_demo/scripts/server_endpoint.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

tutorials/ros_unity_integration/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ The `ROSConnection` plugin (also from [ROS TCP Connector](https://github.com/Uni
1414

1515

1616
## Tutorials
17-
- [ROS–Unity Integration: Initial Setup](setup.md) - ROS-Unity Initial Setup
17+
- [ROS–Unity Integration: Initial Setup](setup.md) - ROSUnity Initial Setup
1818
- [ROS–Unity Integration: Network Description](network.md) - Description of network settings and troubleshooting
19-
- [ROS–Unity Integration: Publisher](publisher.md) - Adding a Publisher to a Unity Scene
20-
- [ROS–Unity Integration: Subscriber](subscriber.md) - Adding a Subscriber to a Unity Scene
21-
- [ROS–Unity Integration: Service](service.md) - Adding a Service call to a Unity Scene
22-
- [ROS–Unity Integration: UnityService](unity_service.md) - Adding a Service that runs in a Unity Scene
23-
- [ROS–Unity Integration: Server Endpoint](server_endpoint.md) - How to write a Server Endpoint
19+
- [ROS–Unity Integration: Publisher](publisher.md) - Publish messages from a Unity Scene
20+
- [ROS–Unity Integration: Subscriber](subscriber.md) - Subscribe to receive messages in a Unity Scene
21+
- [ROS–Unity Integration: Unity Service](unity_service.md) - Implement a service inside a Unity Scene
22+
- [ROS–Unity Integration: Service Call](service_call.md) - Call an external service from a Unity Scene
2423

2524
## Example Unity Scripts
2625

@@ -32,9 +31,9 @@ Example scripts implemented in tutorials:
3231
- `unity_scripts/RosSubscriberExample.cs`
3332
- Subscribes to a topic that accepts color messages and uses them to change the color of a GameObject in the Unity scene.
3433

35-
- `unity_scripts/RosServiceExample.cs`
36-
- Returns a destination position for a GameObject to move towards each time the service is called.
37-
3834
- `unity_scripts/RosUnityServiceExample.cs`
3935
- Runs a service in the Unity scene that takes a GameObject's name and responds with the Pose of that object.
4036

37+
- `unity_scripts/RosServiceExample.cs`
38+
- Returns a destination position for a GameObject to move towards each time the service is called.
39+
39.8 KB
Loading

0 commit comments

Comments
 (0)