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

[switchbot_ros] update switchbot_ros client #345

Merged

Conversation

sktometometo
Copy link
Contributor

Add get-devices to euslisp switchbot_ros client and add python version of switchbot_ros client.

get-devices in euslisp version of switchbot_ros client

irteusgl> (load "./switchbot_ros/scripts/switchbot.l")                                                                                                                                                           
 6t                                                                                                                                                                                                                
 7irteusgl> setq msg (get-devices)                                                                                                                                                                                 
 8#<switchbot_ros::devicearray #X55b8ef10aec8>                                                                                
14irteusgl> dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))                                                                                          
15name: /eng2/1f/elevator_bot_up, type: Bot                                                                                                                                                                        
16name: /eng2/2f/elevator_HubMini, type: Hub Mini                                                                                                                                                                  
17name: /eng2/2f/elevator_bot_up, type: Bot                                                                                                                                                                        
18name: /eng2/3f/3felevatorhall_HubMini, type: Hub Mini                                                                                                                                                            
19name: /eng2/3f/door_bot_new, type: Bot                                                                                                                                                                           
20name: /eng2/3f/door_bot_old, type: Bot                                                                                                                                                                           
21name: /eng2/3f/elevator_bot_up, type: Bot                                                                                                                                                                        
22name: /eng2/7f/73b2_bot_kitchen, type: Bot                                                                                                                                                                       
23name: /eng2/7f/73b2_bot_window, type: Bot                                                                                                                                                                        
24name: /eng2/7f/7felevatorhall_HubMini, type: Hub Mini                                                                                                                                                            
25name: /eng2/7f/elevator_bot_down, type: Bot                                                                                                                                                                      
26name: /eng2/7f/elevator_bot_up, type: Bot                                                                                                                                                                        
27name: /eng2/8f/elevator_bot_down, type: Bot                                                                                                                                                                      
28name: /eng8/1f/elevator_bot_up, type: Bot                                                                                                                                                                        
29name: /eng8/1f/elevator_hall, type: Hub Mini                                                                                                                                                                     
30name: /eng8/3f/elevator_bot_down, type: Bot                                                                                                                                                                      
31name: /eng8/3f/elevator_bot_up, type: Bot                                                                                                                                                                        
32name: /eng8/3f/elevator_hall, type: Hub Mini                                                                                                                                                                     
33name: /eng8/6f/602_meter, type: Meter                                                                                                                                                                            
34name: /eng8/6f/610_front, type: Bot                                                                                                                                                                              
35name: /eng8/6f/610_hub, type: Hub Mini                                                                                                                                                                           
36name: /eng8/6f/610_kitchen, type: Bot                                                                                                                                                                            
37name: /eng8/6f/610_meter, type: Meter                                                                                                                                                                            
38name: /eng8/6f/elevator_bot_down, type: Bot                                                                                                                                                                      
39name: /eng8/6f/elevator_hall, type: Hub Mini                                                                                                                                                                     
40name: /eng8/b1f/elevator_bot_up, type: Bot                                                                                                                                                                       
41name: 73b2_switchhub, type: Hub Plus                                                                                                                                                                             
42name: nazo, type: Bot                                                

python version of switchbot_ros client

In [1]: import rospy

In [2]: rospy.init_node('hoge')

In [3]: from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

In [4]: client = SwitchBotROSClient()

In [5]: client.get_devices()
Out[5]: 
devices:
  -
    name: "/eng2/1f/elevator_bot_up"
    type: "Bot"
  -
    name: "/eng2/2f/elevator_HubMini"
    type: "Hub Mini"
  -
    name: "/eng2/2f/elevator_bot_up"
    type: "Bot"
  -
    name: "/eng2/3f/3felevatorhall_HubMini"
    type: "Hub Mini"
  -
    name: "/eng2/3f/door_bot_new"
    type: "Bot"
  -
    name: "/eng2/3f/door_bot_old"
    type: "Bot"
  -
    name: "/eng2/3f/elevator_bot_up"
    type: "Bot"
  -
    name: "/eng2/7f/73b2_bot_kitchen"
    type: "Bot"
  -
    name: "/eng2/7f/73b2_bot_window"
    type: "Bot"
  -
    name: "/eng2/7f/7felevatorhall_HubMini"
    type: "Hub Mini"
  -
    name: "/eng2/7f/elevator_bot_down"
    type: "Bot"
  -
    name: "/eng2/7f/elevator_bot_up"
    type: "Bot"
  -
    name: "/eng2/8f/elevator_bot_down"
    type: "Bot"
  -
    name: "/eng8/1f/elevator_bot_up"
    type: "Bot"
  -
    name: "/eng8/1f/elevator_hall"
    type: "Hub Mini"
  -
    name: "/eng8/3f/elevator_bot_down"
    type: "Bot"
  -
    name: "/eng8/3f/elevator_bot_up"
    type: "Bot"
  -
    name: "/eng8/3f/elevator_hall"
    type: "Hub Mini"
  -
    name: "/eng8/6f/602_meter"
    type: "Meter"
  -
    name: "/eng8/6f/610_front"
    type: "Bot"
  -
    name: "/eng8/6f/610_hub"
    type: "Hub Mini"
  -
    name: "/eng8/6f/610_kitchen"
    type: "Bot"
  -
    name: "/eng8/6f/610_meter"
    type: "Meter"
  -
    name: "/eng8/6f/elevator_bot_down"
    type: "Bot"
  -
    name: "/eng8/6f/elevator_hall"
    type: "Hub Mini"
  -
    name: "/eng8/b1f/elevator_bot_up"
    type: "Bot"
  -
    name: "73b2_switchhub"
    type: "Hub Plus"
  -
    name: "nazo"
    type: "Bot"

In [6]: client.control_device('/eng2/7f/73b2_bot_kitchen', 'turnOn')

In [7]: 

@mqcmd196
Copy link
Member

This PR requires #344

@mqcmd196
Copy link
Member

LGTM

@k-okada k-okada merged commit 9efdbd4 into jsk-ros-pkg:master May 20, 2022
@sktometometo sktometometo deleted the PR/update-switchbot-ros-client branch May 23, 2022 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants