Jump to content

a servo from a group from krpc


funkheld

Recommended Posts

Hi good afternoon.
I play with krpc.


I have four servos.
How can I address a particular servo?

import time
import krpc
	conn = krpc.connect (
name = 'servo1'
address = '127.0.0.1'
rpc_port = 1000, stream_port = 1001)
	vessel = conn.space_center.active_vessel
	group = conn.infernal_robotics.servo_group_with_name (vessel, 'New Group')
	if group is None:
     print ('Group not found')
     exit (1)
	for servo in group.servos:
     data = (servo.name, servo.position)
	servo.move_right ()
time.sleep (2)
servo.move_left ()
time.sleep (2)
	

Link to comment
Share on other sites

Hi good afternoon.

........................................

it ok.

 

greeting

for g in ADDONS:IR:GROUPS
{
    for s in g:servos
    {
        if (s:NAME = "test1")
        {
            s:MOVETO(90, 2).
        }
                if (s:NAME = "test2")
        {
            s:MOVETO(45, 2).
        }
    }
}
Edited by funkheld
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...