# Jupyter 다루기

현재 터미널 상황입니다.

![](/files/-MThfd7gAwVnEBfWz4s_)

**\[내 PC]** roscore 실행합니다.

![](/files/-MThflxdZ0QLbp-smhfi)

**\[R1mini w/ SSH]** 통신 포트에 권한을 설정합니다.

* 666 : 리눅스의 파일 최대 접근 권한으로 읽기(w), 쓰기(r) 권한을 부여한 상태입니다.

![](/files/-MThfs4rWQl1SQ22vOqp)

**\[R1mini w/ SSH]** bringup.launch를 실행합니다.

![](/files/-MThg2LvZz68BbM8sHTP)

**\[Jupyter in 내 PC]** Jupyter 화면에서

![](/files/-MThgDAMkpLRjwPvROkb)

**\[Jupyter in 내 PC]** 필요한 라이브러리를 import 하고,

```python
import rospy
from geometry_msgs.msg import Point, Twist
```

![](/files/-MThgIRG7z398wLBHFVO)

**\[Jupyter in 내 PC]** 사용할 변수들을 아래와 같이 초기화 해줍니다.

```python
speed = Twist()
rospy.init_node("test_cmd_vel")
rate = rospy.Rate(100)
pub = rospy.Publisher("/cmd_vel", Twist, queue_size=1)
```

![](/files/-MThgO_gSRvBq0IP9EcT)

**\[Jupyter in 내 PC]** speed 변수에 넣은 twist 데이터를 확인하고,

```python
speed
```

![](/files/-MThgRRRQY7PcHmg3p1P)

**\[Jupyter in 내 PC]** x의 방향과 속도를 0.5로 설정해줍니다.

```python
speed.linear.x = 0.5
```

![](/files/-MThggEIX2vZuBRTdkVf)

**\[Jupyter in 내 PC]** 로봇을 동작 시켜보아요\~

```python
while True:
    pub.publish(speed)
    rate.sleep()
```

![](/files/-MThgj2BQ9qAL5DHISac)

**\[Jupyter in 내 PC]** 멈추고 싶을 때는 정지 버튼을 누릅니다.

![](/files/-MThgmIQFQpG3CkPR8B1)

**\[Jupyter in 내 PC]** Battery 상태를 확인할 수 있게 하는 명령입니다.

```python
from omo_r1mini_bringup.srv import Battery

bat_status = rospy.ServiceProxy('/battery_status', Battery)
bat_status()
```

![](/files/-MThgrydnfLEWDPoRhwT)

**\[Jupyter in 내 PC]** led의 색상을 변경할 수 있는 명령입니다.

```python
from omo_r1mini_bringup.srv import Color

set_leds = rospy.ServiceProxy('/set_led_color', Color)
set_leds(250,50,50)
```

![](/files/-MThgxL7U27NIpGgxcGT)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://omorobot.gitbook.io/manual/product/omo-r1mini/ros/ros1-melodic/jupyter2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
