Using ZMQ as input device
Posted: Thu Jul 30, 2015 10:46 pm
Hello,
I'm trying to control my crazyflie using ZMQ as the input device. I have enabled the Crazyflie python client to use ZMQ as input device by editing the config.json file. I have also created a python script that will send a constant thrust signal but I can't figure out why its not working. When I run the python script nothing happens.
This is what I'm doing:
1) open CF python client w/ ZMQ enabled
2) connect the crazyflie
3) run the python script in the terminal
Any help or comments will be highly appreciated.
thanks,
I'm trying to control my crazyflie using ZMQ as the input device. I have enabled the Crazyflie python client to use ZMQ as input device by editing the config.json file. I have also created a python script that will send a constant thrust signal but I can't figure out why its not working. When I run the python script nothing happens.
This is what I'm doing:
1) open CF python client w/ ZMQ enabled
2) connect the crazyflie
3) run the python script in the terminal
Any help or comments will be highly appreciated.
thanks,
Code: Select all
import time
try:
import zmq
except Exception as e:
raise Exception("ZMQ library probably not installed ({})".format(e))
context = zmq.Context()
sender = context.socket(zmq.PUSH)
bind_addr = "tcp://127.0.0.1:{}".format(1024 + 188)
sender.connect(bind_addr)
#sender.send_json(zmess)
thrust_step = 100
thrust_max = 30000
thrust_min = 20000
thrust = thrust_min
cmdmess = {
"version": 1,
"ctrl": {
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0,
"thrust": 20000
}
}
print "starting to send control commands!"
while 1:
time.sleep(0.01)
sender.send_json(cmdmess)