Skip to content
New issue

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

Initial turtlesim example from Hugo #62

Draft
wants to merge 1 commit into
base: humble
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ ros2 fog delete -a

Here are several commands that one may find it useful when developing:
```bash

# starting the second terminal for fogros docker
docker exec -it $(docker ps | grep fogros2 | awk '{print $1}') /bin/bash
```
Expand Down Expand Up @@ -228,5 +227,25 @@ docker run --net=host --env RMW_IMPLEMENTATION=rmw_cyclonedds_cpp --env CYCLONED
```
in ros workspace.

#### To run turtlesim
```
ros2 launch fogros2_examples turtlesim.launch.py
```
Open port 8080 on the ec2 instance's public IPv4 address from the ec2 console to access [FoxGlove Studio](https://foxglove.dev/) and open a connection to rosbridge on port 9090 of the ec2 instance's address.

<img src="https://foxglove.dev/images/blog/introducing-foxglove-studios-new-data-source-dialog/hero.png" width="50%" height="50%" />

Select the Plot panel and the Teleop panel.

<img src="https://foxglove.dev/images/docs/studio/panels/tab.png" width="25%" height="25%" />

In the Teleop panel, configure the publish topic to /turtle/cmd_vel.

In the Plot panel, add /turtle1/pose.x and /turtle1/pose.y as the custom values to plot on the x-axis and y-axis, respectively.

Use the Teleop panel to navigate the turtle around. The plot's values should change as the turtle’s position changes.

<img src="https://foxglove.dev/images/blog/running-your-first-ros-node/plot.png" width="50%" height="50%" />

#### TODO
- Streamline the launch process for client docker images.
31 changes: 31 additions & 0 deletions fogros2_examples/launch/turtlesim.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from launch import FogROSLaunchDescription
from launch_ros.actions import Node
import fogros2

def generate_launch_description():
ld = FogROSLaunchDescription()
machine1 = fogros2.AWS(region="us-west-1", ec2_instance_type="t2.medium", ami_image="ami-09175f2ca3c3dc67c", launch_foxglove=True)
talker_node = Node(
package="fogros2_examples", executable="listener", output="screen")
listener_node = fogros2.CloudNode(
package="fogros2_examples", executable="talker", output="screen",
machine = machine1)
turtlesim_node = Node(
package="turtlesim", executable="turtlesim_node", output="screen")

ld.add_action(talker_node)
ld.add_action(listener_node)
ld.add_action(turtlesim_node)
return ld